@slopus/happy-agent-base 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +62 -9
  2. package/dist/Agent.d.ts +27 -22
  3. package/dist/Agent.d.ts.map +1 -1
  4. package/dist/Agent.js +120 -110
  5. package/dist/Agent.js.map +1 -1
  6. package/dist/AgentBase.d.ts +27 -13
  7. package/dist/AgentBase.d.ts.map +1 -1
  8. package/dist/AgentBase.js +657 -151
  9. package/dist/AgentBase.js.map +1 -1
  10. package/dist/AgentBaseHooks.d.ts +58 -32
  11. package/dist/AgentBaseHooks.d.ts.map +1 -1
  12. package/dist/AgentBasePending.d.ts +6 -2
  13. package/dist/AgentBasePending.d.ts.map +1 -1
  14. package/dist/AgentBasePending.js +7 -0
  15. package/dist/AgentBasePending.js.map +1 -1
  16. package/dist/AgentConfig.d.ts +20 -13
  17. package/dist/AgentConfig.d.ts.map +1 -1
  18. package/dist/AgentConfig.js +32 -12
  19. package/dist/AgentConfig.js.map +1 -1
  20. package/dist/AgentContexts.d.ts +18 -1
  21. package/dist/AgentContexts.d.ts.map +1 -1
  22. package/dist/AgentContexts.js +24 -1
  23. package/dist/AgentContexts.js.map +1 -1
  24. package/dist/AgentDatabase.d.ts +35 -0
  25. package/dist/AgentDatabase.d.ts.map +1 -0
  26. package/dist/AgentDatabase.js +30 -0
  27. package/dist/AgentDatabase.js.map +1 -0
  28. package/dist/AgentKV.d.ts +19 -6
  29. package/dist/AgentKV.d.ts.map +1 -1
  30. package/dist/AgentKV.js +110 -43
  31. package/dist/AgentKV.js.map +1 -1
  32. package/dist/AgentMessageAcceptance.d.ts +14 -0
  33. package/dist/AgentMessageAcceptance.d.ts.map +1 -0
  34. package/dist/AgentMessageAcceptance.js +2 -0
  35. package/dist/AgentMessageAcceptance.js.map +1 -0
  36. package/dist/AgentMetadata.d.ts +37 -0
  37. package/dist/AgentMetadata.d.ts.map +1 -0
  38. package/dist/AgentMetadata.js +74 -0
  39. package/dist/AgentMetadata.js.map +1 -0
  40. package/dist/AgentModule.d.ts +209 -0
  41. package/dist/AgentModule.d.ts.map +1 -0
  42. package/dist/AgentModule.js +2 -0
  43. package/dist/AgentModule.js.map +1 -0
  44. package/dist/{AgentFeatureAction.d.ts → AgentModuleAction.d.ts} +7 -2
  45. package/dist/AgentModuleAction.d.ts.map +1 -0
  46. package/dist/AgentModuleAction.js +2 -0
  47. package/dist/AgentModuleAction.js.map +1 -0
  48. package/dist/AgentPermissionMode.d.ts +1 -1
  49. package/dist/AgentPermissionMode.js +1 -1
  50. package/dist/AgentPersistence.d.ts +20 -7
  51. package/dist/AgentPersistence.d.ts.map +1 -1
  52. package/dist/AgentPersistenceDrizzle.d.ts +31 -0
  53. package/dist/AgentPersistenceDrizzle.d.ts.map +1 -0
  54. package/dist/AgentPersistenceDrizzle.js +99 -0
  55. package/dist/AgentPersistenceDrizzle.js.map +1 -0
  56. package/dist/AgentRef.d.ts +17 -9
  57. package/dist/AgentRef.d.ts.map +1 -1
  58. package/dist/AgentRef.js +16 -9
  59. package/dist/AgentRef.js.map +1 -1
  60. package/dist/AgentStorage.d.ts +33 -13
  61. package/dist/AgentStorage.d.ts.map +1 -1
  62. package/dist/AgentStorage.js +174 -3
  63. package/dist/AgentStorage.js.map +1 -1
  64. package/dist/AgentSystem.d.ts +34 -12
  65. package/dist/AgentSystem.d.ts.map +1 -1
  66. package/dist/AgentSystemContext.d.ts +3 -3
  67. package/dist/AgentSystemContext.d.ts.map +1 -1
  68. package/dist/AgentSystemContext.js +4 -4
  69. package/dist/AgentSystemContext.js.map +1 -1
  70. package/dist/AgentSystemLocal.d.ts +30 -21
  71. package/dist/AgentSystemLocal.d.ts.map +1 -1
  72. package/dist/AgentSystemLocal.js +226 -59
  73. package/dist/AgentSystemLocal.js.map +1 -1
  74. package/dist/AgentSystemRef.d.ts +21 -10
  75. package/dist/AgentSystemRef.d.ts.map +1 -1
  76. package/dist/AgentSystemRef.js +41 -9
  77. package/dist/AgentSystemRef.js.map +1 -1
  78. package/dist/AgentTool.d.ts +16 -1
  79. package/dist/AgentTool.d.ts.map +1 -1
  80. package/dist/AgentTool.js.map +1 -1
  81. package/dist/index.d.ts +10 -7
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +9 -6
  84. package/dist/index.js.map +1 -1
  85. package/package.json +4 -3
  86. package/dist/AgentFeature.d.ts +0 -177
  87. package/dist/AgentFeature.d.ts.map +0 -1
  88. package/dist/AgentFeature.js +0 -2
  89. package/dist/AgentFeature.js.map +0 -1
  90. package/dist/AgentFeatureAction.d.ts.map +0 -1
  91. package/dist/AgentFeatureAction.js +0 -2
  92. package/dist/AgentFeatureAction.js.map +0 -1
package/dist/AgentKV.js CHANGED
@@ -1,35 +1,39 @@
1
- import { withLifetime } from "@steve.kite/stdlib";
2
- /**
3
- * Refuse a store operation whose context has already ended. What a holder of a store may do is
4
- * decided by the context it is given rather than by the object: a store used inside a transaction,
5
- * or handed to a tool for the length of its turn, keeps working exactly as long as that work
6
- * does. Using it afterwards is a mistake in the caller, and says so instead of quietly writing
7
- * into a transaction that has committed or a turn that was cancelled.
8
- */
9
- function assertLive(ctx) {
10
- if (ctx.lifetime?.aborted === true) {
11
- throw new Error("The store cannot be used: the work its context belongs to has ended.");
12
- }
13
- }
1
+ import { asyncLock, withLifetime } from "@steve.kite/stdlib";
14
2
  /**
15
3
  * A key-value store scoped under one prefix of the agent's sorted store. The agent carries a
16
- * session-scoped instance on its context, and narrows it for each caller: a feature works
4
+ * session-scoped instance on its context, and narrows it for each caller: a module works
17
5
  * under its own name, a tool execution under its call ID. Keys are always relative to the
18
6
  * scope — a holder can neither see nor touch anything outside it. Segments join with `.`.
19
7
  *
20
- * The object is nothing but a scope: every operation runs on the context it is given, so which
21
- * transaction a write joins and how long the handle stays usable are both decided by that
22
- * context and never by the handle.
8
+ * Every operation runs on the context it is given, so that context decides which transaction a
9
+ * write joins. Most handles also take their lifetime from that context; explicitly bounded
10
+ * handles, such as a tool call's KV, additionally become unusable when their owner ends.
23
11
  */
24
12
  export class AgentKV {
25
13
  /** The absolute key prefix of this scope, ending with the separator. */
26
14
  prefix;
27
15
  /** The append-only store this scope reads and writes through. */
28
16
  #persistence;
17
+ /** An object-owned lifetime used by bounded stores such as one tool invocation's KV. */
18
+ #available;
19
+ /** Serializes this scope tree so disposal always follows every write that already started. */
20
+ #lock;
29
21
  /** Build a scope over `prefix` of `persistence`. */
30
- constructor(persistence, prefix) {
22
+ constructor(persistence, prefix, available = () => true, lock) {
31
23
  this.#persistence = persistence;
32
24
  this.prefix = prefix;
25
+ this.#available = available;
26
+ this.#lock = lock;
27
+ }
28
+ /**
29
+ * A handle to this scope whose operations serialize with all descendants derived from it.
30
+ * Agent base uses this only for one tool call, so disposal can drain writes already in flight
31
+ * without serializing unrelated module and agent stores.
32
+ *
33
+ * @internal
34
+ */
35
+ serialized() {
36
+ return new AgentKV(this.#persistence, this.prefix, this.#available, asyncLock({ reentry: "block" }));
33
37
  }
34
38
  /**
35
39
  * A narrower store under `segments` within this scope. Each segment is exactly one level:
@@ -39,25 +43,39 @@ export class AgentKV {
39
43
  */
40
44
  scoped(...segments) {
41
45
  const escaped = segments.map((segment) => segment.replaceAll("%", "%25").replaceAll(".", "%2E"));
42
- return new AgentKV(this.#persistence, `${this.prefix}${escaped.join(".")}.`);
46
+ return new AgentKV(this.#persistence, `${this.prefix}${escaped.join(".")}.`, this.#available, this.#lock);
47
+ }
48
+ /**
49
+ * A handle to this exact scope that becomes permanently unusable when `signal` aborts.
50
+ * Narrower scopes inherit the same bound. Agent base uses this for call KV so no context can
51
+ * recreate invocation state after the winning result erases it.
52
+ */
53
+ until(signal, available = () => true) {
54
+ return new AgentKV(this.#persistence, this.prefix, () => this.#available() && !signal.aborted && available(), this.#lock);
43
55
  }
44
56
  /** The stored value, or undefined when the key is absent. */
45
57
  async read(ctx, key) {
46
- assertLive(ctx);
47
- const full = `${this.prefix}${key}`;
48
- const entries = await this.#persistence.readValues(ctx, full);
49
- return entries.find((entry) => entry.key === full)?.value;
58
+ return await this.#locked(ctx, async (lockCtx) => {
59
+ const full = `${this.prefix}${key}`;
60
+ const entries = await this.#persistence.readValues(lockCtx, full);
61
+ return entries.find((entry) => entry.key === full)?.value;
62
+ });
50
63
  }
51
64
  /** Every entry under the scope — or under `prefix` within it — with scope-relative keys. */
52
65
  async list(ctx, prefix = "") {
53
- assertLive(ctx);
54
- const entries = await this.#persistence.readValues(ctx, `${this.prefix}${prefix}`);
55
- return entries.map(({ key, value }) => ({ key: key.slice(this.prefix.length), value }));
66
+ return await this.#locked(ctx, async (lockCtx) => {
67
+ const entries = await this.#persistence.readValues(lockCtx, `${this.prefix}${prefix}`);
68
+ return entries.map(({ key, value }) => ({
69
+ key: key.slice(this.prefix.length),
70
+ value,
71
+ }));
72
+ });
56
73
  }
57
74
  /** Store the value under `key`, replacing whatever was there before. */
58
75
  async write(ctx, key, value) {
59
- assertLive(ctx);
60
- await this.#persistence.writeValue(ctx, `${this.prefix}${key}`, value);
76
+ await this.#locked(ctx, async (lockCtx) => {
77
+ await this.#persistence.writeValue(lockCtx, `${this.prefix}${key}`, value);
78
+ });
61
79
  }
62
80
  /**
63
81
  * Read, decide, and write, so the value the updater sees is exactly the value it replaces.
@@ -65,13 +83,39 @@ export class AgentKV {
65
83
  * updater that throws leaves the stored value untouched.
66
84
  */
67
85
  async update(ctx, key, updater) {
68
- assertLive(ctx);
69
- const full = `${this.prefix}${key}`;
70
- const entries = await this.#persistence.readValues(ctx, full);
71
- const current = entries.find((entry) => entry.key === full)?.value;
72
- const next = await updater(current);
73
- await this.#persistence.writeValue(ctx, full, next);
74
- return next;
86
+ return await this.#locked(ctx, async (lockCtx) => {
87
+ const full = `${this.prefix}${key}`;
88
+ const entries = await this.#persistence.readValues(lockCtx, full);
89
+ const current = entries.find((entry) => entry.key === full)?.value;
90
+ const next = await updater(current);
91
+ await this.#persistence.writeValue(lockCtx, full, next);
92
+ return next;
93
+ });
94
+ }
95
+ /**
96
+ * Return the durable value already stored under `key`, or create and store it exactly once.
97
+ * The read and possible write share one persistence transaction, and an existing outer
98
+ * transaction is reused. A tool can use this on its call-bound KV for retry-stable operation
99
+ * identities without coupling them to a provider call ID.
100
+ */
101
+ async getOrCreate(ctx, key, create) {
102
+ return await this.#locked(ctx, async (lockCtx) => {
103
+ return await this.#persistence.transaction(lockCtx, async (txCtx) => {
104
+ const full = `${this.prefix}${key}`;
105
+ const entries = await this.#persistence.readValues(txCtx, full);
106
+ const existing = entries.find((entry) => entry.key === full);
107
+ if (existing !== undefined)
108
+ return existing.value;
109
+ const value = await create();
110
+ if (await this.#persistence.writeValueIfAbsent(txCtx, full, value))
111
+ return value;
112
+ const winner = (await this.#persistence.readValues(txCtx, full)).find((entry) => entry.key === full);
113
+ if (winner === undefined) {
114
+ throw new Error("The durable get-or-create value disappeared before it was read.");
115
+ }
116
+ return winner.value;
117
+ });
118
+ });
75
119
  }
76
120
  /**
77
121
  * Run work as one atomic step of the underlying store: everything it writes commits together,
@@ -80,7 +124,7 @@ export class AgentKV {
80
124
  * cannot be written into after it has committed.
81
125
  */
82
126
  async transaction(ctx, work) {
83
- assertLive(ctx);
127
+ this.#assertLive(ctx);
84
128
  return await this.#persistence.transaction(ctx, async (txCtx) => {
85
129
  const committed = new AbortController();
86
130
  const liveCtx = withLifetime(txCtx, committed.signal);
@@ -99,16 +143,39 @@ export class AgentKV {
99
143
  * write.
100
144
  */
101
145
  async clear(ctx) {
102
- assertLive(ctx);
103
- const entries = await this.#persistence.readValues(ctx, this.prefix);
104
- for (const entry of entries) {
105
- await this.#persistence.deleteValue(ctx, entry.key);
106
- }
146
+ await this.#locked(ctx, async (lockCtx) => {
147
+ const entries = await this.#persistence.readValues(lockCtx, this.prefix);
148
+ for (const entry of entries) {
149
+ await this.#persistence.deleteValue(lockCtx, entry.key);
150
+ }
151
+ });
107
152
  }
108
153
  /** Remove the entry stored under `key`, if any. */
109
154
  async delete(ctx, key) {
110
- assertLive(ctx);
111
- await this.#persistence.deleteValue(ctx, `${this.prefix}${key}`);
155
+ await this.#locked(ctx, async (lockCtx) => {
156
+ await this.#persistence.deleteValue(lockCtx, `${this.prefix}${key}`);
157
+ });
158
+ }
159
+ /** Re-check availability only after every earlier operation in this scope tree has finished. */
160
+ async #locked(ctx, work) {
161
+ if (this.#lock === undefined) {
162
+ this.#assertLive(ctx);
163
+ return await work(ctx);
164
+ }
165
+ return await this.#lock.runInLock(ctx, async (lockCtx) => {
166
+ this.#assertLive(lockCtx);
167
+ return await work(lockCtx);
168
+ });
169
+ }
170
+ /**
171
+ * Refuse a store operation when either its caller-owned context or this bounded handle has
172
+ * ended. The latter is what makes call KV stay erased even if retained code supplies a fresh
173
+ * unrelated context after commit.
174
+ */
175
+ #assertLive(ctx) {
176
+ if (ctx.lifetime?.aborted === true || !this.#available()) {
177
+ throw new Error("The store cannot be used: the work its context belongs to has ended.");
178
+ }
112
179
  }
113
180
  }
114
181
  //# sourceMappingURL=AgentKV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentKV.js","sourceRoot":"","sources":["../sources/AgentKV.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,oBAAoB,CAAC;AAIhE;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,GAAY;IAC5B,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC5F,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,OAAO;IAChB,wEAAwE;IAC/D,MAAM,CAAS;IAExB,iEAAiE;IACxD,YAAY,CAAmB;IAExC,oDAAoD;IACpD,YAAY,WAA6B,EAAE,MAAc;QACrD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH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,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC1B,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,mDAAmD;IACnD,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,GAAW;QAClC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AgentMessageAcceptance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentMessageAcceptance.js","sourceRoot":"","sources":["../sources/AgentMessageAcceptance.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import { type Static } from "@sinclair/typebox";
2
+ /** A cuid2 identity: two to thirty-two lowercase alphanumeric characters, opening with a letter. */
3
+ export declare const cuid2Schema: import("@sinclair/typebox").TString;
4
+ /** JSON values metadata may contain, so every metadata object is safe to persist and clone. */
5
+ export declare const agentMetadataValueSchema: import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TThis>]>>;
6
+ /** The TypeScript type inferred from {@link agentMetadataValueSchema}. */
7
+ export type AgentMetadataValue = Static<typeof agentMetadataValueSchema>;
8
+ /**
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
+ */
12
+ export declare const agentMessageMetadataSchema: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
13
+ hideFromUser: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
14
+ }>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TThis>]>>>]>;
15
+ /** The TypeScript type inferred from {@link agentMessageMetadataSchema}. */
16
+ export type AgentMessageMetadata = Static<typeof agentMessageMetadataSchema>;
17
+ /**
18
+ * Mutable-by-replacement metadata describing one agent. Modules own additional fields; `title`
19
+ * is the common human-readable label.
20
+ */
21
+ export declare const agentMetadataSchema: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
22
+ title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
23
+ }>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TThis>]>>>]>;
24
+ /** The TypeScript type inferred from {@link agentMetadataSchema}. */
25
+ export type AgentMetadata = Static<typeof agentMetadataSchema>;
26
+ /** What metadata-change hooks see after an update has been merged with the previous object. */
27
+ export interface AgentMetadataChange {
28
+ /** The agent whose metadata changed. */
29
+ readonly agentId: string;
30
+ /** The complete immutable metadata before the update. */
31
+ readonly previousMetadata: AgentMetadata;
32
+ /** The immutable fields supplied by this update. */
33
+ readonly update: AgentMetadata;
34
+ /** The complete immutable result after the shallow merge. */
35
+ readonly metadata: AgentMetadata;
36
+ }
37
+ //# sourceMappingURL=AgentMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentMetadata.d.ts","sourceRoot":"","sources":["../sources/AgentMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGtD,oGAAoG;AACpG,eAAO,MAAM,WAAW,qCAItB,CAAC;AAEH,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,qZASpC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;meAKrC,CAAC;AAEH,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;meAK9B,CAAC;AAEH,qEAAqE;AACrE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE/D,+FAA+F;AAC/F,MAAM,WAAW,mBAAmB;IAChC,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC;IACzC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CACpC"}
@@ -0,0 +1,74 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Value } from "@sinclair/typebox/value";
3
+ /** A cuid2 identity: two to thirty-two lowercase alphanumeric characters, opening with a letter. */
4
+ export const cuid2Schema = Type.String({
5
+ minLength: 2,
6
+ maxLength: 32,
7
+ pattern: "^[a-z][a-z0-9]*$",
8
+ });
9
+ /** JSON values metadata may contain, so every metadata object is safe to persist and clone. */
10
+ export const agentMetadataValueSchema = Type.Recursive((value) => Type.Union([
11
+ Type.String(),
12
+ Type.Number(),
13
+ Type.Boolean(),
14
+ Type.Null(),
15
+ Type.Array(value),
16
+ Type.Record(Type.String(), value),
17
+ ]));
18
+ /**
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
+ */
22
+ export const agentMessageMetadataSchema = Type.Intersect([
23
+ Type.Object({
24
+ hideFromUser: Type.Optional(Type.Boolean()),
25
+ }),
26
+ Type.Record(Type.String(), agentMetadataValueSchema),
27
+ ]);
28
+ /**
29
+ * Mutable-by-replacement metadata describing one agent. Modules own additional fields; `title`
30
+ * is the common human-readable label.
31
+ */
32
+ export const agentMetadataSchema = Type.Intersect([
33
+ Type.Object({
34
+ title: Type.Optional(Type.String()),
35
+ }),
36
+ Type.Record(Type.String(), agentMetadataValueSchema),
37
+ ]);
38
+ /** @internal Validate, clone, and deeply freeze message metadata at its ownership boundary. */
39
+ export function ownAgentMessageMetadata(metadata) {
40
+ if (metadata === undefined)
41
+ return undefined;
42
+ if (!Value.Check(agentMessageMetadataSchema, metadata)) {
43
+ throw new Error("The message metadata is not valid.");
44
+ }
45
+ return immutableClone(metadata);
46
+ }
47
+ /** @internal Validate, clone, and deeply freeze agent metadata at its ownership boundary. */
48
+ export function ownAgentMetadata(metadata) {
49
+ if (metadata === undefined)
50
+ return undefined;
51
+ if (!Value.Check(agentMetadataSchema, metadata)) {
52
+ throw new Error("The agent metadata is not valid.");
53
+ }
54
+ return immutableClone(metadata);
55
+ }
56
+ /** Clone one persisted value and freeze every object reachable through ordinary properties. */
57
+ function immutableClone(value) {
58
+ return deepFreeze(structuredClone(value), new WeakSet());
59
+ }
60
+ function deepFreeze(value, seen) {
61
+ if (value === null || typeof value !== "object")
62
+ return value;
63
+ if (seen.has(value))
64
+ return value;
65
+ seen.add(value);
66
+ for (const key of Reflect.ownKeys(value)) {
67
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
68
+ if (descriptor !== undefined && "value" in descriptor) {
69
+ deepFreeze(descriptor.value, seen);
70
+ }
71
+ }
72
+ return Object.freeze(value);
73
+ }
74
+ //# sourceMappingURL=AgentMetadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentMetadata.js","sourceRoot":"","sources":["../sources/AgentMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,oGAAoG;AACpG,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,kBAAkB;CAC9B,CAAC,CAAC;AAEH,+FAA+F;AAC/F,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7D,IAAI,CAAC,KAAK,CAAC;IACP,IAAI,CAAC,MAAM,EAAE;IACb,IAAI,CAAC,MAAM,EAAE;IACb,IAAI,CAAC,OAAO,EAAE;IACd,IAAI,CAAC,IAAI,EAAE;IACX,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC;CACpC,CAAC,CACL,CAAC;AAKF;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC,SAAS,CAAC;IACrD,IAAI,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AACrE,CAAC;AAED,SAAS,UAAU,CAAQ,KAAY,EAAE,IAAqB;IAC1D,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAClC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChB,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/D,IAAI,UAAU,KAAK,SAAS,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;YACpD,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
@@ -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.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