@butlerbot/sdk 0.0.6-alpha.2 → 0.0.6-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +12 -0
- package/dist/config.js +8 -0
- package/dist/modules/conversation.d.ts +30 -5
- package/dist/modules/conversation.js +68 -21
- package/dist/types/conversation/index.d.ts +3 -0
- package/dist/types/conversation/index.js +19 -0
- package/dist/types/conversation/v1/conversation_v1.d.ts +7 -0
- package/dist/types/conversation/v1/conversation_v1.js +2 -0
- package/dist/types/conversation/v1/index.d.ts +1 -0
- package/dist/types/conversation/v1/index.js +17 -0
- package/dist/types/conversation/v2/aisdk_types.d.ts +431 -0
- package/dist/types/conversation/v2/aisdk_types.js +2 -0
- package/dist/types/conversation/v2/conversation_v2.d.ts +74 -0
- package/dist/types/conversation/v2/conversation_v2.js +2 -0
- package/dist/types/conversation/v2/index.d.ts +1 -0
- package/dist/types/conversation/v2/index.js +17 -0
- package/dist/types/conversation/v3/aisdk_types.d.ts +431 -0
- package/dist/types/conversation/v3/aisdk_types.js +2 -0
- package/dist/types/conversation/v3/conversation_v3.d.ts +344 -0
- package/dist/types/conversation/v3/conversation_v3.js +2 -0
- package/dist/types/conversation/v3/index.d.ts +1 -0
- package/dist/types/conversation/v3/index.js +17 -0
- package/dist/types/model.d.ts +1 -0
- package/dist/types/model.js +2 -0
- package/dist/types/response/v3/ai_response_v3.d.ts +98 -0
- package/dist/types/response/v3/ai_response_v3.js +2 -0
- package/dist/types/response/v3/ai_tools_v3.d.ts +7 -0
- package/dist/types/response/v3/ai_tools_v3.js +2 -0
- package/dist/types/response/v3/dialogue_response_v3.d.ts +29 -0
- package/dist/types/response/v3/dialogue_response_v3.js +2 -0
- package/dist/types/response/v3/index.d.ts +3 -0
- package/dist/types/response/v3/index.js +19 -0
- package/dist/types/response/v4/ai_response_v4.d.ts +22 -0
- package/dist/types/response/v4/ai_response_v4.js +2 -0
- package/dist/types/response/v4/dialogue_response_v4.d.ts +29 -0
- package/dist/types/response/v4/dialogue_response_v4.js +2 -0
- package/dist/types/response/v4/index.d.ts +2 -0
- package/dist/types/response/v4/index.js +18 -0
- package/dist/types/state/convo_state_response.d.ts +11 -0
- package/dist/types/state/convo_state_response.js +2 -0
- package/dist/types/type_registry.d.ts +2 -2
- package/dist/types/type_registry.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { ModelMessage } from "./aisdk_types";
|
|
2
|
+
/** A message in the conversation, extending AI SDK's ModelMessage with AI3 metadata */
|
|
3
|
+
export type ConversationMessage = ModelMessage & {
|
|
4
|
+
/** AI3-specific metadata */
|
|
5
|
+
ai3?: {
|
|
6
|
+
/** ID of the participant who sent this message */
|
|
7
|
+
participantId?: string;
|
|
8
|
+
/** Condensed/summarized version of this message content */
|
|
9
|
+
summarized?: any;
|
|
10
|
+
/** When this message was added */
|
|
11
|
+
timestamp?: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/** Display information for a participant */
|
|
15
|
+
export type DisplayEntity = {
|
|
16
|
+
name?: string;
|
|
17
|
+
avatarUrl?: string;
|
|
18
|
+
};
|
|
19
|
+
/** Rich content that can be attached to tool status updates.
|
|
20
|
+
* Clients can render these if supported, or fall back to just the `label` field on ToolStatus. */
|
|
21
|
+
export type ToolStatusContent = {
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: "code";
|
|
26
|
+
language: string;
|
|
27
|
+
code: string;
|
|
28
|
+
} | {
|
|
29
|
+
type: "image";
|
|
30
|
+
url: string;
|
|
31
|
+
alt?: string;
|
|
32
|
+
} | {
|
|
33
|
+
type: "progress";
|
|
34
|
+
current: number;
|
|
35
|
+
total: number;
|
|
36
|
+
label?: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: "data";
|
|
39
|
+
data: Record<string, unknown>;
|
|
40
|
+
};
|
|
41
|
+
/** Tool execution status. **/
|
|
42
|
+
export type ToolStatus = {
|
|
43
|
+
/** Unique ID for this tool execution */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Parent tool ID (for nested tool calls, e.g., agent sub-tools) */
|
|
46
|
+
parentId?: string;
|
|
47
|
+
/** Top-level status label — always available, suitable for minimal UI */
|
|
48
|
+
label: string;
|
|
49
|
+
/** Current state of the tool execution */
|
|
50
|
+
state: "running" | "completed" | "failed";
|
|
51
|
+
/** Optional rich content for clients that support it */
|
|
52
|
+
content?: ToolStatusContent[];
|
|
53
|
+
/** Whether this tool call is ending the conversation */
|
|
54
|
+
endingConvo?: boolean;
|
|
55
|
+
};
|
|
56
|
+
export type TokenUsage = {
|
|
57
|
+
/**
|
|
58
|
+
* The total number of input (prompt) tokens used.
|
|
59
|
+
*/
|
|
60
|
+
inputTokens: number | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Detailed information about the input tokens.
|
|
63
|
+
*/
|
|
64
|
+
inputTokenDetails: {
|
|
65
|
+
/**
|
|
66
|
+
* The number of non-cached input (prompt) tokens used.
|
|
67
|
+
*/
|
|
68
|
+
noCacheTokens: number | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* The number of cached input (prompt) tokens read.
|
|
71
|
+
*/
|
|
72
|
+
cacheReadTokens: number | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* The number of cached input (prompt) tokens written.
|
|
75
|
+
*/
|
|
76
|
+
cacheWriteTokens: number | undefined;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The number of total output (completion) tokens used.
|
|
80
|
+
*/
|
|
81
|
+
outputTokens: number | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Detailed information about the output tokens.
|
|
84
|
+
*/
|
|
85
|
+
outputTokenDetails: {
|
|
86
|
+
/**
|
|
87
|
+
* The number of text tokens used.
|
|
88
|
+
*/
|
|
89
|
+
textTokens: number | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* The number of reasoning tokens used.
|
|
92
|
+
*/
|
|
93
|
+
reasoningTokens: number | undefined;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The total number of tokens used.
|
|
97
|
+
*/
|
|
98
|
+
totalTokens: number | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Raw usage information from the provider.
|
|
101
|
+
*
|
|
102
|
+
* This is the usage information in the shape that the provider returns.
|
|
103
|
+
* It can include additional information that is not part of the standard usage information.
|
|
104
|
+
*/
|
|
105
|
+
raw?: any;
|
|
106
|
+
};
|
|
107
|
+
export type ModelMessageCost = {
|
|
108
|
+
inputCost: number;
|
|
109
|
+
outputCost: number;
|
|
110
|
+
totalCost: number;
|
|
111
|
+
inputCostDetails: {
|
|
112
|
+
noCacheCost: number;
|
|
113
|
+
cacheReadCost: number;
|
|
114
|
+
cacheWriteCost: number;
|
|
115
|
+
};
|
|
116
|
+
outputCostDetails: {
|
|
117
|
+
textCost: number;
|
|
118
|
+
reasoningCost: number;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
/** Detailed metadata about a completed response. **/
|
|
122
|
+
export type ResponseMetadata = {
|
|
123
|
+
/** Human-readable model name (e.g. "Claude-Sonnet") */
|
|
124
|
+
model: string;
|
|
125
|
+
/** Provider model identifier (e.g. "claude-sonnet-4-6") */
|
|
126
|
+
modelId: string;
|
|
127
|
+
/** Model-specific information */
|
|
128
|
+
modelInfo: {
|
|
129
|
+
/** Maximum context length for this model */
|
|
130
|
+
contextLimit?: number;
|
|
131
|
+
};
|
|
132
|
+
/** Token usage breakdown */
|
|
133
|
+
tokens: TokenUsage;
|
|
134
|
+
/** The cost breakdown */
|
|
135
|
+
cost: {
|
|
136
|
+
/** The cost of the current turn */
|
|
137
|
+
turnCost?: ModelMessageCost;
|
|
138
|
+
/** The current user's usage cost */
|
|
139
|
+
dailyUsageCost: number;
|
|
140
|
+
/** The user's cost limit for the conversation (e.g., daily limit) */
|
|
141
|
+
dailyUsageCostLimit: number;
|
|
142
|
+
};
|
|
143
|
+
/** Usage budget info */
|
|
144
|
+
limit: {
|
|
145
|
+
/** Current usage cost as a percentage of daily limit (0–1) */
|
|
146
|
+
percentage: number;
|
|
147
|
+
/** Human-readable percentage (e.g. "42.3%") */
|
|
148
|
+
percentageDisplay: string;
|
|
149
|
+
/** Name of the active usage stage */
|
|
150
|
+
stageName: string;
|
|
151
|
+
};
|
|
152
|
+
/** Model switching info (tiered auto-downgrade) */
|
|
153
|
+
modelSwitching: {
|
|
154
|
+
/** Whether the model was switched from the user's request */
|
|
155
|
+
switched: boolean;
|
|
156
|
+
/** Originally requested model */
|
|
157
|
+
requestedModel: string;
|
|
158
|
+
/** Model that was actually used */
|
|
159
|
+
activeModel: string;
|
|
160
|
+
/** Usage stage that triggered the switch */
|
|
161
|
+
stage?: string;
|
|
162
|
+
};
|
|
163
|
+
/** Response timing */
|
|
164
|
+
timing: {
|
|
165
|
+
/** Milliseconds from request start to first streamed event */
|
|
166
|
+
firstEventMs: number;
|
|
167
|
+
/** Total response time in milliseconds */
|
|
168
|
+
totalMs: number;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
export type MessagePayload = {
|
|
172
|
+
/** The message content */
|
|
173
|
+
message: string;
|
|
174
|
+
/** The UUID of this message */
|
|
175
|
+
messageId: string;
|
|
176
|
+
/** Whether this message chunk is the final one */
|
|
177
|
+
completed: boolean;
|
|
178
|
+
};
|
|
179
|
+
export type ReasoningPayload = {
|
|
180
|
+
/** The reasoning content */
|
|
181
|
+
reasoning: string;
|
|
182
|
+
/** The UUID of this reasoning */
|
|
183
|
+
reasoningId: string;
|
|
184
|
+
/** Whether this reasoning chunk is the final one */
|
|
185
|
+
completed: boolean;
|
|
186
|
+
};
|
|
187
|
+
export type FilePayload = {
|
|
188
|
+
/** The file URL */
|
|
189
|
+
url?: string;
|
|
190
|
+
/** The media type of the file */
|
|
191
|
+
mediaType: string;
|
|
192
|
+
};
|
|
193
|
+
export type ToolPayload = {
|
|
194
|
+
/** The tool status */
|
|
195
|
+
status: ToolStatus;
|
|
196
|
+
};
|
|
197
|
+
export type ConvoStatusPayload = {
|
|
198
|
+
/** Whether the entire AI convo has been disabled, a disabled convo cannot be restarted */
|
|
199
|
+
disabled?: boolean;
|
|
200
|
+
/** Whether the AI convo has been stopped, a stopped convo can be restarted
|
|
201
|
+
* although just because it's not stopped does not necasserily mean it's an ongoing conversation */
|
|
202
|
+
stopped?: boolean;
|
|
203
|
+
/** Short summary generated for this conversation */
|
|
204
|
+
shortSummary?: string;
|
|
205
|
+
};
|
|
206
|
+
export type ResponseStatusPayload = {
|
|
207
|
+
completed: boolean;
|
|
208
|
+
/** Rich response metadata — only present on the final `completed: true` event.
|
|
209
|
+
* Populated by the caller (e.g. gateway) after the response finishes and usage is available. */
|
|
210
|
+
metadata?: ResponseMetadata;
|
|
211
|
+
};
|
|
212
|
+
export type BaseResponseMetadata = {
|
|
213
|
+
/** Unique response ID */
|
|
214
|
+
responseId: string;
|
|
215
|
+
/** Model display name (e.g., "GPT-5") */
|
|
216
|
+
model: string;
|
|
217
|
+
/** Actual model ID (e.g., "gpt-5.2-2025-12-11") */
|
|
218
|
+
modelId: string;
|
|
219
|
+
/** Timestamp of first action (first stream chunk) */
|
|
220
|
+
firstTimestamp: number;
|
|
221
|
+
/** Timestamp of last action */
|
|
222
|
+
timestamp: number;
|
|
223
|
+
/** The participant who generated this response */
|
|
224
|
+
participantId?: string;
|
|
225
|
+
};
|
|
226
|
+
export type MessageEvent = {
|
|
227
|
+
type: "message";
|
|
228
|
+
payload: MessagePayload;
|
|
229
|
+
metadata: BaseResponseMetadata & {
|
|
230
|
+
display?: DisplayEntity;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
export type ReasoningEvent = {
|
|
234
|
+
type: "reasoning";
|
|
235
|
+
payload: ReasoningPayload;
|
|
236
|
+
metadata: BaseResponseMetadata;
|
|
237
|
+
};
|
|
238
|
+
export type FileEvent = {
|
|
239
|
+
type: "file";
|
|
240
|
+
payload: FilePayload & {
|
|
241
|
+
base64?: string;
|
|
242
|
+
};
|
|
243
|
+
metadata: BaseResponseMetadata & {
|
|
244
|
+
display?: DisplayEntity;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
export type ToolEvent = {
|
|
248
|
+
type: "tool";
|
|
249
|
+
payload: ToolPayload;
|
|
250
|
+
metadata: BaseResponseMetadata;
|
|
251
|
+
};
|
|
252
|
+
export type ResponseStatusEvent = {
|
|
253
|
+
type: "response_status";
|
|
254
|
+
payload: ResponseStatusPayload;
|
|
255
|
+
};
|
|
256
|
+
export type ConvoStatusEvent = {
|
|
257
|
+
type: "convo_status";
|
|
258
|
+
payload: ConvoStatusPayload;
|
|
259
|
+
};
|
|
260
|
+
/** An entry in the client-facing dialogue history.
|
|
261
|
+
* Unlike `ConversationMessage` (which stores raw AI SDK messages),
|
|
262
|
+
* dialogue entries are human-readable and intended for UI rendering. */
|
|
263
|
+
export type DialogueEntry = {
|
|
264
|
+
/** Who sent this */
|
|
265
|
+
from: "user" | "assistant";
|
|
266
|
+
/** Display info for the sender */
|
|
267
|
+
display?: DisplayEntity;
|
|
268
|
+
/** When this happened */
|
|
269
|
+
timestamp: number;
|
|
270
|
+
} & ({
|
|
271
|
+
type: "message";
|
|
272
|
+
payload: {
|
|
273
|
+
message: string;
|
|
274
|
+
};
|
|
275
|
+
} | {
|
|
276
|
+
type: "reasoning";
|
|
277
|
+
payload: {
|
|
278
|
+
reasoning: string;
|
|
279
|
+
reasoningId: string;
|
|
280
|
+
};
|
|
281
|
+
} | {
|
|
282
|
+
type: "file";
|
|
283
|
+
payload: {
|
|
284
|
+
url?: string;
|
|
285
|
+
mediaType: string;
|
|
286
|
+
};
|
|
287
|
+
} | {
|
|
288
|
+
type: "tool";
|
|
289
|
+
payload: {
|
|
290
|
+
status: ToolStatus;
|
|
291
|
+
};
|
|
292
|
+
} | {
|
|
293
|
+
type: "convo_status";
|
|
294
|
+
payload: {
|
|
295
|
+
disabled?: boolean;
|
|
296
|
+
stopped?: boolean;
|
|
297
|
+
shortSummary?: string;
|
|
298
|
+
};
|
|
299
|
+
} | {
|
|
300
|
+
type: "response_status";
|
|
301
|
+
payload: {
|
|
302
|
+
completed: boolean;
|
|
303
|
+
};
|
|
304
|
+
});
|
|
305
|
+
/** Serializable conversation state **/
|
|
306
|
+
export type ConversationState = {
|
|
307
|
+
/** Conversation settings */
|
|
308
|
+
settings: {
|
|
309
|
+
/** Default AI model name */
|
|
310
|
+
model?: string;
|
|
311
|
+
/** Conversation title */
|
|
312
|
+
title?: string;
|
|
313
|
+
/** System prompt override (bypasses personality generation when set) */
|
|
314
|
+
system?: string;
|
|
315
|
+
/** Where this conversation takes place */
|
|
316
|
+
location?: string;
|
|
317
|
+
/** Location-specific formatting instructions (e.g., "use discord formatting") */
|
|
318
|
+
locationInstructions?: string;
|
|
319
|
+
/** AI temperature (0-1) */
|
|
320
|
+
temperature?: number;
|
|
321
|
+
/** Disable auto-title generation */
|
|
322
|
+
disableAutoTitle?: boolean;
|
|
323
|
+
/** Enable token caching */
|
|
324
|
+
tokenCaching?: boolean;
|
|
325
|
+
};
|
|
326
|
+
/** Conversation summaries */
|
|
327
|
+
summary?: {
|
|
328
|
+
shortSummary?: string;
|
|
329
|
+
longSummary?: string;
|
|
330
|
+
};
|
|
331
|
+
/** Raw message history (AI SDK compatible) */
|
|
332
|
+
messages: ConversationMessage[];
|
|
333
|
+
/** Client-facing dialogue history */
|
|
334
|
+
dialogue: DialogueEntry[];
|
|
335
|
+
};
|
|
336
|
+
export interface ConversationV3 {
|
|
337
|
+
version: "3.0";
|
|
338
|
+
conversationId: string;
|
|
339
|
+
ownerUserId: string;
|
|
340
|
+
/** Whether to disable the ability for the user to view this conversation */
|
|
341
|
+
disableView?: boolean;
|
|
342
|
+
/** AI3 conversation state */
|
|
343
|
+
state: ConversationState;
|
|
344
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./conversation_v3";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./conversation_v3"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type AI_MODEL = string;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { AIToolStatusDataV3 } from "./ai_tools_v3";
|
|
2
|
+
import { ErrorCode } from "../../error";
|
|
3
|
+
import { AIChatProfileDisplayEntity } from "../../conversation/v2/conversation_v2";
|
|
4
|
+
export type AIChatResultFailV3 = {
|
|
5
|
+
success: false;
|
|
6
|
+
errorcode: ErrorCode;
|
|
7
|
+
};
|
|
8
|
+
export type AIChatResultSuccessV3 = {
|
|
9
|
+
success: true;
|
|
10
|
+
response: AIResponseV3[];
|
|
11
|
+
usage: any;
|
|
12
|
+
};
|
|
13
|
+
export type AIChatResultV3 = AIChatResultFailV3 | AIChatResultSuccessV3;
|
|
14
|
+
export type BaseAIResponseMetadataV3 = {
|
|
15
|
+
/** The model that generated this message */
|
|
16
|
+
model: string;
|
|
17
|
+
/** The actual model ID that generated this message */
|
|
18
|
+
modelId: string;
|
|
19
|
+
/** The time when this action started (represents time of first action, meaning in streamed messages it'll hold the time the first chunk was sent) */
|
|
20
|
+
firstTimestamp: number;
|
|
21
|
+
/** Epoch time for when this happened (represents time of last action, meaning in streamed messages it'll hold the time the last chunk was sent) */
|
|
22
|
+
timestamp: number;
|
|
23
|
+
};
|
|
24
|
+
type AIMessageResponseV3 = {
|
|
25
|
+
/** Specifies type to be a message */
|
|
26
|
+
type: "message";
|
|
27
|
+
payload: {
|
|
28
|
+
/** Message to send to the user */
|
|
29
|
+
message: string;
|
|
30
|
+
/** The associated message id */
|
|
31
|
+
messageId: string;
|
|
32
|
+
/** Whether this message was completed */
|
|
33
|
+
completed: boolean;
|
|
34
|
+
};
|
|
35
|
+
metadata: BaseAIResponseMetadataV3 & {
|
|
36
|
+
/** Display data for this message response, such as the author's name and profile picture */
|
|
37
|
+
display?: AIChatProfileDisplayEntity;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type AIReasoningResponseV3 = {
|
|
41
|
+
/** Specifies type to be a reasoning update */
|
|
42
|
+
type: "reasoning";
|
|
43
|
+
payload: {
|
|
44
|
+
/** The reasoning text */
|
|
45
|
+
reasoning: string;
|
|
46
|
+
/** The associated reasoning id */
|
|
47
|
+
reasoningId: string;
|
|
48
|
+
/** Whether this reasoning step is completed */
|
|
49
|
+
completed: boolean;
|
|
50
|
+
};
|
|
51
|
+
metadata: BaseAIResponseMetadataV3;
|
|
52
|
+
};
|
|
53
|
+
export type AIFileResponseV3 = {
|
|
54
|
+
/** Specifies type to be a message */
|
|
55
|
+
type: "file";
|
|
56
|
+
payload: {
|
|
57
|
+
/** URL location of the file */
|
|
58
|
+
url?: string;
|
|
59
|
+
/** Base64 representation of the file */
|
|
60
|
+
base64?: string;
|
|
61
|
+
/** The media type of the file */
|
|
62
|
+
mediaType: string;
|
|
63
|
+
};
|
|
64
|
+
metadata: BaseAIResponseMetadataV3 & {
|
|
65
|
+
/** Display data for this message response, such as the author's name and profile picture */
|
|
66
|
+
display?: AIChatProfileDisplayEntity;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export type AIResponseStatusResponseV3 = {
|
|
70
|
+
/** Specifies type to be a status update for the response */
|
|
71
|
+
type: "response_status";
|
|
72
|
+
payload: {
|
|
73
|
+
/** Whether the entire AI response is completed */
|
|
74
|
+
completed: boolean;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export type AIConvoStatusResponseV3 = {
|
|
78
|
+
/** Specifies type to be a status update for the conversation */
|
|
79
|
+
type: "convo_status";
|
|
80
|
+
payload: {
|
|
81
|
+
/** Whether the entire AI convo has been disabled, a disabled convo cannot be restarted */
|
|
82
|
+
disabled: boolean;
|
|
83
|
+
/** Whether the AI convo has been stopped, a stopped convo can be restarted
|
|
84
|
+
* although just because it's not stopped does not necasserily mean it's an ongoing conversation */
|
|
85
|
+
stopped: boolean;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export type AIToolResponseV3 = {
|
|
89
|
+
/** Specifies type to be a tool use status update */
|
|
90
|
+
type: "tool";
|
|
91
|
+
payload: {
|
|
92
|
+
status: string;
|
|
93
|
+
info: AIToolStatusDataV3;
|
|
94
|
+
};
|
|
95
|
+
metadata: BaseAIResponseMetadataV3 & {};
|
|
96
|
+
};
|
|
97
|
+
export type AIResponseV3 = AIMessageResponseV3 | AIToolResponseV3 | AIConvoStatusResponseV3 | AIResponseStatusResponseV3 | AIFileResponseV3 | AIReasoningResponseV3;
|
|
98
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AIResponseV3 } from "./ai_response_v3";
|
|
2
|
+
import { ErrorCode } from "../../error";
|
|
3
|
+
export type RequestBaseResponsePayloadV3 = {
|
|
4
|
+
/** Whether the conversation's ending */
|
|
5
|
+
end?: boolean;
|
|
6
|
+
/** Whether the stream is ending */
|
|
7
|
+
quitStream?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type RequestFailResponseV3 = {
|
|
10
|
+
success: false;
|
|
11
|
+
data: {
|
|
12
|
+
/** Error code */
|
|
13
|
+
code: ErrorCode;
|
|
14
|
+
/** Error message */
|
|
15
|
+
error: string;
|
|
16
|
+
/** User facing message */
|
|
17
|
+
message: string;
|
|
18
|
+
} & RequestBaseResponsePayloadV3;
|
|
19
|
+
};
|
|
20
|
+
export type RequestSuccessResponseV3 = {
|
|
21
|
+
success: true;
|
|
22
|
+
data: {
|
|
23
|
+
/** The AI's response */
|
|
24
|
+
response: AIResponseV3;
|
|
25
|
+
/** The convoId, passed in most responses */
|
|
26
|
+
convoId?: string;
|
|
27
|
+
} & RequestBaseResponsePayloadV3;
|
|
28
|
+
};
|
|
29
|
+
export type RequestResponseV3 = RequestFailResponseV3 | RequestSuccessResponseV3;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ai_response_v3"), exports);
|
|
18
|
+
__exportStar(require("./dialogue_response_v3"), exports);
|
|
19
|
+
__exportStar(require("./ai_tools_v3"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConvoStatusEvent, FileEvent, MessageEvent, ModelMessageCost, ReasoningEvent, ResponseMetadata, ResponseStatusEvent, TokenUsage, ToolEvent } from "../../conversation/v3/conversation_v3";
|
|
2
|
+
import { ErrorCode } from "../../error";
|
|
3
|
+
export type AIChatResultFailV4 = {
|
|
4
|
+
success: false;
|
|
5
|
+
errorcode: ErrorCode;
|
|
6
|
+
};
|
|
7
|
+
export type AIChatResultSuccessV4 = {
|
|
8
|
+
success: true;
|
|
9
|
+
response: AIResponseV4[];
|
|
10
|
+
usage: any;
|
|
11
|
+
};
|
|
12
|
+
export type AIChatResultV4 = AIChatResultFailV4 | AIChatResultSuccessV4;
|
|
13
|
+
export type TokenUsageV4 = TokenUsage;
|
|
14
|
+
export type ModelMessageCostV4 = ModelMessageCost;
|
|
15
|
+
export type ResponseStatusMetadataV4 = ResponseMetadata;
|
|
16
|
+
export type AIMessageResponseV4 = MessageEvent;
|
|
17
|
+
export type AIReasoningResponseV4 = ReasoningEvent;
|
|
18
|
+
export type AIFileResponseV4 = FileEvent;
|
|
19
|
+
export type AIResponseStatusResponseV4 = ResponseStatusEvent;
|
|
20
|
+
export type AIConvoStatusResponseV4 = ConvoStatusEvent;
|
|
21
|
+
export type AIToolResponseV4 = ToolEvent;
|
|
22
|
+
export type AIResponseV4 = AIMessageResponseV4 | AIToolResponseV4 | AIConvoStatusResponseV4 | AIResponseStatusResponseV4 | AIFileResponseV4 | AIReasoningResponseV4;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AIResponseV4 } from "./ai_response_v4";
|
|
2
|
+
import { ErrorCode } from "../../error";
|
|
3
|
+
export type RequestBaseResponsePayloadV4 = {
|
|
4
|
+
/** Whether the conversation's ending */
|
|
5
|
+
end?: boolean;
|
|
6
|
+
/** Whether the stream is ending */
|
|
7
|
+
quitStream?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type RequestFailResponseV4 = {
|
|
10
|
+
success: false;
|
|
11
|
+
data: {
|
|
12
|
+
/** Error code */
|
|
13
|
+
code: ErrorCode;
|
|
14
|
+
/** Error message */
|
|
15
|
+
error: string;
|
|
16
|
+
/** User facing message */
|
|
17
|
+
message: string;
|
|
18
|
+
} & RequestBaseResponsePayloadV4;
|
|
19
|
+
};
|
|
20
|
+
export type RequestSuccessResponseV4 = {
|
|
21
|
+
success: true;
|
|
22
|
+
data: {
|
|
23
|
+
/** The AI's response */
|
|
24
|
+
response: AIResponseV4;
|
|
25
|
+
/** The convoId, passed in most responses */
|
|
26
|
+
convoId?: string;
|
|
27
|
+
} & RequestBaseResponsePayloadV4;
|
|
28
|
+
};
|
|
29
|
+
export type RequestResponseV4 = RequestFailResponseV4 | RequestSuccessResponseV4;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ai_response_v4"), exports);
|
|
18
|
+
__exportStar(require("./dialogue_response_v4"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConversationV1 } from "../conversation/v1/conversation_v1";
|
|
2
|
+
import { ConversationV2 } from "../conversation/v2/conversation_v2";
|
|
3
|
+
import { ConversationV3 } from "../conversation/v3/conversation_v3";
|
|
4
|
+
export type ConversationStateResponse = {
|
|
5
|
+
success: true;
|
|
6
|
+
conversation: ConversationV1 | ConversationV2 | ConversationV3;
|
|
7
|
+
} | {
|
|
8
|
+
success: false;
|
|
9
|
+
error: string;
|
|
10
|
+
errormessage: string;
|
|
11
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./v3";
|
|
2
|
-
export * from "./v4";
|
|
1
|
+
export * from "./response/v3";
|
|
2
|
+
export * from "./response/v4";
|
|
3
3
|
export * from "./error";
|
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./v3"), exports);
|
|
18
|
-
__exportStar(require("./v4"), exports);
|
|
17
|
+
__exportStar(require("./response/v3"), exports);
|
|
18
|
+
__exportStar(require("./response/v4"), exports);
|
|
19
19
|
__exportStar(require("./error"), exports);
|