@xiaozhi-client/shared-types 1.9.4-beta.10
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 +61 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @xiaozhi-client/shared-types
|
|
2
|
+
|
|
3
|
+
小智项目的共享类型定义包,为 backend 和 frontend 提供统一的类型定义。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @xiaozhi-client/shared-types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
### 导入所有类型
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import * as SharedTypes from '@xiaozhi-client/shared-types'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 按模块导入
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// MCP 协议相关类型
|
|
23
|
+
import { MCPMessage, ToolCallOptions } from '@xiaozhi-client/shared-types/mcp'
|
|
24
|
+
|
|
25
|
+
// 扣子平台相关类型
|
|
26
|
+
import { CozeWorkflow, CozeWorkspace } from '@xiaozhi-client/shared-types/coze'
|
|
27
|
+
|
|
28
|
+
// API 响应类型
|
|
29
|
+
import { ApiResponse, ToolValidationError } from '@xiaozhi-client/shared-types/api'
|
|
30
|
+
|
|
31
|
+
// 配置类型
|
|
32
|
+
import { AppConfig, ConnectionConfig } from '@xiaozhi-client/shared-types/config'
|
|
33
|
+
|
|
34
|
+
// 工具类型
|
|
35
|
+
import { TimeoutError, PerformanceMetrics } from '@xiaozhi-client/shared-types/utils'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 模块结构
|
|
39
|
+
|
|
40
|
+
- **mcp/**: MCP 协议相关类型定义
|
|
41
|
+
- **coze/**: 扣子平台相关类型定义
|
|
42
|
+
- **api/**: API 响应和错误类型定义
|
|
43
|
+
- **config/**: 应用配置相关类型定义
|
|
44
|
+
- **utils/**: 工具类型(日志、性能监控、超时等)
|
|
45
|
+
|
|
46
|
+
## 开发
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 开发模式(监听文件变化)
|
|
50
|
+
pnpm dev
|
|
51
|
+
|
|
52
|
+
# 构建
|
|
53
|
+
pnpm build
|
|
54
|
+
|
|
55
|
+
# 类型检查
|
|
56
|
+
pnpm type:check
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 发布
|
|
60
|
+
|
|
61
|
+
这个包会随主项目一起发布,不需要单独发布。
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xiaozhi-client/shared-types",
|
|
3
|
+
"version": "1.9.4-beta.10",
|
|
4
|
+
"description": "小智项目的共享类型定义",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./mcp": {
|
|
14
|
+
"types": "./dist/mcp/index.d.ts",
|
|
15
|
+
"import": "./dist/mcp/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./coze": {
|
|
18
|
+
"types": "./dist/coze/index.d.ts",
|
|
19
|
+
"import": "./dist/coze/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./api": {
|
|
22
|
+
"types": "./dist/api/index.d.ts",
|
|
23
|
+
"import": "./dist/api/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./config": {
|
|
26
|
+
"types": "./dist/config/index.d.ts",
|
|
27
|
+
"import": "./dist/config/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./utils": {
|
|
30
|
+
"types": "./dist/utils/index.d.ts",
|
|
31
|
+
"import": "./dist/utils/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup",
|
|
39
|
+
"dev": "tsup --watch",
|
|
40
|
+
"type:check": "tsc --noEmit"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^24.3.0",
|
|
44
|
+
"tsup": "^8.3.5",
|
|
45
|
+
"typescript": "^5.7.2"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "https://github.com/shenjingnan/xiaozhi-client.git",
|
|
53
|
+
"directory": "packages/shared-types"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"typescript",
|
|
57
|
+
"types",
|
|
58
|
+
"xiaozhi",
|
|
59
|
+
"mcp"
|
|
60
|
+
],
|
|
61
|
+
"author": "Shen Jingnan",
|
|
62
|
+
"license": "MIT"
|
|
63
|
+
}
|