@cloudbase/agent-ui-miniprogram 0.0.12 → 0.0.14
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/CHANGELOG.md +18 -0
- package/README.md +64 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @cloudbase/agent-ui-miniprogram
|
|
2
2
|
|
|
3
|
+
## 1.0.1-alpha.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- alpha release 0.1.2-alpha.1
|
|
8
|
+
- Update all public packages to version 0.1.2-alpha.1
|
|
9
|
+
- Trigger automated alpha release workflow
|
|
10
|
+
- Includes latest features and improvements
|
|
11
|
+
|
|
12
|
+
## 1.0.1-alpha.7
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- alpha release 0.1.2-alpha.1
|
|
17
|
+
- Update all public packages to version 0.1.2-alpha.1
|
|
18
|
+
- Trigger automated alpha release workflow
|
|
19
|
+
- Includes latest features and improvements
|
|
20
|
+
|
|
3
21
|
## 1.0.1-alpha.6
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ this.agui.sendMessage('你好')
|
|
|
37
37
|
## 安装
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install @cloudbase/agent-ui-miniprogram
|
|
40
|
+
npm install @cloudbase/agent-ui-miniprogram@beta
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
---
|
|
@@ -259,7 +259,7 @@ Component({
|
|
|
259
259
|
| `messages` | `Message[]` | 初始消息 |
|
|
260
260
|
| `tools` | `ClientTool[]` | 带有 handler 的客户端工具 |
|
|
261
261
|
| `contexts` | `Context[]` | Agent 运行时的上下文 |
|
|
262
|
-
| `onRawEvent` | `(event) => void` | 每个原始 AG-UI 事件的回调 |
|
|
262
|
+
| `onRawEvent` | `(event: BaseEvent) => void` | 每个原始 AG-UI 事件的回调 |
|
|
263
263
|
|
|
264
264
|
### 实例方法
|
|
265
265
|
|
|
@@ -330,18 +330,18 @@ interface AGUINamespace {
|
|
|
330
330
|
|
|
331
331
|
### 类型定义
|
|
332
332
|
|
|
333
|
-
####
|
|
333
|
+
#### AG-UI 协议类型
|
|
334
334
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
335
|
+
以下类型来自 [AG-UI 协议](https://docs.ag-ui.com),本 SDK 对标版本:**v0.0.42**
|
|
336
|
+
|
|
337
|
+
详细定义请参考 AG-UI 官方文档:
|
|
338
|
+
- [`Message`](https://docs.ag-ui.com/sdk/js/core/types#message) - 消息结构
|
|
339
|
+
- [`Tool`](https://docs.ag-ui.com/sdk/js/core/types#tool) - 工具定义
|
|
340
|
+
- [`ToolCall`](https://docs.ag-ui.com/sdk/js/core/types#toolcall) - 工具调用结构
|
|
341
|
+
- [`Context`](https://docs.ag-ui.com/sdk/js/core/types#context) - Agent 上下文
|
|
342
|
+
- [`RunAgentInput`](https://docs.ag-ui.com/sdk/js/core/types#runagentinput) - Agent 运行输入
|
|
343
|
+
- [`BaseEvent`](https://docs.ag-ui.com/sdk/js/core/events) - 事件基础结构
|
|
344
|
+
- [`EventType`](https://docs.ag-ui.com/sdk/js/core/events) - 事件类型枚举
|
|
345
345
|
|
|
346
346
|
#### UIMessage
|
|
347
347
|
|
|
@@ -376,11 +376,10 @@ interface ToolPart {
|
|
|
376
376
|
|
|
377
377
|
#### ClientTool
|
|
378
378
|
|
|
379
|
+
扩展自 AG-UI 的 `Tool` 类型,增加了 `handler` 函数用于执行客户端工具。
|
|
380
|
+
|
|
379
381
|
```typescript
|
|
380
|
-
interface ClientTool {
|
|
381
|
-
name: string
|
|
382
|
-
description: string
|
|
383
|
-
parameters?: Record<string, unknown> // JSON Schema
|
|
382
|
+
interface ClientTool extends Tool {
|
|
384
383
|
handler: (params: ToolHandlerParams) => string | Promise<string>
|
|
385
384
|
}
|
|
386
385
|
|
|
@@ -416,4 +415,52 @@ type AGUIClientErrorCode =
|
|
|
416
415
|
| 'UNKNOWN'
|
|
417
416
|
```
|
|
418
417
|
|
|
418
|
+
#### ToolCallState
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
interface ToolCallState {
|
|
422
|
+
toolCallId: string
|
|
423
|
+
name: string
|
|
424
|
+
argsString: string // 原始参数字符串(流式传输中)
|
|
425
|
+
args: Record<string, unknown> // 解析后的参数
|
|
426
|
+
status: ToolCallStatus
|
|
427
|
+
result?: unknown
|
|
428
|
+
error?: AGUIClientError
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
type ToolCallStatus = 'pending' | 'ready' | 'executing' | 'completed' | 'failed'
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
#### AGUIConfig
|
|
435
|
+
|
|
436
|
+
```typescript
|
|
437
|
+
interface AGUIConfig {
|
|
438
|
+
transport: Transport
|
|
439
|
+
threadId?: string
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
#### CreateAGUIBehaviorOptions
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
interface CreateAGUIBehaviorOptions {
|
|
447
|
+
transport?: Transport
|
|
448
|
+
threadId?: string
|
|
449
|
+
messages?: Message[]
|
|
450
|
+
tools?: ClientTool[]
|
|
451
|
+
contexts?: Context[]
|
|
452
|
+
onRawEvent?: (event: BaseEvent) => void
|
|
453
|
+
}
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
#### Transport
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
interface Transport {
|
|
460
|
+
run(input: RunAgentInput): AsyncIterable<BaseEvent>
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
> `RunAgentInput` 和 `BaseEvent` 类型定义见 [AG-UI 协议类型](#ag-ui-协议类型)。
|
|
465
|
+
|
|
419
466
|
---
|