@objectstack/service-ai 4.0.2 → 4.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.
package/dist/index.d.cts CHANGED
@@ -363,23 +363,19 @@ declare class ObjectQLConversationService implements IAIConversationService {
363
363
  interface DataToolContext {
364
364
  /** ObjectQL data engine for record-level operations. */
365
365
  dataEngine: IDataEngine;
366
- /** Metadata service for schema/object introspection. */
367
- metadataService: IMetadataService;
368
366
  }
369
- /** All built-in data tool definitions. */
367
+ /** All built-in data tools definitions. */
370
368
  declare const DATA_TOOL_DEFINITIONS: AIToolDefinition[];
371
369
  /**
372
370
  * Register all built-in data tools on the given {@link ToolRegistry}.
373
371
  *
374
- * Typically called from the `ai:ready` hook after both the data engine
375
- * and metadata service are available.
372
+ * Typically called from the `ai:ready` hook after the data engine is available.
376
373
  *
377
374
  * @example
378
375
  * ```ts
379
376
  * ctx.hook('ai:ready', async (aiService) => {
380
377
  * const dataEngine = ctx.getService<IDataEngine>('data');
381
- * const metadataService = ctx.getService<IMetadataService>('metadata');
382
- * registerDataTools(aiService.toolRegistry, { dataEngine, metadataService });
378
+ * registerDataTools(aiService.toolRegistry, { dataEngine });
383
379
  * });
384
380
  * ```
385
381
  */
@@ -400,7 +396,7 @@ declare const createObjectTool: {
400
396
  requiresConfirmation: boolean;
401
397
  active: boolean;
402
398
  builtIn: boolean;
403
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
399
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
404
400
  outputSchema?: Record<string, unknown> | undefined;
405
401
  objectName?: string | undefined;
406
402
  permissions?: string[] | undefined;
@@ -421,7 +417,7 @@ declare const addFieldTool: {
421
417
  requiresConfirmation: boolean;
422
418
  active: boolean;
423
419
  builtIn: boolean;
424
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
420
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
425
421
  outputSchema?: Record<string, unknown> | undefined;
426
422
  objectName?: string | undefined;
427
423
  permissions?: string[] | undefined;
@@ -441,7 +437,7 @@ declare const modifyFieldTool: {
441
437
  requiresConfirmation: boolean;
442
438
  active: boolean;
443
439
  builtIn: boolean;
444
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
440
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
445
441
  outputSchema?: Record<string, unknown> | undefined;
446
442
  objectName?: string | undefined;
447
443
  permissions?: string[] | undefined;
@@ -461,20 +457,20 @@ declare const deleteFieldTool: {
461
457
  requiresConfirmation: boolean;
462
458
  active: boolean;
463
459
  builtIn: boolean;
464
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
460
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
465
461
  outputSchema?: Record<string, unknown> | undefined;
466
462
  objectName?: string | undefined;
467
463
  permissions?: string[] | undefined;
468
464
  };
469
465
 
470
466
  /**
471
- * list_metadata_objects — AI Tool Metadata
467
+ * list_objects — AI Tool Metadata
472
468
  *
473
- * Lists all registered metadata objects (tables) with optional filtering.
474
- * Uses a unique name (`list_metadata_objects`) to avoid collision with
475
- * the data-tools `list_objects` tool.
469
+ * Lists all registered data objects (tables) with optional filtering
470
+ * and field summaries. This is the single, unified tool for listing
471
+ * objects used by both data_chat and metadata_assistant agents.
476
472
  */
477
- declare const listMetadataObjectsTool: {
473
+ declare const listObjectsTool: {
478
474
  name: string;
479
475
  label: string;
480
476
  description: string;
@@ -482,21 +478,20 @@ declare const listMetadataObjectsTool: {
482
478
  requiresConfirmation: boolean;
483
479
  active: boolean;
484
480
  builtIn: boolean;
485
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
481
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
486
482
  outputSchema?: Record<string, unknown> | undefined;
487
483
  objectName?: string | undefined;
488
484
  permissions?: string[] | undefined;
489
485
  };
490
486
 
491
487
  /**
492
- * describe_metadata_object — AI Tool Metadata
488
+ * describe_object — AI Tool Metadata
493
489
  *
494
- * Returns the full metadata schema of a data object including all
495
- * fields, types, relationships, and configuration. Uses a unique name
496
- * (`describe_metadata_object`) to avoid collision with the data-tools
497
- * `describe_object` tool.
490
+ * Returns the full schema of a data object including all fields, types,
491
+ * relationships, and configuration. This is the single, unified tool for
492
+ * describing objects used by both data_chat and metadata_assistant agents.
498
493
  */
499
- declare const describeMetadataObjectTool: {
494
+ declare const describeObjectTool: {
500
495
  name: string;
501
496
  label: string;
502
497
  description: string;
@@ -504,7 +499,7 @@ declare const describeMetadataObjectTool: {
504
499
  requiresConfirmation: boolean;
505
500
  active: boolean;
506
501
  builtIn: boolean;
507
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
502
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
508
503
  outputSchema?: Record<string, unknown> | undefined;
509
504
  objectName?: string | undefined;
510
505
  permissions?: string[] | undefined;
@@ -969,7 +964,7 @@ declare const AiConversationObject: Omit<{
969
964
  actions?: {
970
965
  name: string;
971
966
  label: string;
972
- type: "url" | "script" | "modal" | "flow" | "api";
967
+ type: "url" | "flow" | "api" | "script" | "modal";
973
968
  refreshAfter: boolean;
974
969
  objectName?: string | undefined;
975
970
  icon?: string | undefined;
@@ -2410,7 +2405,7 @@ declare const AiMessageObject: Omit<{
2410
2405
  actions?: {
2411
2406
  name: string;
2412
2407
  label: string;
2413
- type: "url" | "script" | "modal" | "flow" | "api";
2408
+ type: "url" | "flow" | "api" | "script" | "modal";
2414
2409
  refreshAfter: boolean;
2415
2410
  objectName?: string | undefined;
2416
2411
  icon?: string | undefined;
@@ -3670,4 +3665,14 @@ declare function buildAIRoutes(aiService: IAIService, conversationService: IAICo
3670
3665
  */
3671
3666
  declare function buildAgentRoutes(aiService: AIService, agentRuntime: AgentRuntime, logger: Logger): RouteDefinition[];
3672
3667
 
3673
- export { AIService, type AIServiceConfig, AIServicePlugin, type AIServicePluginOptions, type AgentChatContext, AgentRuntime, AiConversationObject, AiMessageObject, DATA_CHAT_AGENT, DATA_TOOL_DEFINITIONS, type DataToolContext, InMemoryConversationService, METADATA_ASSISTANT_AGENT, METADATA_TOOL_DEFINITIONS, MemoryLLMAdapter, type MetadataToolContext, ObjectQLConversationService, type RouteDefinition, type RouteRequest, type RouteResponse, type RouteUserContext, type ToolExecutionResult, type ToolHandler, ToolRegistry, VercelLLMAdapter, type VercelLLMAdapterConfig, addFieldTool, buildAIRoutes, buildAgentRoutes, createObjectTool, deleteFieldTool, describeMetadataObjectTool, encodeStreamPart, encodeVercelDataStream, listMetadataObjectsTool, modifyFieldTool, registerDataTools, registerMetadataTools };
3668
+ /**
3669
+ * Build tool-specific REST routes.
3670
+ *
3671
+ * | Method | Path | Description |
3672
+ * |:---|:---|:---|
3673
+ * | GET | /api/v1/ai/tools | List all registered tools |
3674
+ * | POST | /api/v1/ai/tools/:toolName/execute | Execute a tool with parameters |
3675
+ */
3676
+ declare function buildToolRoutes(aiService: AIService, logger: Logger): RouteDefinition[];
3677
+
3678
+ export { AIService, type AIServiceConfig, AIServicePlugin, type AIServicePluginOptions, type AgentChatContext, AgentRuntime, AiConversationObject, AiMessageObject, DATA_CHAT_AGENT, DATA_TOOL_DEFINITIONS, type DataToolContext, InMemoryConversationService, METADATA_ASSISTANT_AGENT, METADATA_TOOL_DEFINITIONS, MemoryLLMAdapter, type MetadataToolContext, ObjectQLConversationService, type RouteDefinition, type RouteRequest, type RouteResponse, type RouteUserContext, type ToolExecutionResult, type ToolHandler, ToolRegistry, VercelLLMAdapter, type VercelLLMAdapterConfig, addFieldTool, buildAIRoutes, buildAgentRoutes, buildToolRoutes, createObjectTool, deleteFieldTool, describeObjectTool, encodeStreamPart, encodeVercelDataStream, listObjectsTool, modifyFieldTool, registerDataTools, registerMetadataTools };
package/dist/index.d.ts CHANGED
@@ -363,23 +363,19 @@ declare class ObjectQLConversationService implements IAIConversationService {
363
363
  interface DataToolContext {
364
364
  /** ObjectQL data engine for record-level operations. */
365
365
  dataEngine: IDataEngine;
366
- /** Metadata service for schema/object introspection. */
367
- metadataService: IMetadataService;
368
366
  }
369
- /** All built-in data tool definitions. */
367
+ /** All built-in data tools definitions. */
370
368
  declare const DATA_TOOL_DEFINITIONS: AIToolDefinition[];
371
369
  /**
372
370
  * Register all built-in data tools on the given {@link ToolRegistry}.
373
371
  *
374
- * Typically called from the `ai:ready` hook after both the data engine
375
- * and metadata service are available.
372
+ * Typically called from the `ai:ready` hook after the data engine is available.
376
373
  *
377
374
  * @example
378
375
  * ```ts
379
376
  * ctx.hook('ai:ready', async (aiService) => {
380
377
  * const dataEngine = ctx.getService<IDataEngine>('data');
381
- * const metadataService = ctx.getService<IMetadataService>('metadata');
382
- * registerDataTools(aiService.toolRegistry, { dataEngine, metadataService });
378
+ * registerDataTools(aiService.toolRegistry, { dataEngine });
383
379
  * });
384
380
  * ```
385
381
  */
@@ -400,7 +396,7 @@ declare const createObjectTool: {
400
396
  requiresConfirmation: boolean;
401
397
  active: boolean;
402
398
  builtIn: boolean;
403
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
399
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
404
400
  outputSchema?: Record<string, unknown> | undefined;
405
401
  objectName?: string | undefined;
406
402
  permissions?: string[] | undefined;
@@ -421,7 +417,7 @@ declare const addFieldTool: {
421
417
  requiresConfirmation: boolean;
422
418
  active: boolean;
423
419
  builtIn: boolean;
424
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
420
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
425
421
  outputSchema?: Record<string, unknown> | undefined;
426
422
  objectName?: string | undefined;
427
423
  permissions?: string[] | undefined;
@@ -441,7 +437,7 @@ declare const modifyFieldTool: {
441
437
  requiresConfirmation: boolean;
442
438
  active: boolean;
443
439
  builtIn: boolean;
444
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
440
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
445
441
  outputSchema?: Record<string, unknown> | undefined;
446
442
  objectName?: string | undefined;
447
443
  permissions?: string[] | undefined;
@@ -461,20 +457,20 @@ declare const deleteFieldTool: {
461
457
  requiresConfirmation: boolean;
462
458
  active: boolean;
463
459
  builtIn: boolean;
464
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
460
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
465
461
  outputSchema?: Record<string, unknown> | undefined;
466
462
  objectName?: string | undefined;
467
463
  permissions?: string[] | undefined;
468
464
  };
469
465
 
470
466
  /**
471
- * list_metadata_objects — AI Tool Metadata
467
+ * list_objects — AI Tool Metadata
472
468
  *
473
- * Lists all registered metadata objects (tables) with optional filtering.
474
- * Uses a unique name (`list_metadata_objects`) to avoid collision with
475
- * the data-tools `list_objects` tool.
469
+ * Lists all registered data objects (tables) with optional filtering
470
+ * and field summaries. This is the single, unified tool for listing
471
+ * objects used by both data_chat and metadata_assistant agents.
476
472
  */
477
- declare const listMetadataObjectsTool: {
473
+ declare const listObjectsTool: {
478
474
  name: string;
479
475
  label: string;
480
476
  description: string;
@@ -482,21 +478,20 @@ declare const listMetadataObjectsTool: {
482
478
  requiresConfirmation: boolean;
483
479
  active: boolean;
484
480
  builtIn: boolean;
485
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
481
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
486
482
  outputSchema?: Record<string, unknown> | undefined;
487
483
  objectName?: string | undefined;
488
484
  permissions?: string[] | undefined;
489
485
  };
490
486
 
491
487
  /**
492
- * describe_metadata_object — AI Tool Metadata
488
+ * describe_object — AI Tool Metadata
493
489
  *
494
- * Returns the full metadata schema of a data object including all
495
- * fields, types, relationships, and configuration. Uses a unique name
496
- * (`describe_metadata_object`) to avoid collision with the data-tools
497
- * `describe_object` tool.
490
+ * Returns the full schema of a data object including all fields, types,
491
+ * relationships, and configuration. This is the single, unified tool for
492
+ * describing objects used by both data_chat and metadata_assistant agents.
498
493
  */
499
- declare const describeMetadataObjectTool: {
494
+ declare const describeObjectTool: {
500
495
  name: string;
501
496
  label: string;
502
497
  description: string;
@@ -504,7 +499,7 @@ declare const describeMetadataObjectTool: {
504
499
  requiresConfirmation: boolean;
505
500
  active: boolean;
506
501
  builtIn: boolean;
507
- category?: "flow" | "action" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
502
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
508
503
  outputSchema?: Record<string, unknown> | undefined;
509
504
  objectName?: string | undefined;
510
505
  permissions?: string[] | undefined;
@@ -969,7 +964,7 @@ declare const AiConversationObject: Omit<{
969
964
  actions?: {
970
965
  name: string;
971
966
  label: string;
972
- type: "url" | "script" | "modal" | "flow" | "api";
967
+ type: "url" | "flow" | "api" | "script" | "modal";
973
968
  refreshAfter: boolean;
974
969
  objectName?: string | undefined;
975
970
  icon?: string | undefined;
@@ -2410,7 +2405,7 @@ declare const AiMessageObject: Omit<{
2410
2405
  actions?: {
2411
2406
  name: string;
2412
2407
  label: string;
2413
- type: "url" | "script" | "modal" | "flow" | "api";
2408
+ type: "url" | "flow" | "api" | "script" | "modal";
2414
2409
  refreshAfter: boolean;
2415
2410
  objectName?: string | undefined;
2416
2411
  icon?: string | undefined;
@@ -3670,4 +3665,14 @@ declare function buildAIRoutes(aiService: IAIService, conversationService: IAICo
3670
3665
  */
3671
3666
  declare function buildAgentRoutes(aiService: AIService, agentRuntime: AgentRuntime, logger: Logger): RouteDefinition[];
3672
3667
 
3673
- export { AIService, type AIServiceConfig, AIServicePlugin, type AIServicePluginOptions, type AgentChatContext, AgentRuntime, AiConversationObject, AiMessageObject, DATA_CHAT_AGENT, DATA_TOOL_DEFINITIONS, type DataToolContext, InMemoryConversationService, METADATA_ASSISTANT_AGENT, METADATA_TOOL_DEFINITIONS, MemoryLLMAdapter, type MetadataToolContext, ObjectQLConversationService, type RouteDefinition, type RouteRequest, type RouteResponse, type RouteUserContext, type ToolExecutionResult, type ToolHandler, ToolRegistry, VercelLLMAdapter, type VercelLLMAdapterConfig, addFieldTool, buildAIRoutes, buildAgentRoutes, createObjectTool, deleteFieldTool, describeMetadataObjectTool, encodeStreamPart, encodeVercelDataStream, listMetadataObjectsTool, modifyFieldTool, registerDataTools, registerMetadataTools };
3668
+ /**
3669
+ * Build tool-specific REST routes.
3670
+ *
3671
+ * | Method | Path | Description |
3672
+ * |:---|:---|:---|
3673
+ * | GET | /api/v1/ai/tools | List all registered tools |
3674
+ * | POST | /api/v1/ai/tools/:toolName/execute | Execute a tool with parameters |
3675
+ */
3676
+ declare function buildToolRoutes(aiService: AIService, logger: Logger): RouteDefinition[];
3677
+
3678
+ export { AIService, type AIServiceConfig, AIServicePlugin, type AIServicePluginOptions, type AgentChatContext, AgentRuntime, AiConversationObject, AiMessageObject, DATA_CHAT_AGENT, DATA_TOOL_DEFINITIONS, type DataToolContext, InMemoryConversationService, METADATA_ASSISTANT_AGENT, METADATA_TOOL_DEFINITIONS, MemoryLLMAdapter, type MetadataToolContext, ObjectQLConversationService, type RouteDefinition, type RouteRequest, type RouteResponse, type RouteUserContext, type ToolExecutionResult, type ToolHandler, ToolRegistry, VercelLLMAdapter, type VercelLLMAdapterConfig, addFieldTool, buildAIRoutes, buildAgentRoutes, buildToolRoutes, createObjectTool, deleteFieldTool, describeObjectTool, encodeStreamPart, encodeVercelDataStream, listObjectsTool, modifyFieldTool, registerDataTools, registerMetadataTools };