xiaozhi-client 1.9.4-beta.5 → 1.9.4-beta.8

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.
Files changed (53) hide show
  1. package/dist/backend/package.json +3 -1
  2. package/dist/cli/index.js +13 -4448
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/config/index.js +1 -1783
  5. package/dist/config/index.js.map +1 -1
  6. package/dist/shared-types/api-aP8BHcbg.d.ts +97 -0
  7. package/dist/shared-types/api.d.ts +202 -0
  8. package/dist/shared-types/api.js +50 -0
  9. package/dist/shared-types/api.js.map +1 -0
  10. package/dist/shared-types/app-oAmColIN.d.ts +91 -0
  11. package/dist/shared-types/chunk-BMOKIX3Q.js +51 -0
  12. package/dist/shared-types/chunk-BMOKIX3Q.js.map +1 -0
  13. package/dist/shared-types/config.d.ts +97 -0
  14. package/dist/shared-types/config.js +1 -0
  15. package/dist/shared-types/config.js.map +1 -0
  16. package/dist/shared-types/coze.d.ts +30 -0
  17. package/dist/shared-types/coze.js +1 -0
  18. package/dist/shared-types/coze.js.map +1 -0
  19. package/dist/shared-types/index.d.ts +186 -0
  20. package/dist/shared-types/index.js +4 -17
  21. package/dist/shared-types/index.js.map +1 -1
  22. package/dist/shared-types/mcp.d.ts +91 -0
  23. package/dist/shared-types/mcp.js +22 -0
  24. package/dist/shared-types/mcp.js.map +1 -0
  25. package/dist/shared-types/message-xoOM7ZuT.d.ts +154 -0
  26. package/dist/shared-types/timeout-CCp_IFHg.d.ts +39 -0
  27. package/dist/shared-types/toolApi-DYSy8ebd.d.ts +208 -0
  28. package/dist/shared-types/utils.d.ts +115 -0
  29. package/dist/shared-types/utils.js +15 -0
  30. package/dist/shared-types/utils.js.map +1 -0
  31. package/dist/shared-types/workflow-DDqq5Jgp.d.ts +83 -0
  32. package/package.json +3 -1
  33. package/dist/backend/templates/default/xiaozhi.cache.json +0 -0
  34. package/dist/backend/templates/default/xiaozhi.log +0 -0
  35. package/dist/backend/templates/hello-world/xiaozhi.cache.json +0 -0
  36. package/dist/backend/templates/hello-world/xiaozhi.log +0 -0
  37. package/dist/backend/templates/json5/xiaozhi.cache.json +0 -0
  38. package/dist/backend/templates/json5/xiaozhi.log +0 -0
  39. package/dist/backend/templates/jsonc/xiaozhi.cache.json +0 -0
  40. package/dist/backend/templates/jsonc/xiaozhi.log +0 -0
  41. package/dist/backend/templates/modelscope/xiaozhi.cache.json +0 -0
  42. package/dist/backend/templates/modelscope/xiaozhi.log +0 -0
  43. package/dist/config/index.d.ts +0 -580
  44. package/templates/default/xiaozhi.cache.json +0 -0
  45. package/templates/default/xiaozhi.log +0 -0
  46. package/templates/hello-world/xiaozhi.cache.json +0 -0
  47. package/templates/hello-world/xiaozhi.log +0 -0
  48. package/templates/json5/xiaozhi.cache.json +0 -0
  49. package/templates/json5/xiaozhi.log +0 -0
  50. package/templates/jsonc/xiaozhi.cache.json +0 -0
  51. package/templates/jsonc/xiaozhi.log +0 -0
  52. package/templates/modelscope/xiaozhi.cache.json +0 -0
  53. package/templates/modelscope/xiaozhi.log +0 -0
@@ -0,0 +1,208 @@
1
+ import { C as CozeWorkflow, b as WorkflowParameterConfig } from './workflow-DDqq5Jgp.js';
2
+
3
+ /**
4
+ * 工具添加 API 相关类型定义
5
+ * 支持多种工具类型的添加,包括 MCP 工具、Coze 工作流等
6
+ */
7
+
8
+ /**
9
+ * 工具类型枚举
10
+ */
11
+ declare enum ToolType {
12
+ /** MCP 工具(标准 MCP 服务中的工具) */
13
+ MCP = "mcp",
14
+ /** Coze 工作流工具 */
15
+ COZE = "coze",
16
+ /** HTTP API 工具(预留) */
17
+ HTTP = "http",
18
+ /** 自定义函数工具(预留) */
19
+ FUNCTION = "function"
20
+ }
21
+ /**
22
+ * MCP 工具数据
23
+ * 用于将标准 MCP 服务中的工具添加到 customMCP.tools 配置中
24
+ */
25
+ interface MCPToolData {
26
+ /** MCP 服务名称 */
27
+ serviceName: string;
28
+ /** 工具名称 */
29
+ toolName: string;
30
+ /** 可选的自定义名称 */
31
+ customName?: string;
32
+ /** 可选的自定义描述 */
33
+ customDescription?: string;
34
+ }
35
+ /**
36
+ * Coze 工作流数据
37
+ * 保持与现有格式的兼容性
38
+ */
39
+ interface CozeWorkflowData {
40
+ /** Coze 工作流信息 */
41
+ workflow: CozeWorkflow;
42
+ /** 可选的自定义名称 */
43
+ customName?: string;
44
+ /** 可选的自定义描述 */
45
+ customDescription?: string;
46
+ /** 可选的参数配置 */
47
+ parameterConfig?: WorkflowParameterConfig;
48
+ }
49
+ /**
50
+ * HTTP API 工具数据(预留)
51
+ */
52
+ interface HttpApiToolData {
53
+ /** API 地址 */
54
+ url: string;
55
+ /** HTTP 方法 */
56
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
57
+ /** API 描述 */
58
+ description: string;
59
+ /** 请求头 */
60
+ headers?: Record<string, string>;
61
+ /** 请求体模板 */
62
+ bodyTemplate?: string;
63
+ /** 认证配置 */
64
+ auth?: {
65
+ type: "bearer" | "basic" | "api_key";
66
+ token?: string;
67
+ username?: string;
68
+ password?: string;
69
+ apiKey?: string;
70
+ apiKeyHeader?: string;
71
+ };
72
+ /** 可选的自定义名称 */
73
+ customName?: string;
74
+ /** 可选的自定义描述 */
75
+ customDescription?: string;
76
+ }
77
+ /**
78
+ * 函数工具数据(预留)
79
+ */
80
+ interface FunctionToolData {
81
+ /** 模块路径 */
82
+ module: string;
83
+ /** 函数名 */
84
+ function: string;
85
+ /** 函数描述 */
86
+ description: string;
87
+ /** 函数执行上下文 */
88
+ context?: Record<string, any>;
89
+ /** 超时时间 */
90
+ timeout?: number;
91
+ /** 可选的自定义名称 */
92
+ customName?: string;
93
+ /** 可选的自定义描述 */
94
+ customDescription?: string;
95
+ }
96
+ /**
97
+ * 添加自定义工具的统一请求接口
98
+ */
99
+ interface AddCustomToolRequest {
100
+ /** 工具类型 */
101
+ type: ToolType;
102
+ /** 工具数据(根据类型不同而不同) */
103
+ data: MCPToolData | CozeWorkflowData | HttpApiToolData | FunctionToolData;
104
+ }
105
+ /**
106
+ * 工具验证错误类型
107
+ */
108
+ declare enum ToolValidationError {
109
+ /** 无效的工具类型 */
110
+ INVALID_TOOL_TYPE = "INVALID_TOOL_TYPE",
111
+ /** 缺少必需字段 */
112
+ MISSING_REQUIRED_FIELD = "MISSING_REQUIRED_FIELD",
113
+ /** 工具不存在 */
114
+ TOOL_NOT_FOUND = "TOOL_NOT_FOUND",
115
+ /** 服务不存在 */
116
+ SERVICE_NOT_FOUND = "SERVICE_NOT_FOUND",
117
+ /** 工具名称冲突 */
118
+ TOOL_NAME_CONFLICT = "TOOL_NAME_CONFLICT",
119
+ /** 配置验证失败 */
120
+ CONFIG_VALIDATION_FAILED = "CONFIG_VALIDATION_FAILED",
121
+ /** 系统配置错误 */
122
+ SYSTEM_CONFIG_ERROR = "SYSTEM_CONFIG_ERROR",
123
+ /** 资源限制超出 */
124
+ RESOURCE_LIMIT_EXCEEDED = "RESOURCE_LIMIT_EXCEEDED"
125
+ }
126
+ /**
127
+ * 工具验证错误详情
128
+ */
129
+ interface ToolValidationErrorDetail {
130
+ /** 错误类型 */
131
+ error: ToolValidationError;
132
+ /** 错误消息 */
133
+ message: string;
134
+ /** 错误详情 */
135
+ details?: any;
136
+ /** 建议的解决方案 */
137
+ suggestions?: string[];
138
+ }
139
+ /**
140
+ * 添加工具的响应数据
141
+ */
142
+ interface AddToolResponse {
143
+ /** 成功添加的工具 */
144
+ tool: any;
145
+ /** 工具名称 */
146
+ toolName: string;
147
+ /** 工具类型 */
148
+ toolType: ToolType;
149
+ /** 添加时间戳 */
150
+ addedAt: string;
151
+ }
152
+ /**
153
+ * 工具元数据信息
154
+ */
155
+ interface ToolMetadata {
156
+ /** 工具原始来源 */
157
+ source: {
158
+ type: "mcp" | "coze" | "http" | "function";
159
+ serviceName?: string;
160
+ toolName?: string;
161
+ url?: string;
162
+ };
163
+ /** 添加时间 */
164
+ addedAt: string;
165
+ /** 最后更新时间 */
166
+ updatedAt?: string;
167
+ /** 版本信息 */
168
+ version?: string;
169
+ }
170
+ /**
171
+ * 工具配置选项
172
+ */
173
+ interface ToolConfigOptions {
174
+ /** 是否启用工具(默认 true) */
175
+ enabled?: boolean;
176
+ /** 超时时间(毫秒) */
177
+ timeout?: number;
178
+ /** 重试次数 */
179
+ retryCount?: number;
180
+ /** 重试间隔(毫秒) */
181
+ retryDelay?: number;
182
+ /** 自定义标签 */
183
+ tags?: string[];
184
+ /** 工具分组 */
185
+ group?: string;
186
+ }
187
+ /**
188
+ * 扩展的 CustomMCPTool 接口
189
+ * 包含额外的元数据信息
190
+ */
191
+ interface ExtendedCustomMCPTool {
192
+ /** 基础工具配置 */
193
+ name: string;
194
+ description: string;
195
+ inputSchema: any;
196
+ handler: any;
197
+ /** 使用统计信息 */
198
+ stats?: {
199
+ usageCount?: number;
200
+ lastUsedTime?: string;
201
+ };
202
+ /** 工具元数据 */
203
+ metadata?: ToolMetadata;
204
+ /** 配置选项 */
205
+ config?: ToolConfigOptions;
206
+ }
207
+
208
+ export { type AddCustomToolRequest as A, type CozeWorkflowData as C, type ExtendedCustomMCPTool as E, type FunctionToolData as F, type HttpApiToolData as H, type MCPToolData as M, ToolType as T, type AddToolResponse as a, type ToolMetadata as b, type ToolConfigOptions as c, type ToolValidationErrorDetail as d, ToolValidationError as e };
@@ -0,0 +1,115 @@
1
+ export { T as TimeoutError, a as TimeoutResponse, b as isTimeoutError, i as utilsIsTimeoutResponse } from './timeout-CCp_IFHg.js';
2
+
3
+ /**
4
+ * 性能监控相关类型定义
5
+ */
6
+ /**
7
+ * 性能指标接口
8
+ */
9
+ interface PerformanceMetrics {
10
+ serviceName: string;
11
+ connectionLatency: number;
12
+ averageToolCallLatency: number;
13
+ toolCallLatencies: Map<string, number[]>;
14
+ successRate: number;
15
+ errorRate: number;
16
+ totalOperations: number;
17
+ successfulOperations: number;
18
+ failedOperations: number;
19
+ lastUpdated: Date;
20
+ uptime: number;
21
+ startTime: Date;
22
+ }
23
+ /**
24
+ * 操作类型枚举
25
+ */
26
+ declare enum OperationType {
27
+ CONNECTION = "connection",
28
+ TOOL_CALL = "tool_call",
29
+ RECONNECTION = "reconnection",
30
+ HEALTH_CHECK = "health_check"
31
+ }
32
+ /**
33
+ * 计时器接口
34
+ */
35
+ interface Timer {
36
+ id: string;
37
+ operation: string;
38
+ serviceName: string;
39
+ startTime: number;
40
+ type: OperationType;
41
+ }
42
+ /**
43
+ * 性能统计摘要
44
+ */
45
+ interface PerformanceSummary {
46
+ /** 总连接数 */
47
+ totalConnections: number;
48
+ /** 活跃连接数 */
49
+ activeConnections: number;
50
+ /** 平均连接延迟 */
51
+ averageConnectionLatency: number;
52
+ /** 平均工具调用延迟 */
53
+ averageToolCallLatency: number;
54
+ /** 总体成功率 */
55
+ overallSuccessRate: number;
56
+ /** 总操作数 */
57
+ totalOperations: number;
58
+ /** 性能评分(0-100) */
59
+ performanceScore: number;
60
+ }
61
+
62
+ /**
63
+ * 日志相关类型定义
64
+ */
65
+ /**
66
+ * 工具调用记录接口
67
+ */
68
+ interface ToolCallRecord {
69
+ toolName: string;
70
+ originalToolName?: string;
71
+ serverName?: string;
72
+ arguments?: any;
73
+ result?: any;
74
+ success: boolean;
75
+ duration?: number;
76
+ error?: string;
77
+ timestamp?: number;
78
+ }
79
+ /**
80
+ * 工具调用日志配置接口
81
+ */
82
+ interface ToolCallLogConfig {
83
+ maxRecords?: number;
84
+ logFilePath?: string;
85
+ }
86
+ /**
87
+ * 日志级别枚举
88
+ */
89
+ declare enum LogLevel {
90
+ TRACE = "trace",
91
+ DEBUG = "debug",
92
+ INFO = "info",
93
+ WARN = "warn",
94
+ ERROR = "error",
95
+ FATAL = "fatal"
96
+ }
97
+ /**
98
+ * 日志配置接口
99
+ */
100
+ interface LogConfig {
101
+ /** 日志级别 */
102
+ level?: LogLevel;
103
+ /** 是否启用彩色输出 */
104
+ colorize?: boolean;
105
+ /** 是否启用时间戳 */
106
+ timestamp?: boolean;
107
+ /** 日志格式 */
108
+ format?: "json" | "pretty";
109
+ /** 日志输出路径 */
110
+ outputPath?: string;
111
+ /** 是否同时输出到文件和控制台 */
112
+ both?: boolean;
113
+ }
114
+
115
+ export { type LogConfig, LogLevel, OperationType, type PerformanceMetrics, type PerformanceSummary, type Timer, type ToolCallLogConfig, type ToolCallRecord };
@@ -0,0 +1,15 @@
1
+ import {
2
+ LogLevel,
3
+ OperationType,
4
+ TimeoutError,
5
+ isTimeoutError,
6
+ isTimeoutResponse
7
+ } from "./chunk-BMOKIX3Q.js";
8
+ export {
9
+ LogLevel,
10
+ OperationType,
11
+ TimeoutError,
12
+ isTimeoutError,
13
+ isTimeoutResponse as utilsIsTimeoutResponse
14
+ };
15
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * 扣子工作流相关类型定义
3
+ */
4
+ /**
5
+ * 扣子工作流创建者信息
6
+ */
7
+ interface CozeWorkflowCreator {
8
+ /** 创建者ID */
9
+ id: string;
10
+ /** 创建者名称 */
11
+ name: string;
12
+ }
13
+ /**
14
+ * 扣子工作流接口
15
+ */
16
+ interface CozeWorkflow {
17
+ /** 工作流ID */
18
+ workflow_id: string;
19
+ /** 工作流名称 */
20
+ workflow_name: string;
21
+ /** 工作流描述 */
22
+ description: string;
23
+ /** 工作流图标URL */
24
+ icon_url: string;
25
+ /** 关联应用ID */
26
+ app_id: string;
27
+ /** 创建者信息 */
28
+ creator: CozeWorkflowCreator;
29
+ /** 创建时间戳 */
30
+ created_at: number;
31
+ /** 更新时间戳 */
32
+ updated_at: number;
33
+ /** 是否已添加为工具(前端运行时属性) */
34
+ isAddedAsTool?: boolean;
35
+ /** 输入参数Schema(前端运行时属性) */
36
+ inputSchema?: any;
37
+ /** 工具名称(前端运行时属性) */
38
+ toolName?: string | null;
39
+ }
40
+ /**
41
+ * 获取工作流列表的响应数据
42
+ */
43
+ interface CozeWorkflowsData {
44
+ /** 是否有更多数据 */
45
+ has_more: boolean;
46
+ /** 工作流列表 */
47
+ items: CozeWorkflow[];
48
+ }
49
+ /**
50
+ * 获取工作流列表的请求参数
51
+ */
52
+ interface CozeWorkflowsParams {
53
+ /** 工作空间ID */
54
+ workspace_id: string;
55
+ /** 页码,从1开始 */
56
+ page_num?: number;
57
+ /** 每页数量,默认20 */
58
+ page_size?: number;
59
+ /** 工作流模式,默认为 workflow */
60
+ workflow_mode?: "workflow";
61
+ }
62
+ /**
63
+ * 工作流参数定义
64
+ */
65
+ interface WorkflowParameter {
66
+ /** 英文字段名,用作参数标识符 */
67
+ fieldName: string;
68
+ /** 中英文描述,说明参数用途 */
69
+ description: string;
70
+ /** 参数类型 */
71
+ type: "string" | "number" | "boolean";
72
+ /** 是否必填参数 */
73
+ required: boolean;
74
+ }
75
+ /**
76
+ * 工作流参数配置
77
+ */
78
+ interface WorkflowParameterConfig {
79
+ /** 参数列表 */
80
+ parameters: WorkflowParameter[];
81
+ }
82
+
83
+ export type { CozeWorkflow as C, WorkflowParameter as W, CozeWorkflowCreator as a, WorkflowParameterConfig as b, CozeWorkflowsParams as c, CozeWorkflowsData as d };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaozhi-client",
3
- "version": "1.9.4-beta.5",
3
+ "version": "1.9.4-beta.8",
4
4
  "description": "小智 AI 客户端 命令行工具",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,6 +46,8 @@
46
46
  "release:dry": "nx release version --dry-run",
47
47
  "release:version": "nx release version",
48
48
  "release:publish": "nx release publish",
49
+ "release:multi": "tsx scripts/publish.ts",
50
+ "release:multi:dry": "tsx scripts/publish.ts --dry-run",
49
51
  "dev": "nx run-many -t build --exclude=docs --parallel=false && concurrently \"nx run backend:dev\" \"nx run cli:dev\" \"nx run frontend:dev\" --prefix \"[{name}]\" --names \"BACKEND,CLI,FRONTEND\"",
50
52
  "dev:cli": "nx run cli:dev",
51
53
  "dev:docs": "nx run docs:dev",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes