@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
@@ -1,7 +1,7 @@
1
1
  import { acceptanceIsWaitable, AgentRef } from "./AgentRef.js";
2
2
  /**
3
3
  * A reference to a collection of agents that cannot deadlock, for code that runs inside an agent
4
- * — a feature hook, or a tool the run loop is waiting on. Every operation returns without
4
+ * — a module hook, or a tool the run loop is waiting on. Every operation returns without
5
5
  * waiting for any agent's loop to reach a particular point.
6
6
  *
7
7
  * What is missing is missing on purpose. `delete` closes an agent and `start` resumes whole
@@ -21,33 +21,58 @@ import { acceptanceIsWaitable, AgentRef } from "./AgentRef.js";
21
21
  export class AgentSystemRef {
22
22
  /** The collection this reference forwards every operation to without waiting on its loops. */
23
23
  #system;
24
+ /** Identity whose lifecycle lock is held while this scoped reference is in use. */
25
+ #blockedAgentId;
26
+ /** The agent this reference belongs to, or `null` for collection lifecycle code. */
27
+ agentId;
24
28
  /** Wrap a collection as the deadlock-free reference given to code running inside it. */
25
- constructor(system) {
29
+ constructor(system, agentId = null, blockedAgentId) {
26
30
  this.#system = system;
31
+ this.agentId = agentId;
32
+ this.#blockedAgentId = blockedAgentId;
27
33
  }
28
34
  /** The models this collection offers its agents. */
29
35
  get models() {
30
36
  return this.#system.models;
31
37
  }
32
- /** Create an agent with a new system-generated cuid2 identity. */
33
- async create(ctx, config, initialContext) {
34
- return new AgentRef(await this.#system.create(ctx, config, initialContext));
38
+ /** Create an agent, inheriting this reference's agent as parent unless options override it. */
39
+ async create(ctx, config, options) {
40
+ const parent = options?.parent === undefined ? this.agentId : options.parent;
41
+ const agent = await this.#system.create(ctx, config, { ...options, parent });
42
+ return new AgentRef(agent, parent);
35
43
  }
36
44
  /** A reference to an existing agent; resolving one that was never created is an error. */
37
45
  async resolve(ctx, agentId) {
38
- return new AgentRef(await this.#system.resolve(ctx, agentId));
46
+ this.#assertNotLifecycleTarget(agentId);
47
+ const agent = await this.#system.resolve(ctx, agentId);
48
+ const parent = await this.#system.parentOf(ctx, agentId);
49
+ return new AgentRef(agent, parent);
39
50
  }
40
- /** The configuration an agent was created with, or undefined when there is no such agent. */
51
+ /** The current configuration of an agent, or undefined when there is no such agent. */
41
52
  async config(ctx, agentId) {
42
53
  return await this.#system.config(ctx, agentId);
43
54
  }
55
+ /** Shallow-merge fields into an agent's immutable metadata. */
56
+ async updateMetadata(ctx, agentId, update) {
57
+ this.#assertNotLifecycleTarget(agentId);
58
+ await this.#system.updateMetadata(ctx, agentId, update);
59
+ }
60
+ /** The direct children of an agent, in durable key order. */
61
+ async childOf(ctx, agentId) {
62
+ return await this.#system.childOf(ctx, agentId);
63
+ }
64
+ /** The parent of an agent, or `null` when it is a root. */
65
+ async parentOf(ctx, agentId) {
66
+ return await this.#system.parentOf(ctx, agentId);
67
+ }
44
68
  /**
45
69
  * Queue a steered message. For another agent this resolves once the message is durably
46
70
  * accepted and rejects when that write fails; for the caller's own agent it resolves as soon
47
71
  * as the agent has taken the request on.
48
72
  */
49
73
  async steer(ctx, agentId, message, options) {
50
- await this.#system.steer(ctx, agentId, message, {
74
+ this.#assertNotLifecycleTarget(agentId);
75
+ return await this.#system.steer(ctx, agentId, message, {
51
76
  ...options,
52
77
  await: acceptanceIsWaitable(ctx, agentId),
53
78
  });
@@ -58,7 +83,8 @@ export class AgentSystemRef {
58
83
  * agent has taken the request on.
59
84
  */
60
85
  async send(ctx, agentId, message, options) {
61
- await this.#system.send(ctx, agentId, message, {
86
+ this.#assertNotLifecycleTarget(agentId);
87
+ return await this.#system.send(ctx, agentId, message, {
62
88
  ...options,
63
89
  await: acceptanceIsWaitable(ctx, agentId),
64
90
  });
@@ -71,5 +97,11 @@ export class AgentSystemRef {
71
97
  async abort(ctx, agentId) {
72
98
  await (await this.resolve(ctx, agentId)).abort(ctx);
73
99
  }
100
+ /** Fail quickly instead of re-entering an identity lock held by its transactional lifecycle. */
101
+ #assertNotLifecycleTarget(agentId) {
102
+ if (agentId === this.#blockedAgentId) {
103
+ throw new Error(`Agent "${agentId}" cannot be resolved from inside its transactional lifecycle hook.`);
104
+ }
105
+ }
74
106
  }
75
107
  //# sourceMappingURL=AgentSystemRef.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentSystemRef.js","sourceRoot":"","sources":["../sources/AgentSystemRef.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,cAAc;IACvB,8FAA8F;IACrF,OAAO,CAAc;IAE9B,wFAAwF;IACxF,YAAY,MAAmB;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,oDAAoD;IACpD,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED,kEAAkE;IAClE,KAAK,CAAC,MAAM,CACR,GAAY,EACZ,MAAmB,EACnB,cAAoC;QAEpC,OAAO,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IAChF,CAAC;IAED,0FAA0F;IAC1F,KAAK,CAAC,OAAO,CAAC,GAAY,EAAE,OAAe;QACvC,OAAO,IAAI,QAAQ,CAAC,MAAM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e,EACf,OAA2B,EAC3B,OAAiC;QAEjC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;YAClD,GAAG,OAAO;YACV,KAAK,EAAE,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC;SAC5C,CAAC,CAAC;IACP,CAAC;IAED,mEAAmE;IACnE,KAAK,CAAC,OAAO,CAAC,GAAY,EAAE,OAAe;QACvC,MAAM,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC;IAED,2FAA2F;IAC3F,KAAK,CAAC,KAAK,CAAC,GAAY,EAAE,OAAe;QACrC,MAAM,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxD,CAAC;IAED,gGAAgG;IAChG,yBAAyB,CAAC,OAAe;QACrC,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CACX,UAAU,OAAO,oEAAoE,CACxF,CAAC;QACN,CAAC;IACL,CAAC;CACJ"}
@@ -1,6 +1,21 @@
1
1
  import type { SessionOutputBlock, SessionToolLarkGrammar } from "@slopus/happy-providers";
2
2
  import type { Static, TSchema } from "@sinclair/typebox";
3
3
  import type { Context } from "@steve.kite/stdlib";
4
+ import type { AgentKV } from "./AgentKV.js";
5
+ /** One durable invocation as handed directly to the tool that executes it. */
6
+ export interface AgentToolCall<Result extends TSchema = TSchema> {
7
+ /** Stable internally generated cuid2 identity, reused when an interrupted call resumes. */
8
+ readonly id: string;
9
+ /** Opaque identity supplied by the provider and used only to pair its call and result. */
10
+ readonly providerCallId: string;
11
+ /** State owned by this invocation and erased atomically when its winning result commits. */
12
+ readonly kv: AgentKV;
13
+ /**
14
+ * Atomically stage this structured result using the transaction carried by `ctx`. The first
15
+ * successful commit wins; later commits and the eventual execute return value are ignored.
16
+ */
17
+ commit(ctx: Context, result: Static<Result>): Promise<Static<Result>>;
18
+ }
4
19
  /** A tool-owned decision about one invocation while the agent is in Auto mode. */
5
20
  export type AgentToolAutoPermissionPredicate<Args> = {
6
21
  bivarianceHack(args: Args, ctx: Context): boolean | Promise<boolean>;
@@ -75,7 +90,7 @@ export interface AgentTool<Args extends TSchema = TSchema, Result extends TSchem
75
90
  * The context's lifetime aborts when the turn is aborted, so a long-running tool can
76
91
  * observe cancellation and stop its own work.
77
92
  */
78
- execute(ctx: Context, args: Static<Args>): Promise<Static<Result>>;
93
+ execute(ctx: Context, args: Static<Args>, call: AgentToolCall<Result>): Promise<Static<Result>>;
79
94
  /** Renders a validated result into the content blocks the model actually sees. */
80
95
  toLLM(result: Static<Result>): readonly SessionOutputBlock[];
81
96
  /** Whether a structured result should be reported to the model as an error. */
@@ -1 +1 @@
1
- {"version":3,"file":"AgentTool.d.ts","sourceRoot":"","sources":["../sources/AgentTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,kFAAkF;AAClF,MAAM,MAAM,gCAAgC,CAAC,IAAI,IAAI;IACjD,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxE,CAAC,gBAAgB,CAAC,CAAC;AAEpB,sFAAsF;AACtF,MAAM,MAAM,sCAAsC,CAAC,IAAI,IAAI;IACvD,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO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,MAAM,SAAS,OAAO,EACpF,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,GAC9B,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAEzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"AgentTool.js","sourceRoot":"","sources":["../sources/AgentTool.ts"],"names":[],"mappings":"AA0FA,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAC3B,IAA6B;IAE7B,OAAO,IAAI,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"AgentTool.js","sourceRoot":"","sources":["../sources/AgentTool.ts"],"names":[],"mappings":"AA2GA,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAC3B,IAA6B;IAE7B,OAAO,IAAI,CAAC;AAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,26 +1,29 @@
1
1
  /** Public surface of `@slopus/happy-agent-base`, re-exported by concern. */
2
2
  export { Agent, type AgentOptions } from "./Agent.js";
3
3
  export { type AgentSystem } from "./AgentSystem.js";
4
- export { type AgentInitialContext } from "./AgentSystem.js";
4
+ export { type AgentCreateOptions, type AgentInitialContext } from "./AgentSystem.js";
5
5
  export { AgentSystemLocal, type AgentSystemLocalOptions } from "./AgentSystemLocal.js";
6
6
  export { AgentSystemRef } from "./AgentSystemRef.js";
7
7
  export { AgentRef } from "./AgentRef.js";
8
8
  export { agentSystem, withAgentSystem } from "./AgentSystemContext.js";
9
- export { agentConfig, agentConfigSchema, agentFeatureConfig, agentEnvironment, agentEnvironmentSchema, agentFeatureConfigSchema, agentPlatformSchema, currentAgentEnvironment, withAgentConfig, type AgentConfig, type AgentEnvironment, type AgentFeatureConfig, type AgentPlatform, } from "./AgentConfig.js";
9
+ export { agentConfig, agentConfigSchema, agentModuleConfig, agentMetadata, agentEnvironment, agentEnvironmentSchema, agentModuleConfigSchema, agentPlatformSchema, currentAgentEnvironment, withAgentConfig, type AgentConfig, type AgentEnvironment, type AgentModuleConfig, type AgentPlatform, } from "./AgentConfig.js";
10
+ export { agentMessageMetadataSchema, agentMetadataSchema, agentMetadataValueSchema, cuid2Schema, type AgentMessageMetadata, type AgentMetadata, type AgentMetadataChange, type AgentMetadataValue, } from "./AgentMetadata.js";
11
+ export { type AgentMessageAcceptance } from "./AgentMessageAcceptance.js";
10
12
  export { AgentStorage, type AgentStorageLock, type AgentStorageOptions } from "./AgentStorage.js";
13
+ export { agentDatabaseRows, agentDatabaseRun, isAgentSQLiteDatabase, type AgentDatabase, type AgentDatabaseFacade, type AgentModuleMigration, type AgentPostgresDatabase, type AgentSQLiteDatabase, type AgentStorageTransaction, } from "./AgentDatabase.js";
11
14
  export { type AgentModel } from "./AgentModel.js";
12
15
  export { knownModels, type Model } from "./models.js";
13
16
  export { AgentBase, type AgentBaseAwaitOptions, type AgentBaseMessageOptions, type AgentBaseOptions, type AgentBaseQueueMode, } from "./AgentBase.js";
14
- export { agentEffort, agentId, agentKV, agentModel, agentPermissionMode, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentKV, withAgentPermissionMode, withAgentRunKV, } from "./AgentContexts.js";
17
+ export { agentDatabase, agentEffort, agentId, agentKV, agentModel, agentPermissionMode, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentDatabase, withAgentKV, withAgentPermissionMode, withAgentRunKV, } from "./AgentContexts.js";
15
18
  export { agentPermissionModeLabel, agentPermissionModeSchema, isAgentPermissionMode, DEFAULT_AGENT_PERMISSION_MODE, type AgentPermissionMode, } from "./AgentPermissionMode.js";
16
19
  export { agentTaskContext, taskContextBeforeToolCall, withAgentTaskContext, } from "./AgentTaskContext.js";
17
20
  export { AgentKV } from "./AgentKV.js";
18
- export { type AgentBaseAcceptedMessage, type AgentBaseHooks, type AgentBaseInference, type AgentBaseModelChange, type AgentBasePermissionModeChange, type AgentBasePersistedEvent, type AgentBaseToolCall, type AgentBaseToolCallDecision, type AgentBaseToolOutcome, type AgentBaseTurn, type AgentBaseTurnStart, type MaybePromise, } from "./AgentBaseHooks.js";
21
+ export { type AgentBaseAcceptedMessage, type AgentBaseHooks, type AgentBaseInference, type AgentBaseInferenceStart, type AgentBaseLoop, type AgentBaseModelChange, type AgentBasePermissionModeChange, type AgentBasePersistedEvent, type AgentBaseSettlement, type AgentBaseToolCall, type AgentBaseToolCallDecision, type AgentBaseToolOutcome, type AgentBaseTurn, type AgentBaseTurnStart, type MaybePromise, } from "./AgentBaseHooks.js";
19
22
  export { type AgentPersistence, type AgentRecord } from "./AgentPersistence.js";
20
23
  export { agentBasePendingStateOf, agentBaseStoreOwesWork, AGENT_BASE_PENDING_KEY, type AgentBasePendingStage, type AgentBasePendingState, } from "./AgentBasePending.js";
21
24
  export { type AgentBaseState } from "./AgentBaseState.js";
22
- export { type AgentFeature, type AgentFeatureAgent, type AgentFeatureScope, } from "./AgentFeature.js";
23
- export { type AgentFeatureAction } from "./AgentFeatureAction.js";
25
+ export { type AgentModule, type AgentModuleAgent, type AgentModuleAgentLifecycle, type AgentModuleScope, type AgentModuleSystemScope, } from "./AgentModule.js";
26
+ export { type AgentModuleAction } from "./AgentModuleAction.js";
24
27
  export { AgentProviders, type AgentProviderSelection, type AgentProviderSource, } from "./AgentProviders.js";
25
- export { defineAgentTool, type AgentTool, type AgentToolAutoPermissionActionDescriber, type AgentToolAutoPermissionPredicate, type AnyAgentTool, } from "./AgentTool.js";
28
+ export { defineAgentTool, type AgentTool, type AgentToolCall, type AgentToolAutoPermissionActionDescriber, type AgentToolAutoPermissionPredicate, type AnyAgentTool, } from "./AgentTool.js";
26
29
  //# 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,CAAC;AACtD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AA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;AAC1B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,EACH,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,GAC3B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACH,eAAe,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,sCAAsC,EAC3C,KAAK,gCAAgC,EACrC,KAAK,YAAY,GACpB,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -7,15 +7,18 @@ export { AgentSystemLocal } from "./AgentSystemLocal.js";
7
7
  export { AgentSystemRef } from "./AgentSystemRef.js";
8
8
  export { AgentRef } from "./AgentRef.js";
9
9
  export { agentSystem, withAgentSystem } from "./AgentSystemContext.js";
10
- // Static agent configuration: environment, per-feature settings, and their context carrier.
11
- export { agentConfig, agentConfigSchema, agentFeatureConfig, agentEnvironment, agentEnvironmentSchema, agentFeatureConfigSchema, agentPlatformSchema, currentAgentEnvironment, withAgentConfig, } from "./AgentConfig.js";
10
+ // Agent configuration: fixed environment/settings, mergeable metadata, and its context carrier.
11
+ export { agentConfig, agentConfigSchema, agentModuleConfig, agentMetadata, agentEnvironment, agentEnvironmentSchema, agentModuleConfigSchema, agentPlatformSchema, currentAgentEnvironment, withAgentConfig, } from "./AgentConfig.js";
12
+ export { agentMessageMetadataSchema, agentMetadataSchema, agentMetadataValueSchema, cuid2Schema, } from "./AgentMetadata.js";
13
+ export {} from "./AgentMessageAcceptance.js";
12
14
  export { AgentStorage } from "./AgentStorage.js";
15
+ export { agentDatabaseRows, agentDatabaseRun, isAgentSQLiteDatabase, } from "./AgentDatabase.js";
13
16
  // Provider/model routing and the curated model catalog.
14
17
  export {} from "./AgentModel.js";
15
18
  export { knownModels } from "./models.js";
16
19
  // The run loop itself: its context carriers, key-value store, hook contracts, and persistence.
17
20
  export { AgentBase, } from "./AgentBase.js";
18
- export { agentEffort, agentId, agentKV, agentModel, agentPermissionMode, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentKV, withAgentPermissionMode, withAgentRunKV, } from "./AgentContexts.js";
21
+ export { agentDatabase, agentEffort, agentId, agentKV, agentModel, agentPermissionMode, agentProvider, agentRunKV, agentServiceTier, withAgentContext, withAgentDatabase, withAgentKV, withAgentPermissionMode, withAgentRunKV, } from "./AgentContexts.js";
19
22
  export { agentPermissionModeLabel, agentPermissionModeSchema, isAgentPermissionMode, DEFAULT_AGENT_PERMISSION_MODE, } from "./AgentPermissionMode.js";
20
23
  export { agentTaskContext, taskContextBeforeToolCall, withAgentTaskContext, } from "./AgentTaskContext.js";
21
24
  export { AgentKV } from "./AgentKV.js";
@@ -23,9 +26,9 @@ export {} from "./AgentBaseHooks.js";
23
26
  export {} from "./AgentPersistence.js";
24
27
  export { agentBasePendingStateOf, agentBaseStoreOwesWork, AGENT_BASE_PENDING_KEY, } from "./AgentBasePending.js";
25
28
  export {} from "./AgentBaseState.js";
26
- // Features: pluggable capabilities that compose into an agent's hooks, tools, and instructions.
27
- export {} from "./AgentFeature.js";
28
- export {} from "./AgentFeatureAction.js";
29
+ // Modules: pluggable capabilities that compose into an agent's hooks, tools, and instructions.
30
+ export {} from "./AgentModule.js";
31
+ export {} from "./AgentModuleAction.js";
29
32
  // Registry of provider sources agents resolve their selected models through.
30
33
  export { AgentProviders, } from "./AgentProviders.js";
31
34
  // Tool definitions.
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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EACP,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,uBAAuB,EACvB,cAAc,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,6BAA6B,GAEhC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAgBN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA2C,MAAM,uBAAuB,CAAC;AAChF,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GAGzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAuB,MAAM,qBAAqB,CAAC;AAE1D,+FAA+F;AAC/F,OAAO,EAMN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA0B,MAAM,wBAAwB,CAAC;AAEhE,6EAA6E;AAC7E,OAAO,EACH,cAAc,GAGjB,MAAM,qBAAqB,CAAC;AAE7B,oBAAoB;AACpB,OAAO,EACH,eAAe,GAMlB,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopus/happy-agent-base",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Durable runtime for Happy agents.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,8 +26,9 @@
26
26
  "dependencies": {
27
27
  "@paralleldrive/cuid2": "^3.3.0",
28
28
  "@sinclair/typebox": "^0.34.49",
29
- "@slopus/happy-providers": "0.0.7",
30
- "@steve.kite/stdlib": "0.0.8"
29
+ "@slopus/happy-providers": "0.0.8",
30
+ "@steve.kite/stdlib": "0.0.10",
31
+ "drizzle-orm": "^0.45.2"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@types/node": "^24.0.10",
@@ -1,177 +0,0 @@
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 { AgentBaseAcceptedMessage, AgentBaseInference, AgentBaseModelChange, AgentBasePermissionModeChange, AgentBasePersistedEvent, AgentBaseToolCall, AgentBaseToolCallDecision, AgentBaseToolOutcome, AgentBaseTurn, AgentBaseTurnStart, MaybePromise } from "./AgentBaseHooks.js";
4
- import type { AgentFeatureAction } from "./AgentFeatureAction.js";
5
- import type { AgentKV } from "./AgentKV.js";
6
- import type { AgentPermissionMode } from "./AgentPermissionMode.js";
7
- import type { AgentSystemRef } from "./AgentSystemRef.js";
8
- import type { AnyAgentTool } from "./AgentTool.js";
9
- /**
10
- * The agent a hook is serving, in full. One feature instance serves every agent in a collection,
11
- * so this — rather than anything the feature was constructed with — is what tells it whose turn
12
- * it is looking at, and what that agent is about to run on.
13
- */
14
- export interface AgentFeatureAgent {
15
- /** The system-generated identity of the agent, stable for its whole life. */
16
- readonly id: string;
17
- /** The registry ID of the provider in force, which one agent may switch between. */
18
- readonly provider: string;
19
- /**
20
- * What kind of provider that ID is registered as — `"claude"`, `"codex"`, and so on. It is
21
- * the vendor shape a feature has to reason about when a provider ID alone says nothing, and
22
- * is absent when the ID is not registered.
23
- */
24
- readonly providerKind: ProviderModelCompatibilityType | undefined;
25
- /** The model in force, absent when none was ever selected. */
26
- readonly model: string | undefined;
27
- /** The reasoning effort in force, absent when none was ever selected. */
28
- readonly effort: SessionReasoningEffort | undefined;
29
- /** The service tier in force, absent when none was ever selected. */
30
- readonly tier: SessionServiceTier | undefined;
31
- /**
32
- * How much of the machine the agent may touch. The runtime carries it and makes its changes
33
- * durable but enforces nothing, so a feature whose tools act on the machine is what decides
34
- * what this mode actually permits.
35
- */
36
- readonly permissionMode: AgentPermissionMode;
37
- }
38
- /**
39
- * What every hook of a feature is handed alongside the context: which agent it is running for,
40
- * and the three stores it may write to, each with its own lifetime.
41
- *
42
- * They are passed rather than read off the context because a feature's own dependencies are not
43
- * ambient state to be looked up: a hook is given exactly what it is entitled to, and cannot be
44
- * handed a context that quietly means a different agent.
45
- */
46
- export interface AgentFeatureScope {
47
- /** The agent this hook is running for, and the selection it is running on. */
48
- readonly agent: AgentFeatureAgent;
49
- /**
50
- * The feature's durable store for this one agent, scoped to `feature.<name>`. It belongs to
51
- * the agent's conversation: it outlives every run, and it is cleared when the identity is
52
- * created again. Renaming a feature orphans everything it stored here.
53
- */
54
- readonly kv: AgentKV;
55
- /**
56
- * The feature's durable store shared by every agent in the collection, and outliving all of
57
- * them. Work one agent owes another lives here, since an agent's own store belongs to its
58
- * conversation alone.
59
- */
60
- readonly sharedKV: AgentKV;
61
- /**
62
- * The feature's store for the run in progress, erased in the transaction that settles the
63
- * agent. It is where a feature keeps what only makes sense while the agent is working, so a
64
- * crash mid-run leaves notes a resumed run can read, and a finished run leaves none at all.
65
- */
66
- readonly runKV: AgentKV;
67
- }
68
- /**
69
- * One independent capability of an `Agent`: a feature implements any subset of the agent hooks,
70
- * and the agent merges every feature's implementations into the singular hooks its internal
71
- * `AgentBase` runs with. The hook contracts are the same as `AgentBaseHooks`; see there for
72
- * when each hook fires and what its return value means.
73
- *
74
- * Agent-scoped hooks receive the agent's context first and their `AgentFeatureScope` second.
75
- * System start hooks instead receive the system context and its deadlock-safe `AgentSystemRef`.
76
- */
77
- export interface AgentFeature<Tool extends AnyAgentTool = AnyAgentTool> {
78
- /**
79
- * A stable identifier for the feature. Its persisted key-value entries live under this
80
- * name, so renaming a feature orphans everything it stored.
81
- */
82
- readonly name: string;
83
- /**
84
- * The first hook a feature receives. Called once after the owning AgentSystem acquires its
85
- * store lock and before any agent is restored or started. Every feature initializes
86
- * concurrently, and agent work begins only after all of them settle successfully.
87
- */
88
- readonly beforeStart?: (ctx: Context, agents: AgentSystemRef) => Promise<void>;
89
- /**
90
- * Called once after every durable-active agent has been restored and started. Every feature
91
- * runs concurrently, and system creation resolves only after all of them settle successfully.
92
- */
93
- readonly afterStart?: (ctx: Context, agents: AgentSystemRef) => Promise<void>;
94
- /** Observes every session event; must never fail or delay the run. */
95
- readonly onEvent?: (ctx: Context, scope: AgentFeatureScope, event: SessionEvent) => void;
96
- /** Runs inside the transaction committing a completed assistant block. */
97
- readonly onEventTransact?: (ctx: Context, scope: AgentFeatureScope, event: AgentBasePersistedEvent) => MaybePromise<void>;
98
- /** Merged after the base state and every earlier feature's instructions, in feature order. */
99
- readonly instructions?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<string>;
100
- /** Merged after the base state and every earlier feature's tools, in feature order. */
101
- readonly tools?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<readonly Tool[]>;
102
- /**
103
- * Runs inside the transaction that makes a dispatched batch durable, once per call in it.
104
- * Features run in array order and a failure propagates, rolling the dispatch back.
105
- */
106
- readonly beforeToolCallTransact?: (ctx: Context, scope: AgentFeatureScope, call: SessionToolCallBlock) => MaybePromise<void>;
107
- /**
108
- * Decides what to do with one validated call before it runs. Features are asked in array
109
- * order: what one of them amends is what the next one sees, and the first to answer the model
110
- * settles the call and ends the chain.
111
- */
112
- readonly beforeToolCall?: (ctx: Context, scope: AgentFeatureScope, call: AgentBaseToolCall) => MaybePromise<AgentBaseToolCallDecision | undefined>;
113
- /** Observes what one call produced, before its result is committed. */
114
- readonly afterToolCall?: (ctx: Context, scope: AgentFeatureScope, outcome: AgentBaseToolOutcome) => MaybePromise<void>;
115
- /**
116
- * Runs inside the transaction appending one tool result to the durable conversation. Features
117
- * run in array order and a failure propagates, rolling that commit back.
118
- */
119
- readonly afterToolCallTransact?: (ctx: Context, scope: AgentFeatureScope, result: SessionToolResultMessage) => MaybePromise<void>;
120
- /** The first feature that returns a handoff message wins the reset injection. */
121
- readonly modelChanged?: (ctx: Context, scope: AgentFeatureScope, change: AgentBaseModelChange) => MaybePromise<SessionSystemMessage | undefined>;
122
- /**
123
- * Runs inside the transaction appending a queued message to the durable conversation, once per
124
- * message. Features run in array order and a failure propagates, rolling the consumption back.
125
- */
126
- readonly messageAcceptedTransact?: (ctx: Context, scope: AgentFeatureScope, accepted: AgentBaseAcceptedMessage) => MaybePromise<void>;
127
- /** Observes the same messages once the consumption has committed. */
128
- readonly messageAccepted?: (ctx: Context, scope: AgentFeatureScope, accepted: AgentBaseAcceptedMessage) => MaybePromise<void>;
129
- /** Transactional counterpart to `permissionModeChanged`; a failure rolls the change back. */
130
- readonly permissionModeChangedTransact?: (ctx: Context, scope: AgentFeatureScope, change: AgentBasePermissionModeChange) => MaybePromise<void>;
131
- /** Observes a permission-mode change a consumed message made, once it is durable. */
132
- readonly permissionModeChanged?: (ctx: Context, scope: AgentFeatureScope, change: AgentBasePermissionModeChange) => MaybePromise<void>;
133
- /** Transactional counterpart to `beforeAgentLoop`. */
134
- readonly beforeAgentLoopTransact?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<void>;
135
- /** Called when the loop leaves the settled state and begins working. */
136
- readonly beforeAgentLoop?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<void>;
137
- /** Transactional counterpart to `beforeTurn`. */
138
- readonly beforeTurnTransact?: (ctx: Context, scope: AgentFeatureScope, turn: AgentBaseTurnStart) => MaybePromise<void>;
139
- /**
140
- * Receives the measured size of the context the turn is about to run on. Actions from every
141
- * feature are concatenated and applied before the turn's first inference.
142
- */
143
- readonly beforeTurn?: (ctx: Context, scope: AgentFeatureScope, turn: AgentBaseTurnStart) => MaybePromise<readonly AgentFeatureAction[] | undefined>;
144
- /** Transactional counterpart to `beforeInference`. */
145
- readonly beforeInferenceTransact?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<void>;
146
- /** Called immediately before each inference request. */
147
- readonly beforeInference?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<void>;
148
- /** Transactional counterpart to `afterInference`. */
149
- readonly afterInferenceTransact?: (ctx: Context, scope: AgentFeatureScope, inference: AgentBaseInference) => MaybePromise<void>;
150
- /** Receives how the response ended and the token counts the provider measured for it. */
151
- readonly afterInference?: (ctx: Context, scope: AgentFeatureScope, inference: AgentBaseInference) => MaybePromise<void>;
152
- /** Transactional counterpart to `afterTurn`. */
153
- readonly afterTurnTransact?: (ctx: Context, scope: AgentFeatureScope, turn: AgentBaseTurn) => MaybePromise<void>;
154
- /**
155
- * Receives the token counts the turn's last measured response reported. Actions from every
156
- * feature are concatenated and applied together.
157
- */
158
- readonly afterTurn?: (ctx: Context, scope: AgentFeatureScope, turn: AgentBaseTurn) => MaybePromise<readonly AgentFeatureAction[] | undefined>;
159
- /** Transactional counterpart to `afterAgentLoop`. */
160
- readonly afterAgentLoopTransact?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<void>;
161
- /** Actions from every feature are concatenated and applied together. */
162
- readonly afterAgentLoop?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<readonly AgentFeatureAction[] | undefined>;
163
- /**
164
- * Called inside the transaction that records the agent as settled. The feature's stores write
165
- * into that transaction, so what a feature concludes about the run and the fact that the run
166
- * is over become durable together. The `Transact` suffix is what marks a hook as running
167
- * inside a transaction. The run store is erased by that same transaction, so this is the last
168
- * chance to keep any part of what the run wrote about itself.
169
- *
170
- * Unlike the observing hooks, a failure here is not contained: it rolls the settlement back
171
- * along with everything every feature wrote, and the agent stays recorded as working.
172
- */
173
- readonly afterAgentSettledTransact?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<void>;
174
- /** Called once after the loop has fully settled and no feature reopened it. */
175
- readonly afterAgentSettled?: (ctx: Context, scope: AgentFeatureScope) => MaybePromise<void>;
176
- }
177
- //# sourceMappingURL=AgentFeature.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentFeature.d.ts","sourceRoot":"","sources":["../sources/AgentFeature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,8BAA8B,EAC9B,YAAY,EACZ,sBAAsB,E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AAC,IAAI,CAAC,CAAC;CAC/F"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=AgentFeature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentFeature.js","sourceRoot":"","sources":["../sources/AgentFeature.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentFeatureAction.d.ts","sourceRoot":"","sources":["../sources/AgentFeatureAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;CAAE,GAC/D;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=AgentFeatureAction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentFeatureAction.js","sourceRoot":"","sources":["../sources/AgentFeatureAction.ts"],"names":[],"mappings":""}