@huyooo/ai-chat-types 0.2.40 → 0.2.42

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _huyooo_ai_chat_core_events from '@huyooo/ai-chat-core/events';
2
- export { AbortEvent, ChatEvent, ChatEventType, DoneEvent, ErrorCategory, ErrorDetails, ErrorEvent, PlanStep, PlanStepStatus, SearchEndEvent, SearchEvent, SearchResult, SearchResultEvent, SearchStartEvent, SideEffect, StatusEvent, StepEndEvent, StepEvent, StepStartEvent, TextDeltaEvent, TextEvent, ThinkingDeltaEvent, ThinkingEndEvent, ThinkingEvent, ThinkingStartEvent, TokenUsage, ToolApprovalRequestEvent, ToolCallInfo, ToolCallOutputEvent, ToolCallResultEvent, ToolCallStartEvent, ToolCallStatus, ToolErrorShape, ToolEvent, createAbort, createApiError, createDone, createError, createParseError, createRateLimitError, createSearchEnd, createSearchResult, createSearchStart, createStepEnd, createStepStart, createTextDelta, createThinkingDelta, createThinkingEnd, createThinkingStart, createThrowableToolError, createTimeoutError, createToolCallOutput, createToolCallResult, createToolCallStart, createToolError, isAbortEvent, isErrorEvent, isRetryableError, isSearchEvent, isStatusEvent, isStepEvent, isTextEvent, isThinkingEvent, isThrowableToolError, isToolEvent } from '@huyooo/ai-chat-core/events';
2
+ export { AbortEvent, ChatEvent, ChatEventType, CompactEndEvent, CompactEvent, CompactStartEvent, DoneEvent, ErrorCategory, ErrorDetails, ErrorEvent, PlanStep, PlanStepStatus, SearchEndEvent, SearchEvent, SearchResult, SearchResultEvent, SearchStartEvent, StatusEvent, StepEndEvent, StepEvent, StepStartEvent, TextDeltaEvent, TextEvent, ThinkingDeltaEvent, ThinkingEndEvent, ThinkingEvent, ThinkingStartEvent, TokenUsage, ToolApprovalRequestEvent, ToolCallInfo, ToolCallOutputEvent, ToolCallResultEvent, ToolCallStartEvent, ToolCallStatus, ToolErrorShape, ToolEvent, ToolUIShape, createAbort, createApiError, createCompactEnd, createCompactStart, createDone, createError, createParseError, createRateLimitError, createSearchEnd, createSearchResult, createSearchStart, createStepEnd, createStepStart, createTextDelta, createThinkingDelta, createThinkingEnd, createThinkingStart, createTimeoutError, createToolCallOutput, createToolCallResult, createToolCallStart, createToolError, isAbortEvent, isCompactEvent, isErrorEvent, isRetryableError, isSearchEvent, isStatusEvent, isStepEvent, isTextEvent, isThinkingEvent, isThrowableToolError, isToolEvent } from '@huyooo/ai-chat-core/events';
3
3
  import { ModelOption, ChatEvent } from '@huyooo/ai-chat-core';
4
4
  export { AutoRunConfig, AutoRunMode, McpConnectionInfo, McpConnectionStatus, McpServerConfig, ModelOption, ProviderType, ThinkingMode } from '@huyooo/ai-chat-core';
5
5
 
@@ -127,7 +127,12 @@ interface ToolExecutionResult {
127
127
  success: boolean;
128
128
  result: string;
129
129
  error?: string;
130
- resultType?: string;
130
+ /** 工具 UI 声明(成功时) */
131
+ ui?: {
132
+ type: 'render' | 'action';
133
+ name: string;
134
+ props?: Record<string, unknown>;
135
+ };
131
136
  toolError?: _huyooo_ai_chat_core_events.ToolErrorShape;
132
137
  }
133
138
  /** ASR 会话配置 */
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{createThinkingStart as o,createThinkingDelta as e,createThinkingEnd as r,createSearchStart as t,createSearchResult as a,createSearchEnd as c,createToolCallStart as h,createToolCallResult as i,createToolCallOutput as m,createTextDelta as p,createDone as f,createError as n,createApiError as s,createRateLimitError as u,createToolError as v,createTimeoutError as x,createParseError as y,createAbort as b,createStepStart as d,createStepEnd as g,isThinkingEvent as j,isSearchEvent as k,isToolEvent as l,isTextEvent as q,isStatusEvent as w,isErrorEvent as z,isAbortEvent as A,isStepEvent as B,isRetryableError as C,createThrowableToolError as D,isThrowableToolError as E}from"@huyooo/ai-chat-core/events";export{b as createAbort,s as createApiError,f as createDone,n as createError,y as createParseError,u as createRateLimitError,c as createSearchEnd,a as createSearchResult,t as createSearchStart,g as createStepEnd,d as createStepStart,p as createTextDelta,e as createThinkingDelta,r as createThinkingEnd,o as createThinkingStart,D as createThrowableToolError,x as createTimeoutError,m as createToolCallOutput,i as createToolCallResult,h as createToolCallStart,v as createToolError,A as isAbortEvent,z as isErrorEvent,C as isRetryableError,k as isSearchEvent,w as isStatusEvent,B as isStepEvent,q as isTextEvent,j as isThinkingEvent,E as isThrowableToolError,l as isToolEvent};
1
+ import{createThinkingStart as o,createThinkingDelta as e,createThinkingEnd as r,createSearchStart as t,createSearchResult as a,createSearchEnd as c,createToolCallStart as h,createToolCallResult as i,createToolCallOutput as m,createTextDelta as p,createDone as f,createError as n,createApiError as s,createRateLimitError as u,createToolError as v,createTimeoutError as x,createParseError as y,createAbort as b,createStepStart as d,createStepEnd as g,isThinkingEvent as j,isSearchEvent as k,isToolEvent as l,isTextEvent as q,isStatusEvent as w,isErrorEvent as z,isAbortEvent as A,isStepEvent as B,isCompactEvent as C,isRetryableError as D,isThrowableToolError as E,createCompactStart as F,createCompactEnd as G}from"@huyooo/ai-chat-core/events";export{b as createAbort,s as createApiError,G as createCompactEnd,F as createCompactStart,f as createDone,n as createError,y as createParseError,u as createRateLimitError,c as createSearchEnd,a as createSearchResult,t as createSearchStart,g as createStepEnd,d as createStepStart,p as createTextDelta,e as createThinkingDelta,r as createThinkingEnd,o as createThinkingStart,x as createTimeoutError,m as createToolCallOutput,i as createToolCallResult,h as createToolCallStart,v as createToolError,A as isAbortEvent,C as isCompactEvent,z as isErrorEvent,D as isRetryableError,k as isSearchEvent,w as isStatusEvent,B as isStepEvent,q as isTextEvent,j as isThinkingEvent,E as isThrowableToolError,l as isToolEvent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ai-chat-types",
3
- "version": "0.2.40",
3
+ "version": "0.2.42",
4
4
  "description": "AI Chat 通用类型定义 - 支持 Electron/Web/CLI 多端",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "test:watch": "vitest"
24
24
  },
25
25
  "dependencies": {
26
- "@huyooo/ai-chat-core": "^0.2.40"
26
+ "@huyooo/ai-chat-core": "^0.2.42"
27
27
  },
28
28
  "devDependencies": {
29
29
  "tsup": "^8.0.0",
package/src/index.ts CHANGED
@@ -17,7 +17,7 @@ export type {
17
17
  // 聚合类型
18
18
  ChatEvent,
19
19
  ChatEventType,
20
-
20
+
21
21
  // 基础类型
22
22
  SearchResult,
23
23
  ToolCallStatus,
@@ -26,45 +26,50 @@ export type {
26
26
  ErrorCategory,
27
27
  ErrorDetails,
28
28
  ToolErrorShape,
29
- SideEffect,
30
-
29
+ ToolUIShape,
30
+
31
31
  // 思考事件
32
32
  ThinkingStartEvent,
33
33
  ThinkingDeltaEvent,
34
34
  ThinkingEndEvent,
35
35
  ThinkingEvent,
36
-
36
+
37
37
  // 搜索事件
38
38
  SearchStartEvent,
39
39
  SearchResultEvent,
40
40
  SearchEndEvent,
41
41
  SearchEvent,
42
-
42
+
43
43
  // 工具事件
44
44
  ToolCallStartEvent,
45
45
  ToolCallResultEvent,
46
46
  ToolCallOutputEvent,
47
47
  ToolApprovalRequestEvent,
48
48
  ToolEvent,
49
-
49
+
50
50
  // 文本事件
51
51
  TextDeltaEvent,
52
52
  TextEvent,
53
-
53
+
54
54
  // 计划类型
55
55
  PlanStep,
56
56
  PlanStepStatus,
57
-
57
+
58
58
  // 状态事件
59
59
  DoneEvent,
60
60
  ErrorEvent,
61
61
  AbortEvent,
62
62
  StatusEvent,
63
-
63
+
64
64
  // 步骤事件
65
65
  StepStartEvent,
66
66
  StepEndEvent,
67
67
  StepEvent,
68
+
69
+ // 上下文压缩事件
70
+ CompactStartEvent,
71
+ CompactEndEvent,
72
+ CompactEvent,
68
73
  } from '@huyooo/ai-chat-core/events'
69
74
 
70
75
  // 重新导出事件创建函数和类型守卫(从子路径导入,renderer 安全)
@@ -97,9 +102,11 @@ export {
97
102
  isErrorEvent,
98
103
  isAbortEvent,
99
104
  isStepEvent,
105
+ isCompactEvent,
100
106
  isRetryableError,
101
- createThrowableToolError,
102
107
  isThrowableToolError,
108
+ createCompactStart,
109
+ createCompactEnd,
103
110
  } from '@huyooo/ai-chat-core/events'
104
111
 
105
112
  // ==================== 从 ai-chat-core 重新导出配置类型 ====================
@@ -109,13 +116,13 @@ export type {
109
116
  ThinkingMode,
110
117
  AutoRunMode,
111
118
  AutoRunConfig,
112
-
119
+
113
120
  // 模型类型
114
121
  ModelOption,
115
122
  ProviderType,
116
-
123
+
117
124
  // 聊天选项(使用本地 ChatOptions)
118
-
125
+
119
126
  // MCP 类型
120
127
  McpServerConfig,
121
128
  McpConnectionStatus,
@@ -259,7 +266,8 @@ export interface ToolExecutionResult {
259
266
  success: boolean
260
267
  result: string
261
268
  error?: string
262
- resultType?: string
269
+ /** 工具 UI 声明(成功时) */
270
+ ui?: { type: 'render' | 'action'; name: string; props?: Record<string, unknown> }
263
271
  toolError?: import('@huyooo/ai-chat-core/events').ToolErrorShape
264
272
  }
265
273