@amaster.ai/client 1.1.0-beta.30 → 1.1.0-beta.32
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/index.cjs +63 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +63 -8
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/types/__tests__/type-checks.test-d.ts +163 -0
- package/types/asr.d.ts +10 -114
- package/types/auth/code-auth.d.ts +5 -154
- package/types/auth/index.d.ts +20 -166
- package/types/auth/oauth.d.ts +6 -143
- package/types/auth/password-auth.d.ts +38 -137
- package/types/auth/profile.d.ts +4 -103
- package/types/auth/user.d.ts +3 -33
- package/types/bpm.d.ts +182 -92
- package/types/common.d.ts +52 -44
- package/types/copilot.d.ts +50 -117
- package/types/entity.d.ts +65 -342
- package/types/function.d.ts +11 -88
- package/types/index.d.ts +52 -302
- package/types/s3.d.ts +25 -56
- package/types/tts.d.ts +10 -128
- package/types/workflow.d.ts +16 -165
package/types/copilot.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Copilot AI Assistant - Type Definitions
|
|
4
|
-
* ============================================================================
|
|
5
|
-
*
|
|
6
|
-
* AI-powered assistant for interactive conversations and task assistance.
|
|
2
|
+
* * AI-powered assistant for interactive conversations and task assistance.
|
|
7
3
|
*
|
|
8
4
|
* @module copilot
|
|
9
5
|
*/
|
|
@@ -105,26 +101,7 @@ export interface DeleteSurfaceMessage {
|
|
|
105
101
|
*
|
|
106
102
|
* Used by the chat() streaming API to send UI updates.
|
|
107
103
|
* Each message can contain one of several update types.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```typescript
|
|
111
|
-
* const stream = client.copilot.chat([
|
|
112
|
-
* { role: 'user', content: 'Show me a chart' }
|
|
113
|
-
* ]);
|
|
114
|
-
*
|
|
115
|
-
* for await (const messages of stream) {
|
|
116
|
-
* for (const msg of messages) {
|
|
117
|
-
* if (msg.surfaceUpdate) {
|
|
118
|
-
* // Render UI components
|
|
119
|
-
* renderComponents(msg.surfaceUpdate.components);
|
|
120
|
-
* }
|
|
121
|
-
* if (msg.dataModelUpdate) {
|
|
122
|
-
* // Update data bindings
|
|
123
|
-
* updateData(msg.dataModelUpdate.contents);
|
|
124
|
-
* }
|
|
125
|
-
* }
|
|
126
|
-
* }
|
|
127
|
-
* ```
|
|
104
|
+
*
|
|
128
105
|
*/
|
|
129
106
|
export interface ServerToClientMessage {
|
|
130
107
|
beginRendering?: BeginRenderingMessage;
|
|
@@ -187,27 +164,7 @@ export type MessageContent = TextContent | ImageContent | FileContent;
|
|
|
187
164
|
|
|
188
165
|
/**
|
|
189
166
|
* Chat message
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* Text message:
|
|
193
|
-
* ```typescript
|
|
194
|
-
* const message: ChatMessage = {
|
|
195
|
-
* role: 'user',
|
|
196
|
-
* content: 'Hello, how can you help me?'
|
|
197
|
-
* };
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* @example
|
|
201
|
-
* Message with image:
|
|
202
|
-
* ```typescript
|
|
203
|
-
* const message: ChatMessage = {
|
|
204
|
-
* role: 'user',
|
|
205
|
-
* content: [
|
|
206
|
-
* { type: 'text', text: 'What is in this image?' },
|
|
207
|
-
* { type: 'image', imageUrl: 'https://example.com/image.jpg' }
|
|
208
|
-
* ]
|
|
209
|
-
* };
|
|
210
|
-
* ```
|
|
167
|
+
*
|
|
211
168
|
*/
|
|
212
169
|
export interface ChatMessage {
|
|
213
170
|
/** Message role */
|
|
@@ -241,51 +198,9 @@ export interface ChatOptions { /** Task ID for conversation continuity */
|
|
|
241
198
|
/**
|
|
242
199
|
* Copilot AI Assistant Client API
|
|
243
200
|
*
|
|
244
|
-
* @
|
|
245
|
-
* Basic chat:
|
|
246
|
-
* ```typescript
|
|
247
|
-
* const client = createClient({ baseURL: 'https://api.amaster.ai' });
|
|
248
|
-
*
|
|
249
|
-
* const stream = client.copilot.chat([
|
|
250
|
-
* { role: 'user', content: 'Hello, how are you?' }
|
|
251
|
-
* ]);
|
|
252
|
-
*
|
|
253
|
-
* for await (const messages of stream) {
|
|
254
|
-
* // Process A2UI messages
|
|
255
|
-
* }
|
|
256
|
-
* ```
|
|
257
|
-
*
|
|
258
|
-
* @example
|
|
259
|
-
* With task ID for conversation continuity:
|
|
260
|
-
* ```typescript
|
|
261
|
-
* const stream = client.copilot.chat(
|
|
262
|
-
* [{ role: 'user', content: 'Tell me a story' }],
|
|
263
|
-
* { taskId: 'conv-123' }
|
|
264
|
-
* );
|
|
265
|
-
*
|
|
266
|
-
* for await (const messages of stream) {
|
|
267
|
-
* for (const msg of messages) {
|
|
268
|
-
* if (msg.dataModelUpdate) {
|
|
269
|
-
* // Extract and display text content
|
|
270
|
-
* }
|
|
271
|
-
* }
|
|
272
|
-
* }
|
|
273
|
-
* ```
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
* Multi-turn conversation:
|
|
277
|
-
* ```typescript
|
|
278
|
-
* const conversation: ChatMessage[] = [
|
|
279
|
-
* { role: 'system', content: 'You are a helpful assistant' },
|
|
280
|
-
* { role: 'user', content: 'What is TypeScript?' }
|
|
281
|
-
* ];
|
|
282
|
-
*
|
|
283
|
-
* for await (const messages of client.copilot.chat(conversation)) {
|
|
284
|
-
* // Process streaming response
|
|
285
|
-
* }
|
|
286
|
-
* ```
|
|
201
|
+
* @since 1.0.0
|
|
287
202
|
*/
|
|
288
|
-
export interface
|
|
203
|
+
export interface CopilotClientAPI {
|
|
289
204
|
/**
|
|
290
205
|
* Start a streaming chat session with the AI assistant
|
|
291
206
|
*
|
|
@@ -297,41 +212,43 @@ export interface CopilotA2UIClient {
|
|
|
297
212
|
* @returns AsyncGenerator yielding arrays of A2UI messages
|
|
298
213
|
*
|
|
299
214
|
* @example
|
|
300
|
-
* Simple chat
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
* { role: 'user', content: 'What is the capital of France?' }
|
|
215
|
+
* // Simple chat
|
|
216
|
+
* const chatStream = client.copilot.chat([
|
|
217
|
+
* { role: 'user', content: 'Hello, how can you help me?' }
|
|
304
218
|
* ]);
|
|
305
219
|
*
|
|
306
|
-
* for await (const messages of
|
|
307
|
-
*
|
|
220
|
+
* for await (const messages of chatStream) {
|
|
221
|
+
* messages.forEach(msg => {
|
|
222
|
+
* if (msg.surfaceUpdate) {
|
|
223
|
+
* console.log('UI update:', msg.surfaceUpdate);
|
|
224
|
+
* }
|
|
225
|
+
* });
|
|
308
226
|
* }
|
|
309
|
-
* ```
|
|
310
227
|
*
|
|
311
228
|
* @example
|
|
312
|
-
* With
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
* { role: '
|
|
316
|
-
* { role: '
|
|
317
|
-
*
|
|
318
|
-
*
|
|
229
|
+
* // With conversation history
|
|
230
|
+
* const chatStream = client.copilot.chat([
|
|
231
|
+
* { role: 'system', content: 'You are a helpful assistant.' },
|
|
232
|
+
* { role: 'user', content: 'What is TypeScript?' },
|
|
233
|
+
* { role: 'assistant', content: 'TypeScript is...' },
|
|
234
|
+
* { role: 'user', content: 'Can you give an example?' }
|
|
235
|
+
* ], {
|
|
236
|
+
* taskId: 'conversation-123'
|
|
237
|
+
* });
|
|
319
238
|
*
|
|
320
239
|
* @example
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* }
|
|
330
|
-
* }
|
|
331
|
-
* }
|
|
240
|
+
* // With image content
|
|
241
|
+
* const chatStream = client.copilot.chat([
|
|
242
|
+
* {
|
|
243
|
+
* role: 'user',
|
|
244
|
+
* content: [
|
|
245
|
+
* { type: 'text', text: 'What is in this image?' },
|
|
246
|
+
* { type: 'image', imageUrl: 'https://example.com/image.jpg' }
|
|
247
|
+
* ]
|
|
332
248
|
* }
|
|
333
|
-
*
|
|
334
|
-
*
|
|
249
|
+
* ]);
|
|
250
|
+
*
|
|
251
|
+
* @since 1.0.0
|
|
335
252
|
*/
|
|
336
253
|
chat(
|
|
337
254
|
messages: ChatMessage[],
|
|
@@ -343,6 +260,14 @@ export interface CopilotA2UIClient {
|
|
|
343
260
|
*
|
|
344
261
|
* @param taskId - Task ID to cancel
|
|
345
262
|
* @returns Cancellation result
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* const result = await client.copilot.cancelChat('task-123');
|
|
266
|
+
* if (result.success) {
|
|
267
|
+
* console.log('Chat cancelled');
|
|
268
|
+
* }
|
|
269
|
+
*
|
|
270
|
+
* @since 1.0.0
|
|
346
271
|
*/
|
|
347
272
|
cancelChat(taskId: string): Promise<ClientResult<unknown>>;
|
|
348
273
|
|
|
@@ -351,6 +276,14 @@ export interface CopilotA2UIClient {
|
|
|
351
276
|
*
|
|
352
277
|
* @param taskId - Task ID to query
|
|
353
278
|
* @returns Task status information
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* const result = await client.copilot.getChatStatus('task-123');
|
|
282
|
+
* if (result.success) {
|
|
283
|
+
* console.log('Status:', result.data);
|
|
284
|
+
* }
|
|
285
|
+
*
|
|
286
|
+
* @since 1.0.0
|
|
354
287
|
*/
|
|
355
288
|
getChatStatus(taskId: string): Promise<ClientResult<unknown>>;
|
|
356
289
|
}
|