@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/AgentKV.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentKV.js","sourceRoot":"","sources":["../sources/AgentKV.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AgentKV.js","sourceRoot":"","sources":["../sources/AgentKV.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAgC,MAAM,oBAAoB,CAAC;AAI3F;;;;;;;;;GASG;AACH,MAAM,OAAO,OAAO;IAChB,wEAAwE;IAC/D,MAAM,CAAS;IAExB,iEAAiE;IACxD,YAAY,CAAmB;IACxC,wFAAwF;IAC/E,UAAU,CAAgB;IACnC,8FAA8F;IACrF,KAAK,CAAwB;IAEtC,oDAAoD;IACpD,YACI,WAA6B,EAC7B,MAAc,EACd,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,EACtB,IAAgB;QAEhB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACH,UAAU;QACN,OAAO,IAAI,OAAO,CACd,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU,EACf,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAClC,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACH,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K,EAAE,OAAO,EAAE,EAAE;YACtC,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC;IAED,gGAAgG;IAChG,KAAK,CAAC,OAAO,CAAS,GAAY,EAAE,IAAuC;QACvE,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACtB,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACrD,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC1B,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,GAAY;QACpB,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;QAC5F,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The outcome of offering one caller-identified message to an agent. */
|
|
2
|
+
export interface AgentMessageAcceptance {
|
|
3
|
+
/** The caller-supplied or Base-generated cuid2 identity. */
|
|
4
|
+
readonly id: string;
|
|
5
|
+
/** Which delivery queue accepted the message. */
|
|
6
|
+
readonly delivery: "send" | "steer";
|
|
7
|
+
/**
|
|
8
|
+
* Whether this identity was inserted now or was already known. This is the durable result
|
|
9
|
+
* unless the caller explicitly requests non-waiting delivery; in that mode Base returns the
|
|
10
|
+
* current process's immediate reservation. The target's own loop always uses that mode.
|
|
11
|
+
*/
|
|
12
|
+
readonly accepted: "created" | "existing";
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=AgentMessageAcceptance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentMessageAcceptance.d.ts","sourceRoot":"","sources":["../sources/AgentMessageAcceptance.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,WAAW,sBAAsB;IACnC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,UAAU,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentMessageAcceptance.js","sourceRoot":"","sources":["../sources/AgentMessageAcceptance.ts"],"names":[],"mappings":""}
|
package/dist/AgentMetadata.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare const agentMetadataValueSchema: import("@sinclair/typebox").TRecu
|
|
|
6
6
|
/** The TypeScript type inferred from {@link agentMetadataValueSchema}. */
|
|
7
7
|
export type AgentMetadataValue = Static<typeof agentMetadataValueSchema>;
|
|
8
8
|
/**
|
|
9
|
-
* Metadata attached to one queued message.
|
|
10
|
-
* common hint that a presentation
|
|
9
|
+
* Metadata attached to one queued message. Modules own additional fields; `hideFromUser` is the
|
|
10
|
+
* common hint that a presentation module should keep this message out of the user-visible view.
|
|
11
11
|
*/
|
|
12
12
|
export declare const agentMessageMetadataSchema: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
13
13
|
hideFromUser: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
@@ -15,7 +15,7 @@ export declare const agentMessageMetadataSchema: import("@sinclair/typebox").TIn
|
|
|
15
15
|
/** The TypeScript type inferred from {@link agentMessageMetadataSchema}. */
|
|
16
16
|
export type AgentMessageMetadata = Static<typeof agentMessageMetadataSchema>;
|
|
17
17
|
/**
|
|
18
|
-
* Mutable-by-replacement metadata describing one agent.
|
|
18
|
+
* Mutable-by-replacement metadata describing one agent. Modules own additional fields; `title`
|
|
19
19
|
* is the common human-readable label.
|
|
20
20
|
*/
|
|
21
21
|
export declare const agentMetadataSchema: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
package/dist/AgentMetadata.js
CHANGED
|
@@ -16,8 +16,8 @@ export const agentMetadataValueSchema = Type.Recursive((value) => Type.Union([
|
|
|
16
16
|
Type.Record(Type.String(), value),
|
|
17
17
|
]));
|
|
18
18
|
/**
|
|
19
|
-
* Metadata attached to one queued message.
|
|
20
|
-
* common hint that a presentation
|
|
19
|
+
* Metadata attached to one queued message. Modules own additional fields; `hideFromUser` is the
|
|
20
|
+
* common hint that a presentation module should keep this message out of the user-visible view.
|
|
21
21
|
*/
|
|
22
22
|
export const agentMessageMetadataSchema = Type.Intersect([
|
|
23
23
|
Type.Object({
|
|
@@ -26,7 +26,7 @@ export const agentMessageMetadataSchema = Type.Intersect([
|
|
|
26
26
|
Type.Record(Type.String(), agentMetadataValueSchema),
|
|
27
27
|
]);
|
|
28
28
|
/**
|
|
29
|
-
* Mutable-by-replacement metadata describing one agent.
|
|
29
|
+
* Mutable-by-replacement metadata describing one agent. Modules own additional fields; `title`
|
|
30
30
|
* is the common human-readable label.
|
|
31
31
|
*/
|
|
32
32
|
export const agentMetadataSchema = Type.Intersect([
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { ProviderModelCompatibilityType, SessionEvent, SessionReasoningEffort, SessionServiceTier, SessionSystemMessage, SessionToolCallBlock, SessionToolResultMessage } from "@slopus/happy-providers";
|
|
2
|
+
import type { Context } from "@steve.kite/stdlib";
|
|
3
|
+
import type { AgentDatabase, AgentDatabaseFacade, AgentModuleMigration } from "./AgentDatabase.js";
|
|
4
|
+
import type { AgentBaseAcceptedMessage, AgentBaseInference, AgentBaseInferenceStart, AgentBaseLoop, AgentBaseModelChange, AgentBasePermissionModeChange, AgentBasePersistedEvent, AgentBaseToolCall, AgentBaseToolCallDecision, AgentBaseToolOutcome, AgentBaseSettlement, AgentBaseTurn, AgentBaseTurnStart, MaybePromise } from "./AgentBaseHooks.js";
|
|
5
|
+
import type { AgentModuleAction } from "./AgentModuleAction.js";
|
|
6
|
+
import type { AgentKV } from "./AgentKV.js";
|
|
7
|
+
import type { AgentMetadata, AgentMetadataChange } from "./AgentMetadata.js";
|
|
8
|
+
import type { AgentPermissionMode } from "./AgentPermissionMode.js";
|
|
9
|
+
import type { AgentSystemRef } from "./AgentSystemRef.js";
|
|
10
|
+
import type { AnyAgentTool } from "./AgentTool.js";
|
|
11
|
+
/**
|
|
12
|
+
* The agent a hook is serving, in full. One module instance serves every agent in a collection,
|
|
13
|
+
* so this — rather than anything the module was constructed with — is what tells it whose turn
|
|
14
|
+
* it is looking at, and what that agent is about to run on.
|
|
15
|
+
*/
|
|
16
|
+
export interface AgentModuleAgent {
|
|
17
|
+
/** The generated or caller-supplied cuid2 identity, stable for the agent's whole life. */
|
|
18
|
+
readonly id: string;
|
|
19
|
+
/** The immutable descriptive metadata currently stored in this agent's configuration. */
|
|
20
|
+
readonly metadata: AgentMetadata | undefined;
|
|
21
|
+
/** The registry ID of the provider in force, which one agent may switch between. */
|
|
22
|
+
readonly provider: string;
|
|
23
|
+
/**
|
|
24
|
+
* What kind of provider that ID is registered as — `"claude"`, `"codex"`, and so on. It is
|
|
25
|
+
* the vendor shape a module has to reason about when a provider ID alone says nothing, and
|
|
26
|
+
* is absent when the ID is not registered.
|
|
27
|
+
*/
|
|
28
|
+
readonly providerKind: ProviderModelCompatibilityType | undefined;
|
|
29
|
+
/** The model in force, absent when none was ever selected. */
|
|
30
|
+
readonly model: string | undefined;
|
|
31
|
+
/** The reasoning effort in force, absent when none was ever selected. */
|
|
32
|
+
readonly effort: SessionReasoningEffort | undefined;
|
|
33
|
+
/** The service tier in force, absent when none was ever selected. */
|
|
34
|
+
readonly tier: SessionServiceTier | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* How much of the machine the agent may touch. The runtime carries it and makes its changes
|
|
37
|
+
* durable but enforces nothing, so a module whose tools act on the machine is what decides
|
|
38
|
+
* what this mode actually permits.
|
|
39
|
+
*/
|
|
40
|
+
readonly permissionMode: AgentPermissionMode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What every hook of a module is handed alongside the context: which agent it is running for,
|
|
44
|
+
* and the three stores it may write to, each with its own lifetime.
|
|
45
|
+
*
|
|
46
|
+
* They are passed rather than read off the context because a module's own dependencies are not
|
|
47
|
+
* ambient state to be looked up: a hook is given exactly what it is entitled to, and cannot be
|
|
48
|
+
* handed a context that quietly means a different agent.
|
|
49
|
+
*/
|
|
50
|
+
export interface AgentModuleScope<Database extends AgentDatabase = AgentDatabase> {
|
|
51
|
+
/** The active Drizzle database or transaction facade for this hook. */
|
|
52
|
+
readonly database: AgentDatabaseFacade<Database>;
|
|
53
|
+
/** The agent this hook is running for, and the selection it is running on. */
|
|
54
|
+
readonly agent: AgentModuleAgent;
|
|
55
|
+
/**
|
|
56
|
+
* The module's durable store for this one agent, scoped to `module.<name>`. It belongs to
|
|
57
|
+
* the agent's conversation: it outlives every run, and it is cleared when the identity is
|
|
58
|
+
* created again. Renaming a module orphans everything it stored here.
|
|
59
|
+
*/
|
|
60
|
+
readonly kv: AgentKV;
|
|
61
|
+
/**
|
|
62
|
+
* The module's durable store shared by every agent in the collection, and outliving all of
|
|
63
|
+
* them. Work one agent owes another lives here, since an agent's own store belongs to its
|
|
64
|
+
* conversation alone.
|
|
65
|
+
*/
|
|
66
|
+
readonly sharedKV: AgentKV;
|
|
67
|
+
/**
|
|
68
|
+
* The module's store for the run in progress, erased in the transaction that settles the
|
|
69
|
+
* agent. It is where a module keeps what only makes sense while the agent is working, so a
|
|
70
|
+
* crash mid-run leaves notes a resumed run can read, and a finished run leaves none at all.
|
|
71
|
+
*/
|
|
72
|
+
readonly runKV: AgentKV;
|
|
73
|
+
}
|
|
74
|
+
/** Immutable agent identity and metadata observed at a system lifecycle boundary. */
|
|
75
|
+
export interface AgentModuleAgentLifecycle {
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly metadata: AgentMetadata | undefined;
|
|
78
|
+
}
|
|
79
|
+
/** System-owned capabilities handed to module lifecycle observers. */
|
|
80
|
+
export interface AgentModuleSystemScope<Database extends AgentDatabase = AgentDatabase> {
|
|
81
|
+
readonly database: AgentDatabaseFacade<Database>;
|
|
82
|
+
readonly agents: AgentSystemRef<Database>;
|
|
83
|
+
readonly sharedKV: AgentKV;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* One independent capability of an `Agent`: a module implements any subset of the agent hooks,
|
|
87
|
+
* and the agent merges every module's implementations into the singular hooks its internal
|
|
88
|
+
* `AgentBase` runs with. The hook contracts are the same as `AgentBaseHooks`; see there for
|
|
89
|
+
* when each hook fires and what its return value means.
|
|
90
|
+
*
|
|
91
|
+
* Agent-scoped hooks receive the agent's context first and their `AgentModuleScope<Database>` second.
|
|
92
|
+
* System start hooks instead receive the system context and its deadlock-safe `AgentSystemRef`.
|
|
93
|
+
*/
|
|
94
|
+
export interface AgentModule<Tool extends AnyAgentTool = AnyAgentTool, Database extends AgentDatabase = AgentDatabase> {
|
|
95
|
+
/**
|
|
96
|
+
* A stable identifier for the module. Its persisted key-value entries live under this
|
|
97
|
+
* name, so renaming a module orphans everything it stored.
|
|
98
|
+
*/
|
|
99
|
+
readonly name: string;
|
|
100
|
+
/**
|
|
101
|
+
* Ordered durable migrations owned by this module. Keys are immutable identities and may
|
|
102
|
+
* only be appended; each function and its success marker commit atomically before beforeStart.
|
|
103
|
+
*/
|
|
104
|
+
readonly migrations?: readonly AgentModuleMigration<Database>[];
|
|
105
|
+
/**
|
|
106
|
+
* The first hook a module receives. Called once after the owning AgentSystem acquires its
|
|
107
|
+
* store lock and before any agent is restored or started. Every module initializes
|
|
108
|
+
* concurrently, and agent work begins only after all of them settle successfully.
|
|
109
|
+
*/
|
|
110
|
+
readonly beforeStart?: (ctx: Context, agents: AgentSystemRef<Database>, database: Database) => MaybePromise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Called once after every durable-active agent has been restored and started. Every module
|
|
113
|
+
* runs concurrently, and system creation resolves only after all of them settle successfully.
|
|
114
|
+
*/
|
|
115
|
+
readonly afterStart?: (ctx: Context, agents: AgentSystemRef<Database>, database: Database) => MaybePromise<void>;
|
|
116
|
+
readonly agentCreatedTransact?: (ctx: Context, scope: AgentModuleSystemScope<Database>, agent: AgentModuleAgentLifecycle) => MaybePromise<void>;
|
|
117
|
+
readonly agentCreated?: (ctx: Context, scope: AgentModuleSystemScope<Database>, agent: AgentModuleAgentLifecycle) => MaybePromise<void>;
|
|
118
|
+
readonly agentRestoredTransact?: (ctx: Context, scope: AgentModuleSystemScope<Database>, agent: AgentModuleAgentLifecycle) => MaybePromise<void>;
|
|
119
|
+
readonly agentRestored?: (ctx: Context, scope: AgentModuleSystemScope<Database>, agent: AgentModuleAgentLifecycle) => MaybePromise<void>;
|
|
120
|
+
readonly agentArchivedTransact?: (ctx: Context, scope: AgentModuleSystemScope<Database>, agent: AgentModuleAgentLifecycle) => MaybePromise<void>;
|
|
121
|
+
readonly agentArchived?: (ctx: Context, scope: AgentModuleSystemScope<Database>, agent: AgentModuleAgentLifecycle) => MaybePromise<void>;
|
|
122
|
+
/** Observes every session event; the run awaits it and contains its failure. */
|
|
123
|
+
readonly onEvent?: (ctx: Context, scope: AgentModuleScope<Database>, event: SessionEvent) => MaybePromise<unknown>;
|
|
124
|
+
/** Runs inside the transaction committing a completed assistant block. */
|
|
125
|
+
readonly onEventTransact?: (ctx: Context, scope: AgentModuleScope<Database>, event: AgentBasePersistedEvent) => MaybePromise<void>;
|
|
126
|
+
/** Merged after the base state and every earlier module's instructions, in module order. */
|
|
127
|
+
readonly instructions?: (ctx: Context, scope: AgentModuleScope<Database>) => MaybePromise<string>;
|
|
128
|
+
/** Merged after the base state and every earlier module's tools, in module order. */
|
|
129
|
+
readonly tools?: (ctx: Context, scope: AgentModuleScope<Database>) => MaybePromise<readonly Tool[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Runs inside the transaction that makes a dispatched batch durable, once per call in it.
|
|
132
|
+
* Modules run in array order and a failure propagates, rolling the dispatch back.
|
|
133
|
+
*/
|
|
134
|
+
readonly beforeToolCallTransact?: (ctx: Context, scope: AgentModuleScope<Database>, call: SessionToolCallBlock) => MaybePromise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Decides what to do with one validated call before it runs. Modules are asked in array
|
|
137
|
+
* order: what one of them amends is what the next one sees, and the first to answer the model
|
|
138
|
+
* settles the call and ends the chain.
|
|
139
|
+
*/
|
|
140
|
+
readonly beforeToolCall?: (ctx: Context, scope: AgentModuleScope<Database>, call: AgentBaseToolCall) => MaybePromise<AgentBaseToolCallDecision | undefined>;
|
|
141
|
+
/** Observes what one call produced, before its result is committed. */
|
|
142
|
+
readonly afterToolCall?: (ctx: Context, scope: AgentModuleScope<Database>, outcome: AgentBaseToolOutcome) => MaybePromise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Runs inside the transaction appending one tool result to the durable conversation. Modules
|
|
145
|
+
* run in array order and a failure propagates, rolling that commit back.
|
|
146
|
+
*/
|
|
147
|
+
readonly afterToolCallTransact?: (ctx: Context, scope: AgentModuleScope<Database>, result: SessionToolResultMessage) => MaybePromise<void>;
|
|
148
|
+
/** The first module that returns a handoff message wins the reset injection. */
|
|
149
|
+
readonly modelChanged?: (ctx: Context, scope: AgentModuleScope<Database>, change: AgentBaseModelChange) => MaybePromise<SessionSystemMessage | undefined>;
|
|
150
|
+
/**
|
|
151
|
+
* Runs inside the transaction appending a queued message to the durable conversation, once per
|
|
152
|
+
* message. Modules run in array order and a failure propagates, rolling the consumption back.
|
|
153
|
+
*/
|
|
154
|
+
readonly messageAcceptedTransact?: (ctx: Context, scope: AgentModuleScope<Database>, accepted: AgentBaseAcceptedMessage) => MaybePromise<void>;
|
|
155
|
+
/** Observes the same messages once the consumption has committed. */
|
|
156
|
+
readonly messageAccepted?: (ctx: Context, scope: AgentModuleScope<Database>, accepted: AgentBaseAcceptedMessage) => MaybePromise<void>;
|
|
157
|
+
/** Transactional counterpart to `permissionModeChanged`; a failure rolls the change back. */
|
|
158
|
+
readonly permissionModeChangedTransact?: (ctx: Context, scope: AgentModuleScope<Database>, change: AgentBasePermissionModeChange) => MaybePromise<void>;
|
|
159
|
+
/** Observes a permission-mode change a consumed message made, once it is durable. */
|
|
160
|
+
readonly permissionModeChanged?: (ctx: Context, scope: AgentModuleScope<Database>, change: AgentBasePermissionModeChange) => MaybePromise<void>;
|
|
161
|
+
/** Transactional counterpart to `metadataChanged`; a failure rolls the merge back. */
|
|
162
|
+
readonly metadataChangedTransact?: (ctx: Context, scope: AgentModuleScope<Database>, change: AgentMetadataChange) => MaybePromise<void>;
|
|
163
|
+
/** Observes the complete merged agent metadata after it commits. */
|
|
164
|
+
readonly metadataChanged?: (ctx: Context, scope: AgentModuleScope<Database>, change: AgentMetadataChange) => MaybePromise<void>;
|
|
165
|
+
/** Transactional counterpart to `beforeAgentLoop`. */
|
|
166
|
+
readonly beforeAgentLoopTransact?: (ctx: Context, scope: AgentModuleScope<Database>, loop: AgentBaseLoop) => MaybePromise<void>;
|
|
167
|
+
/** Called when the loop leaves the settled state and begins working. */
|
|
168
|
+
readonly beforeAgentLoop?: (ctx: Context, scope: AgentModuleScope<Database>, loop: AgentBaseLoop) => MaybePromise<void>;
|
|
169
|
+
/** Transactional counterpart to `beforeTurn`. */
|
|
170
|
+
readonly beforeTurnTransact?: (ctx: Context, scope: AgentModuleScope<Database>, turn: AgentBaseTurnStart) => MaybePromise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Receives the measured size of the context the turn is about to run on. Actions from every
|
|
173
|
+
* module are concatenated and applied before the turn's first inference.
|
|
174
|
+
*/
|
|
175
|
+
readonly beforeTurn?: (ctx: Context, scope: AgentModuleScope<Database>, turn: AgentBaseTurnStart) => MaybePromise<readonly AgentModuleAction[] | undefined>;
|
|
176
|
+
/** Transactional counterpart to `beforeInference`. */
|
|
177
|
+
readonly beforeInferenceTransact?: (ctx: Context, scope: AgentModuleScope<Database>, inference: AgentBaseInferenceStart) => MaybePromise<void>;
|
|
178
|
+
/** Called immediately before each inference request. */
|
|
179
|
+
readonly beforeInference?: (ctx: Context, scope: AgentModuleScope<Database>, inference: AgentBaseInferenceStart) => MaybePromise<void>;
|
|
180
|
+
/** Transactional counterpart to `afterInference`. */
|
|
181
|
+
readonly afterInferenceTransact?: (ctx: Context, scope: AgentModuleScope<Database>, inference: AgentBaseInference) => MaybePromise<void>;
|
|
182
|
+
/** Receives how the response ended and the token counts the provider measured for it. */
|
|
183
|
+
readonly afterInference?: (ctx: Context, scope: AgentModuleScope<Database>, inference: AgentBaseInference) => MaybePromise<void>;
|
|
184
|
+
/** Transactional counterpart to `afterTurn`. */
|
|
185
|
+
readonly afterTurnTransact?: (ctx: Context, scope: AgentModuleScope<Database>, turn: AgentBaseTurn) => MaybePromise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Receives the token counts the turn's last measured response reported. Actions from every
|
|
188
|
+
* module are concatenated and applied together.
|
|
189
|
+
*/
|
|
190
|
+
readonly afterTurn?: (ctx: Context, scope: AgentModuleScope<Database>, turn: AgentBaseTurn) => MaybePromise<readonly AgentModuleAction[] | undefined>;
|
|
191
|
+
/** Transactional counterpart to `afterAgentLoop`. */
|
|
192
|
+
readonly afterAgentLoopTransact?: (ctx: Context, scope: AgentModuleScope<Database>, loop: AgentBaseLoop) => MaybePromise<void>;
|
|
193
|
+
/** Actions from every module are concatenated and applied together. */
|
|
194
|
+
readonly afterAgentLoop?: (ctx: Context, scope: AgentModuleScope<Database>, loop: AgentBaseLoop) => MaybePromise<readonly AgentModuleAction[] | undefined>;
|
|
195
|
+
/**
|
|
196
|
+
* Called inside the transaction that records the agent as settled. The module's stores write
|
|
197
|
+
* into that transaction, so what a module concludes about the run and the fact that the run
|
|
198
|
+
* is over become durable together. The `Transact` suffix is what marks a hook as running
|
|
199
|
+
* inside a transaction. The run store is erased by that same transaction, so this is the last
|
|
200
|
+
* chance to keep any part of what the run wrote about itself.
|
|
201
|
+
*
|
|
202
|
+
* Unlike the observing hooks, a failure here is not contained: it rolls the settlement back
|
|
203
|
+
* along with everything every module wrote, and the agent stays recorded as working.
|
|
204
|
+
*/
|
|
205
|
+
readonly afterAgentSettledTransact?: (ctx: Context, scope: AgentModuleScope<Database>, settlement: AgentBaseSettlement) => MaybePromise<void>;
|
|
206
|
+
/** Called once after the loop has fully settled and no module reopened it. */
|
|
207
|
+
readonly afterAgentSettled?: (ctx: Context, scope: AgentModuleScope<Database>, settlement: AgentBaseSettlement) => MaybePromise<void>;
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=AgentModule.d.ts.map
|
|
@@ -0,0 +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,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,KAAK,EACR,wBAAwB,EACxB,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,EAA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C9B,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentModule.js","sourceRoot":"","sources":["../sources/AgentModule.ts"],"names":[],"mappings":""}
|
|
@@ -5,7 +5,7 @@ import type { AgentMessageMetadata } from "./AgentMetadata.js";
|
|
|
5
5
|
* the ordinary durable queues, or trigger a compaction. An action drives the loop exactly like
|
|
6
6
|
* an external call to `steer`, `send`, or `compact` would.
|
|
7
7
|
*/
|
|
8
|
-
export type
|
|
8
|
+
export type AgentModuleAction = {
|
|
9
9
|
readonly type: "steer";
|
|
10
10
|
readonly id?: string;
|
|
11
11
|
readonly message: SessionUserMessage;
|
|
@@ -18,4 +18,4 @@ export type AgentFeatureAction = {
|
|
|
18
18
|
} | {
|
|
19
19
|
readonly type: "compact";
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=AgentModuleAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentModuleAction.d.ts","sourceRoot":"","sources":["../sources/AgentModuleAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;;;GAIG;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;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentModuleAction.js","sourceRoot":"","sources":["../sources/AgentModuleAction.ts"],"names":[],"mappings":""}
|
|
@@ -5,7 +5,7 @@ import { type Static } from "@sinclair/typebox";
|
|
|
5
5
|
* The mode is part of what an agent is running on, exactly like its model: it is carried on every
|
|
6
6
|
* context the agent derives, it is durable, and a message may change it. What the runtime does not
|
|
7
7
|
* do is enforce it — the loop has no idea what any particular tool touches. Enforcement belongs to
|
|
8
|
-
* the
|
|
8
|
+
* the modules and tools that know, and they read the mode in force from the context they are
|
|
9
9
|
* given.
|
|
10
10
|
*/
|
|
11
11
|
export declare const agentPermissionModeSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"read_only">, import("@sinclair/typebox").TLiteral<"workspace_write">, import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"full_access">]>;
|
|
@@ -6,7 +6,7 @@ import { Value } from "@sinclair/typebox/value";
|
|
|
6
6
|
* The mode is part of what an agent is running on, exactly like its model: it is carried on every
|
|
7
7
|
* context the agent derives, it is durable, and a message may change it. What the runtime does not
|
|
8
8
|
* do is enforce it — the loop has no idea what any particular tool touches. Enforcement belongs to
|
|
9
|
-
* the
|
|
9
|
+
* the modules and tools that know, and they read the mode in force from the context they are
|
|
10
10
|
* given.
|
|
11
11
|
*/
|
|
12
12
|
export const agentPermissionModeSchema = Type.Union([
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SessionAssistantBlock, SessionMessage, SessionSystemMessage, SessionToolResultMessage, SessionUserMessage } from "@slopus/happy-providers";
|
|
2
2
|
import type { Context } from "@steve.kite/stdlib";
|
|
3
|
+
import type { AgentDatabase } from "./AgentDatabase.js";
|
|
3
4
|
import type { AgentMessageMetadata } from "./AgentMetadata.js";
|
|
4
5
|
/**
|
|
5
6
|
* One record of the main context store. Only content that is part of the model context lives
|
|
@@ -36,15 +37,17 @@ export type AgentRecord = {
|
|
|
36
37
|
* ignored database conflict; history replacement removes keys for the records it deletes.
|
|
37
38
|
* Exactly one owner connects to a store, and the agent serializes its own record and bookkeeping
|
|
38
39
|
* writes through one lock, so history order always matches storage order. Key-value operations —
|
|
39
|
-
* a
|
|
40
|
+
* a module's or a tool's — run as they come, so each one has to be atomic on its own, but no
|
|
40
41
|
* implementation ever has to defend against a second owner.
|
|
41
42
|
*/
|
|
42
43
|
export interface AgentPersistence {
|
|
44
|
+
/** The root Drizzle facade for this store. */
|
|
45
|
+
readonly database: AgentDatabase;
|
|
43
46
|
/**
|
|
44
47
|
* Run work atomically. The implementation opens a transaction and passes work a derived
|
|
45
|
-
* context that its own operations recognize
|
|
46
|
-
*
|
|
47
|
-
* error rolls
|
|
48
|
+
* context that its own operations recognize and that carries stdlib's universal
|
|
49
|
+
* `afterCommit` scope. Work resolving commits every operation and then drains that scope; a
|
|
50
|
+
* thrown error rolls everything back without draining it.
|
|
48
51
|
*/
|
|
49
52
|
transaction<Result>(ctx: Context, work: (ctx: Context) => Promise<Result>): Promise<Result>;
|
|
50
53
|
/** Every record in the main context store, in append order. */
|
|
@@ -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,EACxB,kBAAkB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAA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;IACzE,wEAAwE;IACxE,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE;;;OAGG;IACH,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChF,mDAAmD;IACnD,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Context } from "@steve.kite/stdlib";
|
|
2
|
+
import { type AgentDatabase } from "./AgentDatabase.js";
|
|
3
|
+
import type { AgentPersistence, AgentRecord } from "./AgentPersistence.js";
|
|
4
|
+
/** The database shared by every persistence scope in one AgentStorage. */
|
|
5
|
+
export interface AgentPersistenceDrizzleOptions<Database extends AgentDatabase = AgentDatabase> {
|
|
6
|
+
readonly database: Database;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Drizzle-backed records and key-value entries for either the collection root or one agent.
|
|
10
|
+
* Tables are shared by every instance; `ownerId` is empty for collection state and the cuid2
|
|
11
|
+
* agent identity for a conversation.
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentPersistenceDrizzle<Database extends AgentDatabase = AgentDatabase> implements AgentPersistence {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(options: AgentPersistenceDrizzleOptions<Database>, ownerId: string);
|
|
16
|
+
get database(): AgentDatabase;
|
|
17
|
+
transaction<Result>(ctx: Context, work: (ctx: Context) => Promise<Result>): Promise<Result>;
|
|
18
|
+
load(ctx: Context): Promise<readonly AgentRecord[]>;
|
|
19
|
+
append(ctx: Context, record: AgentRecord): Promise<void>;
|
|
20
|
+
clearRecords(ctx: Context): Promise<void>;
|
|
21
|
+
readValues(ctx: Context, prefix: string): Promise<readonly {
|
|
22
|
+
readonly key: string;
|
|
23
|
+
readonly value: unknown;
|
|
24
|
+
}[]>;
|
|
25
|
+
writeValue(ctx: Context, key: string, value: unknown): Promise<void>;
|
|
26
|
+
writeValueIfAbsent(ctx: Context, key: string, value: unknown): Promise<boolean>;
|
|
27
|
+
deleteValue(ctx: Context, key: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=AgentPersistenceDrizzle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentPersistenceDrizzle.d.ts","sourceRoot":"","sources":["../sources/AgentPersistenceDrizzle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAGH,KAAK,aAAa,EAErB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG3E,0EAA0E;AAC1E,MAAM,WAAW,8BAA8B,CAAC,QAAQ,SAAS,aAAa,GAAG,aAAa;IAC1F,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC/B;AAED;;;;GAIG;AACH,qBAAa,uBAAuB,CAChC,QAAQ,SAAS,aAAa,GAAG,aAAa,CAChD,YAAW,gBAAgB;;IAIzB,YAAY,OAAO,EAAE,8BAA8B,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,MAAM,EAG7E;IAED,IAAI,QAAQ,IAAI,aAAa,CAE5B;IAEK,WAAW,CAAC,MAAM,EACpB,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,GACxC,OAAO,CAAC,MAAM,CAAC,CAEjB;IAEK,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,WAAW,EAAE,CAAC,CAWxD;IAEK,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAU7D;IAEK,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9C;IAEK,UAAU,CACZ,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,SAAS;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC,CAYvE;IAEK,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAYzE;IAEK,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAapF;IAEK,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ1D;CAgCJ"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { sql } from "drizzle-orm";
|
|
2
|
+
import { agentDatabaseRows, agentDatabaseRun, } from "./AgentDatabase.js";
|
|
3
|
+
import { agentStorageTransaction, withAgentDatabase } from "./AgentContexts.js";
|
|
4
|
+
import { inTx } from "./inTx.js";
|
|
5
|
+
/**
|
|
6
|
+
* Drizzle-backed records and key-value entries for either the collection root or one agent.
|
|
7
|
+
* Tables are shared by every instance; `ownerId` is empty for collection state and the cuid2
|
|
8
|
+
* agent identity for a conversation.
|
|
9
|
+
*/
|
|
10
|
+
export class AgentPersistenceDrizzle {
|
|
11
|
+
#options;
|
|
12
|
+
#ownerId;
|
|
13
|
+
constructor(options, ownerId) {
|
|
14
|
+
this.#options = options;
|
|
15
|
+
this.#ownerId = ownerId;
|
|
16
|
+
}
|
|
17
|
+
get database() {
|
|
18
|
+
return this.#options.database;
|
|
19
|
+
}
|
|
20
|
+
async transaction(ctx, work) {
|
|
21
|
+
return await inTx(this.#bound(ctx), work);
|
|
22
|
+
}
|
|
23
|
+
async load(ctx) {
|
|
24
|
+
return await this.#operation(ctx, async (database) => {
|
|
25
|
+
const rows = await agentDatabaseRows(database, sql `SELECT record_json
|
|
26
|
+
FROM happy_agent_records
|
|
27
|
+
WHERE owner_id = ${this.#ownerId}
|
|
28
|
+
ORDER BY position`);
|
|
29
|
+
return rows.map(({ record_json }) => JSON.parse(record_json));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async append(ctx, record) {
|
|
33
|
+
await this.#operation(ctx, async (database) => {
|
|
34
|
+
await agentDatabaseRun(database, sql `INSERT INTO happy_agent_records (owner_id, position, record_json)
|
|
35
|
+
SELECT ${this.#ownerId}, COALESCE(MAX(position), -1) + 1, ${JSON.stringify(record)}
|
|
36
|
+
FROM happy_agent_records
|
|
37
|
+
WHERE owner_id = ${this.#ownerId}`);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async clearRecords(ctx) {
|
|
41
|
+
await this.#operation(ctx, async (database) => {
|
|
42
|
+
await agentDatabaseRun(database, sql `DELETE FROM happy_agent_records WHERE owner_id = ${this.#ownerId}`);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async readValues(ctx, prefix) {
|
|
46
|
+
return await this.#operation(ctx, async (database) => {
|
|
47
|
+
const rows = await agentDatabaseRows(database, sql `SELECT key, value_json
|
|
48
|
+
FROM happy_agent_values
|
|
49
|
+
WHERE owner_id = ${this.#ownerId}
|
|
50
|
+
AND substr(key, 1, length(${prefix})) = ${prefix}
|
|
51
|
+
ORDER BY key`);
|
|
52
|
+
return rows.map(({ key, value_json }) => ({ key, value: JSON.parse(value_json) }));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async writeValue(ctx, key, value) {
|
|
56
|
+
const encoded = JSON.stringify(value);
|
|
57
|
+
if (encoded === undefined)
|
|
58
|
+
throw new Error("Agent storage cannot persist undefined.");
|
|
59
|
+
await this.#operation(ctx, async (database) => {
|
|
60
|
+
await agentDatabaseRun(database, sql `INSERT INTO happy_agent_values (owner_id, key, value_json)
|
|
61
|
+
VALUES (${this.#ownerId}, ${key}, ${encoded})
|
|
62
|
+
ON CONFLICT (owner_id, key)
|
|
63
|
+
DO UPDATE SET value_json = EXCLUDED.value_json`);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async writeValueIfAbsent(ctx, key, value) {
|
|
67
|
+
const encoded = JSON.stringify(value);
|
|
68
|
+
if (encoded === undefined)
|
|
69
|
+
throw new Error("Agent storage cannot persist undefined.");
|
|
70
|
+
return await this.#operation(ctx, async (database) => {
|
|
71
|
+
const rows = await agentDatabaseRows(database, sql `INSERT INTO happy_agent_values (owner_id, key, value_json)
|
|
72
|
+
VALUES (${this.#ownerId}, ${key}, ${encoded})
|
|
73
|
+
ON CONFLICT (owner_id, key) DO NOTHING
|
|
74
|
+
RETURNING key`);
|
|
75
|
+
return rows.length > 0;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async deleteValue(ctx, key) {
|
|
79
|
+
await this.#operation(ctx, async (database) => {
|
|
80
|
+
await agentDatabaseRun(database, sql `DELETE FROM happy_agent_values
|
|
81
|
+
WHERE owner_id = ${this.#ownerId} AND key = ${key}`);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async #operation(ctx, work) {
|
|
85
|
+
const transaction = agentStorageTransaction(ctx);
|
|
86
|
+
if (transaction !== undefined) {
|
|
87
|
+
if (transaction.lifetime.aborted) {
|
|
88
|
+
throw new Error("The agent storage transaction carried by this context has ended.");
|
|
89
|
+
}
|
|
90
|
+
if (transaction.root !== this.#options.database) {
|
|
91
|
+
throw new Error("A transaction context cannot be used with another agent storage.");
|
|
92
|
+
}
|
|
93
|
+
return await work(transaction.database);
|
|
94
|
+
}
|
|
95
|
+
return await inTx(withAgentDatabase(ctx, this.#options.database), async (txCtx) => {
|
|
96
|
+
return await work(txCtx.db);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
#bound(ctx) {
|
|
100
|
+
const transaction = agentStorageTransaction(ctx);
|
|
101
|
+
if (transaction === undefined)
|
|
102
|
+
return withAgentDatabase(ctx, this.#options.database);
|
|
103
|
+
if (transaction.lifetime.aborted) {
|
|
104
|
+
throw new Error("The agent storage transaction carried by this context has ended.");
|
|
105
|
+
}
|
|
106
|
+
if (transaction.root !== this.#options.database) {
|
|
107
|
+
throw new Error("A transaction context cannot be used with another agent storage.");
|
|
108
|
+
}
|
|
109
|
+
return ctx;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=AgentPersistenceDrizzle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentPersistenceDrizzle.js","sourceRoot":"","sources":["../sources/AgentPersistenceDrizzle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EACH,iBAAiB,EACjB,gBAAgB,GAGnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAGvB,QAAQ,CAA2C;IACnD,QAAQ,CAAS;IAE1B,YAAY,OAAiD,EAAE,OAAe;QAC1E,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,WAAW,CACb,GAAY,EACZ,IAAuC;QAEvC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,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