@alquimia-ai/tools 2.3.0 → 2.4.0

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.
@@ -305,6 +305,8 @@ interface GenuiSurfaceItem {
305
305
  afterCount: number;
306
306
  /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */
307
307
  submitted?: boolean;
308
+ /** Set when the user declined the surface and typed a reply */
309
+ dismissedWith?: string;
308
310
  }
309
311
 
310
312
  export { type AIMessageChunk, type AIMessageChunkData, type ActionResponse, type AlquimiaEventData, type AlquimiaMessage, type ApiError, type ApmSpan, type AssistantInferenceResponse, type AssistantResponseData, type AttachmentPayload, type BaseAPIConfig, type CommonAttributes, type ConversationsMap, type DocumentSearchResult, type ElevenLabsRequestSpecs, type ElevenLabsVoiceSettings, type EvaluationStrategy, type ExpertInferenceResponse, type ExtraDataContext, type GenuiSurfaceItem, type IToolSpec, type ITooler, type InferInitResponse, type NativeToolsEvaluationStrategy, type OneShootEvaluationStrategy, type RatingData, type RawToolsEvaluationStrategy, type ResponseMetadata, type TTSResult, type ThinkingsInferenceResponse, type TokenUsage, type ToolEvent, ToolFactory, type ToolOutput, type ToolSummary, type Tooler, type UsageMetadata };
@@ -305,6 +305,8 @@ interface GenuiSurfaceItem {
305
305
  afterCount: number;
306
306
  /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */
307
307
  submitted?: boolean;
308
+ /** Set when the user declined the surface and typed a reply */
309
+ dismissedWith?: string;
308
310
  }
309
311
 
310
312
  export { type AIMessageChunk, type AIMessageChunkData, type ActionResponse, type AlquimiaEventData, type AlquimiaMessage, type ApiError, type ApmSpan, type AssistantInferenceResponse, type AssistantResponseData, type AttachmentPayload, type BaseAPIConfig, type CommonAttributes, type ConversationsMap, type DocumentSearchResult, type ElevenLabsRequestSpecs, type ElevenLabsVoiceSettings, type EvaluationStrategy, type ExpertInferenceResponse, type ExtraDataContext, type GenuiSurfaceItem, type IToolSpec, type ITooler, type InferInitResponse, type NativeToolsEvaluationStrategy, type OneShootEvaluationStrategy, type RatingData, type RawToolsEvaluationStrategy, type ResponseMetadata, type TTSResult, type ThinkingsInferenceResponse, type TokenUsage, type ToolEvent, ToolFactory, type ToolOutput, type ToolSummary, type Tooler, type UsageMetadata };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts","../../src/types/type.ts"],"sourcesContent":["export * from './type'","import { Span } from \"@elastic/apm-rum\";\nimport { Message } from \"ai\";\nimport { A2uiSurface } from \"../genui\";\nexport interface ITooler {\n tooler: Array<{\n name: string;\n parameters: Record<string, any>;\n }>;\n}\n\nexport interface IToolSpec {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport abstract class ToolFactory {\n protected toolSpec: IToolSpec | null = null;\n\n constructor(toolSpec: IToolSpec) {\n this.toolSpec = toolSpec;\n }\n\n static createTool(toolSpec: IToolSpec): IToolSpec {\n return toolSpec;\n }\n\n abstract execute(): Promise<any>;\n}\n\nexport interface AIMessageChunk {\n type: string;\n data?: AIMessageChunkData;\n answer?: string;\n tooler?: ToolEvent[];\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n}\n\nexport interface AIMessageChunkData {\n content: string;\n additional_kwargs?: Record<string, unknown>;\n response_metadata?: Record<string, unknown>;\n type: string;\n name?: string | null;\n id?: string | null;\n example?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n usage_metadata?: any;\n tool_call_chunks?: unknown[];\n error_code?: string;\n error_detail?: string;\n}\n\ntype ToolCall = {\n name: string;\n args: Record<string, any>;\n id?: string | null;\n};\n\ntype InvalidToolCall = {\n name: string | null;\n args: string | null;\n id: string | null;\n error: string | null;\n};\n\nexport interface BaseAPIConfig {\n baseUrl: string;\n route: string;\n token?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RatingData {\n assistantId: string;\n sessionId: string;\n topicId: number;\n score?: number;\n description?: string;\n}\n\nexport interface AttachmentPayload {\n filename: string;\n content_type: string;\n content_size: number;\n}\n\nexport type AlquimiaMessage = Message & {\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n attachments?: AttachmentPayload[];\n};\n\nexport interface ActionResponse<T = void> {\n success: boolean;\n data?: T;\n error?: {\n message: string;\n code?: string;\n details?: any;\n name?: string;\n cause?: string;\n status?: string;\n };\n}\n\nexport type ApmSpan = Span & {\n id?: string \n traceId?: string\n} | undefined\n\nexport type ApiError = Error & {\n message: string;\n name: string;\n cause: string;\n code?: string | number;\n status?: string | number;\n}\n\nexport type Tooler = {\n control_id: string;\n tool_summary?: ToolSummary;\n tool_output?: ToolOutput;\n}\n\nexport type ToolSummary = {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport type ToolOutput = {\n result: any;\n status: string;\n}\n\nexport type ToolEvent = {\n event_class: string;\n control_id: string;\n data: any;\n status: string;\n}\n\nexport interface ConversationsMap {\n [topicId: string]: string;\n}\n\nexport interface DocumentSearchResult {\n pageContent: string;\n metadata: {\n source: string;\n _id: string;\n _collection_name: string;\n };\n score: number;\n}\n\nexport type ElevenLabsVoiceSettings = {\n stability: number;\n similarity_boost: number;\n style: number;\n};\n\nexport type ElevenLabsRequestSpecs = {\n optimize_streaming_latency: string;\n output_format: string;\n model_id: string;\n language: string;\n voice_settings: ElevenLabsVoiceSettings;\n};\n\nexport type TTSResult =\n | { type: 'blob'; data: Blob }\n | { type: 'url'; data: string }\n | { type: 'error'; message: string };\n\n /** One SSE `data:` JSON frame (`event_class` at top level). */\n export interface AlquimiaEventData {\n taskid?: string;\n event_class?: string;\n control_id?: string;\n date_submitted?: string;\n status?: string | null;\n data?: unknown;\n experts?: ExpertInferenceResponse[];\n thinkings?: ThinkingsInferenceResponse[];\n tools_output?: ToolEvent[];\n agents_output?: any[];\n tools_pending_approval?: any[];\n tools_pending_execution?: any[];\n errors?: any[];\n }\n\n export interface AssistantInferenceResponse {\n event_class: string;\n control_id: string;\n data: string;\n status: string;\n date_submitted: string;\n message?: string | null;\n extras?: Record<string, unknown> | null;\n extra_data?: ExtraDataContext | null;\n channel?: unknown | null;\n depth?: number;\n taskid?: string;\n }\n\n /**\n * Channel-scoped context returned alongside an inference response (was\n * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel\n * the inference was triggered from.\n */\n export interface ExtraDataContext {\n whatsapp_message_id?: string;\n whatsapp_message_from?: string;\n email_message_recipient?: string;\n email_message_subject?: string;\n email_message_id?: string;\n email_message_body?: string;\n slack_team_id?: string;\n slack_user_id?: string;\n slack_channel_id?: string;\n slack_response_url?: string;\n }\n\n /**\n * JSON body returned by `POST /event/infer/{assistantId}` (and channel\n * variants). Keys match the runtime wire format (lowercase, no underscores).\n * `taskid` is the id used for the SSE stream.\n */\n export interface CommonAttributes {\n taskid?: string | null;\n parenttaskid?: string | null;\n sessionid?: string | null;\n userid?: string | null;\n assistantid?: string | null;\n agentspaceid?: string | null;\n channelid?: string | null;\n depth?: string;\n attachments?: string[];\n }\n\n export type InferInitResponse = CommonAttributes;\n\n /**\n * Native-tools evaluation strategy. Wraps the client-side tool schemas\n * the SDK previously sent at the top level of the infer payload.\n */\n export interface NativeToolsEvaluationStrategy {\n evaluation_strategy_id: 'native';\n tool_schemas?: unknown[];\n max_steps?: number;\n current_step?: number;\n max_concurrent_tools?: number;\n decorators?: unknown[];\n tool_choice?: unknown;\n structured_output?: unknown;\n }\n\n export interface RawToolsEvaluationStrategy {\n evaluation_strategy_id: 'raw';\n tool_schemas?: unknown[];\n }\n\n export interface OneShootEvaluationStrategy {\n evaluation_strategy_id: 'one-shoot';\n }\n\n export type EvaluationStrategy =\n | NativeToolsEvaluationStrategy\n | RawToolsEvaluationStrategy\n | OneShootEvaluationStrategy;\n\n export interface AssistantResponseData {\n content: string;\n additional_kwargs: Record<string, any>;\n response_metadata: ResponseMetadata;\n type: string;\n id: string;\n example: boolean;\n tool_calls: any[];\n invalid_tool_calls: any[];\n usage_metadata: UsageMetadata;\n }\n\n export interface ResponseMetadata {\n token_usage: TokenUsage;\n model_name: string;\n system_fingerprint: string;\n finish_reason: string;\n logprobs: any | null;\n }\n\n export interface TokenUsage {\n completion_tokens: number;\n prompt_tokens: number;\n total_tokens: number;\n completion_time: number;\n prompt_time: number;\n queue_time: number;\n total_time: number;\n }\n\n export interface UsageMetadata {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n }\n\n export interface ExpertInferenceResponse {\n event_class: string;\n control_id: string;\n data: {\n label: string;\n score: number;\n };\n status: string;\n date_submitted: string;\n }\n\n export interface ThinkingsInferenceResponse {\n event_class: string;\n control_id: string;\n status: string;\n date_submitted: string;\n data: {\n content: AssistantResponseData;\n is_complete: boolean;\n is_partial: boolean;\n };\n }\n\n export interface GenuiSurfaceItem {\n controlId: string;\n surface: A2uiSurface;\n /** Message-count anchor: the surface renders after this many messages (chronological ordering). */\n afterCount: number;\n /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */\n submitted?: boolean;\n }"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,IAAe,cAAf,MAA2B;AAAA,EAGhC,YAAY,UAAqB;AAFjC,SAAU,WAA6B;AAGrC,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,OAAO,WAAW,UAAgC;AAChD,WAAO;AAAA,EACT;AAGF;","names":[]}
1
+ {"version":3,"sources":["../../src/types/index.ts","../../src/types/type.ts"],"sourcesContent":["export * from './type'","import { Span } from \"@elastic/apm-rum\";\nimport { Message } from \"ai\";\nimport { A2uiSurface } from \"../genui\";\nexport interface ITooler {\n tooler: Array<{\n name: string;\n parameters: Record<string, any>;\n }>;\n}\n\nexport interface IToolSpec {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport abstract class ToolFactory {\n protected toolSpec: IToolSpec | null = null;\n\n constructor(toolSpec: IToolSpec) {\n this.toolSpec = toolSpec;\n }\n\n static createTool(toolSpec: IToolSpec): IToolSpec {\n return toolSpec;\n }\n\n abstract execute(): Promise<any>;\n}\n\nexport interface AIMessageChunk {\n type: string;\n data?: AIMessageChunkData;\n answer?: string;\n tooler?: ToolEvent[];\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n}\n\nexport interface AIMessageChunkData {\n content: string;\n additional_kwargs?: Record<string, unknown>;\n response_metadata?: Record<string, unknown>;\n type: string;\n name?: string | null;\n id?: string | null;\n example?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n usage_metadata?: any;\n tool_call_chunks?: unknown[];\n error_code?: string;\n error_detail?: string;\n}\n\ntype ToolCall = {\n name: string;\n args: Record<string, any>;\n id?: string | null;\n};\n\ntype InvalidToolCall = {\n name: string | null;\n args: string | null;\n id: string | null;\n error: string | null;\n};\n\nexport interface BaseAPIConfig {\n baseUrl: string;\n route: string;\n token?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RatingData {\n assistantId: string;\n sessionId: string;\n topicId: number;\n score?: number;\n description?: string;\n}\n\nexport interface AttachmentPayload {\n filename: string;\n content_type: string;\n content_size: number;\n}\n\nexport type AlquimiaMessage = Message & {\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n attachments?: AttachmentPayload[];\n};\n\nexport interface ActionResponse<T = void> {\n success: boolean;\n data?: T;\n error?: {\n message: string;\n code?: string;\n details?: any;\n name?: string;\n cause?: string;\n status?: string;\n };\n}\n\nexport type ApmSpan = Span & {\n id?: string \n traceId?: string\n} | undefined\n\nexport type ApiError = Error & {\n message: string;\n name: string;\n cause: string;\n code?: string | number;\n status?: string | number;\n}\n\nexport type Tooler = {\n control_id: string;\n tool_summary?: ToolSummary;\n tool_output?: ToolOutput;\n}\n\nexport type ToolSummary = {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport type ToolOutput = {\n result: any;\n status: string;\n}\n\nexport type ToolEvent = {\n event_class: string;\n control_id: string;\n data: any;\n status: string;\n}\n\nexport interface ConversationsMap {\n [topicId: string]: string;\n}\n\nexport interface DocumentSearchResult {\n pageContent: string;\n metadata: {\n source: string;\n _id: string;\n _collection_name: string;\n };\n score: number;\n}\n\nexport type ElevenLabsVoiceSettings = {\n stability: number;\n similarity_boost: number;\n style: number;\n};\n\nexport type ElevenLabsRequestSpecs = {\n optimize_streaming_latency: string;\n output_format: string;\n model_id: string;\n language: string;\n voice_settings: ElevenLabsVoiceSettings;\n};\n\nexport type TTSResult =\n | { type: 'blob'; data: Blob }\n | { type: 'url'; data: string }\n | { type: 'error'; message: string };\n\n /** One SSE `data:` JSON frame (`event_class` at top level). */\n export interface AlquimiaEventData {\n taskid?: string;\n event_class?: string;\n control_id?: string;\n date_submitted?: string;\n status?: string | null;\n data?: unknown;\n experts?: ExpertInferenceResponse[];\n thinkings?: ThinkingsInferenceResponse[];\n tools_output?: ToolEvent[];\n agents_output?: any[];\n tools_pending_approval?: any[];\n tools_pending_execution?: any[];\n errors?: any[];\n }\n\n export interface AssistantInferenceResponse {\n event_class: string;\n control_id: string;\n data: string;\n status: string;\n date_submitted: string;\n message?: string | null;\n extras?: Record<string, unknown> | null;\n extra_data?: ExtraDataContext | null;\n channel?: unknown | null;\n depth?: number;\n taskid?: string;\n }\n\n /**\n * Channel-scoped context returned alongside an inference response (was\n * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel\n * the inference was triggered from.\n */\n export interface ExtraDataContext {\n whatsapp_message_id?: string;\n whatsapp_message_from?: string;\n email_message_recipient?: string;\n email_message_subject?: string;\n email_message_id?: string;\n email_message_body?: string;\n slack_team_id?: string;\n slack_user_id?: string;\n slack_channel_id?: string;\n slack_response_url?: string;\n }\n\n /**\n * JSON body returned by `POST /event/infer/{assistantId}` (and channel\n * variants). Keys match the runtime wire format (lowercase, no underscores).\n * `taskid` is the id used for the SSE stream.\n */\n export interface CommonAttributes {\n taskid?: string | null;\n parenttaskid?: string | null;\n sessionid?: string | null;\n userid?: string | null;\n assistantid?: string | null;\n agentspaceid?: string | null;\n channelid?: string | null;\n depth?: string;\n attachments?: string[];\n }\n\n export type InferInitResponse = CommonAttributes;\n\n /**\n * Native-tools evaluation strategy. Wraps the client-side tool schemas\n * the SDK previously sent at the top level of the infer payload.\n */\n export interface NativeToolsEvaluationStrategy {\n evaluation_strategy_id: 'native';\n tool_schemas?: unknown[];\n max_steps?: number;\n current_step?: number;\n max_concurrent_tools?: number;\n decorators?: unknown[];\n tool_choice?: unknown;\n structured_output?: unknown;\n }\n\n export interface RawToolsEvaluationStrategy {\n evaluation_strategy_id: 'raw';\n tool_schemas?: unknown[];\n }\n\n export interface OneShootEvaluationStrategy {\n evaluation_strategy_id: 'one-shoot';\n }\n\n export type EvaluationStrategy =\n | NativeToolsEvaluationStrategy\n | RawToolsEvaluationStrategy\n | OneShootEvaluationStrategy;\n\n export interface AssistantResponseData {\n content: string;\n additional_kwargs: Record<string, any>;\n response_metadata: ResponseMetadata;\n type: string;\n id: string;\n example: boolean;\n tool_calls: any[];\n invalid_tool_calls: any[];\n usage_metadata: UsageMetadata;\n }\n\n export interface ResponseMetadata {\n token_usage: TokenUsage;\n model_name: string;\n system_fingerprint: string;\n finish_reason: string;\n logprobs: any | null;\n }\n\n export interface TokenUsage {\n completion_tokens: number;\n prompt_tokens: number;\n total_tokens: number;\n completion_time: number;\n prompt_time: number;\n queue_time: number;\n total_time: number;\n }\n\n export interface UsageMetadata {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n }\n\n export interface ExpertInferenceResponse {\n event_class: string;\n control_id: string;\n data: {\n label: string;\n score: number;\n };\n status: string;\n date_submitted: string;\n }\n\n export interface ThinkingsInferenceResponse {\n event_class: string;\n control_id: string;\n status: string;\n date_submitted: string;\n data: {\n content: AssistantResponseData;\n is_complete: boolean;\n is_partial: boolean;\n };\n }\n\n export interface GenuiSurfaceItem {\n controlId: string;\n surface: A2uiSurface;\n /** Message-count anchor: the surface renders after this many messages (chronological ordering). */\n afterCount: number;\n /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */\n submitted?: boolean;\n /** Set when the user declined the surface and typed a reply */\n dismissedWith?: string;\n }"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,IAAe,cAAf,MAA2B;AAAA,EAGhC,YAAY,UAAqB;AAFjC,SAAU,WAA6B;AAGrC,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,OAAO,WAAW,UAAgC;AAChD,WAAO;AAAA,EACT;AAGF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/type.ts"],"sourcesContent":["import { Span } from \"@elastic/apm-rum\";\nimport { Message } from \"ai\";\nimport { A2uiSurface } from \"../genui\";\nexport interface ITooler {\n tooler: Array<{\n name: string;\n parameters: Record<string, any>;\n }>;\n}\n\nexport interface IToolSpec {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport abstract class ToolFactory {\n protected toolSpec: IToolSpec | null = null;\n\n constructor(toolSpec: IToolSpec) {\n this.toolSpec = toolSpec;\n }\n\n static createTool(toolSpec: IToolSpec): IToolSpec {\n return toolSpec;\n }\n\n abstract execute(): Promise<any>;\n}\n\nexport interface AIMessageChunk {\n type: string;\n data?: AIMessageChunkData;\n answer?: string;\n tooler?: ToolEvent[];\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n}\n\nexport interface AIMessageChunkData {\n content: string;\n additional_kwargs?: Record<string, unknown>;\n response_metadata?: Record<string, unknown>;\n type: string;\n name?: string | null;\n id?: string | null;\n example?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n usage_metadata?: any;\n tool_call_chunks?: unknown[];\n error_code?: string;\n error_detail?: string;\n}\n\ntype ToolCall = {\n name: string;\n args: Record<string, any>;\n id?: string | null;\n};\n\ntype InvalidToolCall = {\n name: string | null;\n args: string | null;\n id: string | null;\n error: string | null;\n};\n\nexport interface BaseAPIConfig {\n baseUrl: string;\n route: string;\n token?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RatingData {\n assistantId: string;\n sessionId: string;\n topicId: number;\n score?: number;\n description?: string;\n}\n\nexport interface AttachmentPayload {\n filename: string;\n content_type: string;\n content_size: number;\n}\n\nexport type AlquimiaMessage = Message & {\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n attachments?: AttachmentPayload[];\n};\n\nexport interface ActionResponse<T = void> {\n success: boolean;\n data?: T;\n error?: {\n message: string;\n code?: string;\n details?: any;\n name?: string;\n cause?: string;\n status?: string;\n };\n}\n\nexport type ApmSpan = Span & {\n id?: string \n traceId?: string\n} | undefined\n\nexport type ApiError = Error & {\n message: string;\n name: string;\n cause: string;\n code?: string | number;\n status?: string | number;\n}\n\nexport type Tooler = {\n control_id: string;\n tool_summary?: ToolSummary;\n tool_output?: ToolOutput;\n}\n\nexport type ToolSummary = {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport type ToolOutput = {\n result: any;\n status: string;\n}\n\nexport type ToolEvent = {\n event_class: string;\n control_id: string;\n data: any;\n status: string;\n}\n\nexport interface ConversationsMap {\n [topicId: string]: string;\n}\n\nexport interface DocumentSearchResult {\n pageContent: string;\n metadata: {\n source: string;\n _id: string;\n _collection_name: string;\n };\n score: number;\n}\n\nexport type ElevenLabsVoiceSettings = {\n stability: number;\n similarity_boost: number;\n style: number;\n};\n\nexport type ElevenLabsRequestSpecs = {\n optimize_streaming_latency: string;\n output_format: string;\n model_id: string;\n language: string;\n voice_settings: ElevenLabsVoiceSettings;\n};\n\nexport type TTSResult =\n | { type: 'blob'; data: Blob }\n | { type: 'url'; data: string }\n | { type: 'error'; message: string };\n\n /** One SSE `data:` JSON frame (`event_class` at top level). */\n export interface AlquimiaEventData {\n taskid?: string;\n event_class?: string;\n control_id?: string;\n date_submitted?: string;\n status?: string | null;\n data?: unknown;\n experts?: ExpertInferenceResponse[];\n thinkings?: ThinkingsInferenceResponse[];\n tools_output?: ToolEvent[];\n agents_output?: any[];\n tools_pending_approval?: any[];\n tools_pending_execution?: any[];\n errors?: any[];\n }\n\n export interface AssistantInferenceResponse {\n event_class: string;\n control_id: string;\n data: string;\n status: string;\n date_submitted: string;\n message?: string | null;\n extras?: Record<string, unknown> | null;\n extra_data?: ExtraDataContext | null;\n channel?: unknown | null;\n depth?: number;\n taskid?: string;\n }\n\n /**\n * Channel-scoped context returned alongside an inference response (was\n * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel\n * the inference was triggered from.\n */\n export interface ExtraDataContext {\n whatsapp_message_id?: string;\n whatsapp_message_from?: string;\n email_message_recipient?: string;\n email_message_subject?: string;\n email_message_id?: string;\n email_message_body?: string;\n slack_team_id?: string;\n slack_user_id?: string;\n slack_channel_id?: string;\n slack_response_url?: string;\n }\n\n /**\n * JSON body returned by `POST /event/infer/{assistantId}` (and channel\n * variants). Keys match the runtime wire format (lowercase, no underscores).\n * `taskid` is the id used for the SSE stream.\n */\n export interface CommonAttributes {\n taskid?: string | null;\n parenttaskid?: string | null;\n sessionid?: string | null;\n userid?: string | null;\n assistantid?: string | null;\n agentspaceid?: string | null;\n channelid?: string | null;\n depth?: string;\n attachments?: string[];\n }\n\n export type InferInitResponse = CommonAttributes;\n\n /**\n * Native-tools evaluation strategy. Wraps the client-side tool schemas\n * the SDK previously sent at the top level of the infer payload.\n */\n export interface NativeToolsEvaluationStrategy {\n evaluation_strategy_id: 'native';\n tool_schemas?: unknown[];\n max_steps?: number;\n current_step?: number;\n max_concurrent_tools?: number;\n decorators?: unknown[];\n tool_choice?: unknown;\n structured_output?: unknown;\n }\n\n export interface RawToolsEvaluationStrategy {\n evaluation_strategy_id: 'raw';\n tool_schemas?: unknown[];\n }\n\n export interface OneShootEvaluationStrategy {\n evaluation_strategy_id: 'one-shoot';\n }\n\n export type EvaluationStrategy =\n | NativeToolsEvaluationStrategy\n | RawToolsEvaluationStrategy\n | OneShootEvaluationStrategy;\n\n export interface AssistantResponseData {\n content: string;\n additional_kwargs: Record<string, any>;\n response_metadata: ResponseMetadata;\n type: string;\n id: string;\n example: boolean;\n tool_calls: any[];\n invalid_tool_calls: any[];\n usage_metadata: UsageMetadata;\n }\n\n export interface ResponseMetadata {\n token_usage: TokenUsage;\n model_name: string;\n system_fingerprint: string;\n finish_reason: string;\n logprobs: any | null;\n }\n\n export interface TokenUsage {\n completion_tokens: number;\n prompt_tokens: number;\n total_tokens: number;\n completion_time: number;\n prompt_time: number;\n queue_time: number;\n total_time: number;\n }\n\n export interface UsageMetadata {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n }\n\n export interface ExpertInferenceResponse {\n event_class: string;\n control_id: string;\n data: {\n label: string;\n score: number;\n };\n status: string;\n date_submitted: string;\n }\n\n export interface ThinkingsInferenceResponse {\n event_class: string;\n control_id: string;\n status: string;\n date_submitted: string;\n data: {\n content: AssistantResponseData;\n is_complete: boolean;\n is_partial: boolean;\n };\n }\n\n export interface GenuiSurfaceItem {\n controlId: string;\n surface: A2uiSurface;\n /** Message-count anchor: the surface renders after this many messages (chronological ordering). */\n afterCount: number;\n /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */\n submitted?: boolean;\n }"],"mappings":";AAeO,IAAe,cAAf,MAA2B;AAAA,EAGhC,YAAY,UAAqB;AAFjC,SAAU,WAA6B;AAGrC,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,OAAO,WAAW,UAAgC;AAChD,WAAO;AAAA,EACT;AAGF;","names":[]}
1
+ {"version":3,"sources":["../../src/types/type.ts"],"sourcesContent":["import { Span } from \"@elastic/apm-rum\";\nimport { Message } from \"ai\";\nimport { A2uiSurface } from \"../genui\";\nexport interface ITooler {\n tooler: Array<{\n name: string;\n parameters: Record<string, any>;\n }>;\n}\n\nexport interface IToolSpec {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport abstract class ToolFactory {\n protected toolSpec: IToolSpec | null = null;\n\n constructor(toolSpec: IToolSpec) {\n this.toolSpec = toolSpec;\n }\n\n static createTool(toolSpec: IToolSpec): IToolSpec {\n return toolSpec;\n }\n\n abstract execute(): Promise<any>;\n}\n\nexport interface AIMessageChunk {\n type: string;\n data?: AIMessageChunkData;\n answer?: string;\n tooler?: ToolEvent[];\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n}\n\nexport interface AIMessageChunkData {\n content: string;\n additional_kwargs?: Record<string, unknown>;\n response_metadata?: Record<string, unknown>;\n type: string;\n name?: string | null;\n id?: string | null;\n example?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n usage_metadata?: any;\n tool_call_chunks?: unknown[];\n error_code?: string;\n error_detail?: string;\n}\n\ntype ToolCall = {\n name: string;\n args: Record<string, any>;\n id?: string | null;\n};\n\ntype InvalidToolCall = {\n name: string | null;\n args: string | null;\n id: string | null;\n error: string | null;\n};\n\nexport interface BaseAPIConfig {\n baseUrl: string;\n route: string;\n token?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RatingData {\n assistantId: string;\n sessionId: string;\n topicId: number;\n score?: number;\n description?: string;\n}\n\nexport interface AttachmentPayload {\n filename: string;\n content_type: string;\n content_size: number;\n}\n\nexport type AlquimiaMessage = Message & {\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n attachments?: AttachmentPayload[];\n};\n\nexport interface ActionResponse<T = void> {\n success: boolean;\n data?: T;\n error?: {\n message: string;\n code?: string;\n details?: any;\n name?: string;\n cause?: string;\n status?: string;\n };\n}\n\nexport type ApmSpan = Span & {\n id?: string \n traceId?: string\n} | undefined\n\nexport type ApiError = Error & {\n message: string;\n name: string;\n cause: string;\n code?: string | number;\n status?: string | number;\n}\n\nexport type Tooler = {\n control_id: string;\n tool_summary?: ToolSummary;\n tool_output?: ToolOutput;\n}\n\nexport type ToolSummary = {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport type ToolOutput = {\n result: any;\n status: string;\n}\n\nexport type ToolEvent = {\n event_class: string;\n control_id: string;\n data: any;\n status: string;\n}\n\nexport interface ConversationsMap {\n [topicId: string]: string;\n}\n\nexport interface DocumentSearchResult {\n pageContent: string;\n metadata: {\n source: string;\n _id: string;\n _collection_name: string;\n };\n score: number;\n}\n\nexport type ElevenLabsVoiceSettings = {\n stability: number;\n similarity_boost: number;\n style: number;\n};\n\nexport type ElevenLabsRequestSpecs = {\n optimize_streaming_latency: string;\n output_format: string;\n model_id: string;\n language: string;\n voice_settings: ElevenLabsVoiceSettings;\n};\n\nexport type TTSResult =\n | { type: 'blob'; data: Blob }\n | { type: 'url'; data: string }\n | { type: 'error'; message: string };\n\n /** One SSE `data:` JSON frame (`event_class` at top level). */\n export interface AlquimiaEventData {\n taskid?: string;\n event_class?: string;\n control_id?: string;\n date_submitted?: string;\n status?: string | null;\n data?: unknown;\n experts?: ExpertInferenceResponse[];\n thinkings?: ThinkingsInferenceResponse[];\n tools_output?: ToolEvent[];\n agents_output?: any[];\n tools_pending_approval?: any[];\n tools_pending_execution?: any[];\n errors?: any[];\n }\n\n export interface AssistantInferenceResponse {\n event_class: string;\n control_id: string;\n data: string;\n status: string;\n date_submitted: string;\n message?: string | null;\n extras?: Record<string, unknown> | null;\n extra_data?: ExtraDataContext | null;\n channel?: unknown | null;\n depth?: number;\n taskid?: string;\n }\n\n /**\n * Channel-scoped context returned alongside an inference response (was\n * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel\n * the inference was triggered from.\n */\n export interface ExtraDataContext {\n whatsapp_message_id?: string;\n whatsapp_message_from?: string;\n email_message_recipient?: string;\n email_message_subject?: string;\n email_message_id?: string;\n email_message_body?: string;\n slack_team_id?: string;\n slack_user_id?: string;\n slack_channel_id?: string;\n slack_response_url?: string;\n }\n\n /**\n * JSON body returned by `POST /event/infer/{assistantId}` (and channel\n * variants). Keys match the runtime wire format (lowercase, no underscores).\n * `taskid` is the id used for the SSE stream.\n */\n export interface CommonAttributes {\n taskid?: string | null;\n parenttaskid?: string | null;\n sessionid?: string | null;\n userid?: string | null;\n assistantid?: string | null;\n agentspaceid?: string | null;\n channelid?: string | null;\n depth?: string;\n attachments?: string[];\n }\n\n export type InferInitResponse = CommonAttributes;\n\n /**\n * Native-tools evaluation strategy. Wraps the client-side tool schemas\n * the SDK previously sent at the top level of the infer payload.\n */\n export interface NativeToolsEvaluationStrategy {\n evaluation_strategy_id: 'native';\n tool_schemas?: unknown[];\n max_steps?: number;\n current_step?: number;\n max_concurrent_tools?: number;\n decorators?: unknown[];\n tool_choice?: unknown;\n structured_output?: unknown;\n }\n\n export interface RawToolsEvaluationStrategy {\n evaluation_strategy_id: 'raw';\n tool_schemas?: unknown[];\n }\n\n export interface OneShootEvaluationStrategy {\n evaluation_strategy_id: 'one-shoot';\n }\n\n export type EvaluationStrategy =\n | NativeToolsEvaluationStrategy\n | RawToolsEvaluationStrategy\n | OneShootEvaluationStrategy;\n\n export interface AssistantResponseData {\n content: string;\n additional_kwargs: Record<string, any>;\n response_metadata: ResponseMetadata;\n type: string;\n id: string;\n example: boolean;\n tool_calls: any[];\n invalid_tool_calls: any[];\n usage_metadata: UsageMetadata;\n }\n\n export interface ResponseMetadata {\n token_usage: TokenUsage;\n model_name: string;\n system_fingerprint: string;\n finish_reason: string;\n logprobs: any | null;\n }\n\n export interface TokenUsage {\n completion_tokens: number;\n prompt_tokens: number;\n total_tokens: number;\n completion_time: number;\n prompt_time: number;\n queue_time: number;\n total_time: number;\n }\n\n export interface UsageMetadata {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n }\n\n export interface ExpertInferenceResponse {\n event_class: string;\n control_id: string;\n data: {\n label: string;\n score: number;\n };\n status: string;\n date_submitted: string;\n }\n\n export interface ThinkingsInferenceResponse {\n event_class: string;\n control_id: string;\n status: string;\n date_submitted: string;\n data: {\n content: AssistantResponseData;\n is_complete: boolean;\n is_partial: boolean;\n };\n }\n\n export interface GenuiSurfaceItem {\n controlId: string;\n surface: A2uiSurface;\n /** Message-count anchor: the surface renders after this many messages (chronological ordering). */\n afterCount: number;\n /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */\n submitted?: boolean;\n /** Set when the user declined the surface and typed a reply */\n dismissedWith?: string;\n }"],"mappings":";AAeO,IAAe,cAAf,MAA2B;AAAA,EAGhC,YAAY,UAAqB;AAFjC,SAAU,WAA6B;AAGrC,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,OAAO,WAAW,UAAgC;AAChD,WAAO;AAAA,EACT;AAGF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alquimia-ai/tools",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "author": "Alquimia AI",
5
5
  "description": "tools for Alquimia SDK",
6
6
  "private": false,
@@ -1,16 +0,0 @@
1
- import { S as SurfaceAction } from './types-DnfWUE9V.js';
2
-
3
- type UIActionKind = "agent-bound" | "local";
4
- interface UIAction {
5
- surfaceId: string;
6
- componentId: string;
7
- action: string;
8
- kind: UIActionKind;
9
- payload?: Record<string, unknown>;
10
- }
11
- /** Agent-bound actions (wantResponse) return their payload to the agent; others stay local. */
12
- declare function classifyAction(action: SurfaceAction): UIActionKind;
13
- /** Actions are semantic names, never URLs. Reject anything scheme- or protocol-relative. */
14
- declare function assertSafeActionName(name: string): void;
15
-
16
- export { type UIAction as U, type UIActionKind as a, assertSafeActionName as b, classifyAction as c };
@@ -1,16 +0,0 @@
1
- import { S as SurfaceAction } from './types-DnfWUE9V.mjs';
2
-
3
- type UIActionKind = "agent-bound" | "local";
4
- interface UIAction {
5
- surfaceId: string;
6
- componentId: string;
7
- action: string;
8
- kind: UIActionKind;
9
- payload?: Record<string, unknown>;
10
- }
11
- /** Agent-bound actions (wantResponse) return their payload to the agent; others stay local. */
12
- declare function classifyAction(action: SurfaceAction): UIActionKind;
13
- /** Actions are semantic names, never URLs. Reject anything scheme- or protocol-relative. */
14
- declare function assertSafeActionName(name: string): void;
15
-
16
- export { type UIAction as U, type UIActionKind as a, assertSafeActionName as b, classifyAction as c };