@agent-phonon/protocol 0.2.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/LICENSE +21 -0
- package/README.md +70 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema/_index.json +3794 -0
- package/dist/json-schema/connect.hello.json +117 -0
- package/dist/json-schema/discovery.changed.json +190 -0
- package/dist/json-schema/discovery.get.json +183 -0
- package/dist/json-schema/discovery.list.json +182 -0
- package/dist/json-schema/document.prepare_upload.json +96 -0
- package/dist/json-schema/document.send.json +165 -0
- package/dist/json-schema/hook.fired.json +100 -0
- package/dist/json-schema/hook.resolve.json +96 -0
- package/dist/json-schema/interaction.cancel.json +48 -0
- package/dist/json-schema/interaction.request.json +376 -0
- package/dist/json-schema/interaction.response.json +68 -0
- package/dist/json-schema/project.create.json +89 -0
- package/dist/json-schema/project.get.json +76 -0
- package/dist/json-schema/project.git.deleteBranch.json +64 -0
- package/dist/json-schema/project.list.json +72 -0
- package/dist/json-schema/project.remove.json +69 -0
- package/dist/json-schema/project.worktree.create.json +88 -0
- package/dist/json-schema/project.worktree.list.json +77 -0
- package/dist/json-schema/project.worktree.remove.json +61 -0
- package/dist/json-schema/session.compress.json +72 -0
- package/dist/json-schema/session.create.json +128 -0
- package/dist/json-schema/session.inject.json +72 -0
- package/dist/json-schema/session.interrupt.json +58 -0
- package/dist/json-schema/session.list.json +127 -0
- package/dist/json-schema/session.send.json +132 -0
- package/dist/json-schema/session.status.json +94 -0
- package/dist/json-schema/session.switchModel.json +73 -0
- package/dist/json-schema/session.terminate.json +54 -0
- package/dist/json-schema/skill.install.json +171 -0
- package/dist/json-schema/skill.list.json +101 -0
- package/dist/json-schema/skill.uninstall.json +76 -0
- package/dist/json-schema/stream.ack.json +36 -0
- package/dist/json-schema/stream.event.json +381 -0
- package/dist/schemas/capabilities.d.ts +90 -0
- package/dist/schemas/capabilities.d.ts.map +1 -0
- package/dist/schemas/capabilities.js +59 -0
- package/dist/schemas/capabilities.js.map +1 -0
- package/dist/schemas/common.d.ts +66 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +97 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/connect.d.ts +111 -0
- package/dist/schemas/connect.d.ts.map +1 -0
- package/dist/schemas/connect.js +46 -0
- package/dist/schemas/connect.js.map +1 -0
- package/dist/schemas/device.d.ts +221 -0
- package/dist/schemas/device.d.ts.map +1 -0
- package/dist/schemas/device.js +59 -0
- package/dist/schemas/device.js.map +1 -0
- package/dist/schemas/discovery.d.ts +892 -0
- package/dist/schemas/discovery.d.ts.map +1 -0
- package/dist/schemas/discovery.js +66 -0
- package/dist/schemas/discovery.js.map +1 -0
- package/dist/schemas/document.d.ts +351 -0
- package/dist/schemas/document.d.ts.map +1 -0
- package/dist/schemas/document.js +103 -0
- package/dist/schemas/document.js.map +1 -0
- package/dist/schemas/env.d.ts +265 -0
- package/dist/schemas/env.d.ts.map +1 -0
- package/dist/schemas/env.js +44 -0
- package/dist/schemas/env.js.map +1 -0
- package/dist/schemas/file.d.ts +274 -0
- package/dist/schemas/file.d.ts.map +1 -0
- package/dist/schemas/file.js +72 -0
- package/dist/schemas/file.js.map +1 -0
- package/dist/schemas/hook.d.ts +132 -0
- package/dist/schemas/hook.d.ts.map +1 -0
- package/dist/schemas/hook.js +58 -0
- package/dist/schemas/hook.js.map +1 -0
- package/dist/schemas/interaction.d.ts +1583 -0
- package/dist/schemas/interaction.d.ts.map +1 -0
- package/dist/schemas/interaction.js +112 -0
- package/dist/schemas/interaction.js.map +1 -0
- package/dist/schemas/jsonrpc.d.ts +314 -0
- package/dist/schemas/jsonrpc.d.ts.map +1 -0
- package/dist/schemas/jsonrpc.js +64 -0
- package/dist/schemas/jsonrpc.js.map +1 -0
- package/dist/schemas/methods.d.ts +3826 -0
- package/dist/schemas/methods.d.ts.map +1 -0
- package/dist/schemas/methods.js +311 -0
- package/dist/schemas/methods.js.map +1 -0
- package/dist/schemas/policy.d.ts +81 -0
- package/dist/schemas/policy.d.ts.map +1 -0
- package/dist/schemas/policy.js +66 -0
- package/dist/schemas/policy.js.map +1 -0
- package/dist/schemas/project.d.ts +506 -0
- package/dist/schemas/project.d.ts.map +1 -0
- package/dist/schemas/project.js +148 -0
- package/dist/schemas/project.js.map +1 -0
- package/dist/schemas/session.d.ts +730 -0
- package/dist/schemas/session.d.ts.map +1 -0
- package/dist/schemas/session.js +287 -0
- package/dist/schemas/session.js.map +1 -0
- package/dist/schemas/skill.d.ts +465 -0
- package/dist/schemas/skill.d.ts.map +1 -0
- package/dist/schemas/skill.js +103 -0
- package/dist/schemas/skill.js.map +1 -0
- package/dist/schemas/stream.d.ts +688 -0
- package/dist/schemas/stream.d.ts.map +1 -0
- package/dist/schemas/stream.js +133 -0
- package/dist/schemas/stream.js.map +1 -0
- package/package.json +52 -0
- package/src/index.ts +24 -0
- package/src/schemas/capabilities.ts +62 -0
- package/src/schemas/common.ts +119 -0
- package/src/schemas/connect.ts +50 -0
- package/src/schemas/device.ts +67 -0
- package/src/schemas/discovery.ts +80 -0
- package/src/schemas/document.ts +121 -0
- package/src/schemas/env.ts +60 -0
- package/src/schemas/file.ts +97 -0
- package/src/schemas/hook.ts +66 -0
- package/src/schemas/interaction.ts +135 -0
- package/src/schemas/jsonrpc.ts +80 -0
- package/src/schemas/methods.ts +414 -0
- package/src/schemas/policy.ts +71 -0
- package/src/schemas/project.ts +185 -0
- package/src/schemas/session.ts +336 -0
- package/src/schemas/skill.ts +121 -0
- package/src/schemas/stream.ts +149 -0
|
@@ -0,0 +1,730 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* L1 Session 协议原语(design §4)。
|
|
4
|
+
*
|
|
5
|
+
* 铁律:session 必须绑定 agent(D15)。每条 session 天生属于某个 agent + model,
|
|
6
|
+
* 这是 session 的一等身份,不是可选配置。发任务 = 在 session 里对话。
|
|
7
|
+
*/
|
|
8
|
+
/** session 状态。 */
|
|
9
|
+
/**
|
|
10
|
+
* session 状态(design D19)。
|
|
11
|
+
* - idle : 活着、空闲、就绪可接 send(create 后初始态;turn 结束/interrupt 后回到这)
|
|
12
|
+
* - running : agent 正在执行一个 turn
|
|
13
|
+
* - paused : 挂起(重启后从 DB 恢复、原生 ref 尚未 re-attach;或被显式暂停),需恢复才能用
|
|
14
|
+
* - terminated : 已结束销毁
|
|
15
|
+
*/
|
|
16
|
+
export declare const SessionStatus: z.ZodEnum<["idle", "running", "paused", "terminated"]>;
|
|
17
|
+
export type SessionStatus = z.infer<typeof SessionStatus>;
|
|
18
|
+
/**
|
|
19
|
+
* 上下文条目 —— 用于 initialContext / inject。
|
|
20
|
+
* 设计成「角色 + 文本」的最小通用形态,具体 adapter 自行翻译成原生格式。
|
|
21
|
+
*/
|
|
22
|
+
export declare const ContextItem: z.ZodObject<{
|
|
23
|
+
role: z.ZodEnum<["system", "user", "assistant"]>;
|
|
24
|
+
content: z.ZodString;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
role: "system" | "user" | "assistant";
|
|
27
|
+
content: string;
|
|
28
|
+
}, {
|
|
29
|
+
role: "system" | "user" | "assistant";
|
|
30
|
+
content: string;
|
|
31
|
+
}>;
|
|
32
|
+
export type ContextItem = z.infer<typeof ContextItem>;
|
|
33
|
+
export declare const SessionCreateParams: z.ZodObject<{
|
|
34
|
+
/** 可选:幂等键(P0-3,断线重发去重)。 */
|
|
35
|
+
clientRequestId: z.ZodOptional<z.ZodString>;
|
|
36
|
+
/** 必填:绑定的项目(所有 session 必须有项目目录,D23)。 */
|
|
37
|
+
project: z.ZodBranded<z.ZodString, "ProjectId">;
|
|
38
|
+
/** 可选:跑在哪个 worktree(缺省用项目主工作区,D25)。 */
|
|
39
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
40
|
+
/** 必填:绑定的 agent(来自 discovery 的 agentId)。 */
|
|
41
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
42
|
+
/** 必填:绑定的模型(必须在该 agent 的可用模型列表内)。 */
|
|
43
|
+
model: z.ZodString;
|
|
44
|
+
/** 透传给 adapter 的 agent 私有配置(cwd、工具白名单、thinking 等)。 */
|
|
45
|
+
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
46
|
+
/** 初始上下文设置(system prompt / 预置对话)。 */
|
|
47
|
+
initialContext: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
48
|
+
role: z.ZodEnum<["system", "user", "assistant"]>;
|
|
49
|
+
content: z.ZodString;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
role: "system" | "user" | "assistant";
|
|
52
|
+
content: string;
|
|
53
|
+
}, {
|
|
54
|
+
role: "system" | "user" | "assistant";
|
|
55
|
+
content: string;
|
|
56
|
+
}>, "many">>;
|
|
57
|
+
/** 默认返回详细度,send 可覆盖。默认 messages。 */
|
|
58
|
+
verbosity: z.ZodDefault<z.ZodEnum<["final", "messages", "tools", "trace"]>>;
|
|
59
|
+
/** 可选:调用方自带的标签,便于服务端侧对账(phonon 原样回显)。 */
|
|
60
|
+
clientTag: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
agent: string & z.BRAND<"AgentId">;
|
|
63
|
+
project: string & z.BRAND<"ProjectId">;
|
|
64
|
+
model: string;
|
|
65
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
66
|
+
clientRequestId?: string | undefined;
|
|
67
|
+
worktreeId?: string | undefined;
|
|
68
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
69
|
+
initialContext?: {
|
|
70
|
+
role: "system" | "user" | "assistant";
|
|
71
|
+
content: string;
|
|
72
|
+
}[] | undefined;
|
|
73
|
+
clientTag?: string | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
agent: string;
|
|
76
|
+
project: string;
|
|
77
|
+
model: string;
|
|
78
|
+
clientRequestId?: string | undefined;
|
|
79
|
+
worktreeId?: string | undefined;
|
|
80
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
81
|
+
initialContext?: {
|
|
82
|
+
role: "system" | "user" | "assistant";
|
|
83
|
+
content: string;
|
|
84
|
+
}[] | undefined;
|
|
85
|
+
verbosity?: "final" | "messages" | "tools" | "trace" | undefined;
|
|
86
|
+
clientTag?: string | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
export type SessionCreateParams = z.infer<typeof SessionCreateParams>;
|
|
89
|
+
export declare const SessionCreateResult: z.ZodObject<{
|
|
90
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
91
|
+
/** 回显绑定身份,方便调用方确认。 */
|
|
92
|
+
project: z.ZodBranded<z.ZodString, "ProjectId">;
|
|
93
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
94
|
+
model: z.ZodString;
|
|
95
|
+
status: z.ZodEnum<["idle", "running", "paused", "terminated"]>;
|
|
96
|
+
createdAt: z.ZodString;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
99
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
100
|
+
agent: string & z.BRAND<"AgentId">;
|
|
101
|
+
project: string & z.BRAND<"ProjectId">;
|
|
102
|
+
model: string;
|
|
103
|
+
createdAt: string;
|
|
104
|
+
}, {
|
|
105
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
106
|
+
sessionId: string;
|
|
107
|
+
agent: string;
|
|
108
|
+
project: string;
|
|
109
|
+
model: string;
|
|
110
|
+
createdAt: string;
|
|
111
|
+
}>;
|
|
112
|
+
export type SessionCreateResult = z.infer<typeof SessionCreateResult>;
|
|
113
|
+
/**
|
|
114
|
+
* 忙碌处理模式(D18)—— 新消息进来时上一轮还没结束怎么办:
|
|
115
|
+
* - queue :等待,上一轮结束后自动发送积压消息(默认,最安全)。
|
|
116
|
+
* - interrupt:中断当前 turn(session 存活),再发新消息;需 capability.interrupt。
|
|
117
|
+
* - inject :不中断,在下一次 tool call 边界插入输入让 agent 接着处理;
|
|
118
|
+
* 需 capability.injectMidTurn(agent 原生接口或通过 hook 实现)。
|
|
119
|
+
* 不论哪种模式,**消息不丢**:要么按序送达、要么明确拒绝并告知原因。
|
|
120
|
+
*/
|
|
121
|
+
export declare const WhenBusy: z.ZodEnum<["queue", "interrupt", "inject"]>;
|
|
122
|
+
export type WhenBusy = z.infer<typeof WhenBusy>;
|
|
123
|
+
export declare const SessionSendParams: z.ZodObject<{
|
|
124
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
125
|
+
/** 用户输入 / 任务内容。 */
|
|
126
|
+
input: z.ZodString;
|
|
127
|
+
/**
|
|
128
|
+
* 可选:幂等键(P0-3)。服务端断线重发同一 send 时带相同值,
|
|
129
|
+
* phonon 去重,避免 agent 收两遍同样消息;重复回 `errDuplicateRequest` 或原 turnId。
|
|
130
|
+
*/
|
|
131
|
+
clientRequestId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
/**
|
|
133
|
+
* 可选:本轮指定要用的 skill(D26)。每项可是简单名字(string),
|
|
134
|
+
* 或结构体 {name,version?,scope?,force?}(P2-12,消除同名 global/project 歧义)。
|
|
135
|
+
* phonon 保证:(1) skill 在 agent 能访问到的位置;(2) 上下文注入强制加载指令。
|
|
136
|
+
* 优先级:send 指定 > project skill > global skill。
|
|
137
|
+
*/
|
|
138
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
version: z.ZodOptional<z.ZodString>;
|
|
141
|
+
scope: z.ZodOptional<z.ZodEnum<["global", "project"]>>;
|
|
142
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
name: string;
|
|
145
|
+
version?: string | undefined;
|
|
146
|
+
scope?: "project" | "global" | undefined;
|
|
147
|
+
force?: boolean | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
name: string;
|
|
150
|
+
version?: string | undefined;
|
|
151
|
+
scope?: "project" | "global" | undefined;
|
|
152
|
+
force?: boolean | undefined;
|
|
153
|
+
}>]>, "many">>;
|
|
154
|
+
/** 可选:覆盖本轮详细度。 */
|
|
155
|
+
verbosity: z.ZodOptional<z.ZodEnum<["final", "messages", "tools", "trace"]>>;
|
|
156
|
+
/**
|
|
157
|
+
* 忙碌时的处理模式(D18)。缺省 queue。
|
|
158
|
+
* 若选的模式该 agent 不支持(看 capability)且未设 fallback → errCapabilityUnsupported。
|
|
159
|
+
*/
|
|
160
|
+
whenBusy: z.ZodDefault<z.ZodEnum<["queue", "interrupt", "inject"]>>;
|
|
161
|
+
/**
|
|
162
|
+
* 可选:降级模式(P1-11)。当 whenBusy 该 agent 不支持时,不报错而自动降级为它,
|
|
163
|
+
* 保证自动化编排连贯。如 whenBusy="inject", fallback="queue"。
|
|
164
|
+
*/
|
|
165
|
+
fallback: z.ZodOptional<z.ZodEnum<["queue", "interrupt", "inject"]>>;
|
|
166
|
+
/**
|
|
167
|
+
* 可选:本轮关联 id。phonon 会把该轮所有 stream.event 标上同一 turnId,
|
|
168
|
+
* 调用方据此聚合流式输出。缺省由 phonon 生成并在 ack 中返回。
|
|
169
|
+
*/
|
|
170
|
+
turnId: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
173
|
+
input: string;
|
|
174
|
+
whenBusy: "interrupt" | "queue" | "inject";
|
|
175
|
+
clientRequestId?: string | undefined;
|
|
176
|
+
verbosity?: "final" | "messages" | "tools" | "trace" | undefined;
|
|
177
|
+
skills?: (string | {
|
|
178
|
+
name: string;
|
|
179
|
+
version?: string | undefined;
|
|
180
|
+
scope?: "project" | "global" | undefined;
|
|
181
|
+
force?: boolean | undefined;
|
|
182
|
+
})[] | undefined;
|
|
183
|
+
fallback?: "interrupt" | "queue" | "inject" | undefined;
|
|
184
|
+
turnId?: string | undefined;
|
|
185
|
+
}, {
|
|
186
|
+
sessionId: string;
|
|
187
|
+
input: string;
|
|
188
|
+
clientRequestId?: string | undefined;
|
|
189
|
+
verbosity?: "final" | "messages" | "tools" | "trace" | undefined;
|
|
190
|
+
skills?: (string | {
|
|
191
|
+
name: string;
|
|
192
|
+
version?: string | undefined;
|
|
193
|
+
scope?: "project" | "global" | undefined;
|
|
194
|
+
force?: boolean | undefined;
|
|
195
|
+
})[] | undefined;
|
|
196
|
+
whenBusy?: "interrupt" | "queue" | "inject" | undefined;
|
|
197
|
+
fallback?: "interrupt" | "queue" | "inject" | undefined;
|
|
198
|
+
turnId?: string | undefined;
|
|
199
|
+
}>;
|
|
200
|
+
export type SessionSendParams = z.infer<typeof SessionSendParams>;
|
|
201
|
+
/** send 的同步 ack(真正的内容走 stream.event 异步推)。 */
|
|
202
|
+
export declare const SessionSendAck: z.ZodObject<{
|
|
203
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
204
|
+
turnId: z.ZodString;
|
|
205
|
+
accepted: z.ZodLiteral<true>;
|
|
206
|
+
/**
|
|
207
|
+
* 本次 send 的实际处由:
|
|
208
|
+
* - started :立即开始执行(session 空闲)
|
|
209
|
+
* - queued :已排队(whenBusy=queue 且正忙)
|
|
210
|
+
* - interrupted:已中断上一轮并开始本轮(whenBusy=interrupt)
|
|
211
|
+
* - injected :将在下一 tool call 边界插入(whenBusy=inject)
|
|
212
|
+
*/
|
|
213
|
+
disposition: z.ZodEnum<["started", "queued", "interrupted", "injected"]>;
|
|
214
|
+
/** queued 时的队列位置(从 1 起)。 */
|
|
215
|
+
queuePosition: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
}, "strip", z.ZodTypeAny, {
|
|
217
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
218
|
+
turnId: string;
|
|
219
|
+
accepted: true;
|
|
220
|
+
disposition: "started" | "queued" | "interrupted" | "injected";
|
|
221
|
+
queuePosition?: number | undefined;
|
|
222
|
+
}, {
|
|
223
|
+
sessionId: string;
|
|
224
|
+
turnId: string;
|
|
225
|
+
accepted: true;
|
|
226
|
+
disposition: "started" | "queued" | "interrupted" | "injected";
|
|
227
|
+
queuePosition?: number | undefined;
|
|
228
|
+
}>;
|
|
229
|
+
export type SessionSendAck = z.infer<typeof SessionSendAck>;
|
|
230
|
+
export declare const SessionInterruptParams: z.ZodObject<{
|
|
231
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
232
|
+
/** 可选:中断原因(传给 agent / 记录)。 */
|
|
233
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
236
|
+
reason?: string | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
sessionId: string;
|
|
239
|
+
reason?: string | undefined;
|
|
240
|
+
}>;
|
|
241
|
+
export type SessionInterruptParams = z.infer<typeof SessionInterruptParams>;
|
|
242
|
+
export declare const SessionInterruptResult: z.ZodObject<{
|
|
243
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
244
|
+
/** 被中断的 turn(若当时有在跑的)。 */
|
|
245
|
+
interruptedTurnId: z.ZodOptional<z.ZodString>;
|
|
246
|
+
/** 中断后 session 状态(通常回到 active 空闲)。 */
|
|
247
|
+
status: z.ZodEnum<["idle", "running", "paused", "terminated"]>;
|
|
248
|
+
}, "strip", z.ZodTypeAny, {
|
|
249
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
250
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
251
|
+
interruptedTurnId?: string | undefined;
|
|
252
|
+
}, {
|
|
253
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
254
|
+
sessionId: string;
|
|
255
|
+
interruptedTurnId?: string | undefined;
|
|
256
|
+
}>;
|
|
257
|
+
export type SessionInterruptResult = z.infer<typeof SessionInterruptResult>;
|
|
258
|
+
export declare const SessionInjectParams: z.ZodObject<{
|
|
259
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
260
|
+
context: z.ZodArray<z.ZodObject<{
|
|
261
|
+
role: z.ZodEnum<["system", "user", "assistant"]>;
|
|
262
|
+
content: z.ZodString;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
role: "system" | "user" | "assistant";
|
|
265
|
+
content: string;
|
|
266
|
+
}, {
|
|
267
|
+
role: "system" | "user" | "assistant";
|
|
268
|
+
content: string;
|
|
269
|
+
}>, "many">;
|
|
270
|
+
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
272
|
+
context: {
|
|
273
|
+
role: "system" | "user" | "assistant";
|
|
274
|
+
content: string;
|
|
275
|
+
}[];
|
|
276
|
+
}, {
|
|
277
|
+
sessionId: string;
|
|
278
|
+
context: {
|
|
279
|
+
role: "system" | "user" | "assistant";
|
|
280
|
+
content: string;
|
|
281
|
+
}[];
|
|
282
|
+
}>;
|
|
283
|
+
export type SessionInjectParams = z.infer<typeof SessionInjectParams>;
|
|
284
|
+
export declare const SessionInjectResult: z.ZodObject<{
|
|
285
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
286
|
+
injected: z.ZodNumber;
|
|
287
|
+
}, "strip", z.ZodTypeAny, {
|
|
288
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
289
|
+
injected: number;
|
|
290
|
+
}, {
|
|
291
|
+
sessionId: string;
|
|
292
|
+
injected: number;
|
|
293
|
+
}>;
|
|
294
|
+
export type SessionInjectResult = z.infer<typeof SessionInjectResult>;
|
|
295
|
+
export declare const CompressMode: z.ZodEnum<["native", "custom"]>;
|
|
296
|
+
export type CompressMode = z.infer<typeof CompressMode>;
|
|
297
|
+
export declare const SessionCompressParams: z.ZodObject<{
|
|
298
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
299
|
+
/** native = 透传 agent 原生压缩;custom = phonon 自有压缩引擎。 */
|
|
300
|
+
mode: z.ZodEnum<["native", "custom"]>;
|
|
301
|
+
/**
|
|
302
|
+
* custom 模式下的策略名(P2-15)。**server-private:phonon 不做协议层枚举校验**,
|
|
303
|
+
* 透传给 adapter/压缩引擎自行解释(如 summary / truncate_keep_recent)。
|
|
304
|
+
*/
|
|
305
|
+
strategy: z.ZodOptional<z.ZodString>;
|
|
306
|
+
/** dropToolIO 策略:保留最近 N 个 tool call 及其 result,默认 3。 */
|
|
307
|
+
keepRecentToolCalls: z.ZodOptional<z.ZodNumber>;
|
|
308
|
+
}, "strip", z.ZodTypeAny, {
|
|
309
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
310
|
+
mode: "custom" | "native";
|
|
311
|
+
strategy?: string | undefined;
|
|
312
|
+
keepRecentToolCalls?: number | undefined;
|
|
313
|
+
}, {
|
|
314
|
+
sessionId: string;
|
|
315
|
+
mode: "custom" | "native";
|
|
316
|
+
strategy?: string | undefined;
|
|
317
|
+
keepRecentToolCalls?: number | undefined;
|
|
318
|
+
}>;
|
|
319
|
+
export type SessionCompressParams = z.infer<typeof SessionCompressParams>;
|
|
320
|
+
export declare const SessionCompressResult: z.ZodObject<{
|
|
321
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
322
|
+
mode: z.ZodEnum<["native", "custom"]>;
|
|
323
|
+
/** 压缩前后的 token 估算(若可得)。 */
|
|
324
|
+
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
325
|
+
tokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
326
|
+
/** 简短摘要/说明。 */
|
|
327
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
328
|
+
}, "strip", z.ZodTypeAny, {
|
|
329
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
330
|
+
mode: "custom" | "native";
|
|
331
|
+
tokensBefore?: number | undefined;
|
|
332
|
+
tokensAfter?: number | undefined;
|
|
333
|
+
summary?: string | undefined;
|
|
334
|
+
}, {
|
|
335
|
+
sessionId: string;
|
|
336
|
+
mode: "custom" | "native";
|
|
337
|
+
tokensBefore?: number | undefined;
|
|
338
|
+
tokensAfter?: number | undefined;
|
|
339
|
+
summary?: string | undefined;
|
|
340
|
+
}>;
|
|
341
|
+
export type SessionCompressResult = z.infer<typeof SessionCompressResult>;
|
|
342
|
+
export declare const SessionTerminateParams: z.ZodObject<{
|
|
343
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
344
|
+
/**
|
|
345
|
+
* 可选:销毁会话时顺手清理其专用 worktree(P1-10)。
|
|
346
|
+
* 仅当该 session 跑在一个专为它建的 worktree 上才生效;主工作区不清。
|
|
347
|
+
*/
|
|
348
|
+
cleanWorktree: z.ZodDefault<z.ZodBoolean>;
|
|
349
|
+
}, "strip", z.ZodTypeAny, {
|
|
350
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
351
|
+
cleanWorktree: boolean;
|
|
352
|
+
}, {
|
|
353
|
+
sessionId: string;
|
|
354
|
+
cleanWorktree?: boolean | undefined;
|
|
355
|
+
}>;
|
|
356
|
+
export type SessionTerminateParams = z.infer<typeof SessionTerminateParams>;
|
|
357
|
+
export declare const SessionTerminateResult: z.ZodObject<{
|
|
358
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
359
|
+
status: z.ZodLiteral<"terminated">;
|
|
360
|
+
/** 若 cleanWorktree 且确实清了,返回被清理的 worktreeId。 */
|
|
361
|
+
cleanedWorktreeId: z.ZodOptional<z.ZodString>;
|
|
362
|
+
}, "strip", z.ZodTypeAny, {
|
|
363
|
+
status: "terminated";
|
|
364
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
365
|
+
cleanedWorktreeId?: string | undefined;
|
|
366
|
+
}, {
|
|
367
|
+
status: "terminated";
|
|
368
|
+
sessionId: string;
|
|
369
|
+
cleanedWorktreeId?: string | undefined;
|
|
370
|
+
}>;
|
|
371
|
+
export type SessionTerminateResult = z.infer<typeof SessionTerminateResult>;
|
|
372
|
+
export declare const SessionSwitchModelParams: z.ZodObject<{
|
|
373
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
374
|
+
/** 新模型,必须在该 session 绑定 agent 的可用模型列表内。 */
|
|
375
|
+
model: z.ZodString;
|
|
376
|
+
/**
|
|
377
|
+
* running 时的策略(P1-8):
|
|
378
|
+
* - reject(默认) :running 时拒绝切换,避免 adapter 状态不一致
|
|
379
|
+
* - afterCurrentTurn:等当前 turn 结束后再切
|
|
380
|
+
* - interrupt :打断当前 turn 立即切
|
|
381
|
+
* idle 时忽略此参数,直接切。
|
|
382
|
+
*/
|
|
383
|
+
whenRunning: z.ZodDefault<z.ZodEnum<["reject", "afterCurrentTurn", "interrupt"]>>;
|
|
384
|
+
}, "strip", z.ZodTypeAny, {
|
|
385
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
386
|
+
model: string;
|
|
387
|
+
whenRunning: "interrupt" | "reject" | "afterCurrentTurn";
|
|
388
|
+
}, {
|
|
389
|
+
sessionId: string;
|
|
390
|
+
model: string;
|
|
391
|
+
whenRunning?: "interrupt" | "reject" | "afterCurrentTurn" | undefined;
|
|
392
|
+
}>;
|
|
393
|
+
export type SessionSwitchModelParams = z.infer<typeof SessionSwitchModelParams>;
|
|
394
|
+
export declare const SessionSwitchModelResult: z.ZodObject<{
|
|
395
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
396
|
+
/** 切换前的模型(便于调用方记录/回滚)。 */
|
|
397
|
+
previousModel: z.ZodString;
|
|
398
|
+
model: z.ZodString;
|
|
399
|
+
/**
|
|
400
|
+
* 可选警告(P1-8 / Minimax):adapter 发现潜在不兼容(系统提示格式/tool schema 变化)
|
|
401
|
+
* 时填入,server 据此决定是否继续。
|
|
402
|
+
*/
|
|
403
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
404
|
+
/** 若 whenRunning=afterCurrentTurn 且当时 running,表示已排期未立即生效。 */
|
|
405
|
+
deferred: z.ZodOptional<z.ZodBoolean>;
|
|
406
|
+
}, "strip", z.ZodTypeAny, {
|
|
407
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
408
|
+
model: string;
|
|
409
|
+
previousModel: string;
|
|
410
|
+
warnings?: string[] | undefined;
|
|
411
|
+
deferred?: boolean | undefined;
|
|
412
|
+
}, {
|
|
413
|
+
sessionId: string;
|
|
414
|
+
model: string;
|
|
415
|
+
previousModel: string;
|
|
416
|
+
warnings?: string[] | undefined;
|
|
417
|
+
deferred?: boolean | undefined;
|
|
418
|
+
}>;
|
|
419
|
+
export type SessionSwitchModelResult = z.infer<typeof SessionSwitchModelResult>;
|
|
420
|
+
export declare const SessionMeta: z.ZodObject<{
|
|
421
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
422
|
+
/** 绑定的项目(一等身份,D23)。 */
|
|
423
|
+
project: z.ZodBranded<z.ZodString, "ProjectId">;
|
|
424
|
+
/** 绑定的 agent 身份,全程携带。 */
|
|
425
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
426
|
+
model: z.ZodString;
|
|
427
|
+
status: z.ZodEnum<["idle", "running", "paused", "terminated"]>;
|
|
428
|
+
/** 当 status=running 时,正在执行的 turnId(服务端据此知道「在跑哪一轮」)。 */
|
|
429
|
+
currentTurnId: z.ZodOptional<z.ZodString>;
|
|
430
|
+
/** 队列中等待的 send 数(whenBusy=queue 积压,D18)。 */
|
|
431
|
+
queuedCount: z.ZodOptional<z.ZodNumber>;
|
|
432
|
+
/**
|
|
433
|
+
* 上下文信息(D33)——adapter 能提供时填,便于 server 监控上下文压力。
|
|
434
|
+
*/
|
|
435
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
436
|
+
/** 上下文窗口总容量(token)。 */
|
|
437
|
+
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
438
|
+
/** 已用上下文(token,若可估)。 */
|
|
439
|
+
usedTokens: z.ZodOptional<z.ZodNumber>;
|
|
440
|
+
/** 已用上下文占比 0-100。 */
|
|
441
|
+
usagePercent: z.ZodOptional<z.ZodNumber>;
|
|
442
|
+
/** 已发生的压缩次数。 */
|
|
443
|
+
compactions: z.ZodOptional<z.ZodNumber>;
|
|
444
|
+
}, "strip", z.ZodTypeAny, {
|
|
445
|
+
contextWindow?: number | undefined;
|
|
446
|
+
usedTokens?: number | undefined;
|
|
447
|
+
usagePercent?: number | undefined;
|
|
448
|
+
compactions?: number | undefined;
|
|
449
|
+
}, {
|
|
450
|
+
contextWindow?: number | undefined;
|
|
451
|
+
usedTokens?: number | undefined;
|
|
452
|
+
usagePercent?: number | undefined;
|
|
453
|
+
compactions?: number | undefined;
|
|
454
|
+
}>>;
|
|
455
|
+
verbosity: z.ZodEnum<["final", "messages", "tools", "trace"]>;
|
|
456
|
+
clientTag: z.ZodOptional<z.ZodString>;
|
|
457
|
+
createdAt: z.ZodString;
|
|
458
|
+
lastActiveAt: z.ZodOptional<z.ZodString>;
|
|
459
|
+
}, "strip", z.ZodTypeAny, {
|
|
460
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
461
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
462
|
+
agent: string & z.BRAND<"AgentId">;
|
|
463
|
+
project: string & z.BRAND<"ProjectId">;
|
|
464
|
+
model: string;
|
|
465
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
466
|
+
createdAt: string;
|
|
467
|
+
clientTag?: string | undefined;
|
|
468
|
+
context?: {
|
|
469
|
+
contextWindow?: number | undefined;
|
|
470
|
+
usedTokens?: number | undefined;
|
|
471
|
+
usagePercent?: number | undefined;
|
|
472
|
+
compactions?: number | undefined;
|
|
473
|
+
} | undefined;
|
|
474
|
+
currentTurnId?: string | undefined;
|
|
475
|
+
queuedCount?: number | undefined;
|
|
476
|
+
lastActiveAt?: string | undefined;
|
|
477
|
+
}, {
|
|
478
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
479
|
+
sessionId: string;
|
|
480
|
+
agent: string;
|
|
481
|
+
project: string;
|
|
482
|
+
model: string;
|
|
483
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
484
|
+
createdAt: string;
|
|
485
|
+
clientTag?: string | undefined;
|
|
486
|
+
context?: {
|
|
487
|
+
contextWindow?: number | undefined;
|
|
488
|
+
usedTokens?: number | undefined;
|
|
489
|
+
usagePercent?: number | undefined;
|
|
490
|
+
compactions?: number | undefined;
|
|
491
|
+
} | undefined;
|
|
492
|
+
currentTurnId?: string | undefined;
|
|
493
|
+
queuedCount?: number | undefined;
|
|
494
|
+
lastActiveAt?: string | undefined;
|
|
495
|
+
}>;
|
|
496
|
+
export type SessionMeta = z.infer<typeof SessionMeta>;
|
|
497
|
+
export declare const SessionStatusParams: z.ZodObject<{
|
|
498
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
499
|
+
}, "strip", z.ZodTypeAny, {
|
|
500
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
501
|
+
}, {
|
|
502
|
+
sessionId: string;
|
|
503
|
+
}>;
|
|
504
|
+
export type SessionStatusParams = z.infer<typeof SessionStatusParams>;
|
|
505
|
+
export declare const SessionStatusResult: z.ZodObject<{
|
|
506
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
507
|
+
/** 绑定的项目(一等身份,D23)。 */
|
|
508
|
+
project: z.ZodBranded<z.ZodString, "ProjectId">;
|
|
509
|
+
/** 绑定的 agent 身份,全程携带。 */
|
|
510
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
511
|
+
model: z.ZodString;
|
|
512
|
+
status: z.ZodEnum<["idle", "running", "paused", "terminated"]>;
|
|
513
|
+
/** 当 status=running 时,正在执行的 turnId(服务端据此知道「在跑哪一轮」)。 */
|
|
514
|
+
currentTurnId: z.ZodOptional<z.ZodString>;
|
|
515
|
+
/** 队列中等待的 send 数(whenBusy=queue 积压,D18)。 */
|
|
516
|
+
queuedCount: z.ZodOptional<z.ZodNumber>;
|
|
517
|
+
/**
|
|
518
|
+
* 上下文信息(D33)——adapter 能提供时填,便于 server 监控上下文压力。
|
|
519
|
+
*/
|
|
520
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
521
|
+
/** 上下文窗口总容量(token)。 */
|
|
522
|
+
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
523
|
+
/** 已用上下文(token,若可估)。 */
|
|
524
|
+
usedTokens: z.ZodOptional<z.ZodNumber>;
|
|
525
|
+
/** 已用上下文占比 0-100。 */
|
|
526
|
+
usagePercent: z.ZodOptional<z.ZodNumber>;
|
|
527
|
+
/** 已发生的压缩次数。 */
|
|
528
|
+
compactions: z.ZodOptional<z.ZodNumber>;
|
|
529
|
+
}, "strip", z.ZodTypeAny, {
|
|
530
|
+
contextWindow?: number | undefined;
|
|
531
|
+
usedTokens?: number | undefined;
|
|
532
|
+
usagePercent?: number | undefined;
|
|
533
|
+
compactions?: number | undefined;
|
|
534
|
+
}, {
|
|
535
|
+
contextWindow?: number | undefined;
|
|
536
|
+
usedTokens?: number | undefined;
|
|
537
|
+
usagePercent?: number | undefined;
|
|
538
|
+
compactions?: number | undefined;
|
|
539
|
+
}>>;
|
|
540
|
+
verbosity: z.ZodEnum<["final", "messages", "tools", "trace"]>;
|
|
541
|
+
clientTag: z.ZodOptional<z.ZodString>;
|
|
542
|
+
createdAt: z.ZodString;
|
|
543
|
+
lastActiveAt: z.ZodOptional<z.ZodString>;
|
|
544
|
+
}, "strip", z.ZodTypeAny, {
|
|
545
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
546
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
547
|
+
agent: string & z.BRAND<"AgentId">;
|
|
548
|
+
project: string & z.BRAND<"ProjectId">;
|
|
549
|
+
model: string;
|
|
550
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
551
|
+
createdAt: string;
|
|
552
|
+
clientTag?: string | undefined;
|
|
553
|
+
context?: {
|
|
554
|
+
contextWindow?: number | undefined;
|
|
555
|
+
usedTokens?: number | undefined;
|
|
556
|
+
usagePercent?: number | undefined;
|
|
557
|
+
compactions?: number | undefined;
|
|
558
|
+
} | undefined;
|
|
559
|
+
currentTurnId?: string | undefined;
|
|
560
|
+
queuedCount?: number | undefined;
|
|
561
|
+
lastActiveAt?: string | undefined;
|
|
562
|
+
}, {
|
|
563
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
564
|
+
sessionId: string;
|
|
565
|
+
agent: string;
|
|
566
|
+
project: string;
|
|
567
|
+
model: string;
|
|
568
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
569
|
+
createdAt: string;
|
|
570
|
+
clientTag?: string | undefined;
|
|
571
|
+
context?: {
|
|
572
|
+
contextWindow?: number | undefined;
|
|
573
|
+
usedTokens?: number | undefined;
|
|
574
|
+
usagePercent?: number | undefined;
|
|
575
|
+
compactions?: number | undefined;
|
|
576
|
+
} | undefined;
|
|
577
|
+
currentTurnId?: string | undefined;
|
|
578
|
+
queuedCount?: number | undefined;
|
|
579
|
+
lastActiveAt?: string | undefined;
|
|
580
|
+
}>;
|
|
581
|
+
export type SessionStatusResult = z.infer<typeof SessionStatusResult>;
|
|
582
|
+
export declare const SessionListParams: z.ZodObject<{
|
|
583
|
+
/** 可选:按项目过滤。 */
|
|
584
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
585
|
+
/** 可选:按 agent 过滤。 */
|
|
586
|
+
agent: z.ZodOptional<z.ZodBranded<z.ZodString, "AgentId">>;
|
|
587
|
+
/** 可选:按状态过滤。 */
|
|
588
|
+
status: z.ZodOptional<z.ZodEnum<["idle", "running", "paused", "terminated"]>>;
|
|
589
|
+
/** 可选:分页上限(P2-14)。 */
|
|
590
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
591
|
+
/** 可选:分页游标(上一页返回的 nextCursor)。 */
|
|
592
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
593
|
+
}, "strip", z.ZodTypeAny, {
|
|
594
|
+
status?: "idle" | "running" | "paused" | "terminated" | undefined;
|
|
595
|
+
agent?: (string & z.BRAND<"AgentId">) | undefined;
|
|
596
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
597
|
+
limit?: number | undefined;
|
|
598
|
+
cursor?: string | undefined;
|
|
599
|
+
}, {
|
|
600
|
+
status?: "idle" | "running" | "paused" | "terminated" | undefined;
|
|
601
|
+
agent?: string | undefined;
|
|
602
|
+
project?: string | undefined;
|
|
603
|
+
limit?: number | undefined;
|
|
604
|
+
cursor?: string | undefined;
|
|
605
|
+
}>;
|
|
606
|
+
export type SessionListParams = z.infer<typeof SessionListParams>;
|
|
607
|
+
export declare const SessionListResult: z.ZodObject<{
|
|
608
|
+
sessions: z.ZodArray<z.ZodObject<{
|
|
609
|
+
sessionId: z.ZodBranded<z.ZodString, "SessionId">;
|
|
610
|
+
/** 绑定的项目(一等身份,D23)。 */
|
|
611
|
+
project: z.ZodBranded<z.ZodString, "ProjectId">;
|
|
612
|
+
/** 绑定的 agent 身份,全程携带。 */
|
|
613
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
614
|
+
model: z.ZodString;
|
|
615
|
+
status: z.ZodEnum<["idle", "running", "paused", "terminated"]>;
|
|
616
|
+
/** 当 status=running 时,正在执行的 turnId(服务端据此知道「在跑哪一轮」)。 */
|
|
617
|
+
currentTurnId: z.ZodOptional<z.ZodString>;
|
|
618
|
+
/** 队列中等待的 send 数(whenBusy=queue 积压,D18)。 */
|
|
619
|
+
queuedCount: z.ZodOptional<z.ZodNumber>;
|
|
620
|
+
/**
|
|
621
|
+
* 上下文信息(D33)——adapter 能提供时填,便于 server 监控上下文压力。
|
|
622
|
+
*/
|
|
623
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
624
|
+
/** 上下文窗口总容量(token)。 */
|
|
625
|
+
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
626
|
+
/** 已用上下文(token,若可估)。 */
|
|
627
|
+
usedTokens: z.ZodOptional<z.ZodNumber>;
|
|
628
|
+
/** 已用上下文占比 0-100。 */
|
|
629
|
+
usagePercent: z.ZodOptional<z.ZodNumber>;
|
|
630
|
+
/** 已发生的压缩次数。 */
|
|
631
|
+
compactions: z.ZodOptional<z.ZodNumber>;
|
|
632
|
+
}, "strip", z.ZodTypeAny, {
|
|
633
|
+
contextWindow?: number | undefined;
|
|
634
|
+
usedTokens?: number | undefined;
|
|
635
|
+
usagePercent?: number | undefined;
|
|
636
|
+
compactions?: number | undefined;
|
|
637
|
+
}, {
|
|
638
|
+
contextWindow?: number | undefined;
|
|
639
|
+
usedTokens?: number | undefined;
|
|
640
|
+
usagePercent?: number | undefined;
|
|
641
|
+
compactions?: number | undefined;
|
|
642
|
+
}>>;
|
|
643
|
+
verbosity: z.ZodEnum<["final", "messages", "tools", "trace"]>;
|
|
644
|
+
clientTag: z.ZodOptional<z.ZodString>;
|
|
645
|
+
createdAt: z.ZodString;
|
|
646
|
+
lastActiveAt: z.ZodOptional<z.ZodString>;
|
|
647
|
+
}, "strip", z.ZodTypeAny, {
|
|
648
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
649
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
650
|
+
agent: string & z.BRAND<"AgentId">;
|
|
651
|
+
project: string & z.BRAND<"ProjectId">;
|
|
652
|
+
model: string;
|
|
653
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
654
|
+
createdAt: string;
|
|
655
|
+
clientTag?: string | undefined;
|
|
656
|
+
context?: {
|
|
657
|
+
contextWindow?: number | undefined;
|
|
658
|
+
usedTokens?: number | undefined;
|
|
659
|
+
usagePercent?: number | undefined;
|
|
660
|
+
compactions?: number | undefined;
|
|
661
|
+
} | undefined;
|
|
662
|
+
currentTurnId?: string | undefined;
|
|
663
|
+
queuedCount?: number | undefined;
|
|
664
|
+
lastActiveAt?: string | undefined;
|
|
665
|
+
}, {
|
|
666
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
667
|
+
sessionId: string;
|
|
668
|
+
agent: string;
|
|
669
|
+
project: string;
|
|
670
|
+
model: string;
|
|
671
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
672
|
+
createdAt: string;
|
|
673
|
+
clientTag?: string | undefined;
|
|
674
|
+
context?: {
|
|
675
|
+
contextWindow?: number | undefined;
|
|
676
|
+
usedTokens?: number | undefined;
|
|
677
|
+
usagePercent?: number | undefined;
|
|
678
|
+
compactions?: number | undefined;
|
|
679
|
+
} | undefined;
|
|
680
|
+
currentTurnId?: string | undefined;
|
|
681
|
+
queuedCount?: number | undefined;
|
|
682
|
+
lastActiveAt?: string | undefined;
|
|
683
|
+
}>, "many">;
|
|
684
|
+
/** 下一页游标;缺省/null 表示已到末尾。 */
|
|
685
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
686
|
+
}, "strip", z.ZodTypeAny, {
|
|
687
|
+
sessions: {
|
|
688
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
689
|
+
sessionId: string & z.BRAND<"SessionId">;
|
|
690
|
+
agent: string & z.BRAND<"AgentId">;
|
|
691
|
+
project: string & z.BRAND<"ProjectId">;
|
|
692
|
+
model: string;
|
|
693
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
694
|
+
createdAt: string;
|
|
695
|
+
clientTag?: string | undefined;
|
|
696
|
+
context?: {
|
|
697
|
+
contextWindow?: number | undefined;
|
|
698
|
+
usedTokens?: number | undefined;
|
|
699
|
+
usagePercent?: number | undefined;
|
|
700
|
+
compactions?: number | undefined;
|
|
701
|
+
} | undefined;
|
|
702
|
+
currentTurnId?: string | undefined;
|
|
703
|
+
queuedCount?: number | undefined;
|
|
704
|
+
lastActiveAt?: string | undefined;
|
|
705
|
+
}[];
|
|
706
|
+
nextCursor?: string | undefined;
|
|
707
|
+
}, {
|
|
708
|
+
sessions: {
|
|
709
|
+
status: "idle" | "running" | "paused" | "terminated";
|
|
710
|
+
sessionId: string;
|
|
711
|
+
agent: string;
|
|
712
|
+
project: string;
|
|
713
|
+
model: string;
|
|
714
|
+
verbosity: "final" | "messages" | "tools" | "trace";
|
|
715
|
+
createdAt: string;
|
|
716
|
+
clientTag?: string | undefined;
|
|
717
|
+
context?: {
|
|
718
|
+
contextWindow?: number | undefined;
|
|
719
|
+
usedTokens?: number | undefined;
|
|
720
|
+
usagePercent?: number | undefined;
|
|
721
|
+
compactions?: number | undefined;
|
|
722
|
+
} | undefined;
|
|
723
|
+
currentTurnId?: string | undefined;
|
|
724
|
+
queuedCount?: number | undefined;
|
|
725
|
+
lastActiveAt?: string | undefined;
|
|
726
|
+
}[];
|
|
727
|
+
nextCursor?: string | undefined;
|
|
728
|
+
}>;
|
|
729
|
+
export type SessionListResult = z.infer<typeof SessionListResult>;
|
|
730
|
+
//# sourceMappingURL=session.d.ts.map
|