@agentxjs/core 1.9.7-dev → 1.9.9-dev

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.
@@ -27,12 +27,12 @@ import {
27
27
  mapOutput,
28
28
  withLogging
29
29
  } from "../chunk-EKHT54KN.js";
30
+ import "../chunk-7ZDX3O6I.js";
30
31
  import {
31
32
  isMessageEvent,
32
33
  isStateEvent,
33
34
  isTurnEvent
34
35
  } from "../chunk-K6WXQ2RW.js";
35
- import "../chunk-7ZDX3O6I.js";
36
36
  import "../chunk-E5FPOAPO.js";
37
37
  import "../chunk-7D4SUZUM.js";
38
38
  export {
@@ -122,8 +122,29 @@ type DriverStreamEventType = DriverStreamEvent["type"];
122
122
  *
123
123
  * This is our capability boundary - we define what we support.
124
124
  * Specific implementations (Claude, OpenAI) must work within this.
125
+ *
126
+ * @typeParam TOptions - Driver-specific options type. Each driver implementation
127
+ * can define its own options interface and pass it as a type parameter.
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * // Define driver-specific options
132
+ * interface ClaudeDriverOptions {
133
+ * claudeCodePath?: string;
134
+ * maxTurns?: number;
135
+ * }
136
+ *
137
+ * // Use with type parameter
138
+ * const config: DriverConfig<ClaudeDriverOptions> = {
139
+ * apiKey: "...",
140
+ * agentId: "my-agent",
141
+ * options: {
142
+ * claudeCodePath: "/usr/local/bin/claude"
143
+ * }
144
+ * };
145
+ * ```
125
146
  */
126
- interface DriverConfig {
147
+ interface DriverConfig<TOptions = Record<string, unknown>> {
127
148
  /**
128
149
  * API key for authentication
129
150
  */
@@ -170,6 +191,27 @@ interface DriverConfig {
170
191
  * Save this ID to enable session resume later.
171
192
  */
172
193
  onSessionIdCaptured?: (sessionId: string) => void;
194
+ /**
195
+ * Driver-specific options
196
+ *
197
+ * Each driver implementation can define its own options type.
198
+ * This allows drivers to have custom configuration without
199
+ * polluting the base DriverConfig interface.
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * // ClaudeDriver options
204
+ * interface ClaudeDriverOptions {
205
+ * claudeCodePath?: string;
206
+ * }
207
+ *
208
+ * const config: DriverConfig<ClaudeDriverOptions> = {
209
+ * apiKey: "...",
210
+ * options: { claudeCodePath: "/usr/bin/claude" }
211
+ * };
212
+ * ```
213
+ */
214
+ options?: TOptions;
173
215
  }
174
216
  /**
175
217
  * DriverState - Current state of the Driver
@@ -253,14 +295,16 @@ interface Driver {
253
295
  *
254
296
  * Each implementation package exports a function of this type.
255
297
  *
298
+ * @typeParam TOptions - Driver-specific options type
299
+ *
256
300
  * @example
257
301
  * ```typescript
258
302
  * // @agentxjs/claude-driver
259
- * export const createDriver: CreateDriver = (config) => {
260
- * return new ClaudeDriverImpl(config);
303
+ * export const createClaudeDriver: CreateDriver<ClaudeDriverOptions> = (config) => {
304
+ * return new ClaudeDriver(config);
261
305
  * };
262
306
  * ```
263
307
  */
264
- type CreateDriver = (config: DriverConfig) => Driver;
308
+ type CreateDriver<TOptions = Record<string, unknown>> = (config: DriverConfig<TOptions>) => Driver;
265
309
 
266
310
  export type { CreateDriver, Driver, DriverConfig, DriverState, DriverStreamEvent, DriverStreamEventType, ErrorEvent, InputJsonDeltaEvent, InterruptedEvent, McpServerConfig, MessageStartEvent, MessageStopEvent, StopReason, StreamEvent, TextDeltaEvent, ToolResultEvent, ToolUseStartEvent, ToolUseStopEvent };
package/dist/index.js CHANGED
@@ -27,15 +27,15 @@ import {
27
27
  mapOutput,
28
28
  withLogging
29
29
  } from "./chunk-EKHT54KN.js";
30
+ import "./chunk-7ZDX3O6I.js";
30
31
  import {
31
32
  isMessageEvent,
32
33
  isStateEvent,
33
34
  isTurnEvent
34
35
  } from "./chunk-K6WXQ2RW.js";
35
- import "./chunk-7ZDX3O6I.js";
36
36
  import "./chunk-E5FPOAPO.js";
37
- import "./chunk-7D4SUZUM.js";
38
37
  import "./chunk-RL3JRNXM.js";
38
+ import "./chunk-7D4SUZUM.js";
39
39
  export {
40
40
  AgentStateMachine,
41
41
  MealyMachine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentxjs/core",
3
- "version": "1.9.7-dev",
3
+ "version": "1.9.9-dev",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -185,8 +185,29 @@ export type DriverStreamEventType = DriverStreamEvent["type"];
185
185
  *
186
186
  * This is our capability boundary - we define what we support.
187
187
  * Specific implementations (Claude, OpenAI) must work within this.
188
+ *
189
+ * @typeParam TOptions - Driver-specific options type. Each driver implementation
190
+ * can define its own options interface and pass it as a type parameter.
191
+ *
192
+ * @example
193
+ * ```typescript
194
+ * // Define driver-specific options
195
+ * interface ClaudeDriverOptions {
196
+ * claudeCodePath?: string;
197
+ * maxTurns?: number;
198
+ * }
199
+ *
200
+ * // Use with type parameter
201
+ * const config: DriverConfig<ClaudeDriverOptions> = {
202
+ * apiKey: "...",
203
+ * agentId: "my-agent",
204
+ * options: {
205
+ * claudeCodePath: "/usr/local/bin/claude"
206
+ * }
207
+ * };
208
+ * ```
188
209
  */
189
- export interface DriverConfig {
210
+ export interface DriverConfig<TOptions = Record<string, unknown>> {
190
211
  // === Provider Configuration ===
191
212
 
192
213
  /**
@@ -248,6 +269,30 @@ export interface DriverConfig {
248
269
  * Save this ID to enable session resume later.
249
270
  */
250
271
  onSessionIdCaptured?: (sessionId: string) => void;
272
+
273
+ // === Driver-Specific Options ===
274
+
275
+ /**
276
+ * Driver-specific options
277
+ *
278
+ * Each driver implementation can define its own options type.
279
+ * This allows drivers to have custom configuration without
280
+ * polluting the base DriverConfig interface.
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * // ClaudeDriver options
285
+ * interface ClaudeDriverOptions {
286
+ * claudeCodePath?: string;
287
+ * }
288
+ *
289
+ * const config: DriverConfig<ClaudeDriverOptions> = {
290
+ * apiKey: "...",
291
+ * options: { claudeCodePath: "/usr/bin/claude" }
292
+ * };
293
+ * ```
294
+ */
295
+ options?: TOptions;
251
296
  }
252
297
 
253
298
  // ============================================================================
@@ -352,12 +397,16 @@ export interface Driver {
352
397
  *
353
398
  * Each implementation package exports a function of this type.
354
399
  *
400
+ * @typeParam TOptions - Driver-specific options type
401
+ *
355
402
  * @example
356
403
  * ```typescript
357
404
  * // @agentxjs/claude-driver
358
- * export const createDriver: CreateDriver = (config) => {
359
- * return new ClaudeDriverImpl(config);
405
+ * export const createClaudeDriver: CreateDriver<ClaudeDriverOptions> = (config) => {
406
+ * return new ClaudeDriver(config);
360
407
  * };
361
408
  * ```
362
409
  */
363
- export type CreateDriver = (config: DriverConfig) => Driver;
410
+ export type CreateDriver<TOptions = Record<string, unknown>> = (
411
+ config: DriverConfig<TOptions>
412
+ ) => Driver;