@amaster.ai/copilot-client 1.1.0-beta.42 → 1.1.0-beta.44
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 -9
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -452
- package/dist/index.d.ts +12 -452
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,444 +1,5 @@
|
|
|
1
|
-
import { CancelTaskResponse, GetTaskResponse } from '@a2a-js/sdk';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A2UI Types - Inlined from @a2ui/lit for Taro compatibility
|
|
6
|
-
*
|
|
7
|
-
* This file contains the minimal A2UI type definitions needed by copilot-client.
|
|
8
|
-
* We inline these types instead of importing from @a2ui/lit because @a2ui/lit
|
|
9
|
-
* uses ES2025 `import ... with { type: "json" }` syntax which is not supported
|
|
10
|
-
* by Taro's Vite/esbuild version.
|
|
11
|
-
*/
|
|
12
|
-
interface StringValue {
|
|
13
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
14
|
-
path?: string;
|
|
15
|
-
/** A fixed, hardcoded string value. */
|
|
16
|
-
literalString?: string;
|
|
17
|
-
/** A fixed, hardcoded string value. */
|
|
18
|
-
literal?: string;
|
|
19
|
-
}
|
|
20
|
-
interface NumberValue {
|
|
21
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
22
|
-
path?: string;
|
|
23
|
-
/** A fixed, hardcoded number value. */
|
|
24
|
-
literalNumber?: number;
|
|
25
|
-
/** A fixed, hardcoded number value. */
|
|
26
|
-
literal?: number;
|
|
27
|
-
}
|
|
28
|
-
interface BooleanValue {
|
|
29
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
30
|
-
path?: string;
|
|
31
|
-
/** A fixed, hardcoded boolean value. */
|
|
32
|
-
literalBoolean?: boolean;
|
|
33
|
-
/** A fixed, hardcoded boolean value. */
|
|
34
|
-
literal?: boolean;
|
|
35
|
-
}
|
|
36
|
-
interface Action {
|
|
37
|
-
/** A unique name identifying the action (e.g., 'submitForm'). */
|
|
38
|
-
name: string;
|
|
39
|
-
/** A key-value map of data bindings to be resolved when the action is triggered. */
|
|
40
|
-
context?: {
|
|
41
|
-
key: string;
|
|
42
|
-
/** The dynamic value. Define EXACTLY ONE of the nested properties. */
|
|
43
|
-
value: {
|
|
44
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
45
|
-
path?: string;
|
|
46
|
-
/** A fixed, hardcoded string value. */
|
|
47
|
-
literalString?: string;
|
|
48
|
-
literalNumber?: number;
|
|
49
|
-
literalBoolean?: boolean;
|
|
50
|
-
};
|
|
51
|
-
}[];
|
|
52
|
-
}
|
|
53
|
-
interface Text {
|
|
54
|
-
text: StringValue;
|
|
55
|
-
usageHint: "h1" | "h2" | "h3" | "h4" | "h5" | "caption" | "body";
|
|
56
|
-
}
|
|
57
|
-
interface Image {
|
|
58
|
-
url: StringValue;
|
|
59
|
-
usageHint: "icon" | "avatar" | "smallFeature" | "mediumFeature" | "largeFeature" | "header";
|
|
60
|
-
fit?: "contain" | "cover" | "fill" | "none" | "scale-down";
|
|
61
|
-
}
|
|
62
|
-
interface Icon {
|
|
63
|
-
name: StringValue;
|
|
64
|
-
}
|
|
65
|
-
interface Video {
|
|
66
|
-
url: StringValue;
|
|
67
|
-
}
|
|
68
|
-
interface AudioPlayer {
|
|
69
|
-
url: StringValue;
|
|
70
|
-
/** A label, title, or placeholder text. */
|
|
71
|
-
description?: StringValue;
|
|
72
|
-
}
|
|
73
|
-
interface Tabs {
|
|
74
|
-
/** A list of tabs, each with a title and a child component ID. */
|
|
75
|
-
tabItems: {
|
|
76
|
-
/** The title of the tab. */
|
|
77
|
-
title: {
|
|
78
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
79
|
-
path?: string;
|
|
80
|
-
/** A fixed, hardcoded string value. */
|
|
81
|
-
literalString?: string;
|
|
82
|
-
};
|
|
83
|
-
/** A reference to a component instance by its unique ID. */
|
|
84
|
-
child: string;
|
|
85
|
-
}[];
|
|
86
|
-
}
|
|
87
|
-
interface Divider {
|
|
88
|
-
/** The orientation. */
|
|
89
|
-
axis?: "horizontal" | "vertical";
|
|
90
|
-
/** The color of the divider (e.g., hex code or semantic name). */
|
|
91
|
-
color?: string;
|
|
92
|
-
/** The thickness of the divider. */
|
|
93
|
-
thickness?: number;
|
|
94
|
-
}
|
|
95
|
-
interface Modal {
|
|
96
|
-
/** The ID of the component (e.g., a button) that triggers the modal. */
|
|
97
|
-
entryPointChild: string;
|
|
98
|
-
/** The ID of the component to display as the modal's content. */
|
|
99
|
-
contentChild: string;
|
|
100
|
-
}
|
|
101
|
-
interface Button {
|
|
102
|
-
/** The ID of the component to display as the button's content. */
|
|
103
|
-
child: string;
|
|
104
|
-
/** Represents a user-initiated action. */
|
|
105
|
-
action: Action;
|
|
106
|
-
}
|
|
107
|
-
interface Checkbox {
|
|
108
|
-
label: StringValue;
|
|
109
|
-
value: {
|
|
110
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
111
|
-
path?: string;
|
|
112
|
-
literalBoolean?: boolean;
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
interface TextField {
|
|
116
|
-
text?: StringValue;
|
|
117
|
-
/** A label, title, or placeholder text. */
|
|
118
|
-
label: StringValue;
|
|
119
|
-
type?: "shortText" | "number" | "date" | "longText";
|
|
120
|
-
/** A regex string to validate the input. */
|
|
121
|
-
validationRegexp?: string;
|
|
122
|
-
}
|
|
123
|
-
interface DateTimeInput {
|
|
124
|
-
value: StringValue;
|
|
125
|
-
enableDate?: boolean;
|
|
126
|
-
enableTime?: boolean;
|
|
127
|
-
/** The string format for the output (e.g., 'YYYY-MM-DD'). */
|
|
128
|
-
outputFormat?: string;
|
|
129
|
-
}
|
|
130
|
-
interface MultipleChoice {
|
|
131
|
-
selections: {
|
|
132
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
133
|
-
path?: string;
|
|
134
|
-
literalArray?: string[];
|
|
135
|
-
};
|
|
136
|
-
options?: {
|
|
137
|
-
label: {
|
|
138
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
139
|
-
path?: string;
|
|
140
|
-
/** A fixed, hardcoded string value. */
|
|
141
|
-
literalString?: string;
|
|
142
|
-
};
|
|
143
|
-
value: string;
|
|
144
|
-
}[];
|
|
145
|
-
maxAllowedSelections?: number;
|
|
146
|
-
}
|
|
147
|
-
interface Slider {
|
|
148
|
-
value: {
|
|
149
|
-
/** A data binding reference to a location in the data model (e.g., '/user/name'). */
|
|
150
|
-
path?: string;
|
|
151
|
-
literalNumber?: number;
|
|
152
|
-
};
|
|
153
|
-
minValue?: number;
|
|
154
|
-
maxValue?: number;
|
|
155
|
-
}
|
|
156
|
-
/** A recursive type for any valid JSON-like value in the data model. */
|
|
157
|
-
type DataValue = string | number | boolean | null | DataMap | DataObject | DataArray;
|
|
158
|
-
type DataObject = {
|
|
159
|
-
[key: string]: DataValue;
|
|
160
|
-
};
|
|
161
|
-
type DataMap = Map<string, DataValue>;
|
|
162
|
-
type DataArray = DataValue[];
|
|
163
|
-
/** A template for creating components from a list in the data model. */
|
|
164
|
-
interface ComponentArrayTemplate {
|
|
165
|
-
componentId: string;
|
|
166
|
-
dataBinding: string;
|
|
167
|
-
}
|
|
168
|
-
/** Defines a list of child components, either explicitly or via a template. */
|
|
169
|
-
interface ComponentArrayReference {
|
|
170
|
-
explicitList?: string[];
|
|
171
|
-
template?: ComponentArrayTemplate;
|
|
172
|
-
}
|
|
173
|
-
/** Represents the general shape of a component's properties. */
|
|
174
|
-
type ComponentProperties = {
|
|
175
|
-
children?: ComponentArrayReference;
|
|
176
|
-
child?: string;
|
|
177
|
-
[k: string]: unknown;
|
|
178
|
-
};
|
|
179
|
-
/** A raw component instance from a SurfaceUpdate message. */
|
|
180
|
-
interface ComponentInstance {
|
|
181
|
-
id: string;
|
|
182
|
-
weight?: number;
|
|
183
|
-
component?: ComponentProperties;
|
|
184
|
-
}
|
|
185
|
-
type ValueMap = DataObject & {
|
|
186
|
-
key: string;
|
|
187
|
-
/** May be JSON */
|
|
188
|
-
valueString?: string;
|
|
189
|
-
valueNumber?: number;
|
|
190
|
-
valueBoolean?: boolean;
|
|
191
|
-
valueMap?: ValueMap[];
|
|
192
|
-
};
|
|
193
|
-
interface BeginRenderingMessage {
|
|
194
|
-
surfaceId: string;
|
|
195
|
-
root: string;
|
|
196
|
-
styles?: Record<string, string>;
|
|
197
|
-
}
|
|
198
|
-
interface SurfaceUpdateMessage {
|
|
199
|
-
surfaceId: string;
|
|
200
|
-
components: ComponentInstance[];
|
|
201
|
-
}
|
|
202
|
-
interface DataModelUpdate {
|
|
203
|
-
surfaceId: string;
|
|
204
|
-
path?: string;
|
|
205
|
-
contents: ValueMap[];
|
|
206
|
-
}
|
|
207
|
-
interface DeleteSurfaceMessage {
|
|
208
|
-
surfaceId: string;
|
|
209
|
-
}
|
|
210
|
-
interface ServerToClientMessage {
|
|
211
|
-
beginRendering?: BeginRenderingMessage;
|
|
212
|
-
surfaceUpdate?: SurfaceUpdateMessage;
|
|
213
|
-
dataModelUpdate?: DataModelUpdate;
|
|
214
|
-
deleteSurface?: DeleteSurfaceMessage;
|
|
215
|
-
}
|
|
216
|
-
/** A recursive type for any value that can appear within a resolved component tree. */
|
|
217
|
-
type ResolvedValue = string | number | boolean | null | AnyComponentNode | ResolvedMap | ResolvedArray;
|
|
218
|
-
/** A generic map where each value has been recursively resolved. */
|
|
219
|
-
type ResolvedMap = {
|
|
220
|
-
[key: string]: ResolvedValue;
|
|
221
|
-
};
|
|
222
|
-
/** A generic array where each item has been recursively resolved. */
|
|
223
|
-
type ResolvedArray = ResolvedValue[];
|
|
224
|
-
/** A base interface that all component nodes share. */
|
|
225
|
-
interface BaseComponentNode {
|
|
226
|
-
id: string;
|
|
227
|
-
weight?: number;
|
|
228
|
-
dataContextPath?: string;
|
|
229
|
-
slotName?: string;
|
|
230
|
-
}
|
|
231
|
-
interface TextNode extends BaseComponentNode {
|
|
232
|
-
type: "Text";
|
|
233
|
-
properties: Text;
|
|
234
|
-
}
|
|
235
|
-
interface ImageNode extends BaseComponentNode {
|
|
236
|
-
type: "Image";
|
|
237
|
-
properties: Image;
|
|
238
|
-
}
|
|
239
|
-
interface IconNode extends BaseComponentNode {
|
|
240
|
-
type: "Icon";
|
|
241
|
-
properties: Icon;
|
|
242
|
-
}
|
|
243
|
-
interface VideoNode extends BaseComponentNode {
|
|
244
|
-
type: "Video";
|
|
245
|
-
properties: Video;
|
|
246
|
-
}
|
|
247
|
-
interface AudioPlayerNode extends BaseComponentNode {
|
|
248
|
-
type: "AudioPlayer";
|
|
249
|
-
properties: AudioPlayer;
|
|
250
|
-
}
|
|
251
|
-
interface RowNode extends BaseComponentNode {
|
|
252
|
-
type: "Row";
|
|
253
|
-
properties: ResolvedRow;
|
|
254
|
-
}
|
|
255
|
-
interface ColumnNode extends BaseComponentNode {
|
|
256
|
-
type: "Column";
|
|
257
|
-
properties: ResolvedColumn;
|
|
258
|
-
}
|
|
259
|
-
interface ListNode extends BaseComponentNode {
|
|
260
|
-
type: "List";
|
|
261
|
-
properties: ResolvedList;
|
|
262
|
-
}
|
|
263
|
-
interface CardNode extends BaseComponentNode {
|
|
264
|
-
type: "Card";
|
|
265
|
-
properties: ResolvedCard;
|
|
266
|
-
}
|
|
267
|
-
interface TabsNode extends BaseComponentNode {
|
|
268
|
-
type: "Tabs";
|
|
269
|
-
properties: ResolvedTabs;
|
|
270
|
-
}
|
|
271
|
-
interface DividerNode extends BaseComponentNode {
|
|
272
|
-
type: "Divider";
|
|
273
|
-
properties: Divider;
|
|
274
|
-
}
|
|
275
|
-
interface ModalNode extends BaseComponentNode {
|
|
276
|
-
type: "Modal";
|
|
277
|
-
properties: ResolvedModal;
|
|
278
|
-
}
|
|
279
|
-
interface ButtonNode extends BaseComponentNode {
|
|
280
|
-
type: "Button";
|
|
281
|
-
properties: ResolvedButton;
|
|
282
|
-
}
|
|
283
|
-
interface CheckboxNode extends BaseComponentNode {
|
|
284
|
-
type: "CheckBox";
|
|
285
|
-
properties: Checkbox;
|
|
286
|
-
}
|
|
287
|
-
interface TextFieldNode extends BaseComponentNode {
|
|
288
|
-
type: "TextField";
|
|
289
|
-
properties: TextField;
|
|
290
|
-
}
|
|
291
|
-
interface DateTimeInputNode extends BaseComponentNode {
|
|
292
|
-
type: "DateTimeInput";
|
|
293
|
-
properties: DateTimeInput;
|
|
294
|
-
}
|
|
295
|
-
interface MultipleChoiceNode extends BaseComponentNode {
|
|
296
|
-
type: "MultipleChoice";
|
|
297
|
-
properties: MultipleChoice;
|
|
298
|
-
}
|
|
299
|
-
interface SliderNode extends BaseComponentNode {
|
|
300
|
-
type: "Slider";
|
|
301
|
-
properties: Slider;
|
|
302
|
-
}
|
|
303
|
-
interface CustomNode extends BaseComponentNode {
|
|
304
|
-
type: string;
|
|
305
|
-
properties: CustomNodeProperties;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* The complete discriminated union of all possible resolved component nodes.
|
|
309
|
-
* A renderer would use this type for any given node in the component tree.
|
|
310
|
-
*/
|
|
311
|
-
type AnyComponentNode = TextNode | IconNode | ImageNode | VideoNode | AudioPlayerNode | RowNode | ColumnNode | ListNode | CardNode | TabsNode | DividerNode | ModalNode | ButtonNode | CheckboxNode | TextFieldNode | DateTimeInputNode | MultipleChoiceNode | SliderNode | CustomNode;
|
|
312
|
-
interface ResolvedRow {
|
|
313
|
-
children: AnyComponentNode[];
|
|
314
|
-
distribution?: "start" | "center" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly";
|
|
315
|
-
alignment?: "start" | "center" | "end" | "stretch";
|
|
316
|
-
}
|
|
317
|
-
interface ResolvedColumn {
|
|
318
|
-
children: AnyComponentNode[];
|
|
319
|
-
distribution?: "start" | "center" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly";
|
|
320
|
-
alignment?: "start" | "center" | "end" | "stretch";
|
|
321
|
-
}
|
|
322
|
-
interface ResolvedButton {
|
|
323
|
-
child: AnyComponentNode;
|
|
324
|
-
action: Button["action"];
|
|
325
|
-
}
|
|
326
|
-
interface ResolvedList {
|
|
327
|
-
children: AnyComponentNode[];
|
|
328
|
-
direction?: "vertical" | "horizontal";
|
|
329
|
-
alignment?: "start" | "center" | "end" | "stretch";
|
|
330
|
-
}
|
|
331
|
-
interface ResolvedCard {
|
|
332
|
-
child: AnyComponentNode;
|
|
333
|
-
children: AnyComponentNode[];
|
|
334
|
-
}
|
|
335
|
-
interface ResolvedTabItem {
|
|
336
|
-
title: StringValue;
|
|
337
|
-
child: AnyComponentNode;
|
|
338
|
-
}
|
|
339
|
-
interface ResolvedTabs {
|
|
340
|
-
tabItems: ResolvedTabItem[];
|
|
341
|
-
}
|
|
342
|
-
interface ResolvedModal {
|
|
343
|
-
entryPointChild: AnyComponentNode;
|
|
344
|
-
contentChild: AnyComponentNode;
|
|
345
|
-
}
|
|
346
|
-
interface CustomNodeProperties {
|
|
347
|
-
[k: string]: ResolvedValue;
|
|
348
|
-
}
|
|
349
|
-
type SurfaceID = string;
|
|
350
|
-
/** The complete state of a single UI surface. */
|
|
351
|
-
interface Surface {
|
|
352
|
-
rootComponentId: string | null;
|
|
353
|
-
componentTree: AnyComponentNode | null;
|
|
354
|
-
dataModel: DataMap;
|
|
355
|
-
components: Map<string, ComponentInstance>;
|
|
356
|
-
styles: Record<string, string>;
|
|
357
|
-
}
|
|
358
|
-
interface MessageProcessor {
|
|
359
|
-
getSurfaces(): ReadonlyMap<string, Surface>;
|
|
360
|
-
clearSurfaces(): void;
|
|
361
|
-
processMessages(messages: ServerToClientMessage[]): void;
|
|
362
|
-
/**
|
|
363
|
-
* Retrieves the data for a given component node and a relative path string.
|
|
364
|
-
* This correctly handles the special `.` path, which refers to the node's
|
|
365
|
-
* own data context.
|
|
366
|
-
*/
|
|
367
|
-
getData(node: AnyComponentNode, relativePath: string, surfaceId: string): DataValue | null;
|
|
368
|
-
setData(node: AnyComponentNode | null, relativePath: string, value: DataValue, surfaceId: string): void;
|
|
369
|
-
resolvePath(path: string, dataContextPath?: string): string;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
type a2uiTypes_Action = Action;
|
|
373
|
-
type a2uiTypes_AnyComponentNode = AnyComponentNode;
|
|
374
|
-
type a2uiTypes_AudioPlayer = AudioPlayer;
|
|
375
|
-
type a2uiTypes_AudioPlayerNode = AudioPlayerNode;
|
|
376
|
-
type a2uiTypes_BeginRenderingMessage = BeginRenderingMessage;
|
|
377
|
-
type a2uiTypes_BooleanValue = BooleanValue;
|
|
378
|
-
type a2uiTypes_Button = Button;
|
|
379
|
-
type a2uiTypes_ButtonNode = ButtonNode;
|
|
380
|
-
type a2uiTypes_CardNode = CardNode;
|
|
381
|
-
type a2uiTypes_Checkbox = Checkbox;
|
|
382
|
-
type a2uiTypes_CheckboxNode = CheckboxNode;
|
|
383
|
-
type a2uiTypes_ColumnNode = ColumnNode;
|
|
384
|
-
type a2uiTypes_ComponentArrayReference = ComponentArrayReference;
|
|
385
|
-
type a2uiTypes_ComponentArrayTemplate = ComponentArrayTemplate;
|
|
386
|
-
type a2uiTypes_ComponentInstance = ComponentInstance;
|
|
387
|
-
type a2uiTypes_ComponentProperties = ComponentProperties;
|
|
388
|
-
type a2uiTypes_CustomNode = CustomNode;
|
|
389
|
-
type a2uiTypes_CustomNodeProperties = CustomNodeProperties;
|
|
390
|
-
type a2uiTypes_DataArray = DataArray;
|
|
391
|
-
type a2uiTypes_DataMap = DataMap;
|
|
392
|
-
type a2uiTypes_DataModelUpdate = DataModelUpdate;
|
|
393
|
-
type a2uiTypes_DataObject = DataObject;
|
|
394
|
-
type a2uiTypes_DataValue = DataValue;
|
|
395
|
-
type a2uiTypes_DateTimeInput = DateTimeInput;
|
|
396
|
-
type a2uiTypes_DateTimeInputNode = DateTimeInputNode;
|
|
397
|
-
type a2uiTypes_DeleteSurfaceMessage = DeleteSurfaceMessage;
|
|
398
|
-
type a2uiTypes_Divider = Divider;
|
|
399
|
-
type a2uiTypes_DividerNode = DividerNode;
|
|
400
|
-
type a2uiTypes_Icon = Icon;
|
|
401
|
-
type a2uiTypes_IconNode = IconNode;
|
|
402
|
-
type a2uiTypes_Image = Image;
|
|
403
|
-
type a2uiTypes_ImageNode = ImageNode;
|
|
404
|
-
type a2uiTypes_ListNode = ListNode;
|
|
405
|
-
type a2uiTypes_MessageProcessor = MessageProcessor;
|
|
406
|
-
type a2uiTypes_Modal = Modal;
|
|
407
|
-
type a2uiTypes_ModalNode = ModalNode;
|
|
408
|
-
type a2uiTypes_MultipleChoice = MultipleChoice;
|
|
409
|
-
type a2uiTypes_MultipleChoiceNode = MultipleChoiceNode;
|
|
410
|
-
type a2uiTypes_NumberValue = NumberValue;
|
|
411
|
-
type a2uiTypes_ResolvedArray = ResolvedArray;
|
|
412
|
-
type a2uiTypes_ResolvedButton = ResolvedButton;
|
|
413
|
-
type a2uiTypes_ResolvedCard = ResolvedCard;
|
|
414
|
-
type a2uiTypes_ResolvedColumn = ResolvedColumn;
|
|
415
|
-
type a2uiTypes_ResolvedList = ResolvedList;
|
|
416
|
-
type a2uiTypes_ResolvedMap = ResolvedMap;
|
|
417
|
-
type a2uiTypes_ResolvedModal = ResolvedModal;
|
|
418
|
-
type a2uiTypes_ResolvedRow = ResolvedRow;
|
|
419
|
-
type a2uiTypes_ResolvedTabItem = ResolvedTabItem;
|
|
420
|
-
type a2uiTypes_ResolvedTabs = ResolvedTabs;
|
|
421
|
-
type a2uiTypes_ResolvedValue = ResolvedValue;
|
|
422
|
-
type a2uiTypes_RowNode = RowNode;
|
|
423
|
-
type a2uiTypes_ServerToClientMessage = ServerToClientMessage;
|
|
424
|
-
type a2uiTypes_Slider = Slider;
|
|
425
|
-
type a2uiTypes_SliderNode = SliderNode;
|
|
426
|
-
type a2uiTypes_StringValue = StringValue;
|
|
427
|
-
type a2uiTypes_Surface = Surface;
|
|
428
|
-
type a2uiTypes_SurfaceID = SurfaceID;
|
|
429
|
-
type a2uiTypes_SurfaceUpdateMessage = SurfaceUpdateMessage;
|
|
430
|
-
type a2uiTypes_Tabs = Tabs;
|
|
431
|
-
type a2uiTypes_TabsNode = TabsNode;
|
|
432
|
-
type a2uiTypes_Text = Text;
|
|
433
|
-
type a2uiTypes_TextField = TextField;
|
|
434
|
-
type a2uiTypes_TextFieldNode = TextFieldNode;
|
|
435
|
-
type a2uiTypes_TextNode = TextNode;
|
|
436
|
-
type a2uiTypes_ValueMap = ValueMap;
|
|
437
|
-
type a2uiTypes_Video = Video;
|
|
438
|
-
type a2uiTypes_VideoNode = VideoNode;
|
|
439
|
-
declare namespace a2uiTypes {
|
|
440
|
-
export type { a2uiTypes_Action as Action, a2uiTypes_AnyComponentNode as AnyComponentNode, a2uiTypes_AudioPlayer as AudioPlayer, a2uiTypes_AudioPlayerNode as AudioPlayerNode, a2uiTypes_BeginRenderingMessage as BeginRenderingMessage, a2uiTypes_BooleanValue as BooleanValue, a2uiTypes_Button as Button, a2uiTypes_ButtonNode as ButtonNode, a2uiTypes_CardNode as CardNode, a2uiTypes_Checkbox as Checkbox, a2uiTypes_CheckboxNode as CheckboxNode, a2uiTypes_ColumnNode as ColumnNode, a2uiTypes_ComponentArrayReference as ComponentArrayReference, a2uiTypes_ComponentArrayTemplate as ComponentArrayTemplate, a2uiTypes_ComponentInstance as ComponentInstance, a2uiTypes_ComponentProperties as ComponentProperties, a2uiTypes_CustomNode as CustomNode, a2uiTypes_CustomNodeProperties as CustomNodeProperties, a2uiTypes_DataArray as DataArray, a2uiTypes_DataMap as DataMap, a2uiTypes_DataModelUpdate as DataModelUpdate, a2uiTypes_DataObject as DataObject, a2uiTypes_DataValue as DataValue, a2uiTypes_DateTimeInput as DateTimeInput, a2uiTypes_DateTimeInputNode as DateTimeInputNode, a2uiTypes_DeleteSurfaceMessage as DeleteSurfaceMessage, a2uiTypes_Divider as Divider, a2uiTypes_DividerNode as DividerNode, a2uiTypes_Icon as Icon, a2uiTypes_IconNode as IconNode, a2uiTypes_Image as Image, a2uiTypes_ImageNode as ImageNode, a2uiTypes_ListNode as ListNode, a2uiTypes_MessageProcessor as MessageProcessor, a2uiTypes_Modal as Modal, a2uiTypes_ModalNode as ModalNode, a2uiTypes_MultipleChoice as MultipleChoice, a2uiTypes_MultipleChoiceNode as MultipleChoiceNode, a2uiTypes_NumberValue as NumberValue, a2uiTypes_ResolvedArray as ResolvedArray, a2uiTypes_ResolvedButton as ResolvedButton, a2uiTypes_ResolvedCard as ResolvedCard, a2uiTypes_ResolvedColumn as ResolvedColumn, a2uiTypes_ResolvedList as ResolvedList, a2uiTypes_ResolvedMap as ResolvedMap, a2uiTypes_ResolvedModal as ResolvedModal, a2uiTypes_ResolvedRow as ResolvedRow, a2uiTypes_ResolvedTabItem as ResolvedTabItem, a2uiTypes_ResolvedTabs as ResolvedTabs, a2uiTypes_ResolvedValue as ResolvedValue, a2uiTypes_RowNode as RowNode, a2uiTypes_ServerToClientMessage as ServerToClientMessage, a2uiTypes_Slider as Slider, a2uiTypes_SliderNode as SliderNode, a2uiTypes_StringValue as StringValue, a2uiTypes_Surface as Surface, a2uiTypes_SurfaceID as SurfaceID, a2uiTypes_SurfaceUpdateMessage as SurfaceUpdateMessage, a2uiTypes_Tabs as Tabs, a2uiTypes_TabsNode as TabsNode, a2uiTypes_Text as Text, a2uiTypes_TextField as TextField, a2uiTypes_TextFieldNode as TextFieldNode, a2uiTypes_TextNode as TextNode, a2uiTypes_ValueMap as ValueMap, a2uiTypes_Video as Video, a2uiTypes_VideoNode as VideoNode };
|
|
441
|
-
}
|
|
1
|
+
import { SendStreamingMessageResponse, CancelTaskResponse, GetTaskResponse } from '@a2a-js/sdk';
|
|
2
|
+
import { HttpClient, ClientResult } from '@amaster.ai/http-client';
|
|
442
3
|
|
|
443
4
|
interface TextContent {
|
|
444
5
|
type: "text";
|
|
@@ -465,31 +26,30 @@ interface ChatMessage {
|
|
|
465
26
|
interface ChatOptions {
|
|
466
27
|
taskId?: string;
|
|
467
28
|
}
|
|
468
|
-
type
|
|
29
|
+
type CopilotClient = {
|
|
469
30
|
/**
|
|
470
|
-
* Stream
|
|
31
|
+
* Stream messages from Copilot Agent.
|
|
471
32
|
*
|
|
472
33
|
* @example
|
|
473
34
|
* ```typescript
|
|
474
|
-
* import {
|
|
35
|
+
* import { createCopilotClient, Data } from "@amaster.ai/copilot-client";
|
|
475
36
|
*
|
|
476
|
-
* const client =
|
|
477
|
-
* const processor = Data.createSignalA2uiMessageProcessor();
|
|
37
|
+
* const client = createCopilotClient();
|
|
478
38
|
*
|
|
479
|
-
* for await (const
|
|
480
|
-
*
|
|
39
|
+
* for await (const response of client.chat([{ role: "user", content: "Hello" }])) {
|
|
40
|
+
* // deal response
|
|
481
41
|
* }
|
|
482
42
|
* ```
|
|
483
43
|
*/
|
|
484
|
-
chat(messages: ChatMessage[], options?: ChatOptions): AsyncGenerator<
|
|
44
|
+
chat(messages: ChatMessage[], options?: ChatOptions): AsyncGenerator<SendStreamingMessageResponse, void, unknown>;
|
|
485
45
|
cancelChat(taskId: string): Promise<ClientResult<CancelTaskResponse>>;
|
|
486
46
|
getChatStatus(taskId: string): Promise<ClientResult<GetTaskResponse>>;
|
|
487
47
|
};
|
|
488
48
|
/**
|
|
489
|
-
* Create Copilot
|
|
49
|
+
* Create Copilot client
|
|
490
50
|
*
|
|
491
51
|
* Auto-detects runtime environment (Browser/Vite/Taro H5/Taro Mini-program)
|
|
492
52
|
*/
|
|
493
|
-
declare function
|
|
53
|
+
declare function createCopilotClient(http?: HttpClient, baseUrl?: string, getAccessToken?: () => string | null): CopilotClient;
|
|
494
54
|
|
|
495
|
-
export {
|
|
55
|
+
export { type ChatMessage, type ChatOptions, type CopilotClient, type FileContent, type ImageContent, type MessageContent, type TextContent, createCopilotClient };
|