@slopus/happy-agent-base 0.0.2 → 0.0.4

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 (46) hide show
  1. package/README.md +20 -635
  2. package/dist/Agent.d.ts +7 -0
  3. package/dist/Agent.d.ts.map +1 -1
  4. package/dist/Agent.js +20 -2
  5. package/dist/Agent.js.map +1 -1
  6. package/dist/AgentBase.d.ts +15 -17
  7. package/dist/AgentBase.d.ts.map +1 -1
  8. package/dist/AgentBase.js +237 -270
  9. package/dist/AgentBase.js.map +1 -1
  10. package/dist/AgentBaseHooks.d.ts +43 -5
  11. package/dist/AgentBaseHooks.d.ts.map +1 -1
  12. package/dist/AgentBasePending.d.ts +3 -8
  13. package/dist/AgentBasePending.d.ts.map +1 -1
  14. package/dist/AgentBasePending.js +4 -13
  15. package/dist/AgentBasePending.js.map +1 -1
  16. package/dist/AgentFeature.d.ts +29 -2
  17. package/dist/AgentFeature.d.ts.map +1 -1
  18. package/dist/AgentKV.d.ts +0 -5
  19. package/dist/AgentKV.d.ts.map +1 -1
  20. package/dist/AgentKV.js +0 -8
  21. package/dist/AgentKV.js.map +1 -1
  22. package/dist/AgentPersistence.d.ts +0 -30
  23. package/dist/AgentPersistence.d.ts.map +1 -1
  24. package/dist/AgentProviders.d.ts +19 -9
  25. package/dist/AgentProviders.d.ts.map +1 -1
  26. package/dist/AgentProviders.js +15 -12
  27. package/dist/AgentProviders.js.map +1 -1
  28. package/dist/AgentStorage.d.ts +20 -0
  29. package/dist/AgentStorage.d.ts.map +1 -1
  30. package/dist/AgentStorage.js +33 -0
  31. package/dist/AgentStorage.js.map +1 -1
  32. package/dist/AgentSystem.d.ts +2 -0
  33. package/dist/AgentSystem.d.ts.map +1 -1
  34. package/dist/AgentSystemLocal.d.ts +12 -11
  35. package/dist/AgentSystemLocal.d.ts.map +1 -1
  36. package/dist/AgentSystemLocal.js +186 -67
  37. package/dist/AgentSystemLocal.js.map +1 -1
  38. package/dist/index.d.ts +3 -3
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -2
  41. package/dist/index.js.map +1 -1
  42. package/package.json +2 -2
  43. package/dist/AgentBaseStoreLock.d.ts +0 -16
  44. package/dist/AgentBaseStoreLock.d.ts.map +0 -1
  45. package/dist/AgentBaseStoreLock.js +0 -37
  46. package/dist/AgentBaseStoreLock.js.map +0 -1
@@ -3,7 +3,7 @@ import { Value } from "@sinclair/typebox/value";
3
3
  import { asyncLock } from "@steve.kite/stdlib";
4
4
  import { Agent } from "./Agent.js";
5
5
  import {} from "./AgentBase.js";
6
- import { agentBaseWithStoreStill } from "./AgentBaseStoreLock.js";
6
+ import { agentId as agentIdOf } from "./AgentContexts.js";
7
7
  import { agentConfigSchema, withAgentConfig } from "./AgentConfig.js";
8
8
  import { withAgentSystem } from "./AgentSystemContext.js";
9
9
  import { AgentSystemRef } from "./AgentSystemRef.js";
@@ -12,10 +12,8 @@ import { AgentSystemRef } from "./AgentSystemRef.js";
12
12
  * the identities its storage holds. Concurrent resolutions of the same ID share one load, while a
13
13
  * failed load is forgotten so a later resolution can retry.
14
14
  *
15
- * Identity is durable and shared, so more than one live collection can be working over one
16
- * storage. Everything below therefore serializes per agent rather than per collection a
17
- * collection-wide lock would make one agent's feature load block every other agent, including one
18
- * that load itself resolves — and treats storage, not memory, as the authority on who exists.
15
+ * Work serializes per agent rather than per collection: a collection-wide lock would make one
16
+ * agent's feature load block every other agent, including one that load itself resolves.
19
17
  *
20
18
  * This is the owner's handle, and some of what it offers waits for an agent to reach a point only
21
19
  * that agent's run loop can bring it to. Hand an `AgentSystemRef` to anything running inside an
@@ -24,6 +22,8 @@ import { AgentSystemRef } from "./AgentSystemRef.js";
24
22
  export class AgentSystemLocal {
25
23
  /** The models this collection offers its agents. */
26
24
  models;
25
+ /** The lifetime context retained by this system and its storage lock. */
26
+ #ctx;
27
27
  /**
28
28
  * What this collection looks like from inside one of its agents, and the only form of it a
29
29
  * derived context ever carries.
@@ -37,6 +37,8 @@ export class AgentSystemLocal {
37
37
  #providers;
38
38
  /** The registry ID of the provider new agents are created with. */
39
39
  #provider;
40
+ /** Exclusive database-backed ownership of this collection's whole durable store. */
41
+ #storageLock;
40
42
  /** The configuration each identity was created with. */
41
43
  #configs;
42
44
  /**
@@ -51,6 +53,12 @@ export class AgentSystemLocal {
51
53
  #persistences = new Map();
52
54
  /** Per-agent locks handed out by `#lockFor`, created lazily the first time an ID is touched. */
53
55
  #locks = new Map();
56
+ /** Public operations admitted before shutdown and therefore allowed to finish. */
57
+ #admitted = new Set();
58
+ /** No agent operation is admitted until every feature has finished its beforeStart hook. */
59
+ #lifecycle = "initializing";
60
+ /** The shared shutdown, including release of the hard storage lock. */
61
+ #closePromise;
54
62
  /**
55
63
  * Bring up a collection over one storage and carry on where the last process left off.
56
64
  *
@@ -58,28 +66,109 @@ export class AgentSystemLocal {
58
66
  * was running when the previous process ended is still owed an answer, and this is what
59
67
  * makes it happen. Every identity the storage holds is examined, and each one that owes work
60
68
  * is resolved and resumed, so by the time this returns the collection is not merely built
61
- * but running. An identity another owner is still creating is left alone, since until that
62
- * creation commits there is no agent to resume.
69
+ * but running.
63
70
  */
64
71
  static async create(ctx, storage, config) {
65
- const system = new AgentSystemLocal(storage, config);
66
- await system.#start(ctx);
67
- return system;
72
+ const systemCtx = ctx;
73
+ const storageLock = await storage.acquireLock(systemCtx);
74
+ const system = new AgentSystemLocal(systemCtx, storage, storageLock, config);
75
+ try {
76
+ await system.#beforeStart(systemCtx);
77
+ const active = await system.#start(systemCtx);
78
+ system.#lifecycle = "open";
79
+ for (const agent of active)
80
+ agent.start();
81
+ await system.#afterStart(systemCtx);
82
+ return system;
83
+ }
84
+ catch (error) {
85
+ await system.close(systemCtx).catch(() => undefined);
86
+ throw error;
87
+ }
68
88
  }
69
89
  /**
70
90
  * Wire this collection to its storage, providers, and feature configuration, without reading
71
91
  * any of it. Private: a collection is brought up by `create`, which also resumes the work
72
92
  * the storage was left holding — building one without that is building half of it.
73
93
  */
74
- constructor(storage, options) {
94
+ constructor(ctx, storage, storageLock, options) {
95
+ this.#ctx = ctx;
75
96
  this.#features = options.features ?? [];
76
97
  this.#storage = storage;
98
+ this.#storageLock = storageLock;
77
99
  this.#providers = options.providers;
78
100
  this.#provider = options.provider;
79
101
  this.models = [...options.models];
80
102
  this.#configs = storage.kv.scoped("config");
81
103
  this.#sharedFeatureKV = storage.kv.scoped("features");
82
104
  }
105
+ /**
106
+ * Stop every live agent, wait for operations already admitted by this owner, and only then
107
+ * release the database lock. Repeated callers join the same shutdown.
108
+ */
109
+ async close(ctx) {
110
+ if (this.#closePromise === undefined) {
111
+ this.#lifecycle = "closing";
112
+ this.#closePromise = this.#shutdown();
113
+ }
114
+ const closing = this.#closePromise;
115
+ const caller = agentIdOf(ctx);
116
+ if (caller !== undefined && this.#agents.has(caller)) {
117
+ void closing.catch(() => undefined);
118
+ throw new Error("Closing the agent system from inside one of its own agents would wait for " +
119
+ "that agent's turn. Shutdown will finish and release the store after this " +
120
+ "caller returns.");
121
+ }
122
+ await closing;
123
+ }
124
+ /** The real shutdown barrier, which keeps the hard store lock until every agent is closed. */
125
+ async #shutdown() {
126
+ try {
127
+ while (this.#admitted.size > 0) {
128
+ await Promise.allSettled(this.#admitted);
129
+ }
130
+ const closed = [...this.#agents.values()].map((agent) => {
131
+ void agent.close().catch(() => undefined);
132
+ return agent.waitForClosed();
133
+ });
134
+ await Promise.allSettled(closed);
135
+ this.#agents.clear();
136
+ this.#persistences.clear();
137
+ this.#locks.clear();
138
+ }
139
+ finally {
140
+ try {
141
+ await this.#storageLock.release(this.#ctx);
142
+ }
143
+ finally {
144
+ this.#lifecycle = "closed";
145
+ }
146
+ }
147
+ }
148
+ /**
149
+ * Admit one public operation while this system still owns the store. Shutdown rejects new
150
+ * admissions and waits for every earlier one before releasing the hard lock.
151
+ */
152
+ #admit(operation) {
153
+ if (this.#lifecycle !== "open") {
154
+ return Promise.reject(new Error(this.#lifecycle === "initializing"
155
+ ? "The agent system is not ready."
156
+ : "The agent system is closed."));
157
+ }
158
+ let running;
159
+ try {
160
+ // Begin synchronously so ownership-transfer boundaries such as create(config) copy
161
+ // caller-owned input before the caller can mutate it after receiving the promise.
162
+ running = operation();
163
+ }
164
+ catch (error) {
165
+ return Promise.reject(error);
166
+ }
167
+ const settled = running.then(() => undefined, () => undefined);
168
+ this.#admitted.add(settled);
169
+ void settled.finally(() => this.#admitted.delete(settled));
170
+ return running;
171
+ }
83
172
  /**
84
173
  * Create an agent with the configuration it keeps for its whole life, and resolve it. The
85
174
  * identity is allocated here and nowhere else: it is a cuid2, globally unique, so a new
@@ -87,29 +176,30 @@ export class AgentSystemLocal {
87
176
  * The configuration is persisted before the agent runs, so every later process resolves the
88
177
  * agent exactly as it was created.
89
178
  *
90
- * Nothing here is ever undone: an agent whose features refuse to load leaves an identity
91
- * that exists, is resolvable, and will be built the next time something wants it. The
92
- * alternative writing a provisional identity and taking it back when the build fails —
93
- * has to get the taking-back right in the presence of crashes and other owners, and a
94
- * compensation that can itself fail is not a guarantee.
179
+ * Nothing here is undone: an agent whose features refuse to load leaves an identity that
180
+ * exists, is resolvable, and will be built the next time something wants it. Taking a
181
+ * provisional identity back after a failed build would add a compensation that can itself
182
+ * fail.
95
183
  */
96
184
  async create(ctx, config, initialContext) {
97
- const agentId = createId();
98
- if (!Value.Check(agentConfigSchema, config)) {
99
- throw new Error(`The configuration for agent "${agentId}" is not valid.`);
100
- }
101
- // The caller keeps its own object, and may go on editing it. What was created is what
102
- // was passed at this moment, so storage and this agent's context both get a copy.
103
- const owned = structuredClone(config);
104
- return await this.#lockFor(agentId).runInLock(ctx, async (lockCtx) => {
105
- await this.#configs.write(lockCtx, agentId, owned);
106
- if (initialContext !== undefined) {
107
- await this.#seedInitialContext(lockCtx, agentId, initialContext.messages);
185
+ return await this.#admit(async () => {
186
+ const agentId = createId();
187
+ if (!Value.Check(agentConfigSchema, config)) {
188
+ throw new Error(`The configuration for agent "${agentId}" is not valid.`);
108
189
  }
109
- const agent = await this.#instantiate(lockCtx, agentId, owned);
110
- if (agent === undefined)
111
- throw new Error(`Agent "${agentId}" could not be built.`);
112
- return agent;
190
+ // The caller keeps its own object, and may go on editing it. What was created is what
191
+ // was passed at this moment, so storage and this agent's context both get a copy.
192
+ const owned = structuredClone(config);
193
+ return await this.#lockFor(agentId).runInLock(ctx, async (lockCtx) => {
194
+ await this.#configs.write(lockCtx, agentId, owned);
195
+ if (initialContext !== undefined) {
196
+ await this.#seedInitialContext(lockCtx, agentId, initialContext.messages);
197
+ }
198
+ const agent = await this.#instantiate(lockCtx, agentId, owned);
199
+ if (agent === undefined)
200
+ throw new Error(`Agent "${agentId}" could not be built.`);
201
+ return agent;
202
+ });
113
203
  });
114
204
  }
115
205
  /**
@@ -123,12 +213,14 @@ export class AgentSystemLocal {
123
213
  * what clears it.
124
214
  */
125
215
  async delete(ctx, agentId) {
126
- await this.#lockFor(agentId).runInLock(ctx, async (lockCtx) => {
127
- const agent = this.#agents.get(agentId);
128
- this.#agents.delete(agentId);
129
- await agent?.close();
130
- await this.#configs.delete(lockCtx, agentId);
131
- this.#persistences.delete(agentId);
216
+ await this.#admit(async () => {
217
+ await this.#lockFor(agentId).runInLock(ctx, async (lockCtx) => {
218
+ const agent = this.#agents.get(agentId);
219
+ this.#agents.delete(agentId);
220
+ await agent?.close();
221
+ await this.#configs.delete(lockCtx, agentId);
222
+ this.#persistences.delete(agentId);
223
+ });
132
224
  });
133
225
  }
134
226
  /** Install a projected conversation before the new agent is started. */
@@ -136,15 +228,19 @@ export class AgentSystemLocal {
136
228
  if (messages.length === 0)
137
229
  return;
138
230
  const persistence = this.#persistenceFor(agentId);
139
- await agentBaseWithStoreStill(ctx, persistence, (storeCtx) => persistence.transaction(storeCtx, async (txCtx) => {
231
+ await persistence.transaction(ctx, async (txCtx) => {
140
232
  await persistence.append(txCtx, {
141
233
  type: "compaction",
142
234
  messages: structuredClone(messages),
143
235
  });
144
- }));
236
+ });
145
237
  }
146
238
  /** The configuration an agent was created with, or undefined when there is no such agent. */
147
239
  async config(ctx, agentId) {
240
+ return await this.#admit(async () => await this.#config(ctx, agentId));
241
+ }
242
+ /** Read one stored configuration while its owning operation is already admitted. */
243
+ async #config(ctx, agentId) {
148
244
  const stored = await this.#configs.read(ctx, agentId);
149
245
  if (stored === undefined)
150
246
  return undefined;
@@ -158,6 +254,10 @@ export class AgentSystemLocal {
158
254
  * Concurrent resolutions of the same ID share one load.
159
255
  */
160
256
  async resolve(ctx, agentId) {
257
+ return await this.#admit(async () => await this.#resolve(ctx, agentId));
258
+ }
259
+ /** Resolve one agent while its owning public operation is already admitted. */
260
+ async #resolve(ctx, agentId) {
161
261
  const existing = this.#agents.get(agentId);
162
262
  if (existing !== undefined)
163
263
  return existing;
@@ -165,23 +265,13 @@ export class AgentSystemLocal {
165
265
  const resolved = this.#agents.get(agentId);
166
266
  if (resolved !== undefined)
167
267
  return resolved;
168
- const config = await this.config(lockCtx, agentId);
268
+ const config = await this.#config(lockCtx, agentId);
169
269
  if (config === undefined) {
170
270
  throw new Error(`Agent "${agentId}" has not been created.`);
171
271
  }
172
272
  const agent = await this.#instantiate(lockCtx, agentId, config);
173
273
  if (agent === undefined)
174
274
  throw new Error(`Agent "${agentId}" could not be built.`);
175
- // Building an agent takes as long as its features do, and identity is not this
176
- // collection's to hold still for that: another owner may have deleted the ID, or a
177
- // creation this resolution overtook may have rolled it back. Handing back an agent
178
- // for an identity that no longer exists strands its caller with a live object no
179
- // restart would ever reproduce, so the answer is checked before it is given.
180
- if ((await this.config(lockCtx, agentId)) === undefined) {
181
- this.#agents.delete(agentId);
182
- await agent.close();
183
- throw new Error(`Agent "${agentId}" was deleted while it was being resolved.`);
184
- }
185
275
  return agent;
186
276
  });
187
277
  }
@@ -189,7 +279,7 @@ export class AgentSystemLocal {
189
279
  * Build one agent and put it to work. Called with the agent's lock held, and only for an ID
190
280
  * that has no live instance yet.
191
281
  */
192
- async #instantiate(ctx, agentId, config, onlyIfActive = false) {
282
+ async #instantiate(ctx, agentId, config, onlyIfActive = false, start = true) {
193
283
  const agentCtx = withAgentConfig(withAgentSystem(ctx, this.#ref), config);
194
284
  const options = {
195
285
  id: agentId,
@@ -205,13 +295,14 @@ export class AgentSystemLocal {
205
295
  // resolves through — so the agent is loaded rather than created, and knows whether it
206
296
  // has work left before anything asks it. Bringing a collection up asks only for the
207
297
  // agents that do; anything else resolving an agent wants it whether it owes work or not.
208
- const agent = onlyIfActive
209
- ? await Agent.loadActive(agentCtx, options)
210
- : await Agent.load(agentCtx, options);
211
- if (agent === undefined)
298
+ const agent = await Agent.load(agentCtx, options);
299
+ if (onlyIfActive && !agent.active) {
300
+ await agent.close();
212
301
  return undefined;
213
- agent.start();
302
+ }
214
303
  this.#agents.set(agentId, agent);
304
+ if (start)
305
+ agent.start();
215
306
  return agent;
216
307
  }
217
308
  /**
@@ -228,15 +319,29 @@ export class AgentSystemLocal {
228
319
  */
229
320
  async #start(ctx) {
230
321
  const created = await this.#configs.list(ctx);
231
- await Promise.all(created.map(async ({ key: agentId, value }) => {
322
+ const results = await Promise.allSettled(created.map(async ({ key: agentId, value }) => {
232
323
  if (!Value.Check(agentConfigSchema, value))
233
- return;
234
- await this.#lockFor(agentId).runInLock(ctx, async (lockCtx) => {
324
+ return undefined;
325
+ return await this.#lockFor(agentId).runInLock(ctx, async (lockCtx) => {
235
326
  if (this.#agents.has(agentId))
236
- return;
237
- await this.#instantiate(lockCtx, agentId, value, true);
327
+ return undefined;
328
+ return await this.#instantiate(lockCtx, agentId, value, true, false);
238
329
  });
239
330
  }));
331
+ throwFirstStartFailure(results);
332
+ return results.flatMap((result) => result.status === "fulfilled" && result.value !== undefined ? [result.value] : []);
333
+ }
334
+ /** Initialize every feature before any active agent is restored or started. */
335
+ async #beforeStart(ctx) {
336
+ const startCtx = withAgentSystem(ctx, this.#ref);
337
+ const results = await Promise.allSettled(this.#features.map(async (feature) => await feature.beforeStart?.(startCtx, this.#ref)));
338
+ throwFirstStartFailure(results);
339
+ }
340
+ /** Notify every feature after all active agents have been restored and started. */
341
+ async #afterStart(ctx) {
342
+ const startCtx = withAgentSystem(ctx, this.#ref);
343
+ const results = await Promise.allSettled(this.#features.map(async (feature) => await feature.afterStart?.(startCtx, this.#ref)));
344
+ throwFirstStartFailure(results);
240
345
  }
241
346
  /** The durable store for one agent, created once and reused for the life of the collection. */
242
347
  #persistenceFor(agentId) {
@@ -262,21 +367,35 @@ export class AgentSystemLocal {
262
367
  }
263
368
  /** Queue a steered message for an agent. */
264
369
  async steer(ctx, agentId, message, options) {
265
- const agent = await this.resolve(ctx, agentId);
266
- await agent.steer(ctx, message, options);
370
+ await this.#admit(async () => {
371
+ const agent = await this.#resolve(ctx, agentId);
372
+ await agent.steer(ctx, message, options);
373
+ });
267
374
  }
268
375
  /** Queue a message for an agent. */
269
376
  async send(ctx, agentId, message, options) {
270
- const agent = await this.resolve(ctx, agentId);
271
- await agent.send(ctx, message, options);
377
+ await this.#admit(async () => {
378
+ const agent = await this.#resolve(ctx, agentId);
379
+ await agent.send(ctx, message, options);
380
+ });
272
381
  }
273
382
  /** Cancel an agent's active turn, leaving its queued messages durable for the next one. */
274
383
  async abort(ctx, agentId, options) {
275
- await (await this.resolve(ctx, agentId)).abort(ctx, options);
384
+ await this.#admit(async () => {
385
+ await (await this.#resolve(ctx, agentId)).abort(ctx, options);
386
+ });
276
387
  }
277
388
  /** Ask an agent for its conversation to be replaced by the provider's summary of it. */
278
389
  async compact(ctx, agentId, options) {
279
- await (await this.resolve(ctx, agentId)).compact(ctx, options);
390
+ await this.#admit(async () => {
391
+ await (await this.#resolve(ctx, agentId)).compact(ctx, options);
392
+ });
280
393
  }
281
394
  }
395
+ /** Start every feature even when one fails, then surface the first failure in feature order. */
396
+ function throwFirstStartFailure(results) {
397
+ const failure = results.find((result) => result.status === "rejected");
398
+ if (failure !== undefined)
399
+ throw failure.reason;
400
+ }
282
401
  //# sourceMappingURL=AgentSystemLocal.js.map
@@ -1 +1 @@
1
- {"version":3,"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+B;QACtE,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;YACzB,MAAM,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC;IAED,wFAAwF;IACxF,KAAK,CAAC,OAAO,CAAC,GAAY,EAAE,OAAe,EAAE,OAA+B;QACxE,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;YACzB,MAAM,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,gGAAgG;AAChG,SAAS,sBAAsB,CAAC,OAAiD;IAC7E,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CACxB,CAAC,MAAM,EAAmC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAC5E,CAAC;IACF,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,OAAO,CAAC,MAAM,CAAC;AACpD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,19 +7,19 @@ export { AgentSystemRef } from "./AgentSystemRef.js";
7
7
  export { AgentRef } from "./AgentRef.js";
8
8
  export { agentSystem, withAgentSystem } from "./AgentSystemContext.js";
9
9
  export { agentConfig, agentConfigSchema, agentFeatureConfig, agentEnvironment, agentEnvironmentSchema, agentFeatureConfigSchema, agentPlatformSchema, currentAgentEnvironment, withAgentConfig, type AgentConfig, type AgentEnvironment, type AgentFeatureConfig, type AgentPlatform, } from "./AgentConfig.js";
10
- export { AgentStorage, type AgentStorageOptions } from "./AgentStorage.js";
10
+ export { AgentStorage, type AgentStorageLock, type AgentStorageOptions } from "./AgentStorage.js";
11
11
  export { type AgentModel } from "./AgentModel.js";
12
12
  export { knownModels, type Model } from "./models.js";
13
13
  export { AgentBase, type AgentBaseAwaitOptions, type AgentBaseMessageOptions, type AgentBaseOptions, type AgentBaseQueueMode, } from "./AgentBase.js";
14
14
  export { agentEffort, agentId, agentKV, agentModel, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentKV, withAgentRunKV, } from "./AgentContexts.js";
15
15
  export { agentTaskContext, taskContextBeforeToolCall, withAgentTaskContext, } from "./AgentTaskContext.js";
16
16
  export { AgentKV } from "./AgentKV.js";
17
- export { type AgentBaseHooks, type AgentBaseInference, type AgentBaseModelChange, type AgentBaseToolExecution, type AgentBaseTurn, type AgentBaseTurnStart, type MaybePromise, } from "./AgentBaseHooks.js";
17
+ export { type AgentBaseHooks, type AgentBaseInference, type AgentBaseModelChange, type AgentBasePersistedEvent, type AgentBaseToolExecution, type AgentBaseTurn, type AgentBaseTurnStart, type MaybePromise, } from "./AgentBaseHooks.js";
18
18
  export { type AgentPersistence, type AgentRecord } from "./AgentPersistence.js";
19
19
  export { agentBasePendingStateOf, agentBaseStoreOwesWork, AGENT_BASE_PENDING_KEY, type AgentBasePendingStage, type AgentBasePendingState, } from "./AgentBasePending.js";
20
20
  export { type AgentBaseState } from "./AgentBaseState.js";
21
21
  export { type AgentFeature, type AgentFeatureAgent, type AgentFeatureScope, } from "./AgentFeature.js";
22
22
  export { type AgentFeatureAction } from "./AgentFeatureAction.js";
23
- export { AgentProviders } from "./AgentProviders.js";
23
+ export { AgentProviders, type AgentProviderSelection, type AgentProviderSource, } from "./AgentProviders.js";
24
24
  export { defineAgentTool, type AgentTool, type AgentToolAutoPermissionActionDescriber, type AgentToolAutoPermissionPredicate, type AnyAgentTool, } from "./AgentTool.js";
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../sources/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY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KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,EACH,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,GAC3B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACH,eAAe,EACf,KAAK,SAAS,EACd,KAAK,sCAAsC,EAC3C,KAAK,gCAAgC,EACrC,KAAK,YAAY,GACpB,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -25,8 +25,8 @@ export {} from "./AgentBaseState.js";
25
25
  // Features: pluggable capabilities that compose into an agent's hooks, tools, and instructions.
26
26
  export {} from "./AgentFeature.js";
27
27
  export {} from "./AgentFeatureAction.js";
28
- // Registry of provider instances agents resolve their models through.
29
- export { AgentProviders } from "./AgentProviders.js";
28
+ // Registry of provider sources agents resolve their selected models through.
29
+ export { AgentProviders, } from "./AgentProviders.js";
30
30
  // Tool definitions.
31
31
  export { defineAgentTool, } from "./AgentTool.js";
32
32
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../sources/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,8EAA8E;AAC9E,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAoB,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAA4B,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAgC,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,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BAAsB,GAGzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAuB,MAAM,qBAAqB,CAAC;AAE1D,gGAAgG;AAChG,OAAO,EAIN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA2B,MAAM,yBAAyB,CAAC;AAElE,6EAA6E;AAC7E,OAAO,EACH,cAAc,GAGjB,MAAM,qBAAqB,CAAC;AAE7B,oBAAoB;AACpB,OAAO,EACH,eAAe,GAKlB,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slopus/happy-agent-base",
3
- "version": "0.0.2",
4
- "description": "Shared foundations for Happy coding agents.",
3
+ "version": "0.0.4",
4
+ "description": "Durable runtime for Happy agents.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,16 +0,0 @@
1
- import { type AsyncLock, type Context } from "@steve.kite/stdlib";
2
- import type { AgentPersistence } from "./AgentPersistence.js";
3
- /**
4
- * A fresh lock for one owner of a store, remembered as belonging to that store. Two owners over
5
- * one store are genuinely concurrent — that is what makes the store, rather than any one owner's
6
- * memory, the authority — so each gets its own lock and neither waits for the other.
7
- */
8
- export declare function agentBaseStoreLock(persistence: AgentPersistence): AsyncLock;
9
- /**
10
- * Run work with every owner of a store holding still. This is for the questions asked about a
11
- * store from outside it — whether it owes work, or erasing it once its identity is gone — where
12
- * a half-applied step of some owner would be read as a whole one. Owners only ever take their
13
- * own lock, so taking all of them in one fixed order cannot deadlock against them.
14
- */
15
- export declare function agentBaseWithStoreStill<Result>(ctx: Context, persistence: AgentPersistence, work: (ctx: Context) => Promise<Result>): Promise<Result>;
16
- //# sourceMappingURL=AgentBaseStoreLock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentBaseStoreLock.d.ts","sourceRoot":"","sources":["../sources/AgentBaseStoreLock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAK9D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,gBAAgB,GAAG,SAAS,CAS3E;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAChD,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,gBAAgB,EAC7B,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,GACxC,OAAO,CAAC,MAAM,CAAC,CASjB"}
@@ -1,37 +0,0 @@
1
- import { asyncLock } from "@steve.kite/stdlib";
2
- /** Every lock handed out for a store, so `agentBaseWithStoreStill` can find and hold them all. */
3
- const owners = new WeakMap();
4
- /**
5
- * A fresh lock for one owner of a store, remembered as belonging to that store. Two owners over
6
- * one store are genuinely concurrent — that is what makes the store, rather than any one owner's
7
- * memory, the authority — so each gets its own lock and neither waits for the other.
8
- */
9
- export function agentBaseStoreLock(persistence) {
10
- const created = asyncLock({ reentry: "block" });
11
- const existing = owners.get(persistence);
12
- if (existing === undefined) {
13
- owners.set(persistence, [created]);
14
- }
15
- else {
16
- existing.push(created);
17
- }
18
- return created;
19
- }
20
- /**
21
- * Run work with every owner of a store holding still. This is for the questions asked about a
22
- * store from outside it — whether it owes work, or erasing it once its identity is gone — where
23
- * a half-applied step of some owner would be read as a whole one. Owners only ever take their
24
- * own lock, so taking all of them in one fixed order cannot deadlock against them.
25
- */
26
- export async function agentBaseWithStoreStill(ctx, persistence, work) {
27
- const held = [...(owners.get(persistence) ?? [])];
28
- /** Take the next lock in `held` and recurse, running `work` once every owner is held. */
29
- const enter = async (index, entered) => {
30
- const lock = held[index];
31
- if (lock === undefined)
32
- return await work(entered);
33
- return await lock.runInLock(entered, (lockCtx) => enter(index + 1, lockCtx));
34
- };
35
- return await enter(0, ctx);
36
- }
37
- //# sourceMappingURL=AgentBaseStoreLock.js.map
@@ -1 +0,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