@alquimia-ai/tools 2.0.1 → 2.2.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.
Files changed (60) hide show
  1. package/dist/actions/index.d.mts +2 -7
  2. package/dist/actions/index.d.ts +2 -7
  3. package/dist/actions/index.js +10 -8
  4. package/dist/actions/index.js.map +1 -1
  5. package/dist/actions/index.mjs +10 -8
  6. package/dist/actions/index.mjs.map +1 -1
  7. package/dist/adapters/fetch.d.mts +2 -1
  8. package/dist/adapters/fetch.d.ts +2 -1
  9. package/dist/adapters/fetch.js +6 -4
  10. package/dist/adapters/fetch.js.map +1 -1
  11. package/dist/adapters/fetch.mjs +6 -4
  12. package/dist/adapters/fetch.mjs.map +1 -1
  13. package/dist/adapters/index.d.mts +1 -1
  14. package/dist/adapters/index.d.ts +1 -1
  15. package/dist/adapters/index.js.map +1 -1
  16. package/dist/adapters/next.d.mts +2 -1
  17. package/dist/adapters/next.d.ts +2 -1
  18. package/dist/adapters/next.js +7 -5
  19. package/dist/adapters/next.js.map +1 -1
  20. package/dist/adapters/next.mjs +7 -5
  21. package/dist/adapters/next.mjs.map +1 -1
  22. package/dist/hooks/index.d.mts +5 -3
  23. package/dist/hooks/index.d.ts +5 -3
  24. package/dist/hooks/index.js +266 -65
  25. package/dist/hooks/index.js.map +1 -1
  26. package/dist/hooks/index.mjs +248 -47
  27. package/dist/hooks/index.mjs.map +1 -1
  28. package/dist/next/index.d.mts +6 -9
  29. package/dist/next/index.d.ts +6 -9
  30. package/dist/next/index.js +69 -64
  31. package/dist/next/index.js.map +1 -1
  32. package/dist/next/index.mjs +69 -64
  33. package/dist/next/index.mjs.map +1 -1
  34. package/dist/proxy.d.mts +2 -2
  35. package/dist/proxy.d.ts +2 -2
  36. package/dist/proxy.js +32 -9
  37. package/dist/proxy.js.map +1 -1
  38. package/dist/proxy.mjs +32 -9
  39. package/dist/proxy.mjs.map +1 -1
  40. package/dist/sdk/index.d.mts +15 -7
  41. package/dist/sdk/index.d.ts +15 -7
  42. package/dist/sdk/index.js +45 -26
  43. package/dist/sdk/index.js.map +1 -1
  44. package/dist/sdk/index.mjs +45 -26
  45. package/dist/sdk/index.mjs.map +1 -1
  46. package/dist/session.action-DirvOWt0.d.mts +3 -0
  47. package/dist/session.action-DirvOWt0.d.ts +3 -0
  48. package/dist/types/index.d.mts +79 -18
  49. package/dist/types/index.d.ts +79 -18
  50. package/dist/types/index.js.map +1 -1
  51. package/dist/types/index.mjs.map +1 -1
  52. package/dist/types-CIqszY3g.d.mts +53 -0
  53. package/dist/types-CIqszY3g.d.ts +53 -0
  54. package/dist/worklog/index.d.mts +29 -0
  55. package/dist/worklog/index.d.ts +29 -0
  56. package/dist/worklog/index.js +218 -0
  57. package/dist/worklog/index.js.map +1 -0
  58. package/dist/worklog/index.mjs +195 -0
  59. package/dist/worklog/index.mjs.map +1 -0
  60. package/package.json +6 -1
@@ -24,10 +24,9 @@ interface AIMessageChunk {
24
24
  tooler?: ToolEvent[];
25
25
  error_code?: string;
26
26
  error_detail?: string;
27
- stream_id?: string;
27
+ taskid?: string;
28
28
  loading?: boolean;
29
29
  thinkings?: ThinkingsInferenceResponse[];
30
- evaluation_strategy?: string;
31
30
  }
32
31
  interface AIMessageChunkData {
33
32
  content: string;
@@ -76,13 +75,12 @@ interface AttachmentPayload {
76
75
  type AlquimiaMessage = Message & {
77
76
  error_code?: string;
78
77
  error_detail?: string;
79
- stream_id?: string;
78
+ taskid?: string;
80
79
  loading?: boolean;
81
80
  created_at?: string;
82
81
  additionalInfo?: string;
83
82
  tooler?: Tooler[];
84
83
  thinkings?: ThinkingsInferenceResponse[];
85
- evaluation_strategy?: string;
86
84
  attachments?: AttachmentPayload[];
87
85
  };
88
86
  interface ActionResponse<T = void> {
@@ -161,19 +159,21 @@ type TTSResult = {
161
159
  type: 'error';
162
160
  message: string;
163
161
  };
162
+ /** One SSE `data:` JSON frame (`event_class` at top level). */
164
163
  interface AlquimiaEventData {
165
- stream_id: string;
166
- response: AssistantInferenceResponse;
167
- experts: ExpertInferenceResponse[];
168
- thinkings: ThinkingsInferenceResponse[];
169
- tools_output: ToolEvent[];
170
- agents_output: any[];
171
- tools_pending_approval: any[];
172
- tools_pending_execution: any[];
173
- errors: any[];
174
- event_class: string;
175
- date_submitted: string;
176
- control_id: string;
164
+ taskid?: string;
165
+ event_class?: string;
166
+ control_id?: string;
167
+ date_submitted?: string;
168
+ status?: string | null;
169
+ data?: unknown;
170
+ experts?: ExpertInferenceResponse[];
171
+ thinkings?: ThinkingsInferenceResponse[];
172
+ tools_output?: ToolEvent[];
173
+ agents_output?: any[];
174
+ tools_pending_approval?: any[];
175
+ tools_pending_execution?: any[];
176
+ errors?: any[];
177
177
  }
178
178
  interface AssistantInferenceResponse {
179
179
  event_class: string;
@@ -181,8 +181,69 @@ interface AssistantInferenceResponse {
181
181
  data: string;
182
182
  status: string;
183
183
  date_submitted: string;
184
- stream_id?: string;
184
+ message?: string | null;
185
+ extras?: Record<string, unknown> | null;
186
+ extra_data?: ExtraDataContext | null;
187
+ channel?: unknown | null;
188
+ depth?: number;
189
+ taskid?: string;
190
+ }
191
+ /**
192
+ * Channel-scoped context returned alongside an inference response (was
193
+ * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel
194
+ * the inference was triggered from.
195
+ */
196
+ interface ExtraDataContext {
197
+ whatsapp_message_id?: string;
198
+ whatsapp_message_from?: string;
199
+ email_message_recipient?: string;
200
+ email_message_subject?: string;
201
+ email_message_id?: string;
202
+ email_message_body?: string;
203
+ slack_team_id?: string;
204
+ slack_user_id?: string;
205
+ slack_channel_id?: string;
206
+ slack_response_url?: string;
207
+ }
208
+ /**
209
+ * JSON body returned by `POST /event/infer/{assistantId}` (and channel
210
+ * variants). Keys match the runtime wire format (lowercase, no underscores).
211
+ * `taskid` is the id used for the SSE stream.
212
+ */
213
+ interface CommonAttributes {
214
+ taskid?: string | null;
215
+ parenttaskid?: string | null;
216
+ sessionid?: string | null;
217
+ userid?: string | null;
218
+ assistantid?: string | null;
219
+ agentspaceid?: string | null;
220
+ channelid?: string | null;
221
+ depth?: string;
222
+ attachments?: string[];
223
+ }
224
+ type InferInitResponse = CommonAttributes;
225
+ /**
226
+ * Native-tools evaluation strategy. Wraps the client-side tool schemas
227
+ * the SDK previously sent at the top level of the infer payload.
228
+ */
229
+ interface NativeToolsEvaluationStrategy {
230
+ evaluation_strategy_id: 'native';
231
+ tool_schemas?: unknown[];
232
+ max_steps?: number;
233
+ current_step?: number;
234
+ max_concurrent_tools?: number;
235
+ decorators?: unknown[];
236
+ tool_choice?: unknown;
237
+ structured_output?: unknown;
238
+ }
239
+ interface RawToolsEvaluationStrategy {
240
+ evaluation_strategy_id: 'raw';
241
+ tool_schemas?: unknown[];
242
+ }
243
+ interface OneShootEvaluationStrategy {
244
+ evaluation_strategy_id: 'one-shoot';
185
245
  }
246
+ type EvaluationStrategy = NativeToolsEvaluationStrategy | RawToolsEvaluationStrategy | OneShootEvaluationStrategy;
186
247
  interface AssistantResponseData {
187
248
  content: string;
188
249
  additional_kwargs: Record<string, any>;
@@ -237,4 +298,4 @@ interface ThinkingsInferenceResponse {
237
298
  };
238
299
  }
239
300
 
240
- export { type AIMessageChunk, type AIMessageChunkData, type ActionResponse, type AlquimiaEventData, type AlquimiaMessage, type ApiError, type ApmSpan, type AssistantInferenceResponse, type AssistantResponseData, type AttachmentPayload, type BaseAPIConfig, type ConversationsMap, type DocumentSearchResult, type ElevenLabsRequestSpecs, type ElevenLabsVoiceSettings, type ExpertInferenceResponse, type IToolSpec, type ITooler, type RatingData, type ResponseMetadata, type TTSResult, type ThinkingsInferenceResponse, type TokenUsage, type ToolEvent, ToolFactory, type ToolOutput, type ToolSummary, type Tooler, type UsageMetadata };
301
+ 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 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 };
@@ -24,10 +24,9 @@ interface AIMessageChunk {
24
24
  tooler?: ToolEvent[];
25
25
  error_code?: string;
26
26
  error_detail?: string;
27
- stream_id?: string;
27
+ taskid?: string;
28
28
  loading?: boolean;
29
29
  thinkings?: ThinkingsInferenceResponse[];
30
- evaluation_strategy?: string;
31
30
  }
32
31
  interface AIMessageChunkData {
33
32
  content: string;
@@ -76,13 +75,12 @@ interface AttachmentPayload {
76
75
  type AlquimiaMessage = Message & {
77
76
  error_code?: string;
78
77
  error_detail?: string;
79
- stream_id?: string;
78
+ taskid?: string;
80
79
  loading?: boolean;
81
80
  created_at?: string;
82
81
  additionalInfo?: string;
83
82
  tooler?: Tooler[];
84
83
  thinkings?: ThinkingsInferenceResponse[];
85
- evaluation_strategy?: string;
86
84
  attachments?: AttachmentPayload[];
87
85
  };
88
86
  interface ActionResponse<T = void> {
@@ -161,19 +159,21 @@ type TTSResult = {
161
159
  type: 'error';
162
160
  message: string;
163
161
  };
162
+ /** One SSE `data:` JSON frame (`event_class` at top level). */
164
163
  interface AlquimiaEventData {
165
- stream_id: string;
166
- response: AssistantInferenceResponse;
167
- experts: ExpertInferenceResponse[];
168
- thinkings: ThinkingsInferenceResponse[];
169
- tools_output: ToolEvent[];
170
- agents_output: any[];
171
- tools_pending_approval: any[];
172
- tools_pending_execution: any[];
173
- errors: any[];
174
- event_class: string;
175
- date_submitted: string;
176
- control_id: string;
164
+ taskid?: string;
165
+ event_class?: string;
166
+ control_id?: string;
167
+ date_submitted?: string;
168
+ status?: string | null;
169
+ data?: unknown;
170
+ experts?: ExpertInferenceResponse[];
171
+ thinkings?: ThinkingsInferenceResponse[];
172
+ tools_output?: ToolEvent[];
173
+ agents_output?: any[];
174
+ tools_pending_approval?: any[];
175
+ tools_pending_execution?: any[];
176
+ errors?: any[];
177
177
  }
178
178
  interface AssistantInferenceResponse {
179
179
  event_class: string;
@@ -181,8 +181,69 @@ interface AssistantInferenceResponse {
181
181
  data: string;
182
182
  status: string;
183
183
  date_submitted: string;
184
- stream_id?: string;
184
+ message?: string | null;
185
+ extras?: Record<string, unknown> | null;
186
+ extra_data?: ExtraDataContext | null;
187
+ channel?: unknown | null;
188
+ depth?: number;
189
+ taskid?: string;
190
+ }
191
+ /**
192
+ * Channel-scoped context returned alongside an inference response (was
193
+ * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel
194
+ * the inference was triggered from.
195
+ */
196
+ interface ExtraDataContext {
197
+ whatsapp_message_id?: string;
198
+ whatsapp_message_from?: string;
199
+ email_message_recipient?: string;
200
+ email_message_subject?: string;
201
+ email_message_id?: string;
202
+ email_message_body?: string;
203
+ slack_team_id?: string;
204
+ slack_user_id?: string;
205
+ slack_channel_id?: string;
206
+ slack_response_url?: string;
207
+ }
208
+ /**
209
+ * JSON body returned by `POST /event/infer/{assistantId}` (and channel
210
+ * variants). Keys match the runtime wire format (lowercase, no underscores).
211
+ * `taskid` is the id used for the SSE stream.
212
+ */
213
+ interface CommonAttributes {
214
+ taskid?: string | null;
215
+ parenttaskid?: string | null;
216
+ sessionid?: string | null;
217
+ userid?: string | null;
218
+ assistantid?: string | null;
219
+ agentspaceid?: string | null;
220
+ channelid?: string | null;
221
+ depth?: string;
222
+ attachments?: string[];
223
+ }
224
+ type InferInitResponse = CommonAttributes;
225
+ /**
226
+ * Native-tools evaluation strategy. Wraps the client-side tool schemas
227
+ * the SDK previously sent at the top level of the infer payload.
228
+ */
229
+ interface NativeToolsEvaluationStrategy {
230
+ evaluation_strategy_id: 'native';
231
+ tool_schemas?: unknown[];
232
+ max_steps?: number;
233
+ current_step?: number;
234
+ max_concurrent_tools?: number;
235
+ decorators?: unknown[];
236
+ tool_choice?: unknown;
237
+ structured_output?: unknown;
238
+ }
239
+ interface RawToolsEvaluationStrategy {
240
+ evaluation_strategy_id: 'raw';
241
+ tool_schemas?: unknown[];
242
+ }
243
+ interface OneShootEvaluationStrategy {
244
+ evaluation_strategy_id: 'one-shoot';
185
245
  }
246
+ type EvaluationStrategy = NativeToolsEvaluationStrategy | RawToolsEvaluationStrategy | OneShootEvaluationStrategy;
186
247
  interface AssistantResponseData {
187
248
  content: string;
188
249
  additional_kwargs: Record<string, any>;
@@ -237,4 +298,4 @@ interface ThinkingsInferenceResponse {
237
298
  };
238
299
  }
239
300
 
240
- export { type AIMessageChunk, type AIMessageChunkData, type ActionResponse, type AlquimiaEventData, type AlquimiaMessage, type ApiError, type ApmSpan, type AssistantInferenceResponse, type AssistantResponseData, type AttachmentPayload, type BaseAPIConfig, type ConversationsMap, type DocumentSearchResult, type ElevenLabsRequestSpecs, type ElevenLabsVoiceSettings, type ExpertInferenceResponse, type IToolSpec, type ITooler, type RatingData, type ResponseMetadata, type TTSResult, type ThinkingsInferenceResponse, type TokenUsage, type ToolEvent, ToolFactory, type ToolOutput, type ToolSummary, type Tooler, type UsageMetadata };
301
+ 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 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\";\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 stream_id?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n evaluation_strategy?: string;\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 stream_id?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n evaluation_strategy?: string;\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 export interface AlquimiaEventData {\n stream_id: string;\n response: AssistantInferenceResponse;\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 event_class: string;\n date_submitted: string;\n control_id: string;\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 stream_id?: string;\n }\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 }"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,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\";\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 }"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,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\";\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 stream_id?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n evaluation_strategy?: string;\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 stream_id?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n evaluation_strategy?: string;\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 export interface AlquimiaEventData {\n stream_id: string;\n response: AssistantInferenceResponse;\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 event_class: string;\n date_submitted: string;\n control_id: string;\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 stream_id?: string;\n }\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 }"],"mappings":";AAcO,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\";\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 }"],"mappings":";AAcO,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":[]}
@@ -0,0 +1,53 @@
1
+ /** One granular Runtime worklog record (a `bus_mode` SSE frame or a `/worklog/{task_id}/events` item). */
2
+ interface WorklogRecord {
3
+ event_class: string;
4
+ control_id: string | null;
5
+ data: unknown;
6
+ status: "success" | "error" | null;
7
+ date_submitted: string;
8
+ }
9
+ /** Semantic bucket a node belongs to. */
10
+ type NodeKind = "safeguard" | "reasoning" | "tool" | "a2a" | "memory" | "answer" | "unknown";
11
+ /** Lifecycle state of a single node. */
12
+ type NodeStatus = "pending" | "running" | "completed" | "failed" | "skipped";
13
+ /** Overall run status. */
14
+ type RunStatus = "idle" | "running" | "success" | "error";
15
+ /** A single step in the execution chain (command + its response merged by control_id). */
16
+ interface WorklogNode {
17
+ id: string;
18
+ kind: NodeKind;
19
+ eventClass: string;
20
+ status: NodeStatus;
21
+ title: string;
22
+ startedAt?: string;
23
+ endedAt?: string;
24
+ depth: number;
25
+ parentId?: string;
26
+ children: WorklogNode[];
27
+ command?: unknown;
28
+ response?: unknown;
29
+ error?: string;
30
+ raw: WorklogRecord[];
31
+ }
32
+ /** Normalized execution model produced by the reducer. */
33
+ interface WorklogState {
34
+ taskId: string | null;
35
+ status: RunStatus;
36
+ answer: string | null;
37
+ nodes: WorklogNode[];
38
+ index: Record<string, number>;
39
+ raw: WorklogRecord[];
40
+ }
41
+ /** How a record acts on the model. */
42
+ type EventRole = "open" | "close" | "run-open" | "run-close" | "ignore";
43
+ /** Registry descriptor for one event_class. */
44
+ interface EventInterpreter {
45
+ kind: NodeKind;
46
+ role: EventRole;
47
+ title: (record: WorklogRecord) => string;
48
+ /** If true, an opened node starts in "pending" (awaiting external input) rather than "running". */
49
+ pending?: boolean;
50
+ }
51
+ declare function initialWorklogState(taskId?: string | null): WorklogState;
52
+
53
+ export { type EventInterpreter as E, type NodeKind as N, type RunStatus as R, type WorklogState as W, type WorklogRecord as a, type NodeStatus as b, type WorklogNode as c, type EventRole as d, initialWorklogState as i };
@@ -0,0 +1,53 @@
1
+ /** One granular Runtime worklog record (a `bus_mode` SSE frame or a `/worklog/{task_id}/events` item). */
2
+ interface WorklogRecord {
3
+ event_class: string;
4
+ control_id: string | null;
5
+ data: unknown;
6
+ status: "success" | "error" | null;
7
+ date_submitted: string;
8
+ }
9
+ /** Semantic bucket a node belongs to. */
10
+ type NodeKind = "safeguard" | "reasoning" | "tool" | "a2a" | "memory" | "answer" | "unknown";
11
+ /** Lifecycle state of a single node. */
12
+ type NodeStatus = "pending" | "running" | "completed" | "failed" | "skipped";
13
+ /** Overall run status. */
14
+ type RunStatus = "idle" | "running" | "success" | "error";
15
+ /** A single step in the execution chain (command + its response merged by control_id). */
16
+ interface WorklogNode {
17
+ id: string;
18
+ kind: NodeKind;
19
+ eventClass: string;
20
+ status: NodeStatus;
21
+ title: string;
22
+ startedAt?: string;
23
+ endedAt?: string;
24
+ depth: number;
25
+ parentId?: string;
26
+ children: WorklogNode[];
27
+ command?: unknown;
28
+ response?: unknown;
29
+ error?: string;
30
+ raw: WorklogRecord[];
31
+ }
32
+ /** Normalized execution model produced by the reducer. */
33
+ interface WorklogState {
34
+ taskId: string | null;
35
+ status: RunStatus;
36
+ answer: string | null;
37
+ nodes: WorklogNode[];
38
+ index: Record<string, number>;
39
+ raw: WorklogRecord[];
40
+ }
41
+ /** How a record acts on the model. */
42
+ type EventRole = "open" | "close" | "run-open" | "run-close" | "ignore";
43
+ /** Registry descriptor for one event_class. */
44
+ interface EventInterpreter {
45
+ kind: NodeKind;
46
+ role: EventRole;
47
+ title: (record: WorklogRecord) => string;
48
+ /** If true, an opened node starts in "pending" (awaiting external input) rather than "running". */
49
+ pending?: boolean;
50
+ }
51
+ declare function initialWorklogState(taskId?: string | null): WorklogState;
52
+
53
+ export { type EventInterpreter as E, type NodeKind as N, type RunStatus as R, type WorklogState as W, type WorklogRecord as a, type NodeStatus as b, type WorklogNode as c, type EventRole as d, initialWorklogState as i };
@@ -0,0 +1,29 @@
1
+ import { E as EventInterpreter, W as WorklogState, a as WorklogRecord } from '../types-CIqszY3g.mjs';
2
+ export { d as EventRole, N as NodeKind, b as NodeStatus, R as RunStatus, c as WorklogNode, i as initialWorklogState } from '../types-CIqszY3g.mjs';
3
+
4
+ declare const EVENT_REGISTRY: Record<string, EventInterpreter>;
5
+ declare function resolveInterpreter(eventClass: string): EventInterpreter;
6
+
7
+ declare function reduceWorklog(state: WorklogState, record: WorklogRecord): WorklogState;
8
+ declare function foldWorklog(records: WorklogRecord[], taskId?: string | null): WorklogState;
9
+
10
+ /** Live worklog accumulator. Feed it `bus_mode` records via `ingest`; use `foldWorklog` for history. */
11
+ declare function useWorklog(taskId?: string | null): {
12
+ worklog: WorklogState;
13
+ ingest: (record: WorklogRecord) => void;
14
+ ingestMany: (records: WorklogRecord[]) => void;
15
+ reset: (id?: string | null) => void;
16
+ };
17
+
18
+ /** Loosely-typed shape of a parsed SSE `data:` frame from the granular Runtime stream. */
19
+ interface RawFrame {
20
+ event_class?: string;
21
+ control_id?: string | null;
22
+ data?: unknown;
23
+ status?: string | null;
24
+ date_submitted?: string;
25
+ }
26
+ /** Normalize a parsed SSE frame into a WorklogRecord (defaults missing fields; never throws). */
27
+ declare function frameToRecord(frame: RawFrame): WorklogRecord;
28
+
29
+ export { EVENT_REGISTRY, EventInterpreter, type RawFrame, WorklogRecord, WorklogState, foldWorklog, frameToRecord, reduceWorklog, resolveInterpreter, useWorklog };
@@ -0,0 +1,29 @@
1
+ import { E as EventInterpreter, W as WorklogState, a as WorklogRecord } from '../types-CIqszY3g.js';
2
+ export { d as EventRole, N as NodeKind, b as NodeStatus, R as RunStatus, c as WorklogNode, i as initialWorklogState } from '../types-CIqszY3g.js';
3
+
4
+ declare const EVENT_REGISTRY: Record<string, EventInterpreter>;
5
+ declare function resolveInterpreter(eventClass: string): EventInterpreter;
6
+
7
+ declare function reduceWorklog(state: WorklogState, record: WorklogRecord): WorklogState;
8
+ declare function foldWorklog(records: WorklogRecord[], taskId?: string | null): WorklogState;
9
+
10
+ /** Live worklog accumulator. Feed it `bus_mode` records via `ingest`; use `foldWorklog` for history. */
11
+ declare function useWorklog(taskId?: string | null): {
12
+ worklog: WorklogState;
13
+ ingest: (record: WorklogRecord) => void;
14
+ ingestMany: (records: WorklogRecord[]) => void;
15
+ reset: (id?: string | null) => void;
16
+ };
17
+
18
+ /** Loosely-typed shape of a parsed SSE `data:` frame from the granular Runtime stream. */
19
+ interface RawFrame {
20
+ event_class?: string;
21
+ control_id?: string | null;
22
+ data?: unknown;
23
+ status?: string | null;
24
+ date_submitted?: string;
25
+ }
26
+ /** Normalize a parsed SSE frame into a WorklogRecord (defaults missing fields; never throws). */
27
+ declare function frameToRecord(frame: RawFrame): WorklogRecord;
28
+
29
+ export { EVENT_REGISTRY, EventInterpreter, type RawFrame, WorklogRecord, WorklogState, foldWorklog, frameToRecord, reduceWorklog, resolveInterpreter, useWorklog };