@alquimia-ai/tools 2.3.0 → 2.5.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.
- package/README.md +6 -0
- package/dist/actions/index.d.mts +2 -2
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/index.js +1 -1
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/index.mjs +1 -1
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions-BjDPJdyA.d.mts +57 -0
- package/dist/actions-CP1d4Ye1.d.ts +57 -0
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/genui/index.d.mts +3 -3
- package/dist/genui/index.d.ts +3 -3
- package/dist/genui/index.js +34 -2
- package/dist/genui/index.js.map +1 -1
- package/dist/genui/index.mjs +34 -2
- package/dist/genui/index.mjs.map +1 -1
- package/dist/hooks/index.d.mts +11 -10
- package/dist/hooks/index.d.ts +11 -10
- package/dist/hooks/index.js +81 -11
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +81 -11
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/next/index.js +19 -5
- package/dist/next/index.js.map +1 -1
- package/dist/next/index.mjs +19 -5
- package/dist/next/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +4 -4
- package/dist/providers/index.d.ts +4 -4
- package/dist/providers/index.js +111 -110
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +111 -110
- package/dist/providers/index.mjs.map +1 -1
- package/dist/{providers-BJTXCtI3.d.ts → providers-DiR9cgyo.d.mts} +8 -8
- package/dist/{providers-0Gi78uNQ.d.mts → providers-b5_yMyMo.d.ts} +8 -8
- package/dist/proxy.d.mts +4 -4
- package/dist/proxy.d.ts +4 -4
- package/dist/proxy.js +19 -5
- package/dist/proxy.js.map +1 -1
- package/dist/proxy.mjs +19 -5
- package/dist/proxy.mjs.map +1 -1
- package/dist/sdk/index.d.mts +4 -3
- package/dist/sdk/index.d.ts +4 -3
- package/dist/sdk/index.js +8 -2
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/index.mjs +8 -2
- package/dist/sdk/index.mjs.map +1 -1
- package/dist/services/index.d.mts +3 -3
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs.map +1 -1
- package/dist/type-DqX3-9QS.d.mts +312 -0
- package/dist/type-xksRnBUW.d.ts +312 -0
- package/dist/types/index.d.mts +78 -302
- package/dist/types/index.d.ts +78 -302
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/types-C-6fgK1_.d.mts +111 -0
- package/dist/types-C-6fgK1_.d.ts +111 -0
- package/dist/{types-DnfWUE9V.d.mts → types-CMVbyEv8.d.mts} +3 -2
- package/dist/{types-DnfWUE9V.d.ts → types-CMVbyEv8.d.ts} +3 -2
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/index.mjs.map +1 -1
- package/dist/worklog/index.d.mts +5 -2
- package/dist/worklog/index.d.ts +5 -2
- package/dist/worklog/index.js +3 -1
- package/dist/worklog/index.js.map +1 -1
- package/dist/worklog/index.mjs +3 -1
- package/dist/worklog/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/actions-BebMyGqF.d.ts +0 -16
- package/dist/actions-Ca3ro-hX.d.mts +0 -16
- package/dist/types-Dvu9y4WM.d.mts +0 -53
- package/dist/types-Dvu9y4WM.d.ts +0 -53
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { Span } from '@elastic/apm-rum';
|
|
2
|
+
import { Message } from 'ai';
|
|
3
|
+
import { A as A2uiSurface } from './types-CMVbyEv8.js';
|
|
4
|
+
|
|
5
|
+
interface ITooler {
|
|
6
|
+
tooler: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
parameters: Record<string, any>;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
interface IToolSpec {
|
|
12
|
+
name: string;
|
|
13
|
+
parameters: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
declare abstract class ToolFactory {
|
|
16
|
+
protected toolSpec: IToolSpec | null;
|
|
17
|
+
constructor(toolSpec: IToolSpec);
|
|
18
|
+
static createTool(toolSpec: IToolSpec): IToolSpec;
|
|
19
|
+
abstract execute(): Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
interface AIMessageChunk {
|
|
22
|
+
type: string;
|
|
23
|
+
data?: AIMessageChunkData;
|
|
24
|
+
answer?: string;
|
|
25
|
+
tooler?: ToolEvent[];
|
|
26
|
+
error_code?: string;
|
|
27
|
+
error_detail?: string;
|
|
28
|
+
taskid?: string;
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
31
|
+
}
|
|
32
|
+
interface AIMessageChunkData {
|
|
33
|
+
content: string;
|
|
34
|
+
additional_kwargs?: Record<string, unknown>;
|
|
35
|
+
response_metadata?: Record<string, unknown>;
|
|
36
|
+
type: string;
|
|
37
|
+
name?: string | null;
|
|
38
|
+
id?: string | null;
|
|
39
|
+
example?: boolean;
|
|
40
|
+
tool_calls?: ToolCall[];
|
|
41
|
+
invalid_tool_calls?: InvalidToolCall[];
|
|
42
|
+
usage_metadata?: any;
|
|
43
|
+
tool_call_chunks?: unknown[];
|
|
44
|
+
error_code?: string;
|
|
45
|
+
error_detail?: string;
|
|
46
|
+
}
|
|
47
|
+
type ToolCall = {
|
|
48
|
+
name: string;
|
|
49
|
+
args: Record<string, any>;
|
|
50
|
+
id?: string | null;
|
|
51
|
+
};
|
|
52
|
+
type InvalidToolCall = {
|
|
53
|
+
name: string | null;
|
|
54
|
+
args: string | null;
|
|
55
|
+
id: string | null;
|
|
56
|
+
error: string | null;
|
|
57
|
+
};
|
|
58
|
+
interface BaseAPIConfig {
|
|
59
|
+
baseUrl: string;
|
|
60
|
+
route: string;
|
|
61
|
+
token?: string;
|
|
62
|
+
headers?: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
interface RatingData {
|
|
65
|
+
assistantId: string;
|
|
66
|
+
sessionId: string;
|
|
67
|
+
topicId: number;
|
|
68
|
+
score?: number;
|
|
69
|
+
description?: string;
|
|
70
|
+
}
|
|
71
|
+
interface AttachmentPayload {
|
|
72
|
+
filename: string;
|
|
73
|
+
content_type: string;
|
|
74
|
+
content_size: number;
|
|
75
|
+
}
|
|
76
|
+
type AlquimiaMessage = Message & {
|
|
77
|
+
error_code?: string;
|
|
78
|
+
error_detail?: string;
|
|
79
|
+
taskid?: string;
|
|
80
|
+
loading?: boolean;
|
|
81
|
+
created_at?: string;
|
|
82
|
+
additionalInfo?: string;
|
|
83
|
+
tooler?: Tooler[];
|
|
84
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
85
|
+
attachments?: AttachmentPayload[];
|
|
86
|
+
};
|
|
87
|
+
interface ActionResponse<T = void> {
|
|
88
|
+
success: boolean;
|
|
89
|
+
data?: T;
|
|
90
|
+
error?: {
|
|
91
|
+
message: string;
|
|
92
|
+
code?: string;
|
|
93
|
+
details?: any;
|
|
94
|
+
name?: string;
|
|
95
|
+
cause?: string;
|
|
96
|
+
status?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
type ApmSpan = Span & {
|
|
100
|
+
id?: string;
|
|
101
|
+
traceId?: string;
|
|
102
|
+
} | undefined;
|
|
103
|
+
type ApiError = Error & {
|
|
104
|
+
message: string;
|
|
105
|
+
name: string;
|
|
106
|
+
cause: string;
|
|
107
|
+
code?: string | number;
|
|
108
|
+
status?: string | number;
|
|
109
|
+
};
|
|
110
|
+
type Tooler = {
|
|
111
|
+
control_id: string;
|
|
112
|
+
tool_summary?: ToolSummary;
|
|
113
|
+
tool_output?: ToolOutput;
|
|
114
|
+
};
|
|
115
|
+
type ToolSummary = {
|
|
116
|
+
name: string;
|
|
117
|
+
parameters: Record<string, any>;
|
|
118
|
+
};
|
|
119
|
+
type ToolOutput = {
|
|
120
|
+
result: any;
|
|
121
|
+
status: string;
|
|
122
|
+
};
|
|
123
|
+
type ToolEvent = {
|
|
124
|
+
event_class: string;
|
|
125
|
+
control_id: string;
|
|
126
|
+
data: any;
|
|
127
|
+
status: string;
|
|
128
|
+
};
|
|
129
|
+
interface ConversationsMap {
|
|
130
|
+
[topicId: string]: string;
|
|
131
|
+
}
|
|
132
|
+
interface DocumentSearchResult {
|
|
133
|
+
pageContent: string;
|
|
134
|
+
metadata: {
|
|
135
|
+
source: string;
|
|
136
|
+
_id: string;
|
|
137
|
+
_collection_name: string;
|
|
138
|
+
};
|
|
139
|
+
score: number;
|
|
140
|
+
}
|
|
141
|
+
type ElevenLabsVoiceSettings = {
|
|
142
|
+
stability: number;
|
|
143
|
+
similarity_boost: number;
|
|
144
|
+
style: number;
|
|
145
|
+
};
|
|
146
|
+
type ElevenLabsRequestSpecs = {
|
|
147
|
+
optimize_streaming_latency: string;
|
|
148
|
+
output_format: string;
|
|
149
|
+
model_id: string;
|
|
150
|
+
language: string;
|
|
151
|
+
voice_settings: ElevenLabsVoiceSettings;
|
|
152
|
+
};
|
|
153
|
+
type TTSResult = {
|
|
154
|
+
type: 'blob';
|
|
155
|
+
data: Blob;
|
|
156
|
+
} | {
|
|
157
|
+
type: 'url';
|
|
158
|
+
data: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: 'error';
|
|
161
|
+
message: string;
|
|
162
|
+
};
|
|
163
|
+
/** One SSE `data:` JSON frame (`event_class` at top level). */
|
|
164
|
+
interface AlquimiaEventData {
|
|
165
|
+
taskid?: string;
|
|
166
|
+
event_class?: string;
|
|
167
|
+
control_id?: string;
|
|
168
|
+
date_submitted?: string;
|
|
169
|
+
status?: string | null;
|
|
170
|
+
data?: unknown;
|
|
171
|
+
experts?: ExpertInferenceResponse[];
|
|
172
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
173
|
+
tools_output?: ToolEvent[];
|
|
174
|
+
agents_output?: any[];
|
|
175
|
+
tools_pending_approval?: any[];
|
|
176
|
+
tools_pending_execution?: any[];
|
|
177
|
+
errors?: any[];
|
|
178
|
+
}
|
|
179
|
+
interface AssistantInferenceResponse {
|
|
180
|
+
event_class: string;
|
|
181
|
+
control_id: string;
|
|
182
|
+
data: string;
|
|
183
|
+
status: string;
|
|
184
|
+
date_submitted: string;
|
|
185
|
+
message?: string | null;
|
|
186
|
+
extras?: Record<string, unknown> | null;
|
|
187
|
+
extra_data?: ExtraDataContext | null;
|
|
188
|
+
channel?: unknown | null;
|
|
189
|
+
depth?: number;
|
|
190
|
+
taskid?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Channel-scoped context returned alongside an inference response (was
|
|
194
|
+
* `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel
|
|
195
|
+
* the inference was triggered from.
|
|
196
|
+
*/
|
|
197
|
+
interface ExtraDataContext {
|
|
198
|
+
whatsapp_message_id?: string;
|
|
199
|
+
whatsapp_message_from?: string;
|
|
200
|
+
email_message_recipient?: string;
|
|
201
|
+
email_message_subject?: string;
|
|
202
|
+
email_message_id?: string;
|
|
203
|
+
email_message_body?: string;
|
|
204
|
+
slack_team_id?: string;
|
|
205
|
+
slack_user_id?: string;
|
|
206
|
+
slack_channel_id?: string;
|
|
207
|
+
slack_response_url?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* JSON body returned by `POST /event/infer/{assistantId}` (and channel
|
|
211
|
+
* variants). Keys match the runtime wire format (lowercase, no underscores).
|
|
212
|
+
* `taskid` is the id used for the SSE stream.
|
|
213
|
+
*/
|
|
214
|
+
interface CommonAttributes {
|
|
215
|
+
taskid?: string | null;
|
|
216
|
+
parenttaskid?: string | null;
|
|
217
|
+
sessionid?: string | null;
|
|
218
|
+
userid?: string | null;
|
|
219
|
+
assistantid?: string | null;
|
|
220
|
+
agentspaceid?: string | null;
|
|
221
|
+
channelid?: string | null;
|
|
222
|
+
depth?: string;
|
|
223
|
+
attachments?: string[];
|
|
224
|
+
}
|
|
225
|
+
type InferInitResponse = CommonAttributes;
|
|
226
|
+
/**
|
|
227
|
+
* Native-tools evaluation strategy. Wraps the client-side tool schemas
|
|
228
|
+
* the SDK previously sent at the top level of the infer payload.
|
|
229
|
+
*/
|
|
230
|
+
interface NativeToolsEvaluationStrategy {
|
|
231
|
+
evaluation_strategy_id: 'native';
|
|
232
|
+
tool_schemas?: unknown[];
|
|
233
|
+
max_steps?: number;
|
|
234
|
+
current_step?: number;
|
|
235
|
+
max_concurrent_tools?: number;
|
|
236
|
+
decorators?: unknown[];
|
|
237
|
+
tool_choice?: unknown;
|
|
238
|
+
structured_output?: unknown;
|
|
239
|
+
}
|
|
240
|
+
interface RawToolsEvaluationStrategy {
|
|
241
|
+
evaluation_strategy_id: 'raw';
|
|
242
|
+
tool_schemas?: unknown[];
|
|
243
|
+
}
|
|
244
|
+
interface OneShootEvaluationStrategy {
|
|
245
|
+
evaluation_strategy_id: 'one-shoot';
|
|
246
|
+
}
|
|
247
|
+
type EvaluationStrategy = NativeToolsEvaluationStrategy | RawToolsEvaluationStrategy | OneShootEvaluationStrategy;
|
|
248
|
+
interface AssistantResponseData {
|
|
249
|
+
content: string;
|
|
250
|
+
additional_kwargs: Record<string, any>;
|
|
251
|
+
response_metadata: ResponseMetadata;
|
|
252
|
+
type: string;
|
|
253
|
+
id: string;
|
|
254
|
+
example: boolean;
|
|
255
|
+
tool_calls: any[];
|
|
256
|
+
invalid_tool_calls: any[];
|
|
257
|
+
usage_metadata: UsageMetadata;
|
|
258
|
+
}
|
|
259
|
+
interface ResponseMetadata {
|
|
260
|
+
token_usage: TokenUsage;
|
|
261
|
+
model_name: string;
|
|
262
|
+
system_fingerprint: string;
|
|
263
|
+
finish_reason: string;
|
|
264
|
+
logprobs: any | null;
|
|
265
|
+
}
|
|
266
|
+
interface TokenUsage {
|
|
267
|
+
completion_tokens: number;
|
|
268
|
+
prompt_tokens: number;
|
|
269
|
+
total_tokens: number;
|
|
270
|
+
completion_time: number;
|
|
271
|
+
prompt_time: number;
|
|
272
|
+
queue_time: number;
|
|
273
|
+
total_time: number;
|
|
274
|
+
}
|
|
275
|
+
interface UsageMetadata {
|
|
276
|
+
input_tokens: number;
|
|
277
|
+
output_tokens: number;
|
|
278
|
+
total_tokens: number;
|
|
279
|
+
}
|
|
280
|
+
interface ExpertInferenceResponse {
|
|
281
|
+
event_class: string;
|
|
282
|
+
control_id: string;
|
|
283
|
+
data: {
|
|
284
|
+
label: string;
|
|
285
|
+
score: number;
|
|
286
|
+
};
|
|
287
|
+
status: string;
|
|
288
|
+
date_submitted: string;
|
|
289
|
+
}
|
|
290
|
+
interface ThinkingsInferenceResponse {
|
|
291
|
+
event_class: string;
|
|
292
|
+
control_id: string;
|
|
293
|
+
status: string;
|
|
294
|
+
date_submitted: string;
|
|
295
|
+
data: {
|
|
296
|
+
content: AssistantResponseData;
|
|
297
|
+
is_complete: boolean;
|
|
298
|
+
is_partial: boolean;
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
interface GenuiSurfaceItem {
|
|
302
|
+
controlId: string;
|
|
303
|
+
surface: A2uiSurface;
|
|
304
|
+
/** Message-count anchor: the surface renders after this many messages (chronological ordering). */
|
|
305
|
+
afterCount: number;
|
|
306
|
+
/** True once the user has submitted an interactive surface (disables it + shows a submitted state). */
|
|
307
|
+
submitted?: boolean;
|
|
308
|
+
/** Set when the user declined the surface and typed a reply */
|
|
309
|
+
dismissedWith?: string;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export { type ApmSpan as A, type BaseAPIConfig as B, type CommonAttributes as C, type DocumentSearchResult as D, type ElevenLabsRequestSpecs as E, type GenuiSurfaceItem as G, type IToolSpec as I, type NativeToolsEvaluationStrategy as N, type OneShootEvaluationStrategy as O, type RatingData as R, type TTSResult as T, type UsageMetadata as U, type AIMessageChunk as a, type AIMessageChunkData as b, type ActionResponse as c, type AlquimiaEventData as d, type AlquimiaMessage as e, type ApiError as f, type AssistantInferenceResponse as g, type AssistantResponseData as h, type AttachmentPayload as i, type ConversationsMap as j, type ElevenLabsVoiceSettings as k, type EvaluationStrategy as l, type ExpertInferenceResponse as m, type ExtraDataContext as n, type ITooler as o, type InferInitResponse as p, type RawToolsEvaluationStrategy as q, type ResponseMetadata as r, type ThinkingsInferenceResponse as s, type TokenUsage as t, type ToolEvent as u, ToolFactory as v, type ToolOutput as w, type ToolSummary as x, type Tooler as y };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,310 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
export { a as AIMessageChunk, b as AIMessageChunkData, c as ActionResponse, d as AlquimiaEventData, e as AlquimiaMessage, f as ApiError, A as ApmSpan, g as AssistantInferenceResponse, h as AssistantResponseData, i as AttachmentPayload, B as BaseAPIConfig, C as CommonAttributes, j as ConversationsMap, D as DocumentSearchResult, E as ElevenLabsRequestSpecs, k as ElevenLabsVoiceSettings, l as EvaluationStrategy, m as ExpertInferenceResponse, n as ExtraDataContext, G as GenuiSurfaceItem, I as IToolSpec, o as ITooler, p as InferInitResponse, N as NativeToolsEvaluationStrategy, O as OneShootEvaluationStrategy, R as RatingData, q as RawToolsEvaluationStrategy, r as ResponseMetadata, T as TTSResult, s as ThinkingsInferenceResponse, t as TokenUsage, u as ToolEvent, v as ToolFactory, w as ToolOutput, x as ToolSummary, y as Tooler, U as UsageMetadata } from '../type-DqX3-9QS.mjs';
|
|
2
|
+
import { T as ToolExecutionResponse } from '../types-CMVbyEv8.mjs';
|
|
3
|
+
import { W as WorklogRecord } from '../types-C-6fgK1_.mjs';
|
|
4
|
+
import '@elastic/apm-rum';
|
|
5
|
+
import 'ai';
|
|
4
6
|
|
|
5
|
-
interface ITooler {
|
|
6
|
-
tooler: Array<{
|
|
7
|
-
name: string;
|
|
8
|
-
parameters: Record<string, any>;
|
|
9
|
-
}>;
|
|
10
|
-
}
|
|
11
|
-
interface IToolSpec {
|
|
12
|
-
name: string;
|
|
13
|
-
parameters: Record<string, any>;
|
|
14
|
-
}
|
|
15
|
-
declare abstract class ToolFactory {
|
|
16
|
-
protected toolSpec: IToolSpec | null;
|
|
17
|
-
constructor(toolSpec: IToolSpec);
|
|
18
|
-
static createTool(toolSpec: IToolSpec): IToolSpec;
|
|
19
|
-
abstract execute(): Promise<any>;
|
|
20
|
-
}
|
|
21
|
-
interface AIMessageChunk {
|
|
22
|
-
type: string;
|
|
23
|
-
data?: AIMessageChunkData;
|
|
24
|
-
answer?: string;
|
|
25
|
-
tooler?: ToolEvent[];
|
|
26
|
-
error_code?: string;
|
|
27
|
-
error_detail?: string;
|
|
28
|
-
taskid?: string;
|
|
29
|
-
loading?: boolean;
|
|
30
|
-
thinkings?: ThinkingsInferenceResponse[];
|
|
31
|
-
}
|
|
32
|
-
interface AIMessageChunkData {
|
|
33
|
-
content: string;
|
|
34
|
-
additional_kwargs?: Record<string, unknown>;
|
|
35
|
-
response_metadata?: Record<string, unknown>;
|
|
36
|
-
type: string;
|
|
37
|
-
name?: string | null;
|
|
38
|
-
id?: string | null;
|
|
39
|
-
example?: boolean;
|
|
40
|
-
tool_calls?: ToolCall[];
|
|
41
|
-
invalid_tool_calls?: InvalidToolCall[];
|
|
42
|
-
usage_metadata?: any;
|
|
43
|
-
tool_call_chunks?: unknown[];
|
|
44
|
-
error_code?: string;
|
|
45
|
-
error_detail?: string;
|
|
46
|
-
}
|
|
47
|
-
type ToolCall = {
|
|
48
|
-
name: string;
|
|
49
|
-
args: Record<string, any>;
|
|
50
|
-
id?: string | null;
|
|
51
|
-
};
|
|
52
|
-
type InvalidToolCall = {
|
|
53
|
-
name: string | null;
|
|
54
|
-
args: string | null;
|
|
55
|
-
id: string | null;
|
|
56
|
-
error: string | null;
|
|
57
|
-
};
|
|
58
|
-
interface BaseAPIConfig {
|
|
59
|
-
baseUrl: string;
|
|
60
|
-
route: string;
|
|
61
|
-
token?: string;
|
|
62
|
-
headers?: Record<string, string>;
|
|
63
|
-
}
|
|
64
|
-
interface RatingData {
|
|
65
|
-
assistantId: string;
|
|
66
|
-
sessionId: string;
|
|
67
|
-
topicId: number;
|
|
68
|
-
score?: number;
|
|
69
|
-
description?: string;
|
|
70
|
-
}
|
|
71
|
-
interface AttachmentPayload {
|
|
72
|
-
filename: string;
|
|
73
|
-
content_type: string;
|
|
74
|
-
content_size: number;
|
|
75
|
-
}
|
|
76
|
-
type AlquimiaMessage = Message & {
|
|
77
|
-
error_code?: string;
|
|
78
|
-
error_detail?: string;
|
|
79
|
-
taskid?: string;
|
|
80
|
-
loading?: boolean;
|
|
81
|
-
created_at?: string;
|
|
82
|
-
additionalInfo?: string;
|
|
83
|
-
tooler?: Tooler[];
|
|
84
|
-
thinkings?: ThinkingsInferenceResponse[];
|
|
85
|
-
attachments?: AttachmentPayload[];
|
|
86
|
-
};
|
|
87
|
-
interface ActionResponse<T = void> {
|
|
88
|
-
success: boolean;
|
|
89
|
-
data?: T;
|
|
90
|
-
error?: {
|
|
91
|
-
message: string;
|
|
92
|
-
code?: string;
|
|
93
|
-
details?: any;
|
|
94
|
-
name?: string;
|
|
95
|
-
cause?: string;
|
|
96
|
-
status?: string;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
type ApmSpan = Span & {
|
|
100
|
-
id?: string;
|
|
101
|
-
traceId?: string;
|
|
102
|
-
} | undefined;
|
|
103
|
-
type ApiError = Error & {
|
|
104
|
-
message: string;
|
|
105
|
-
name: string;
|
|
106
|
-
cause: string;
|
|
107
|
-
code?: string | number;
|
|
108
|
-
status?: string | number;
|
|
109
|
-
};
|
|
110
|
-
type Tooler = {
|
|
111
|
-
control_id: string;
|
|
112
|
-
tool_summary?: ToolSummary;
|
|
113
|
-
tool_output?: ToolOutput;
|
|
114
|
-
};
|
|
115
|
-
type ToolSummary = {
|
|
116
|
-
name: string;
|
|
117
|
-
parameters: Record<string, any>;
|
|
118
|
-
};
|
|
119
|
-
type ToolOutput = {
|
|
120
|
-
result: any;
|
|
121
|
-
status: string;
|
|
122
|
-
};
|
|
123
|
-
type ToolEvent = {
|
|
124
|
-
event_class: string;
|
|
125
|
-
control_id: string;
|
|
126
|
-
data: any;
|
|
127
|
-
status: string;
|
|
128
|
-
};
|
|
129
|
-
interface ConversationsMap {
|
|
130
|
-
[topicId: string]: string;
|
|
131
|
-
}
|
|
132
|
-
interface DocumentSearchResult {
|
|
133
|
-
pageContent: string;
|
|
134
|
-
metadata: {
|
|
135
|
-
source: string;
|
|
136
|
-
_id: string;
|
|
137
|
-
_collection_name: string;
|
|
138
|
-
};
|
|
139
|
-
score: number;
|
|
140
|
-
}
|
|
141
|
-
type ElevenLabsVoiceSettings = {
|
|
142
|
-
stability: number;
|
|
143
|
-
similarity_boost: number;
|
|
144
|
-
style: number;
|
|
145
|
-
};
|
|
146
|
-
type ElevenLabsRequestSpecs = {
|
|
147
|
-
optimize_streaming_latency: string;
|
|
148
|
-
output_format: string;
|
|
149
|
-
model_id: string;
|
|
150
|
-
language: string;
|
|
151
|
-
voice_settings: ElevenLabsVoiceSettings;
|
|
152
|
-
};
|
|
153
|
-
type TTSResult = {
|
|
154
|
-
type: 'blob';
|
|
155
|
-
data: Blob;
|
|
156
|
-
} | {
|
|
157
|
-
type: 'url';
|
|
158
|
-
data: string;
|
|
159
|
-
} | {
|
|
160
|
-
type: 'error';
|
|
161
|
-
message: string;
|
|
162
|
-
};
|
|
163
|
-
/** One SSE `data:` JSON frame (`event_class` at top level). */
|
|
164
|
-
interface AlquimiaEventData {
|
|
165
|
-
taskid?: string;
|
|
166
|
-
event_class?: string;
|
|
167
|
-
control_id?: string;
|
|
168
|
-
date_submitted?: string;
|
|
169
|
-
status?: string | null;
|
|
170
|
-
data?: unknown;
|
|
171
|
-
experts?: ExpertInferenceResponse[];
|
|
172
|
-
thinkings?: ThinkingsInferenceResponse[];
|
|
173
|
-
tools_output?: ToolEvent[];
|
|
174
|
-
agents_output?: any[];
|
|
175
|
-
tools_pending_approval?: any[];
|
|
176
|
-
tools_pending_execution?: any[];
|
|
177
|
-
errors?: any[];
|
|
178
|
-
}
|
|
179
|
-
interface AssistantInferenceResponse {
|
|
180
|
-
event_class: string;
|
|
181
|
-
control_id: string;
|
|
182
|
-
data: string;
|
|
183
|
-
status: string;
|
|
184
|
-
date_submitted: string;
|
|
185
|
-
message?: string | null;
|
|
186
|
-
extras?: Record<string, unknown> | null;
|
|
187
|
-
extra_data?: ExtraDataContext | null;
|
|
188
|
-
channel?: unknown | null;
|
|
189
|
-
depth?: number;
|
|
190
|
-
taskid?: string;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Channel-scoped context returned alongside an inference response (was
|
|
194
|
-
* `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel
|
|
195
|
-
* the inference was triggered from.
|
|
196
|
-
*/
|
|
197
|
-
interface ExtraDataContext {
|
|
198
|
-
whatsapp_message_id?: string;
|
|
199
|
-
whatsapp_message_from?: string;
|
|
200
|
-
email_message_recipient?: string;
|
|
201
|
-
email_message_subject?: string;
|
|
202
|
-
email_message_id?: string;
|
|
203
|
-
email_message_body?: string;
|
|
204
|
-
slack_team_id?: string;
|
|
205
|
-
slack_user_id?: string;
|
|
206
|
-
slack_channel_id?: string;
|
|
207
|
-
slack_response_url?: string;
|
|
208
|
-
}
|
|
209
7
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
8
|
+
* Runtime v0.5.0 event payloads.
|
|
9
|
+
*
|
|
10
|
+
* These types mirror the request/response schemas exposed by the
|
|
11
|
+
* `/event/*` endpoints. Many fields are optional because the runtime accepts
|
|
12
|
+
* sparse payloads and fills in defaults from the controller context.
|
|
213
13
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
interface
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
usage_metadata: UsageMetadata;
|
|
258
|
-
}
|
|
259
|
-
interface ResponseMetadata {
|
|
260
|
-
token_usage: TokenUsage;
|
|
261
|
-
model_name: string;
|
|
262
|
-
system_fingerprint: string;
|
|
263
|
-
finish_reason: string;
|
|
264
|
-
logprobs: any | null;
|
|
265
|
-
}
|
|
266
|
-
interface TokenUsage {
|
|
267
|
-
completion_tokens: number;
|
|
268
|
-
prompt_tokens: number;
|
|
269
|
-
total_tokens: number;
|
|
270
|
-
completion_time: number;
|
|
271
|
-
prompt_time: number;
|
|
272
|
-
queue_time: number;
|
|
273
|
-
total_time: number;
|
|
274
|
-
}
|
|
275
|
-
interface UsageMetadata {
|
|
276
|
-
input_tokens: number;
|
|
277
|
-
output_tokens: number;
|
|
278
|
-
total_tokens: number;
|
|
279
|
-
}
|
|
280
|
-
interface ExpertInferenceResponse {
|
|
281
|
-
event_class: string;
|
|
14
|
+
/** Base fields shared by most runtime events. */
|
|
15
|
+
interface RuntimeEventBase {
|
|
16
|
+
task_id?: string;
|
|
17
|
+
session_id?: string;
|
|
18
|
+
user_id?: string;
|
|
19
|
+
assistant_id?: string;
|
|
20
|
+
agentspace_id?: string;
|
|
21
|
+
channel_id?: string;
|
|
22
|
+
control_id?: string | null;
|
|
23
|
+
timestamp?: string;
|
|
24
|
+
}
|
|
25
|
+
/** POST /event/session-start */
|
|
26
|
+
interface SessionStartEvent extends RuntimeEventBase {
|
|
27
|
+
event_class: "SessionStartEvent";
|
|
28
|
+
session_id: string;
|
|
29
|
+
assistant_id?: string;
|
|
30
|
+
user_id?: string;
|
|
31
|
+
agentspace_id?: string;
|
|
32
|
+
channel_id?: string;
|
|
33
|
+
}
|
|
34
|
+
/** POST /event/session-end */
|
|
35
|
+
interface SessionEndEvent extends RuntimeEventBase {
|
|
36
|
+
event_class: "SessionEndEvent";
|
|
37
|
+
session_id?: string;
|
|
38
|
+
reason?: string;
|
|
39
|
+
}
|
|
40
|
+
/** POST /event/user-message */
|
|
41
|
+
interface UserMessageEvent extends RuntimeEventBase {
|
|
42
|
+
event_class: "UserMessageEvent";
|
|
43
|
+
message: unknown;
|
|
44
|
+
session_id?: string;
|
|
45
|
+
user_id?: string;
|
|
46
|
+
}
|
|
47
|
+
/** POST /event/agent-message */
|
|
48
|
+
interface AgentMessageEvent extends RuntimeEventBase {
|
|
49
|
+
event_class: "AgentMessageEvent";
|
|
50
|
+
content: unknown;
|
|
51
|
+
session_id?: string;
|
|
52
|
+
assistant_id?: string;
|
|
53
|
+
}
|
|
54
|
+
/** POST /event/tool-approval (approval/rejection of a pending human-approval gate). */
|
|
55
|
+
interface ToolApprovalEvent extends RuntimeEventBase {
|
|
56
|
+
event_class: "ToolApprovalEvent";
|
|
282
57
|
control_id: string;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
58
|
+
/** `true` for approval, `false` for rejection. */
|
|
59
|
+
result: boolean;
|
|
60
|
+
/** Optional reason or note attached to the decision. */
|
|
61
|
+
message?: string;
|
|
62
|
+
}
|
|
63
|
+
/** POST /event/tool-completion (client-side tool execution result). */
|
|
64
|
+
interface ToolCompletionEvent extends ToolExecutionResponse {
|
|
65
|
+
event_class: "ToolCompletionEvent";
|
|
66
|
+
}
|
|
67
|
+
/** POST /event/error */
|
|
68
|
+
interface RuntimeErrorEvent extends RuntimeEventBase {
|
|
69
|
+
event_class: "ErrorEvent";
|
|
70
|
+
error_code?: string;
|
|
71
|
+
message: string;
|
|
72
|
+
details?: unknown;
|
|
289
73
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
date_submitted: string;
|
|
295
|
-
data: {
|
|
296
|
-
content: AssistantResponseData;
|
|
297
|
-
is_complete: boolean;
|
|
298
|
-
is_partial: boolean;
|
|
299
|
-
};
|
|
74
|
+
/** POST /event/bus-mode (batch of worklog records emitted when streaming in bus mode). */
|
|
75
|
+
interface BusModeEvent extends RuntimeEventBase {
|
|
76
|
+
event_class: "BusModeEvent";
|
|
77
|
+
records?: WorklogRecord[];
|
|
300
78
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
/** Message-count anchor: the surface renders after this many messages (chronological ordering). */
|
|
305
|
-
afterCount: number;
|
|
306
|
-
/** True once the user has submitted an interactive surface (disables it + shows a submitted state). */
|
|
307
|
-
submitted?: boolean;
|
|
79
|
+
/** POST /event/heartbeat */
|
|
80
|
+
interface HeartbeatEvent extends RuntimeEventBase {
|
|
81
|
+
event_class: "HeartbeatEvent";
|
|
308
82
|
}
|
|
83
|
+
/** Discriminated union of all runtime v0.5.0 event payloads. */
|
|
84
|
+
type RuntimeEvent = SessionStartEvent | SessionEndEvent | UserMessageEvent | AgentMessageEvent | ToolApprovalEvent | ToolCompletionEvent | RuntimeErrorEvent | BusModeEvent | HeartbeatEvent;
|
|
309
85
|
|
|
310
|
-
export
|
|
86
|
+
export type { AgentMessageEvent, BusModeEvent, HeartbeatEvent, RuntimeErrorEvent, RuntimeEvent, RuntimeEventBase, SessionEndEvent, SessionStartEvent, ToolApprovalEvent, ToolCompletionEvent, UserMessageEvent };
|