@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
package/dist/types/index.d.ts
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-xksRnBUW.js';
|
|
2
|
+
import { T as ToolExecutionResponse } from '../types-CMVbyEv8.js';
|
|
3
|
+
import { W as WorklogRecord } from '../types-C-6fgK1_.js';
|
|
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 };
|
package/dist/types/index.js.map
CHANGED
|
@@ -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';\nexport * from './runtime';\n","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":[]}
|
package/dist/types/index.mjs.map
CHANGED
|
@@ -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":[]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/** One granular Runtime worklog record (a `bus_mode` SSE frame or a `/worklog/{task_id}/events` item). */
|
|
2
|
+
interface WorklogRecord {
|
|
3
|
+
/** Runtime v0.5.0+ tamper-evident hash chain fields (optional on SSE frames). */
|
|
4
|
+
entry_hash?: string | null;
|
|
5
|
+
previous_hash?: string | null;
|
|
6
|
+
event_class: string;
|
|
7
|
+
control_id: string | null;
|
|
8
|
+
data: unknown;
|
|
9
|
+
status: "success" | "error" | null;
|
|
10
|
+
date_submitted: string;
|
|
11
|
+
}
|
|
12
|
+
/** Runtime v0.5.0 worklog audit summary returned by `GET /worklog/`. */
|
|
13
|
+
interface WorklogSummary {
|
|
14
|
+
task_id: string;
|
|
15
|
+
parent_task_id?: string | null;
|
|
16
|
+
session_id?: string | null;
|
|
17
|
+
user_id?: string | null;
|
|
18
|
+
assistant_id?: string | null;
|
|
19
|
+
agentspace_id?: string | null;
|
|
20
|
+
channel_id?: string | null;
|
|
21
|
+
depth?: number;
|
|
22
|
+
final_status?: string | null;
|
|
23
|
+
started_at: string;
|
|
24
|
+
finished_at?: string | null;
|
|
25
|
+
}
|
|
26
|
+
/** Runtime v0.5.0 full worklog detail returned by `GET /worklog/{task_id}`. */
|
|
27
|
+
interface WorklogDetail extends WorklogSummary {
|
|
28
|
+
final_result?: string | null;
|
|
29
|
+
error_message?: string | null;
|
|
30
|
+
}
|
|
31
|
+
/** Runtime v0.5.0 single worklog event returned by `GET /worklog/{task_id}/events`. */
|
|
32
|
+
interface WorklogEventDetail {
|
|
33
|
+
id: number;
|
|
34
|
+
task_id: string;
|
|
35
|
+
previous_hash?: string | null;
|
|
36
|
+
entry_hash?: string | null;
|
|
37
|
+
event_class: string;
|
|
38
|
+
control_id?: string | null;
|
|
39
|
+
status?: string | null;
|
|
40
|
+
data?: unknown;
|
|
41
|
+
submitted_at: string;
|
|
42
|
+
}
|
|
43
|
+
/** Runtime v0.5.0 paginated list of worklog summaries. */
|
|
44
|
+
interface WorklogPage {
|
|
45
|
+
items: WorklogSummary[];
|
|
46
|
+
total: number;
|
|
47
|
+
limit: number;
|
|
48
|
+
offset: number;
|
|
49
|
+
}
|
|
50
|
+
/** Runtime v0.5.0 paginated list of worklog events for a single task. */
|
|
51
|
+
interface WorklogEventPage {
|
|
52
|
+
task_id: string;
|
|
53
|
+
items: WorklogEventDetail[];
|
|
54
|
+
total: number;
|
|
55
|
+
}
|
|
56
|
+
/** Runtime v0.5.0 hash-chain verification result returned by `GET /worklog/{task_id}/verify`. */
|
|
57
|
+
interface WorklogVerificationResult {
|
|
58
|
+
valid: boolean;
|
|
59
|
+
task_id: string;
|
|
60
|
+
event_count: number;
|
|
61
|
+
first_broken_event_id?: number | null;
|
|
62
|
+
first_broken_index?: number | null;
|
|
63
|
+
expected_hash?: string | null;
|
|
64
|
+
actual_hash?: string | null;
|
|
65
|
+
message: string;
|
|
66
|
+
}
|
|
67
|
+
/** Semantic bucket a node belongs to. */
|
|
68
|
+
type NodeKind = "safeguard" | "reasoning" | "tool" | "a2a" | "memory" | "answer" | "unknown";
|
|
69
|
+
/** Lifecycle state of a single node. */
|
|
70
|
+
type NodeStatus = "pending" | "running" | "completed" | "failed" | "skipped";
|
|
71
|
+
/** Overall run status. */
|
|
72
|
+
type RunStatus = "idle" | "running" | "success" | "error";
|
|
73
|
+
/** A single step in the execution chain (command + its response merged by control_id). */
|
|
74
|
+
interface WorklogNode {
|
|
75
|
+
id: string;
|
|
76
|
+
kind: NodeKind;
|
|
77
|
+
eventClass: string;
|
|
78
|
+
status: NodeStatus;
|
|
79
|
+
title: string;
|
|
80
|
+
startedAt?: string;
|
|
81
|
+
endedAt?: string;
|
|
82
|
+
depth: number;
|
|
83
|
+
parentId?: string;
|
|
84
|
+
children: WorklogNode[];
|
|
85
|
+
command?: unknown;
|
|
86
|
+
response?: unknown;
|
|
87
|
+
error?: string;
|
|
88
|
+
raw: WorklogRecord[];
|
|
89
|
+
}
|
|
90
|
+
/** Normalized execution model produced by the reducer. */
|
|
91
|
+
interface WorklogState {
|
|
92
|
+
taskId: string | null;
|
|
93
|
+
status: RunStatus;
|
|
94
|
+
answer: string | null;
|
|
95
|
+
nodes: WorklogNode[];
|
|
96
|
+
index: Record<string, number>;
|
|
97
|
+
raw: WorklogRecord[];
|
|
98
|
+
}
|
|
99
|
+
/** How a record acts on the model. */
|
|
100
|
+
type EventRole = "open" | "close" | "run-open" | "run-close" | "ignore";
|
|
101
|
+
/** Registry descriptor for one event_class. */
|
|
102
|
+
interface EventInterpreter {
|
|
103
|
+
kind: NodeKind;
|
|
104
|
+
role: EventRole;
|
|
105
|
+
title: (_record: WorklogRecord) => string;
|
|
106
|
+
/** If true, an opened node starts in "pending" (awaiting external input) rather than "running". */
|
|
107
|
+
pending?: boolean;
|
|
108
|
+
}
|
|
109
|
+
declare function initialWorklogState(taskId?: string | null): WorklogState;
|
|
110
|
+
|
|
111
|
+
export { type EventInterpreter as E, type NodeKind as N, type RunStatus as R, type WorklogRecord as W, type WorklogState as a, type EventRole as b, type NodeStatus as c, type WorklogDetail as d, type WorklogEventDetail as e, type WorklogEventPage as f, type WorklogNode as g, type WorklogPage as h, type WorklogSummary as i, type WorklogVerificationResult as j, initialWorklogState as k };
|