@agentforge/core 0.16.10 → 0.16.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1026,6 +1026,29 @@ function createLogger(name, options) {
1026
1026
  return new LoggerImpl(name, options);
1027
1027
  }
1028
1028
 
1029
+ // src/tools/registry-collection.ts
1030
+ function getAllRegistryTools(tools) {
1031
+ return Array.from(tools.values());
1032
+ }
1033
+ function getRegistryToolNames(tools) {
1034
+ return Array.from(tools.keys());
1035
+ }
1036
+ function getRegistryToolsByCategory(tools, category) {
1037
+ return getAllRegistryTools(tools).filter((tool) => tool.metadata.category === category);
1038
+ }
1039
+ function getRegistryToolsByTag(tools, tag) {
1040
+ return getAllRegistryTools(tools).filter((tool) => tool.metadata.tags?.includes(tag));
1041
+ }
1042
+ function searchRegistryTools(tools, query) {
1043
+ const lowerQuery = query.toLowerCase();
1044
+ return getAllRegistryTools(tools).filter((tool) => {
1045
+ const name = tool.metadata.name.toLowerCase();
1046
+ const displayName = tool.metadata.displayName?.toLowerCase() ?? "";
1047
+ const description = tool.metadata.description.toLowerCase();
1048
+ return name.includes(lowerQuery) || displayName.includes(lowerQuery) || description.includes(lowerQuery);
1049
+ });
1050
+ }
1051
+
1029
1052
  // src/tools/registry.ts
1030
1053
  var logger = createLogger("agentforge:core:tools:registry", { level: "info" /* INFO */ });
1031
1054
  var RegistryEvent = /* @__PURE__ */ ((RegistryEvent2) => {
@@ -1156,7 +1179,7 @@ var ToolRegistry = class {
1156
1179
  * ```
1157
1180
  */
1158
1181
  getAll() {
1159
- return Array.from(this.tools.values());
1182
+ return getAllRegistryTools(this.tools);
1160
1183
  }
1161
1184
  /**
1162
1185
  * Get tools by category
@@ -1170,7 +1193,7 @@ var ToolRegistry = class {
1170
1193
  * ```
1171
1194
  */
1172
1195
  getByCategory(category) {
1173
- return this.getAll().filter((tool) => tool.metadata.category === category);
1196
+ return getRegistryToolsByCategory(this.tools, category);
1174
1197
  }
1175
1198
  /**
1176
1199
  * Get tools by tag
@@ -1184,9 +1207,7 @@ var ToolRegistry = class {
1184
1207
  * ```
1185
1208
  */
1186
1209
  getByTag(tag) {
1187
- return this.getAll().filter(
1188
- (tool) => tool.metadata.tags?.includes(tag)
1189
- );
1210
+ return getRegistryToolsByTag(this.tools, tag);
1190
1211
  }
1191
1212
  /**
1192
1213
  * Search tools by name or description
@@ -1203,13 +1224,7 @@ var ToolRegistry = class {
1203
1224
  * ```
1204
1225
  */
1205
1226
  search(query) {
1206
- const lowerQuery = query.toLowerCase();
1207
- return this.getAll().filter((tool) => {
1208
- const name = tool.metadata.name.toLowerCase();
1209
- const displayName = tool.metadata.displayName?.toLowerCase() || "";
1210
- const description = tool.metadata.description.toLowerCase();
1211
- return name.includes(lowerQuery) || displayName.includes(lowerQuery) || description.includes(lowerQuery);
1212
- });
1227
+ return searchRegistryTools(this.tools, query);
1213
1228
  }
1214
1229
  /**
1215
1230
  * Register multiple tools at once
@@ -1292,7 +1307,7 @@ var ToolRegistry = class {
1292
1307
  * ```
1293
1308
  */
1294
1309
  getNames() {
1295
- return Array.from(this.tools.keys());
1310
+ return getRegistryToolNames(this.tools);
1296
1311
  }
1297
1312
  /**
1298
1313
  * Register an event handler
package/dist/index.d.cts CHANGED
@@ -1177,8 +1177,8 @@ declare enum RegistryEvent {
1177
1177
  * Event handler type
1178
1178
  */
1179
1179
  type EventHandler = (data: unknown) => void;
1180
- type RegistryTool = Tool<unknown, unknown>;
1181
1180
  type RegisterManyTool = Tool<never, unknown>;
1181
+ type RegistryTool = Tool<unknown, unknown>;
1182
1182
  /**
1183
1183
  * Options for generating tool prompts
1184
1184
  */
@@ -4182,6 +4182,7 @@ declare function createErrorReporter(options: ErrorReporterOptions): ErrorReport
4182
4182
  * Types for LangGraph interrupt handling
4183
4183
  * @module langgraph/interrupts/types
4184
4184
  */
4185
+
4185
4186
  /**
4186
4187
  * Priority level for human requests
4187
4188
  */
@@ -4205,7 +4206,7 @@ interface HumanRequest {
4205
4206
  /**
4206
4207
  * Optional context
4207
4208
  */
4208
- context?: Record<string, any>;
4209
+ context?: JsonObject;
4209
4210
  /**
4210
4211
  * Priority level
4211
4212
  */
@@ -4243,14 +4244,22 @@ interface HumanRequest {
4243
4244
  * Interrupt type - identifies what kind of interrupt occurred
4244
4245
  */
4245
4246
  type InterruptType = 'human_request' | 'approval_required' | 'custom';
4247
+ /**
4248
+ * Shared interrupt metadata contract.
4249
+ */
4250
+ type InterruptMetadata = JsonObject;
4251
+ /**
4252
+ * JSON-safe payload allowed in generic interrupt and resume flows.
4253
+ */
4254
+ type InterruptPayload = JsonValue;
4246
4255
  /**
4247
4256
  * Interrupt data stored in the checkpoint
4248
4257
  */
4249
- interface InterruptData {
4258
+ interface InterruptData<TType extends InterruptType = InterruptType, TData = unknown, TMetadata extends InterruptMetadata = InterruptMetadata> {
4250
4259
  /**
4251
4260
  * Type of interrupt
4252
4261
  */
4253
- type: InterruptType;
4262
+ type: TType;
4254
4263
  /**
4255
4264
  * Unique ID for this interrupt
4256
4265
  */
@@ -4262,37 +4271,32 @@ interface InterruptData {
4262
4271
  /**
4263
4272
  * The data associated with this interrupt
4264
4273
  */
4265
- data: any;
4274
+ data: TData;
4266
4275
  /**
4267
4276
  * Optional metadata
4268
4277
  */
4269
- metadata?: Record<string, any>;
4278
+ metadata?: TMetadata;
4270
4279
  }
4271
4280
  /**
4272
- * Human request interrupt data
4281
+ * Approval request payload.
4273
4282
  */
4274
- interface HumanRequestInterrupt extends InterruptData {
4275
- type: 'human_request';
4276
- data: HumanRequest;
4283
+ interface ApprovalRequiredData {
4284
+ action: string;
4285
+ description: string;
4286
+ context?: JsonObject;
4277
4287
  }
4288
+ /**
4289
+ * Human request interrupt data
4290
+ */
4291
+ type HumanRequestInterrupt = InterruptData<'human_request', HumanRequest>;
4278
4292
  /**
4279
4293
  * Approval required interrupt data
4280
4294
  */
4281
- interface ApprovalRequiredInterrupt extends InterruptData {
4282
- type: 'approval_required';
4283
- data: {
4284
- action: string;
4285
- description: string;
4286
- context?: Record<string, any>;
4287
- };
4288
- }
4295
+ type ApprovalRequiredInterrupt = InterruptData<'approval_required', ApprovalRequiredData>;
4289
4296
  /**
4290
4297
  * Custom interrupt data
4291
4298
  */
4292
- interface CustomInterrupt extends InterruptData {
4293
- type: 'custom';
4294
- data: any;
4295
- }
4299
+ type CustomInterrupt<TData extends InterruptPayload = InterruptPayload, TMetadata extends InterruptMetadata = InterruptMetadata> = InterruptData<'custom', TData, TMetadata>;
4296
4300
  /**
4297
4301
  * Union type of all interrupt types
4298
4302
  */
@@ -4300,15 +4304,15 @@ type AnyInterrupt = HumanRequestInterrupt | ApprovalRequiredInterrupt | CustomIn
4300
4304
  /**
4301
4305
  * Resume command for continuing after an interrupt
4302
4306
  */
4303
- interface ResumeCommand {
4307
+ interface ResumeCommand<TResume extends InterruptPayload = InterruptPayload, TMetadata extends InterruptMetadata = InterruptMetadata> {
4304
4308
  /**
4305
4309
  * The response to the interrupt
4306
4310
  */
4307
- resume: any;
4311
+ resume: TResume;
4308
4312
  /**
4309
4313
  * Optional metadata about the response
4310
4314
  */
4311
- metadata?: Record<string, any>;
4315
+ metadata?: TMetadata;
4312
4316
  }
4313
4317
  /**
4314
4318
  * Thread status
@@ -4337,7 +4341,7 @@ interface ThreadInfo {
4337
4341
  /**
4338
4342
  * Optional metadata
4339
4343
  */
4340
- metadata?: Record<string, any>;
4344
+ metadata?: InterruptMetadata;
4341
4345
  }
4342
4346
  /**
4343
4347
  * Options for checking interrupt status
@@ -4367,11 +4371,11 @@ interface ResumeOptions {
4367
4371
  /**
4368
4372
  * The response/value to resume with
4369
4373
  */
4370
- value: any;
4374
+ value: InterruptPayload;
4371
4375
  /**
4372
4376
  * Optional metadata
4373
4377
  */
4374
- metadata?: Record<string, any>;
4378
+ metadata?: InterruptMetadata;
4375
4379
  }
4376
4380
 
4377
4381
  /**
@@ -4415,7 +4419,7 @@ declare function createHumanRequestInterrupt(request: HumanRequest): HumanReques
4415
4419
  * );
4416
4420
  * ```
4417
4421
  */
4418
- declare function createApprovalRequiredInterrupt(action: string, description: string, context?: Record<string, any>): ApprovalRequiredInterrupt;
4422
+ declare function createApprovalRequiredInterrupt(action: string, description: string, context?: JsonObject): ApprovalRequiredInterrupt;
4419
4423
  /**
4420
4424
  * Create a custom interrupt
4421
4425
  *
@@ -4432,7 +4436,7 @@ declare function createApprovalRequiredInterrupt(action: string, description: st
4432
4436
  * );
4433
4437
  * ```
4434
4438
  */
4435
- declare function createCustomInterrupt(id: string, data: any, metadata?: Record<string, any>): CustomInterrupt;
4439
+ declare function createCustomInterrupt<TData extends InterruptPayload, TMetadata extends InterruptMetadata = InterruptMetadata>(id: string, data: TData, metadata?: TMetadata): CustomInterrupt<TData, TMetadata>;
4436
4440
  /**
4437
4441
  * Check if an interrupt is a human request
4438
4442
  *
package/dist/index.d.ts CHANGED
@@ -1177,8 +1177,8 @@ declare enum RegistryEvent {
1177
1177
  * Event handler type
1178
1178
  */
1179
1179
  type EventHandler = (data: unknown) => void;
1180
- type RegistryTool = Tool<unknown, unknown>;
1181
1180
  type RegisterManyTool = Tool<never, unknown>;
1181
+ type RegistryTool = Tool<unknown, unknown>;
1182
1182
  /**
1183
1183
  * Options for generating tool prompts
1184
1184
  */
@@ -4182,6 +4182,7 @@ declare function createErrorReporter(options: ErrorReporterOptions): ErrorReport
4182
4182
  * Types for LangGraph interrupt handling
4183
4183
  * @module langgraph/interrupts/types
4184
4184
  */
4185
+
4185
4186
  /**
4186
4187
  * Priority level for human requests
4187
4188
  */
@@ -4205,7 +4206,7 @@ interface HumanRequest {
4205
4206
  /**
4206
4207
  * Optional context
4207
4208
  */
4208
- context?: Record<string, any>;
4209
+ context?: JsonObject;
4209
4210
  /**
4210
4211
  * Priority level
4211
4212
  */
@@ -4243,14 +4244,22 @@ interface HumanRequest {
4243
4244
  * Interrupt type - identifies what kind of interrupt occurred
4244
4245
  */
4245
4246
  type InterruptType = 'human_request' | 'approval_required' | 'custom';
4247
+ /**
4248
+ * Shared interrupt metadata contract.
4249
+ */
4250
+ type InterruptMetadata = JsonObject;
4251
+ /**
4252
+ * JSON-safe payload allowed in generic interrupt and resume flows.
4253
+ */
4254
+ type InterruptPayload = JsonValue;
4246
4255
  /**
4247
4256
  * Interrupt data stored in the checkpoint
4248
4257
  */
4249
- interface InterruptData {
4258
+ interface InterruptData<TType extends InterruptType = InterruptType, TData = unknown, TMetadata extends InterruptMetadata = InterruptMetadata> {
4250
4259
  /**
4251
4260
  * Type of interrupt
4252
4261
  */
4253
- type: InterruptType;
4262
+ type: TType;
4254
4263
  /**
4255
4264
  * Unique ID for this interrupt
4256
4265
  */
@@ -4262,37 +4271,32 @@ interface InterruptData {
4262
4271
  /**
4263
4272
  * The data associated with this interrupt
4264
4273
  */
4265
- data: any;
4274
+ data: TData;
4266
4275
  /**
4267
4276
  * Optional metadata
4268
4277
  */
4269
- metadata?: Record<string, any>;
4278
+ metadata?: TMetadata;
4270
4279
  }
4271
4280
  /**
4272
- * Human request interrupt data
4281
+ * Approval request payload.
4273
4282
  */
4274
- interface HumanRequestInterrupt extends InterruptData {
4275
- type: 'human_request';
4276
- data: HumanRequest;
4283
+ interface ApprovalRequiredData {
4284
+ action: string;
4285
+ description: string;
4286
+ context?: JsonObject;
4277
4287
  }
4288
+ /**
4289
+ * Human request interrupt data
4290
+ */
4291
+ type HumanRequestInterrupt = InterruptData<'human_request', HumanRequest>;
4278
4292
  /**
4279
4293
  * Approval required interrupt data
4280
4294
  */
4281
- interface ApprovalRequiredInterrupt extends InterruptData {
4282
- type: 'approval_required';
4283
- data: {
4284
- action: string;
4285
- description: string;
4286
- context?: Record<string, any>;
4287
- };
4288
- }
4295
+ type ApprovalRequiredInterrupt = InterruptData<'approval_required', ApprovalRequiredData>;
4289
4296
  /**
4290
4297
  * Custom interrupt data
4291
4298
  */
4292
- interface CustomInterrupt extends InterruptData {
4293
- type: 'custom';
4294
- data: any;
4295
- }
4299
+ type CustomInterrupt<TData extends InterruptPayload = InterruptPayload, TMetadata extends InterruptMetadata = InterruptMetadata> = InterruptData<'custom', TData, TMetadata>;
4296
4300
  /**
4297
4301
  * Union type of all interrupt types
4298
4302
  */
@@ -4300,15 +4304,15 @@ type AnyInterrupt = HumanRequestInterrupt | ApprovalRequiredInterrupt | CustomIn
4300
4304
  /**
4301
4305
  * Resume command for continuing after an interrupt
4302
4306
  */
4303
- interface ResumeCommand {
4307
+ interface ResumeCommand<TResume extends InterruptPayload = InterruptPayload, TMetadata extends InterruptMetadata = InterruptMetadata> {
4304
4308
  /**
4305
4309
  * The response to the interrupt
4306
4310
  */
4307
- resume: any;
4311
+ resume: TResume;
4308
4312
  /**
4309
4313
  * Optional metadata about the response
4310
4314
  */
4311
- metadata?: Record<string, any>;
4315
+ metadata?: TMetadata;
4312
4316
  }
4313
4317
  /**
4314
4318
  * Thread status
@@ -4337,7 +4341,7 @@ interface ThreadInfo {
4337
4341
  /**
4338
4342
  * Optional metadata
4339
4343
  */
4340
- metadata?: Record<string, any>;
4344
+ metadata?: InterruptMetadata;
4341
4345
  }
4342
4346
  /**
4343
4347
  * Options for checking interrupt status
@@ -4367,11 +4371,11 @@ interface ResumeOptions {
4367
4371
  /**
4368
4372
  * The response/value to resume with
4369
4373
  */
4370
- value: any;
4374
+ value: InterruptPayload;
4371
4375
  /**
4372
4376
  * Optional metadata
4373
4377
  */
4374
- metadata?: Record<string, any>;
4378
+ metadata?: InterruptMetadata;
4375
4379
  }
4376
4380
 
4377
4381
  /**
@@ -4415,7 +4419,7 @@ declare function createHumanRequestInterrupt(request: HumanRequest): HumanReques
4415
4419
  * );
4416
4420
  * ```
4417
4421
  */
4418
- declare function createApprovalRequiredInterrupt(action: string, description: string, context?: Record<string, any>): ApprovalRequiredInterrupt;
4422
+ declare function createApprovalRequiredInterrupt(action: string, description: string, context?: JsonObject): ApprovalRequiredInterrupt;
4419
4423
  /**
4420
4424
  * Create a custom interrupt
4421
4425
  *
@@ -4432,7 +4436,7 @@ declare function createApprovalRequiredInterrupt(action: string, description: st
4432
4436
  * );
4433
4437
  * ```
4434
4438
  */
4435
- declare function createCustomInterrupt(id: string, data: any, metadata?: Record<string, any>): CustomInterrupt;
4439
+ declare function createCustomInterrupt<TData extends InterruptPayload, TMetadata extends InterruptMetadata = InterruptMetadata>(id: string, data: TData, metadata?: TMetadata): CustomInterrupt<TData, TMetadata>;
4436
4440
  /**
4437
4441
  * Check if an interrupt is a human request
4438
4442
  *
package/dist/index.js CHANGED
@@ -851,6 +851,29 @@ function createLogger(name, options) {
851
851
  return new LoggerImpl(name, options);
852
852
  }
853
853
 
854
+ // src/tools/registry-collection.ts
855
+ function getAllRegistryTools(tools) {
856
+ return Array.from(tools.values());
857
+ }
858
+ function getRegistryToolNames(tools) {
859
+ return Array.from(tools.keys());
860
+ }
861
+ function getRegistryToolsByCategory(tools, category) {
862
+ return getAllRegistryTools(tools).filter((tool) => tool.metadata.category === category);
863
+ }
864
+ function getRegistryToolsByTag(tools, tag) {
865
+ return getAllRegistryTools(tools).filter((tool) => tool.metadata.tags?.includes(tag));
866
+ }
867
+ function searchRegistryTools(tools, query) {
868
+ const lowerQuery = query.toLowerCase();
869
+ return getAllRegistryTools(tools).filter((tool) => {
870
+ const name = tool.metadata.name.toLowerCase();
871
+ const displayName = tool.metadata.displayName?.toLowerCase() ?? "";
872
+ const description = tool.metadata.description.toLowerCase();
873
+ return name.includes(lowerQuery) || displayName.includes(lowerQuery) || description.includes(lowerQuery);
874
+ });
875
+ }
876
+
854
877
  // src/tools/registry.ts
855
878
  var logger = createLogger("agentforge:core:tools:registry", { level: "info" /* INFO */ });
856
879
  var RegistryEvent = /* @__PURE__ */ ((RegistryEvent2) => {
@@ -981,7 +1004,7 @@ var ToolRegistry = class {
981
1004
  * ```
982
1005
  */
983
1006
  getAll() {
984
- return Array.from(this.tools.values());
1007
+ return getAllRegistryTools(this.tools);
985
1008
  }
986
1009
  /**
987
1010
  * Get tools by category
@@ -995,7 +1018,7 @@ var ToolRegistry = class {
995
1018
  * ```
996
1019
  */
997
1020
  getByCategory(category) {
998
- return this.getAll().filter((tool) => tool.metadata.category === category);
1021
+ return getRegistryToolsByCategory(this.tools, category);
999
1022
  }
1000
1023
  /**
1001
1024
  * Get tools by tag
@@ -1009,9 +1032,7 @@ var ToolRegistry = class {
1009
1032
  * ```
1010
1033
  */
1011
1034
  getByTag(tag) {
1012
- return this.getAll().filter(
1013
- (tool) => tool.metadata.tags?.includes(tag)
1014
- );
1035
+ return getRegistryToolsByTag(this.tools, tag);
1015
1036
  }
1016
1037
  /**
1017
1038
  * Search tools by name or description
@@ -1028,13 +1049,7 @@ var ToolRegistry = class {
1028
1049
  * ```
1029
1050
  */
1030
1051
  search(query) {
1031
- const lowerQuery = query.toLowerCase();
1032
- return this.getAll().filter((tool) => {
1033
- const name = tool.metadata.name.toLowerCase();
1034
- const displayName = tool.metadata.displayName?.toLowerCase() || "";
1035
- const description = tool.metadata.description.toLowerCase();
1036
- return name.includes(lowerQuery) || displayName.includes(lowerQuery) || description.includes(lowerQuery);
1037
- });
1052
+ return searchRegistryTools(this.tools, query);
1038
1053
  }
1039
1054
  /**
1040
1055
  * Register multiple tools at once
@@ -1117,7 +1132,7 @@ var ToolRegistry = class {
1117
1132
  * ```
1118
1133
  */
1119
1134
  getNames() {
1120
- return Array.from(this.tools.keys());
1135
+ return getRegistryToolNames(this.tools);
1121
1136
  }
1122
1137
  /**
1123
1138
  * Register an event handler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge/core",
3
- "version": "0.16.10",
3
+ "version": "0.16.12",
4
4
  "description": "Production-ready TypeScript agent framework built on LangGraph with orchestration, middleware, and typed abstractions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",