@optima-chat/gateway-protocol 0.1.0
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/events.d.ts +356 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +11 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +32 -0
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @optima-chat/gateway-protocol
|
|
3
|
+
*
|
|
4
|
+
* WebSocket 事件协议类型定义
|
|
5
|
+
* 定义客户端 ↔ 网关之间的所有消息类型
|
|
6
|
+
*
|
|
7
|
+
* 这是协议的单一数据源。@optima/shared 和 @optima-chat/agentic-sdk 都依赖此包。
|
|
8
|
+
* gateway 内部类型(Worker 生命周期事件等)不在此包中,保留在 @optima/shared。
|
|
9
|
+
*/
|
|
10
|
+
export interface ContentParts {
|
|
11
|
+
text?: string;
|
|
12
|
+
images?: Array<{
|
|
13
|
+
url: string;
|
|
14
|
+
mediaType?: string;
|
|
15
|
+
}>;
|
|
16
|
+
files?: Array<{
|
|
17
|
+
url: string;
|
|
18
|
+
filename: string;
|
|
19
|
+
mediaType?: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface SessionInfo {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
userId: string;
|
|
26
|
+
conversations: ConversationSummary[];
|
|
27
|
+
activeConversation?: {
|
|
28
|
+
conversationId: string;
|
|
29
|
+
startedAt: number;
|
|
30
|
+
} | null;
|
|
31
|
+
provider?: string;
|
|
32
|
+
model?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ConversationSummary {
|
|
35
|
+
id: string;
|
|
36
|
+
title: string;
|
|
37
|
+
lastMessageAt: string;
|
|
38
|
+
messageCount: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ToolCallInfo {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
arguments: string;
|
|
44
|
+
}
|
|
45
|
+
/** Tool result 内容块(支持文本和图片) */
|
|
46
|
+
export type ToolResultContentBlock = {
|
|
47
|
+
type: 'text';
|
|
48
|
+
text: string;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'image';
|
|
51
|
+
data: string;
|
|
52
|
+
mimeType: string;
|
|
53
|
+
};
|
|
54
|
+
export interface ToolResultInfo {
|
|
55
|
+
tool_call_id: string;
|
|
56
|
+
tool_name: string;
|
|
57
|
+
/** 纯文本输出(内部序列化处理) */
|
|
58
|
+
output: string;
|
|
59
|
+
error?: string;
|
|
60
|
+
/** 多模态内容块(图片通过 URL 引用,不含 base64) */
|
|
61
|
+
content_blocks?: ToolResultContentBlock[];
|
|
62
|
+
}
|
|
63
|
+
export interface Question {
|
|
64
|
+
question: string;
|
|
65
|
+
options?: Array<{
|
|
66
|
+
label: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
}>;
|
|
69
|
+
multiSelect?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** Tool approval request — sent when a tool marked requiresApproval needs user confirmation */
|
|
72
|
+
export interface ApprovalRequest {
|
|
73
|
+
/** Unique request ID for correlation */
|
|
74
|
+
requestId: string;
|
|
75
|
+
/** Tool name requiring approval */
|
|
76
|
+
toolName: string;
|
|
77
|
+
/** Tool call arguments (for display to user) */
|
|
78
|
+
args: Record<string, unknown>;
|
|
79
|
+
/** Human-readable description of what the tool will do */
|
|
80
|
+
description?: string;
|
|
81
|
+
/** Risk level hint for UI styling */
|
|
82
|
+
risk?: 'low' | 'medium' | 'high';
|
|
83
|
+
}
|
|
84
|
+
/** Tool approval response — user's decision */
|
|
85
|
+
export interface ApprovalResponse {
|
|
86
|
+
requestId: string;
|
|
87
|
+
/** approved: execute as-is, denied: reject, modified: execute with changed args */
|
|
88
|
+
decision: 'approved' | 'denied' | 'modified';
|
|
89
|
+
/** Denial reason or user feedback (shown to agent so it can adjust) */
|
|
90
|
+
message?: string;
|
|
91
|
+
/** Modified args — only when decision='modified' */
|
|
92
|
+
modifiedArgs?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
export interface TokenProgress {
|
|
95
|
+
total_input_tokens: number;
|
|
96
|
+
total_output_tokens: number;
|
|
97
|
+
current_input_tokens?: number;
|
|
98
|
+
current_output_tokens?: number;
|
|
99
|
+
by_model?: Record<string, {
|
|
100
|
+
input: number;
|
|
101
|
+
output: number;
|
|
102
|
+
}>;
|
|
103
|
+
timestamp?: number;
|
|
104
|
+
/** 累计消耗的 Credits(token 部分,由 gateway 根据 model 费率计算) */
|
|
105
|
+
credits?: number;
|
|
106
|
+
/** 当前 model 的 credit 费率(credits per 1K tokens) */
|
|
107
|
+
credit_rate?: {
|
|
108
|
+
input_per_1k: number;
|
|
109
|
+
output_per_1k: number;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export interface FinishInfo {
|
|
113
|
+
reason: string;
|
|
114
|
+
stop_reason?: string;
|
|
115
|
+
/** Number of turns */
|
|
116
|
+
turnCount?: number;
|
|
117
|
+
/** Total input tokens */
|
|
118
|
+
totalInputTokens?: number;
|
|
119
|
+
/** Total output tokens */
|
|
120
|
+
totalOutputTokens?: number;
|
|
121
|
+
/** Duration in milliseconds */
|
|
122
|
+
durationMs?: number;
|
|
123
|
+
/** Total cost in USD */
|
|
124
|
+
totalCost?: number;
|
|
125
|
+
/** @deprecated use turnCount */
|
|
126
|
+
iterations?: number;
|
|
127
|
+
/** @deprecated use totalInputTokens/totalOutputTokens */
|
|
128
|
+
usage?: {
|
|
129
|
+
input_tokens: number;
|
|
130
|
+
output_tokens: number;
|
|
131
|
+
by_model: Record<string, {
|
|
132
|
+
input: number;
|
|
133
|
+
output: number;
|
|
134
|
+
}>;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export interface ErrorInfo {
|
|
138
|
+
code: string;
|
|
139
|
+
message: string;
|
|
140
|
+
retryable?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* 当错误与并发对话锁相关时,携带当前持锁的 conversationId。
|
|
143
|
+
* 目前用于 `CONCURRENT_CONVERSATION_BLOCKED` 告知客户端谁在占用。
|
|
144
|
+
*/
|
|
145
|
+
activeConversationId?: string;
|
|
146
|
+
}
|
|
147
|
+
export interface BillingError {
|
|
148
|
+
reason: string;
|
|
149
|
+
balance?: number;
|
|
150
|
+
message: string;
|
|
151
|
+
requiredCredits?: number;
|
|
152
|
+
}
|
|
153
|
+
export interface InfoMessage {
|
|
154
|
+
message: string;
|
|
155
|
+
code?: string;
|
|
156
|
+
}
|
|
157
|
+
export interface ConversationUpdate {
|
|
158
|
+
conversation_id: string;
|
|
159
|
+
claude_sdk_session_id: string;
|
|
160
|
+
last_message_at: string;
|
|
161
|
+
}
|
|
162
|
+
export interface TokenUserInfo {
|
|
163
|
+
userId: string;
|
|
164
|
+
email?: string;
|
|
165
|
+
roles?: string[];
|
|
166
|
+
}
|
|
167
|
+
/** Desired skill state for sync — gateway sends to agent-runtime via bridge */
|
|
168
|
+
export interface SkillSyncDesired {
|
|
169
|
+
slug: string;
|
|
170
|
+
downloadUrl: string;
|
|
171
|
+
version: string;
|
|
172
|
+
}
|
|
173
|
+
/** Container-bound event: gateway-core → agent-runtime (sent as JSON string via bridge) */
|
|
174
|
+
export interface ContainerSyncSkillsEvent {
|
|
175
|
+
type: 'sync_skills';
|
|
176
|
+
desired: SkillSyncDesired[];
|
|
177
|
+
}
|
|
178
|
+
export type ClientEvent = {
|
|
179
|
+
type: 'message';
|
|
180
|
+
conversation_id: string;
|
|
181
|
+
content: string;
|
|
182
|
+
message?: string;
|
|
183
|
+
streamFormat?: 'delta' | 'content';
|
|
184
|
+
contentParts?: ContentParts;
|
|
185
|
+
metadata?: Record<string, unknown>;
|
|
186
|
+
} | {
|
|
187
|
+
type: 'abort';
|
|
188
|
+
conversation_id: string;
|
|
189
|
+
} | {
|
|
190
|
+
type: 'answer_question';
|
|
191
|
+
request_id: string;
|
|
192
|
+
answers: Record<string, string>;
|
|
193
|
+
} | {
|
|
194
|
+
type: 'approval_response';
|
|
195
|
+
approval: ApprovalResponse;
|
|
196
|
+
} | {
|
|
197
|
+
type: 'ping';
|
|
198
|
+
} | {
|
|
199
|
+
type: 'update_token';
|
|
200
|
+
token: string;
|
|
201
|
+
user: TokenUserInfo;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'delete_conversation';
|
|
204
|
+
conversation_id: string;
|
|
205
|
+
} | {
|
|
206
|
+
type: 'reset_conversation';
|
|
207
|
+
conversation_id: string;
|
|
208
|
+
} | {
|
|
209
|
+
type: 'rename_conversation';
|
|
210
|
+
conversation_id: string;
|
|
211
|
+
title: string;
|
|
212
|
+
} | {
|
|
213
|
+
type: 'restore_conversations';
|
|
214
|
+
conversations: Array<{
|
|
215
|
+
conversation_id: string;
|
|
216
|
+
claude_sdk_session_id: string;
|
|
217
|
+
created_at: string;
|
|
218
|
+
last_message_at: string;
|
|
219
|
+
}>;
|
|
220
|
+
} | {
|
|
221
|
+
type: 'init_user';
|
|
222
|
+
userId: string;
|
|
223
|
+
sessionId: string;
|
|
224
|
+
token: string;
|
|
225
|
+
env: Record<string, string>;
|
|
226
|
+
} | {
|
|
227
|
+
type: 'init';
|
|
228
|
+
sessionId?: string;
|
|
229
|
+
model?: string;
|
|
230
|
+
} | {
|
|
231
|
+
type: 'switch_config';
|
|
232
|
+
provider?: string;
|
|
233
|
+
model?: string;
|
|
234
|
+
runtime?: string;
|
|
235
|
+
conversation_id?: string;
|
|
236
|
+
} | {
|
|
237
|
+
type: 'sync_skills';
|
|
238
|
+
};
|
|
239
|
+
export type ServerEvent = {
|
|
240
|
+
type: 'session_ready';
|
|
241
|
+
session: SessionInfo;
|
|
242
|
+
} | {
|
|
243
|
+
type: 'init';
|
|
244
|
+
init: {
|
|
245
|
+
model: string;
|
|
246
|
+
maxContextTokens: number;
|
|
247
|
+
workspaceDir: string;
|
|
248
|
+
};
|
|
249
|
+
} | {
|
|
250
|
+
type: 'ready';
|
|
251
|
+
} | {
|
|
252
|
+
type: 'thinking';
|
|
253
|
+
conversation_id: string;
|
|
254
|
+
} | {
|
|
255
|
+
type: 'text_delta';
|
|
256
|
+
conversation_id: string;
|
|
257
|
+
delta: {
|
|
258
|
+
text: string;
|
|
259
|
+
};
|
|
260
|
+
} | {
|
|
261
|
+
type: 'content';
|
|
262
|
+
conversation_id: string;
|
|
263
|
+
content: {
|
|
264
|
+
text: string;
|
|
265
|
+
};
|
|
266
|
+
} | {
|
|
267
|
+
type: 'tool_call';
|
|
268
|
+
conversation_id: string;
|
|
269
|
+
tool_call: ToolCallInfo;
|
|
270
|
+
} | {
|
|
271
|
+
type: 'tool_result';
|
|
272
|
+
conversation_id: string;
|
|
273
|
+
tool_result: ToolResultInfo;
|
|
274
|
+
} | {
|
|
275
|
+
type: 'ask_question';
|
|
276
|
+
conversation_id: string;
|
|
277
|
+
request_id: string;
|
|
278
|
+
questions: Question[];
|
|
279
|
+
} | {
|
|
280
|
+
type: 'approval_request';
|
|
281
|
+
conversation_id: string;
|
|
282
|
+
approval: ApprovalRequest;
|
|
283
|
+
} | {
|
|
284
|
+
type: 'progress';
|
|
285
|
+
conversation_id: string;
|
|
286
|
+
progress: TokenProgress;
|
|
287
|
+
} | {
|
|
288
|
+
type: 'finish';
|
|
289
|
+
conversation_id: string;
|
|
290
|
+
finish: FinishInfo;
|
|
291
|
+
} | {
|
|
292
|
+
type: 'error';
|
|
293
|
+
error: ErrorInfo;
|
|
294
|
+
} | {
|
|
295
|
+
type: 'info';
|
|
296
|
+
info: InfoMessage;
|
|
297
|
+
} | {
|
|
298
|
+
type: 'conversation_update';
|
|
299
|
+
update: ConversationUpdate;
|
|
300
|
+
} | {
|
|
301
|
+
type: 'session_recovering';
|
|
302
|
+
info: InfoMessage;
|
|
303
|
+
} | {
|
|
304
|
+
type: 'session_recovered';
|
|
305
|
+
info: InfoMessage;
|
|
306
|
+
} | {
|
|
307
|
+
type: 'pong';
|
|
308
|
+
timestamp: number;
|
|
309
|
+
} | {
|
|
310
|
+
type: 'token_refresh_needed';
|
|
311
|
+
conversation_id?: string;
|
|
312
|
+
} | {
|
|
313
|
+
type: 'billing_error';
|
|
314
|
+
billing: BillingError;
|
|
315
|
+
conversation_id?: string;
|
|
316
|
+
} | {
|
|
317
|
+
type: 'conversation_title_updated';
|
|
318
|
+
conversation_id: string;
|
|
319
|
+
title: string;
|
|
320
|
+
} | {
|
|
321
|
+
type: 'restore_conversations';
|
|
322
|
+
conversations: Array<{
|
|
323
|
+
conversation_id: string;
|
|
324
|
+
title: string;
|
|
325
|
+
created_at: string;
|
|
326
|
+
last_message_at: string;
|
|
327
|
+
}>;
|
|
328
|
+
} | {
|
|
329
|
+
type: 'skills_synced';
|
|
330
|
+
added: number;
|
|
331
|
+
removed: number;
|
|
332
|
+
failed: number;
|
|
333
|
+
} | {
|
|
334
|
+
type: 'skills_sync_error';
|
|
335
|
+
error: {
|
|
336
|
+
code: string;
|
|
337
|
+
message: string;
|
|
338
|
+
};
|
|
339
|
+
} | {
|
|
340
|
+
type: 'restore_started';
|
|
341
|
+
conversationId: string;
|
|
342
|
+
} | {
|
|
343
|
+
type: 'restore_complete';
|
|
344
|
+
conversationId: string;
|
|
345
|
+
durationMs: number;
|
|
346
|
+
} | {
|
|
347
|
+
type: 'restore_failed';
|
|
348
|
+
conversationId: string;
|
|
349
|
+
reason?: string;
|
|
350
|
+
} | {
|
|
351
|
+
type: 'warning';
|
|
352
|
+
code: string;
|
|
353
|
+
message: string;
|
|
354
|
+
conversationId?: string;
|
|
355
|
+
};
|
|
356
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;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,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACnE;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @optima-chat/gateway-protocol
|
|
3
|
+
*
|
|
4
|
+
* WebSocket 事件协议类型定义
|
|
5
|
+
* 定义客户端 ↔ 网关之间的所有消息类型
|
|
6
|
+
*
|
|
7
|
+
* 这是协议的单一数据源。@optima/shared 和 @optima-chat/agentic-sdk 都依赖此包。
|
|
8
|
+
* gateway 内部类型(Worker 生命周期事件等)不在此包中,保留在 @optima/shared。
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { ContentParts, SessionInfo, ConversationSummary, ToolCallInfo, ToolResultContentBlock, ToolResultInfo, Question, ApprovalRequest, ApprovalResponse, TokenProgress, FinishInfo, ErrorInfo, BillingError, InfoMessage, ConversationUpdate, TokenUserInfo, SkillSyncDesired, ContainerSyncSkillsEvent, ClientEvent, ServerEvent, } from './events.js';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAEV,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EAExB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@optima-chat/gateway-protocol",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "WebSocket protocol type definitions for optima-gateway",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/Optima-Chat/optima-gateway.git",
|
|
25
|
+
"directory": "packages/gateway-protocol"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"clean": "rm -rf dist"
|
|
31
|
+
}
|
|
32
|
+
}
|