@xiaozhi-client/shared-types 1.9.4-beta.5
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/LICENSE +21 -0
- package/README.md +61 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 shenjingnan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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.5",
|
|
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
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^24.3.0",
|
|
39
|
+
"tsup": "^8.3.5",
|
|
40
|
+
"typescript": "^5.7.2"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/shenjingnan/xiaozhi-client.git",
|
|
48
|
+
"directory": "packages/shared-types"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"typescript",
|
|
52
|
+
"types",
|
|
53
|
+
"xiaozhi",
|
|
54
|
+
"mcp"
|
|
55
|
+
],
|
|
56
|
+
"author": "Shen Jingnan",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup",
|
|
60
|
+
"dev": "tsup --watch",
|
|
61
|
+
"type:check": "tsc --noEmit"
|
|
62
|
+
}
|
|
63
|
+
}
|