@bobannomi/client 0.0.0-stage → 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/README.md +146 -3
- package/dist/THIRD_PARTY_NOTICES.txt +93 -0
- package/dist/index.d.ts +2577 -0
- package/dist/index.js +4498 -0
- package/dist/index.js.map +6 -0
- package/dist/service.d.ts +49 -0
- package/dist/service.js +4918 -0
- package/dist/service.js.map +6 -0
- package/package.json +52 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2577 @@
|
|
|
1
|
+
type ContextBucketId = "system" | "tools" | "rules" | "skills" | "mcp" | "subagents" | "summary" | "conversation";
|
|
2
|
+
interface ContextUsageBucket {
|
|
3
|
+
id: ContextBucketId;
|
|
4
|
+
label: string;
|
|
5
|
+
tokens: number;
|
|
6
|
+
}
|
|
7
|
+
type ContextUsageTipCode = "near_full" | "overflow_after_model_switch" | "static_tools_heavy" | "conversation_omitted" | "partial_sources" | "media_unestimated" | "no_context_window" | "stale_or_rebuilt";
|
|
8
|
+
interface ContextUsageTip {
|
|
9
|
+
code: ContextUsageTipCode | (string & {});
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
interface ContextUsageSnapshot {
|
|
13
|
+
model: string;
|
|
14
|
+
contextWindow: number | null;
|
|
15
|
+
outputLimit?: number | null;
|
|
16
|
+
estimatedInputTokens: number;
|
|
17
|
+
percentFull: number | null;
|
|
18
|
+
estimator: "heuristic_v1";
|
|
19
|
+
buckets: ContextUsageBucket[];
|
|
20
|
+
tips: ContextUsageTip[];
|
|
21
|
+
computedAt: string;
|
|
22
|
+
source: "live_assembly" | "session_cache" | "static_only";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** JSON transported to an application; no runtime objects or host execution facts. */
|
|
26
|
+
type McpJsonValue = null | boolean | number | string | McpJsonValue[] | McpJsonObject;
|
|
27
|
+
interface McpJsonObject {
|
|
28
|
+
[key: string]: McpJsonValue;
|
|
29
|
+
}
|
|
30
|
+
interface McpCallResultData {
|
|
31
|
+
content: McpJsonObject[];
|
|
32
|
+
structuredContent?: McpJsonObject;
|
|
33
|
+
_meta?: McpJsonObject;
|
|
34
|
+
isError?: boolean;
|
|
35
|
+
[key: string]: McpJsonValue | undefined;
|
|
36
|
+
}
|
|
37
|
+
/** Copy bounded JSON without invoking toJSON/getters or silently dropping fields. */
|
|
38
|
+
declare function parseMcpCallResultData(value: unknown): McpCallResultData;
|
|
39
|
+
|
|
40
|
+
type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
41
|
+
[key: string]: JsonValue;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** How an agent explains findings and delivers results, independently of update timing. */
|
|
45
|
+
type ReplyStyle = "collaborative" | "direct" | "explanatory";
|
|
46
|
+
|
|
47
|
+
/** Application choices; none of these fields grants access to a resource. */
|
|
48
|
+
interface SessionConfigurationInput {
|
|
49
|
+
model?: {
|
|
50
|
+
provider: string;
|
|
51
|
+
model: string;
|
|
52
|
+
};
|
|
53
|
+
roleId?: string | null;
|
|
54
|
+
systemPrompt?: string | null;
|
|
55
|
+
executionInstructions?: {
|
|
56
|
+
revision: number;
|
|
57
|
+
content: string;
|
|
58
|
+
} | null;
|
|
59
|
+
effort?: string | null;
|
|
60
|
+
workMode?: "execute" | "plan";
|
|
61
|
+
maxTurns?: number;
|
|
62
|
+
sessionMode?: "direct" | "coordinator";
|
|
63
|
+
replyStyle?: ReplyStyle;
|
|
64
|
+
approvalMode?: "ask" | "auto_review" | "full_access";
|
|
65
|
+
tools?: {
|
|
66
|
+
allowed?: string[];
|
|
67
|
+
denied?: string[];
|
|
68
|
+
};
|
|
69
|
+
pluginsEnabled?: boolean;
|
|
70
|
+
pluginAutoSelectionEnabled?: boolean;
|
|
71
|
+
activePluginId?: string | null;
|
|
72
|
+
pluginIds?: string[];
|
|
73
|
+
serviceBindings?: string[];
|
|
74
|
+
memory?: {
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
interface ResolvedSessionConfiguration extends Required<Omit<SessionConfigurationInput, "tools">> {
|
|
79
|
+
tools: {
|
|
80
|
+
allowed: string[];
|
|
81
|
+
denied: string[];
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
interface ConfigureClientSessionInput {
|
|
85
|
+
requestId: string;
|
|
86
|
+
expectedRevision: number;
|
|
87
|
+
configuration: SessionConfigurationInput;
|
|
88
|
+
optionsRevision?: string;
|
|
89
|
+
}
|
|
90
|
+
interface SessionConfigurationSnapshot {
|
|
91
|
+
revision: number;
|
|
92
|
+
configuration: ResolvedSessionConfiguration;
|
|
93
|
+
configurationRoot: {
|
|
94
|
+
cwd: string;
|
|
95
|
+
settingsRoot: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface SessionConfigurationResultInput {
|
|
99
|
+
requestId: string;
|
|
100
|
+
original: ConfigureClientSessionInput;
|
|
101
|
+
}
|
|
102
|
+
interface CreateClientSessionInput$1 {
|
|
103
|
+
id?: string;
|
|
104
|
+
requestId?: string;
|
|
105
|
+
cwd: string;
|
|
106
|
+
projectId?: string;
|
|
107
|
+
title?: string;
|
|
108
|
+
storage?: "sqlite" | "memory";
|
|
109
|
+
configuration?: SessionConfigurationInput;
|
|
110
|
+
optionsRevision?: string;
|
|
111
|
+
metadata?: {
|
|
112
|
+
app?: Record<string, unknown>;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
type DispatchedSessionCreation = CreateClientSessionInput$1 & {
|
|
116
|
+
id: string;
|
|
117
|
+
requestId: string;
|
|
118
|
+
};
|
|
119
|
+
interface SessionCreationReceipt {
|
|
120
|
+
dataScopeId: string;
|
|
121
|
+
sessionId: string;
|
|
122
|
+
requestId: string;
|
|
123
|
+
action: "create-session";
|
|
124
|
+
state: "prepared" | "completed" | "unknown";
|
|
125
|
+
revision?: number;
|
|
126
|
+
configuration?: SessionConfigurationSnapshot;
|
|
127
|
+
}
|
|
128
|
+
interface SessionConfigurationOptions {
|
|
129
|
+
optionsRevision: string;
|
|
130
|
+
models: {
|
|
131
|
+
provider: string;
|
|
132
|
+
model: string;
|
|
133
|
+
name: string;
|
|
134
|
+
reasoningEfforts?: string[];
|
|
135
|
+
}[];
|
|
136
|
+
roles: {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
revision: string;
|
|
140
|
+
}[];
|
|
141
|
+
tools: {
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
}[];
|
|
145
|
+
plugins: {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
revision: string;
|
|
149
|
+
}[];
|
|
150
|
+
services: {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
revision: string;
|
|
154
|
+
}[];
|
|
155
|
+
defaults: SessionConfigurationInput;
|
|
156
|
+
}
|
|
157
|
+
interface SessionConfigurationBinding {
|
|
158
|
+
revision: number;
|
|
159
|
+
/** Explicit creation choices plus subsequent editor deltas; never accepted as public metadata. */
|
|
160
|
+
configurationInput?: SessionConfigurationInput;
|
|
161
|
+
/** Original non-role defaults for fields that role selection can replace. */
|
|
162
|
+
roleBaseConfiguration?: SessionConfigurationInput;
|
|
163
|
+
effectiveConfiguration: ResolvedSessionConfiguration;
|
|
164
|
+
resolvedResources: (ConfigurationResourceRef & {
|
|
165
|
+
revision: string;
|
|
166
|
+
})[];
|
|
167
|
+
defaultsRevision: string;
|
|
168
|
+
configurationRoot: {
|
|
169
|
+
cwd: string;
|
|
170
|
+
settingsRoot: string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
interface ConfigurationResourceRef {
|
|
174
|
+
kind: "model" | "role" | "tool" | "plugin" | "service" | "skill" | "mcp";
|
|
175
|
+
id: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** A directory's actual filesystem identity, captured by trusted execution code. */
|
|
179
|
+
interface SessionExecutionRoot {
|
|
180
|
+
readonly canonicalRoot: string;
|
|
181
|
+
readonly rootIdentity: {
|
|
182
|
+
readonly dev: string;
|
|
183
|
+
readonly ino: string;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/** Execution provenance describes a business relationship; it grants no access. */
|
|
187
|
+
type SessionExecutionSource = {
|
|
188
|
+
readonly kind: "interactive";
|
|
189
|
+
} | {
|
|
190
|
+
readonly kind: "channel";
|
|
191
|
+
readonly conversationId: string;
|
|
192
|
+
} | {
|
|
193
|
+
readonly kind: "automation";
|
|
194
|
+
readonly service: string;
|
|
195
|
+
readonly sourceId: string;
|
|
196
|
+
} | {
|
|
197
|
+
readonly kind: "child";
|
|
198
|
+
readonly sessionId: string;
|
|
199
|
+
readonly runId: string;
|
|
200
|
+
readonly childId: string;
|
|
201
|
+
readonly postRunPurpose?: "review" | "maintenance";
|
|
202
|
+
} | {
|
|
203
|
+
readonly kind: "fork";
|
|
204
|
+
readonly sessionId: string;
|
|
205
|
+
readonly requestId: string;
|
|
206
|
+
};
|
|
207
|
+
/** Frozen alongside configuration when work is accepted, then copied to Input/Run. */
|
|
208
|
+
interface SessionExecutionBinding {
|
|
209
|
+
readonly version: 1;
|
|
210
|
+
readonly cwd: SessionExecutionRoot;
|
|
211
|
+
readonly settingsRoot: SessionExecutionRoot;
|
|
212
|
+
readonly source: SessionExecutionSource;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
type AttachmentAssetStatus = "importing" | "ready" | "failed" | "deleted";
|
|
216
|
+
type AttachmentIntent = "auto" | "vision" | "ocr" | "document" | "tool_resource" | "workspace_reference";
|
|
217
|
+
/** 持久资源来自哪个聊天;临时聊天消失后仍保留这些来源信息。 */
|
|
218
|
+
interface ChatResourceSource {
|
|
219
|
+
storage: "memory" | "sqlite";
|
|
220
|
+
sessionId: string;
|
|
221
|
+
sourceSessionId?: string;
|
|
222
|
+
inputId?: string;
|
|
223
|
+
runId?: string;
|
|
224
|
+
}
|
|
225
|
+
interface AttachmentAssetRecord {
|
|
226
|
+
id: string;
|
|
227
|
+
displayName: string;
|
|
228
|
+
declaredMediaType?: string;
|
|
229
|
+
mediaType?: string;
|
|
230
|
+
sizeBytes?: number;
|
|
231
|
+
sha256?: string;
|
|
232
|
+
status: AttachmentAssetStatus;
|
|
233
|
+
failureCode?: string;
|
|
234
|
+
createdAt: number;
|
|
235
|
+
updatedAt: number;
|
|
236
|
+
deletedAt?: number;
|
|
237
|
+
chatSources?: ChatResourceSource[];
|
|
238
|
+
}
|
|
239
|
+
interface SessionInputAttachmentRecord {
|
|
240
|
+
draftId?: string;
|
|
241
|
+
id: string;
|
|
242
|
+
sessionId: string;
|
|
243
|
+
inputId: string;
|
|
244
|
+
assetId: string;
|
|
245
|
+
seq: number;
|
|
246
|
+
intent: AttachmentIntent;
|
|
247
|
+
displayName: string;
|
|
248
|
+
mediaType: string;
|
|
249
|
+
sizeBytes: number;
|
|
250
|
+
metadata: Record<string, unknown>;
|
|
251
|
+
createdAt: number;
|
|
252
|
+
}
|
|
253
|
+
interface AttachmentLimits {
|
|
254
|
+
maxFilesPerPrompt: number;
|
|
255
|
+
maxBytesPerFile: number;
|
|
256
|
+
maxBytesPerPrompt: number;
|
|
257
|
+
maxSessionReferencedBytes: number;
|
|
258
|
+
resumableThresholdBytes: number;
|
|
259
|
+
uploadSessionTtlMs: number;
|
|
260
|
+
stagingTtlMs: number;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
type SkillSource$1 = "bundled" | "user" | "project" | "plugin";
|
|
264
|
+
type PluginCapabilityRef = {
|
|
265
|
+
type: "capability";
|
|
266
|
+
kind: "plugin";
|
|
267
|
+
pluginId: string;
|
|
268
|
+
displayName: string;
|
|
269
|
+
};
|
|
270
|
+
type PluginAgentRef = {
|
|
271
|
+
type: "capability";
|
|
272
|
+
kind: "plugin_agent";
|
|
273
|
+
pluginId: string;
|
|
274
|
+
agentId: string;
|
|
275
|
+
displayName: string;
|
|
276
|
+
};
|
|
277
|
+
type SessionUserInputItem = {
|
|
278
|
+
type: "text";
|
|
279
|
+
text: string;
|
|
280
|
+
} | {
|
|
281
|
+
type: "skill";
|
|
282
|
+
name: string;
|
|
283
|
+
path: string;
|
|
284
|
+
displayName?: string;
|
|
285
|
+
source?: SkillSource$1;
|
|
286
|
+
} | {
|
|
287
|
+
type: "mention";
|
|
288
|
+
name: string;
|
|
289
|
+
path: string;
|
|
290
|
+
displayName?: string;
|
|
291
|
+
} | {
|
|
292
|
+
type: "context";
|
|
293
|
+
kind: "conversation";
|
|
294
|
+
id: string;
|
|
295
|
+
displayName: string;
|
|
296
|
+
} | PluginCapabilityRef | PluginAgentRef;
|
|
297
|
+
|
|
298
|
+
interface PromptAttachment {
|
|
299
|
+
assetId: string;
|
|
300
|
+
draftId?: string;
|
|
301
|
+
intent?: AttachmentIntent;
|
|
302
|
+
displayName?: string;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* `closing` 表示 Session 正在停止当前工作并等待资源释放,此时不再接收新工作。
|
|
307
|
+
* 等待结束后,Session 会进入不可逆的 archived 状态。
|
|
308
|
+
*/
|
|
309
|
+
type SessionStatus = "idle" | "running" | "closing" | "archived" | "error";
|
|
310
|
+
type SessionStorage = "sqlite" | "memory";
|
|
311
|
+
type InputDelivery = "queue" | "steer";
|
|
312
|
+
type RunStatus = "pending" | "running" | "completed" | "failed" | "interrupted";
|
|
313
|
+
type RunAttemptStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
314
|
+
type SessionTaskStatus = "pending" | "running" | "completed" | "failed" | "stopped" | "interrupted";
|
|
315
|
+
type PermissionStatus = "pending" | "approved" | "denied" | "expired";
|
|
316
|
+
type SessionMessageRole = "system" | "user" | "assistant";
|
|
317
|
+
type SessionMessagePartType = "text" | "attachment" | "transformation" | "reasoning" | "tool" | "tool_result" | "error" | "log";
|
|
318
|
+
type SessionMessagePartStatus = "pending" | "running" | "completed" | "failed" | "interrupted";
|
|
319
|
+
interface SessionRecord {
|
|
320
|
+
id: string;
|
|
321
|
+
storage?: SessionStorage;
|
|
322
|
+
parentId?: string;
|
|
323
|
+
projectId?: string;
|
|
324
|
+
cwd: string;
|
|
325
|
+
cwdRelative?: string;
|
|
326
|
+
title: string;
|
|
327
|
+
model: string;
|
|
328
|
+
agent?: string;
|
|
329
|
+
status: SessionStatus;
|
|
330
|
+
metadata: Record<string, unknown> & {
|
|
331
|
+
configurationBinding?: SessionConfigurationBinding;
|
|
332
|
+
executionBinding?: SessionExecutionBinding;
|
|
333
|
+
};
|
|
334
|
+
createdAt: number;
|
|
335
|
+
updatedAt: number;
|
|
336
|
+
archivedAt?: number;
|
|
337
|
+
}
|
|
338
|
+
interface SearchSessionsOptions {
|
|
339
|
+
query: string;
|
|
340
|
+
limit?: number;
|
|
341
|
+
}
|
|
342
|
+
interface SessionSearchResult {
|
|
343
|
+
session: SessionRecord;
|
|
344
|
+
messageId: string;
|
|
345
|
+
snippet: string;
|
|
346
|
+
}
|
|
347
|
+
interface SessionInputRecord {
|
|
348
|
+
id: string;
|
|
349
|
+
sessionId: string;
|
|
350
|
+
seq: number;
|
|
351
|
+
delivery: InputDelivery;
|
|
352
|
+
items: SessionUserInputItem[];
|
|
353
|
+
content: string;
|
|
354
|
+
attachments: SessionInputAttachmentRecord[];
|
|
355
|
+
promotedMessageId?: string;
|
|
356
|
+
metadata: Record<string, unknown> & {
|
|
357
|
+
configurationBinding?: SessionConfigurationBinding;
|
|
358
|
+
executionBinding?: SessionExecutionBinding;
|
|
359
|
+
};
|
|
360
|
+
createdAt: number;
|
|
361
|
+
}
|
|
362
|
+
interface SessionMessageRecord {
|
|
363
|
+
id: string;
|
|
364
|
+
sessionId: string;
|
|
365
|
+
seq: number;
|
|
366
|
+
role: SessionMessageRole;
|
|
367
|
+
runId?: string;
|
|
368
|
+
inputId?: string;
|
|
369
|
+
metadata: Record<string, unknown>;
|
|
370
|
+
createdAt: number;
|
|
371
|
+
updatedAt: number;
|
|
372
|
+
}
|
|
373
|
+
interface SessionMessagePartRecord {
|
|
374
|
+
id: string;
|
|
375
|
+
sessionId: string;
|
|
376
|
+
messageId: string;
|
|
377
|
+
seq: number;
|
|
378
|
+
type: SessionMessagePartType;
|
|
379
|
+
status: SessionMessagePartStatus;
|
|
380
|
+
text?: string;
|
|
381
|
+
toolUseId?: string;
|
|
382
|
+
toolName?: string;
|
|
383
|
+
input?: Record<string, unknown>;
|
|
384
|
+
output?: unknown;
|
|
385
|
+
/** Opt-in wire view only; preview bodies must be read from the scoped detail API. */
|
|
386
|
+
bodyView?: {
|
|
387
|
+
input: "full" | "preview" | "unavailable";
|
|
388
|
+
output: "full" | "preview" | "unavailable";
|
|
389
|
+
outputReferences?: string[];
|
|
390
|
+
};
|
|
391
|
+
isError?: boolean;
|
|
392
|
+
assetId?: string;
|
|
393
|
+
intent?: AttachmentIntent;
|
|
394
|
+
displayName?: string;
|
|
395
|
+
mediaType?: string;
|
|
396
|
+
sizeBytes?: number;
|
|
397
|
+
kind?: "direct" | "document_extract" | "tool_mount";
|
|
398
|
+
representationId?: string;
|
|
399
|
+
processor?: string;
|
|
400
|
+
transformationError?: string;
|
|
401
|
+
metadata: Record<string, unknown>;
|
|
402
|
+
createdAt: number;
|
|
403
|
+
updatedAt: number;
|
|
404
|
+
}
|
|
405
|
+
interface SessionEventRecord {
|
|
406
|
+
id: string;
|
|
407
|
+
seq: number;
|
|
408
|
+
type: string;
|
|
409
|
+
schemaVersion: number;
|
|
410
|
+
sessionId?: string;
|
|
411
|
+
payload: Record<string, unknown>;
|
|
412
|
+
createdAt: number;
|
|
413
|
+
}
|
|
414
|
+
interface SessionAttachmentMessagePartRecord extends SessionMessagePartRecord {
|
|
415
|
+
type: "attachment";
|
|
416
|
+
assetId: string;
|
|
417
|
+
intent: AttachmentIntent;
|
|
418
|
+
displayName: string;
|
|
419
|
+
mediaType: string;
|
|
420
|
+
sizeBytes: number;
|
|
421
|
+
}
|
|
422
|
+
interface SessionTransformationMessagePartRecord extends SessionMessagePartRecord {
|
|
423
|
+
type: "transformation";
|
|
424
|
+
assetId: string;
|
|
425
|
+
kind: "direct" | "document_extract" | "tool_mount";
|
|
426
|
+
representationId?: string;
|
|
427
|
+
processor?: string;
|
|
428
|
+
transformationError?: string;
|
|
429
|
+
}
|
|
430
|
+
interface SessionRunRecord {
|
|
431
|
+
id: string;
|
|
432
|
+
sessionId: string;
|
|
433
|
+
inputId?: string;
|
|
434
|
+
status: RunStatus;
|
|
435
|
+
startedAt?: number;
|
|
436
|
+
finishedAt?: number;
|
|
437
|
+
error?: string;
|
|
438
|
+
metadata: Record<string, unknown> & {
|
|
439
|
+
configurationBinding?: SessionConfigurationBinding;
|
|
440
|
+
executionBinding?: SessionExecutionBinding;
|
|
441
|
+
};
|
|
442
|
+
createdAt: number;
|
|
443
|
+
updatedAt: number;
|
|
444
|
+
}
|
|
445
|
+
interface SessionRunAttemptRecord {
|
|
446
|
+
id: string;
|
|
447
|
+
runId: string;
|
|
448
|
+
sequence: number;
|
|
449
|
+
status: RunAttemptStatus;
|
|
450
|
+
provider?: string;
|
|
451
|
+
model?: string;
|
|
452
|
+
retryReason?: string;
|
|
453
|
+
errorKind?: string;
|
|
454
|
+
error?: string;
|
|
455
|
+
inputTokens?: number;
|
|
456
|
+
outputTokens?: number;
|
|
457
|
+
startedAt?: number;
|
|
458
|
+
finishedAt?: number;
|
|
459
|
+
createdAt: number;
|
|
460
|
+
updatedAt: number;
|
|
461
|
+
}
|
|
462
|
+
interface SessionExecutionRecord {
|
|
463
|
+
id: string;
|
|
464
|
+
sessionId: string;
|
|
465
|
+
/** Producer namespace plus requestId uniquely identify one logical admission. */
|
|
466
|
+
requestNamespace?: string;
|
|
467
|
+
requestId?: string;
|
|
468
|
+
childSessionId?: string;
|
|
469
|
+
runId?: string;
|
|
470
|
+
type: string;
|
|
471
|
+
status: SessionTaskStatus;
|
|
472
|
+
description: string;
|
|
473
|
+
cwd: string;
|
|
474
|
+
output?: string;
|
|
475
|
+
error?: string;
|
|
476
|
+
metadata: Record<string, unknown>;
|
|
477
|
+
createdAt: number;
|
|
478
|
+
startedAt?: number;
|
|
479
|
+
finishedAt?: number;
|
|
480
|
+
updatedAt: number;
|
|
481
|
+
}
|
|
482
|
+
interface PermissionRequestRecord {
|
|
483
|
+
id: string;
|
|
484
|
+
sessionId: string;
|
|
485
|
+
runId?: string;
|
|
486
|
+
toolName: string;
|
|
487
|
+
payload: Record<string, unknown>;
|
|
488
|
+
status: PermissionStatus;
|
|
489
|
+
decision?: string;
|
|
490
|
+
decidedByClientId?: string;
|
|
491
|
+
createdAt: number;
|
|
492
|
+
updatedAt: number;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
interface PluginUiInventory {
|
|
496
|
+
manifestCount: number;
|
|
497
|
+
componentCount: number | null;
|
|
498
|
+
validatedComponentCount: number;
|
|
499
|
+
}
|
|
500
|
+
interface PluginUiInstanceRecord {
|
|
501
|
+
schemaVersion: 2;
|
|
502
|
+
instanceId: string;
|
|
503
|
+
sessionId: string;
|
|
504
|
+
sourceRunId: string;
|
|
505
|
+
sourcePartId: string;
|
|
506
|
+
sourceToolUseId: string;
|
|
507
|
+
sourceToolName: string;
|
|
508
|
+
pluginId: string;
|
|
509
|
+
pluginVersion: string;
|
|
510
|
+
pluginDigest: string;
|
|
511
|
+
componentId: string;
|
|
512
|
+
componentDigest: string;
|
|
513
|
+
title: string;
|
|
514
|
+
surface: "tool-result" | "session-sidebar";
|
|
515
|
+
status: "open" | "resolved" | "dismissed";
|
|
516
|
+
revision: number;
|
|
517
|
+
data: Record<string, JsonValue>;
|
|
518
|
+
activeActionRunId?: string;
|
|
519
|
+
lastActionRunId?: string;
|
|
520
|
+
dismissal?: {
|
|
521
|
+
requestId: string;
|
|
522
|
+
requestFingerprint: string;
|
|
523
|
+
expectedRevision: number;
|
|
524
|
+
revision: number;
|
|
525
|
+
dismissedAt: number;
|
|
526
|
+
};
|
|
527
|
+
createdAt: number;
|
|
528
|
+
updatedAt: number;
|
|
529
|
+
}
|
|
530
|
+
/** Shape validation only; the Server must also verify ownership against the actual Part. */
|
|
531
|
+
declare function readPluginUiInstance(metadata: unknown): PluginUiInstanceRecord | undefined;
|
|
532
|
+
|
|
533
|
+
type GoalStatus = "active" | "waiting_user" | "blocked" | "paused" | "completed" | "cancelled";
|
|
534
|
+
type GoalAction = "pause" | "resume" | "cancel" | "budget" | "cancel_resume";
|
|
535
|
+
interface GoalUsage {
|
|
536
|
+
knownTokens: number;
|
|
537
|
+
incomplete: boolean;
|
|
538
|
+
unknownAttempts: number;
|
|
539
|
+
partialAttempts: number;
|
|
540
|
+
inFlightAttempts: number;
|
|
541
|
+
runTimeMs: number;
|
|
542
|
+
seq: number;
|
|
543
|
+
updatedAt: number;
|
|
544
|
+
}
|
|
545
|
+
interface GoalStopReason {
|
|
546
|
+
code: "user_paused" | "user_cancelled" | "updating_objective" | "auto_turn_limit" | "run_error" | "wait_invalid" | "wait_timeout" | "external_failed" | "no_progress" | "startup_recovery" | "token_budget" | "usage_unknown" | "provider_limit";
|
|
547
|
+
at: number;
|
|
548
|
+
runId?: string;
|
|
549
|
+
detail?: string;
|
|
550
|
+
}
|
|
551
|
+
interface GoalExternalWait {
|
|
552
|
+
kind: "external";
|
|
553
|
+
targetRunId: string;
|
|
554
|
+
ownerRunId: string;
|
|
555
|
+
goalId: string;
|
|
556
|
+
objectiveVersion: number;
|
|
557
|
+
deadlineAt: number;
|
|
558
|
+
observedStatus?: "pending" | "running" | "completed" | "failed" | "interrupted";
|
|
559
|
+
}
|
|
560
|
+
type GoalWait = {
|
|
561
|
+
kind: "user";
|
|
562
|
+
questionId: string;
|
|
563
|
+
question: string;
|
|
564
|
+
objectiveVersion: number;
|
|
565
|
+
replyInputId?: string;
|
|
566
|
+
/** Accepted answer restored after a queued Run could not be dispatched. */
|
|
567
|
+
response?: string;
|
|
568
|
+
} | {
|
|
569
|
+
kind: "approval";
|
|
570
|
+
permissionRequestId: string;
|
|
571
|
+
} | GoalExternalWait;
|
|
572
|
+
interface SessionGoal {
|
|
573
|
+
id: string;
|
|
574
|
+
sessionId: string;
|
|
575
|
+
objective: string;
|
|
576
|
+
objectiveVersion: number;
|
|
577
|
+
pluginId?: string;
|
|
578
|
+
revision: number;
|
|
579
|
+
status: GoalStatus;
|
|
580
|
+
maxAutoTurns: number;
|
|
581
|
+
tokenBudget?: number;
|
|
582
|
+
usage: GoalUsage;
|
|
583
|
+
autoTurnsUsed: number;
|
|
584
|
+
currentRunId?: string;
|
|
585
|
+
/** A single accepted resume waiting for user work to finish. */
|
|
586
|
+
queuedResume?: {
|
|
587
|
+
requestId: string;
|
|
588
|
+
};
|
|
589
|
+
reason?: string;
|
|
590
|
+
stopReason?: GoalStopReason;
|
|
591
|
+
wait?: GoalWait;
|
|
592
|
+
createdAt: number;
|
|
593
|
+
updatedAt: number;
|
|
594
|
+
}
|
|
595
|
+
interface CreateSessionGoalInput {
|
|
596
|
+
requestId: string;
|
|
597
|
+
objective: string;
|
|
598
|
+
maxAutoTurns?: number;
|
|
599
|
+
tokenBudget?: number;
|
|
600
|
+
items?: SessionUserInputItem[];
|
|
601
|
+
attachments?: PromptAttachment[];
|
|
602
|
+
}
|
|
603
|
+
interface UpdateSessionGoalInput {
|
|
604
|
+
requestId: string;
|
|
605
|
+
expectedRevision: number;
|
|
606
|
+
objective: string;
|
|
607
|
+
items?: SessionUserInputItem[];
|
|
608
|
+
attachments?: PromptAttachment[];
|
|
609
|
+
}
|
|
610
|
+
interface GoalActionInput {
|
|
611
|
+
requestId: string;
|
|
612
|
+
expectedRevision: number;
|
|
613
|
+
action: GoalAction;
|
|
614
|
+
tokenBudget?: number | null;
|
|
615
|
+
additionalAutoTurns?: number;
|
|
616
|
+
questionId?: string;
|
|
617
|
+
response?: string;
|
|
618
|
+
objectiveVersion?: number;
|
|
619
|
+
}
|
|
620
|
+
/** Public durable command receipt; runtime/source and plugin admission evidence stay private. */
|
|
621
|
+
interface SessionGoalRequestReceipt {
|
|
622
|
+
requestId: string;
|
|
623
|
+
sessionId: string;
|
|
624
|
+
fingerprint: string;
|
|
625
|
+
status: "pending" | "completed" | "failed";
|
|
626
|
+
goalId?: string;
|
|
627
|
+
result?: {
|
|
628
|
+
goal?: SessionGoal;
|
|
629
|
+
runId?: string;
|
|
630
|
+
inputId?: string;
|
|
631
|
+
phase?: string;
|
|
632
|
+
};
|
|
633
|
+
error?: string;
|
|
634
|
+
createdAt: number;
|
|
635
|
+
updatedAt: number;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
declare function parseCreateSessionGoalInput(value: unknown): CreateSessionGoalInput;
|
|
639
|
+
declare function parseUpdateSessionGoalInput(value: unknown): UpdateSessionGoalInput;
|
|
640
|
+
declare function parseGoalActionInput(value: unknown): GoalActionInput;
|
|
641
|
+
|
|
642
|
+
type SessionModelFailureKind = "network" | "timeout" | "rate_limit" | "server" | "stream_incomplete" | "authentication" | "invalid_request" | "quota" | "protocol" | "unknown";
|
|
643
|
+
/** Mirrors core `ModelRetryState` without creating a protocol -> core dependency. */
|
|
644
|
+
interface SessionModelRetryState {
|
|
645
|
+
generationId: string;
|
|
646
|
+
attempt: number;
|
|
647
|
+
retryNumber: number;
|
|
648
|
+
maxRetries: number;
|
|
649
|
+
reason: SessionModelFailureKind;
|
|
650
|
+
nextRetryAt: number;
|
|
651
|
+
recoveryDeadlineAt: number;
|
|
652
|
+
}
|
|
653
|
+
interface SessionModelUsageSummary {
|
|
654
|
+
incomplete: boolean;
|
|
655
|
+
unknownAttempts: number;
|
|
656
|
+
partialAttempts: number;
|
|
657
|
+
}
|
|
658
|
+
/** 安全解析 Run metadata 中的重试状态;非法/未知数据返回 undefined。 */
|
|
659
|
+
declare function readSessionModelRetryState(metadata: Record<string, unknown> | undefined): SessionModelRetryState | undefined;
|
|
660
|
+
/** 被新尝试替代的 part:界面和模型历史都不应把它当作有效内容。 */
|
|
661
|
+
declare function isSupersededModelPart(part: SessionMessagePartRecord): boolean;
|
|
662
|
+
declare function readSessionModelUsage(metadata: Record<string, unknown> | undefined): SessionModelUsageSummary | undefined;
|
|
663
|
+
|
|
664
|
+
/** User-facing authorization presets, independent from read-only planning. */
|
|
665
|
+
type ApprovalMode = "ask" | "auto_review" | "full_access";
|
|
666
|
+
type WorkMode = "execute" | "plan";
|
|
667
|
+
interface ApprovalReviewResult {
|
|
668
|
+
decision: "approve" | "ask_user" | "deny";
|
|
669
|
+
risk: "low" | "medium" | "high" | "unknown";
|
|
670
|
+
authorization: "explicit" | "task_implied" | "missing";
|
|
671
|
+
reason: string;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
type SessionApiFormat = "anthropic" | "openai";
|
|
675
|
+
type SessionRuntimeConfig = {
|
|
676
|
+
model: string;
|
|
677
|
+
provider?: string;
|
|
678
|
+
baseUrl?: string;
|
|
679
|
+
apiFormat?: SessionApiFormat;
|
|
680
|
+
permissionMode?: "default" | "plan" | "full_auto";
|
|
681
|
+
approvalMode?: ApprovalMode;
|
|
682
|
+
workMode?: WorkMode;
|
|
683
|
+
maxTurns?: number;
|
|
684
|
+
effort?: string;
|
|
685
|
+
sessionMode?: "direct" | "coordinator";
|
|
686
|
+
identityPrompt?: string;
|
|
687
|
+
systemPrompt?: string;
|
|
688
|
+
replyStyle?: ReplyStyle | "inherit";
|
|
689
|
+
allowedTools?: string[];
|
|
690
|
+
disallowedTools?: string[];
|
|
691
|
+
pluginsEnabled?: boolean;
|
|
692
|
+
memoryEnabled?: boolean;
|
|
693
|
+
pluginAutoSelectionEnabled?: boolean;
|
|
694
|
+
appServiceBindings?: string[];
|
|
695
|
+
};
|
|
696
|
+
type SessionRuntimeConfigPatch = Partial<SessionRuntimeConfig>;
|
|
697
|
+
|
|
698
|
+
type SessionManagementAction = "rename" | "pin" | "archive" | "delete";
|
|
699
|
+
interface SessionMutationResult {
|
|
700
|
+
readonly sessionId: string;
|
|
701
|
+
readonly action: SessionManagementAction;
|
|
702
|
+
readonly revision?: number;
|
|
703
|
+
readonly deletedSessionIds?: readonly string[];
|
|
704
|
+
}
|
|
705
|
+
interface SessionMutationPublicReceipt {
|
|
706
|
+
readonly dataScopeId: string;
|
|
707
|
+
readonly sessionId: string;
|
|
708
|
+
readonly requestId: string;
|
|
709
|
+
readonly result: SessionMutationResult;
|
|
710
|
+
}
|
|
711
|
+
interface SessionDirectoryEntry {
|
|
712
|
+
readonly id: string;
|
|
713
|
+
readonly title: string;
|
|
714
|
+
readonly project: {
|
|
715
|
+
readonly id: string;
|
|
716
|
+
readonly displayName: string;
|
|
717
|
+
};
|
|
718
|
+
readonly status: string;
|
|
719
|
+
readonly updatedAt: number;
|
|
720
|
+
/** Display fields only, present when this caller can read the session. */
|
|
721
|
+
readonly summary?: {
|
|
722
|
+
cwd: string;
|
|
723
|
+
model: string;
|
|
724
|
+
createdAt: number;
|
|
725
|
+
metadata: Record<string, unknown>;
|
|
726
|
+
projectId?: string;
|
|
727
|
+
cwdRelative?: string;
|
|
728
|
+
parentId?: string;
|
|
729
|
+
agent?: string;
|
|
730
|
+
archivedAt?: number;
|
|
731
|
+
storage?: "sqlite" | "memory";
|
|
732
|
+
};
|
|
733
|
+
readonly pinnedAt?: number;
|
|
734
|
+
readonly source: "instance" | "im";
|
|
735
|
+
readonly hints: Readonly<Record<"read" | "execute" | SessionManagementAction, boolean>>;
|
|
736
|
+
readonly unavailableReason?: string;
|
|
737
|
+
}
|
|
738
|
+
interface SessionDirectoryPage {
|
|
739
|
+
readonly dataScopeId: string;
|
|
740
|
+
readonly entries: readonly SessionDirectoryEntry[];
|
|
741
|
+
readonly nextCursor?: string;
|
|
742
|
+
}
|
|
743
|
+
interface SessionResourceRevision {
|
|
744
|
+
readonly revision: number;
|
|
745
|
+
readonly treeRevision?: string;
|
|
746
|
+
}
|
|
747
|
+
interface SessionActivityPage {
|
|
748
|
+
dataScopeId: string;
|
|
749
|
+
revision: string;
|
|
750
|
+
nextCursor?: string;
|
|
751
|
+
entries: {
|
|
752
|
+
sessionId: string;
|
|
753
|
+
latestSeq: number;
|
|
754
|
+
status: string;
|
|
755
|
+
activeRunId?: string;
|
|
756
|
+
pendingQuestionIds: string[];
|
|
757
|
+
pendingApprovalIds: string[];
|
|
758
|
+
}[];
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
type ScheduledTaskStatus = "active" | "paused" | "completed";
|
|
762
|
+
type ScheduledTaskDestination = "standalone" | "chat";
|
|
763
|
+
type ScheduledTaskExecutionMode = "local" | "worktree";
|
|
764
|
+
type ScheduledRecurrenceFormat = "rrule" | "once";
|
|
765
|
+
type ScheduledOverlapPolicy = "skip" | "queue";
|
|
766
|
+
type ScheduledMissedRunPolicy = "skip" | "run_once";
|
|
767
|
+
interface ScheduledPermissionProfile {
|
|
768
|
+
mode: "read_only" | "workspace_write" | "full_access";
|
|
769
|
+
network?: boolean;
|
|
770
|
+
allowedTools?: string[];
|
|
771
|
+
deniedTools?: string[];
|
|
772
|
+
}
|
|
773
|
+
interface ScheduledStopPolicy {
|
|
774
|
+
runOnce?: boolean;
|
|
775
|
+
maxRuns?: number;
|
|
776
|
+
stopWhenCompleted?: boolean;
|
|
777
|
+
expiresAt?: number;
|
|
778
|
+
}
|
|
779
|
+
interface ScheduledTaskRecord {
|
|
780
|
+
id: string;
|
|
781
|
+
name: string;
|
|
782
|
+
description?: string;
|
|
783
|
+
prompt: string;
|
|
784
|
+
recurrence: string;
|
|
785
|
+
recurrenceFormat: ScheduledRecurrenceFormat;
|
|
786
|
+
timezone: string;
|
|
787
|
+
status: ScheduledTaskStatus;
|
|
788
|
+
destination: ScheduledTaskDestination;
|
|
789
|
+
sessionId?: string;
|
|
790
|
+
workspaceId?: string;
|
|
791
|
+
executionRoot?: string;
|
|
792
|
+
dataScopeId?: string;
|
|
793
|
+
privateSessionId?: string;
|
|
794
|
+
permissionModeId?: "ask" | "auto_review" | "full_access";
|
|
795
|
+
workMode?: "execute" | "plan";
|
|
796
|
+
pluginSelectionPolicy?: "auto" | "none";
|
|
797
|
+
projectPaths: string[];
|
|
798
|
+
executionMode: ScheduledTaskExecutionMode;
|
|
799
|
+
model?: string;
|
|
800
|
+
effort?: string;
|
|
801
|
+
skillNames: string[];
|
|
802
|
+
pluginNames: string[];
|
|
803
|
+
permissionProfile: ScheduledPermissionProfile;
|
|
804
|
+
overlapPolicy: ScheduledOverlapPolicy;
|
|
805
|
+
missedRunPolicy: ScheduledMissedRunPolicy;
|
|
806
|
+
stopPolicy?: ScheduledStopPolicy;
|
|
807
|
+
createdBy: "user" | "agent";
|
|
808
|
+
createdFromSessionId?: string;
|
|
809
|
+
lastRunAt?: number;
|
|
810
|
+
nextRunAt?: number;
|
|
811
|
+
runCount: number;
|
|
812
|
+
createdAt: number;
|
|
813
|
+
updatedAt: number;
|
|
814
|
+
}
|
|
815
|
+
type ScheduledRunCause = "scheduled" | "manual" | "missed_run";
|
|
816
|
+
type ScheduledRunStatus = "queued" | "running" | "succeeded" | "failed" | "interrupted" | "needs_attention" | "skipped";
|
|
817
|
+
interface ScheduledRunRecord {
|
|
818
|
+
id: string;
|
|
819
|
+
taskId: string;
|
|
820
|
+
executionRoot?: string;
|
|
821
|
+
cause: ScheduledRunCause;
|
|
822
|
+
status: ScheduledRunStatus;
|
|
823
|
+
scheduledFor: number;
|
|
824
|
+
sessionId?: string;
|
|
825
|
+
runId?: string;
|
|
826
|
+
summary?: string;
|
|
827
|
+
error?: string;
|
|
828
|
+
unread: boolean;
|
|
829
|
+
attentionReason?: string;
|
|
830
|
+
createdAt: number;
|
|
831
|
+
startedAt?: number;
|
|
832
|
+
finishedAt?: number;
|
|
833
|
+
updatedAt: number;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
interface CreateScheduledTaskInput {
|
|
837
|
+
id?: string;
|
|
838
|
+
name: string;
|
|
839
|
+
description?: string;
|
|
840
|
+
prompt: string;
|
|
841
|
+
recurrence: string;
|
|
842
|
+
recurrenceFormat: ScheduledRecurrenceFormat;
|
|
843
|
+
timezone: string;
|
|
844
|
+
status?: ScheduledTaskStatus;
|
|
845
|
+
destination: ScheduledTaskDestination;
|
|
846
|
+
sessionId?: string;
|
|
847
|
+
workspaceId?: string;
|
|
848
|
+
executionRoot?: string;
|
|
849
|
+
dataScopeId?: string;
|
|
850
|
+
privateSessionId?: string;
|
|
851
|
+
permissionModeId?: "ask" | "auto_review" | "full_access";
|
|
852
|
+
workMode?: "execute" | "plan";
|
|
853
|
+
pluginSelectionPolicy?: "auto" | "none";
|
|
854
|
+
projectPaths?: string[];
|
|
855
|
+
executionMode?: ScheduledTaskExecutionMode;
|
|
856
|
+
model?: string;
|
|
857
|
+
effort?: string;
|
|
858
|
+
skillNames?: string[];
|
|
859
|
+
pluginNames?: string[];
|
|
860
|
+
permissionProfile?: ScheduledPermissionProfile;
|
|
861
|
+
overlapPolicy?: ScheduledOverlapPolicy;
|
|
862
|
+
missedRunPolicy?: ScheduledMissedRunPolicy;
|
|
863
|
+
stopPolicy?: ScheduledStopPolicy;
|
|
864
|
+
createdBy?: ScheduledTaskRecord["createdBy"];
|
|
865
|
+
createdFromSessionId?: string;
|
|
866
|
+
nextRunAt?: number;
|
|
867
|
+
}
|
|
868
|
+
type UpdateScheduledTaskInput = Partial<Omit<CreateScheduledTaskInput, "id" | "nextRunAt" | "workspaceId" | "executionRoot" | "sessionId" | "privateSessionId">> & {
|
|
869
|
+
workspaceId?: string | null;
|
|
870
|
+
executionRoot?: string | null;
|
|
871
|
+
sessionId?: string | null;
|
|
872
|
+
privateSessionId?: string | null;
|
|
873
|
+
lastRunAt?: number | null;
|
|
874
|
+
nextRunAt?: number | null;
|
|
875
|
+
runCount?: number;
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
interface ControlOption {
|
|
879
|
+
id: string;
|
|
880
|
+
name: string;
|
|
881
|
+
}
|
|
882
|
+
interface DraftComposerTarget {
|
|
883
|
+
source: "instance";
|
|
884
|
+
workspaceId?: string;
|
|
885
|
+
outsideProject?: boolean;
|
|
886
|
+
roleId?: string | null;
|
|
887
|
+
}
|
|
888
|
+
interface DraftComposerOptions {
|
|
889
|
+
source: "instance";
|
|
890
|
+
optionsRevision: string;
|
|
891
|
+
skills: (ControlOption & {
|
|
892
|
+
path: string;
|
|
893
|
+
source?: string;
|
|
894
|
+
})[];
|
|
895
|
+
plugins: (ControlOption & {
|
|
896
|
+
agents: ControlOption[];
|
|
897
|
+
})[];
|
|
898
|
+
}
|
|
899
|
+
type SessionControlAction = "readContext" | "configure" | "compact" | "edit" | "fork" | "resume" | "goalRead" | "goalWrite" | "goalStop";
|
|
900
|
+
interface SessionControls {
|
|
901
|
+
dataScopeId: string;
|
|
902
|
+
sessionId: string;
|
|
903
|
+
source: "instance" | "auxiliary" | "im";
|
|
904
|
+
revision: number;
|
|
905
|
+
optionsRevision: string;
|
|
906
|
+
actions: Record<SessionControlAction, boolean>;
|
|
907
|
+
models: ControlOption[];
|
|
908
|
+
roles: ControlOption[];
|
|
909
|
+
efforts: ControlOption[];
|
|
910
|
+
workModes: ControlOption[];
|
|
911
|
+
permissionModes?: ControlOption[];
|
|
912
|
+
appServiceBindings?: ControlOption[];
|
|
913
|
+
skills: (ControlOption & {
|
|
914
|
+
path: string;
|
|
915
|
+
source?: string;
|
|
916
|
+
})[];
|
|
917
|
+
commands: ControlOption[];
|
|
918
|
+
contexts: ControlOption[];
|
|
919
|
+
plugins?: (ControlOption & {
|
|
920
|
+
agents: ControlOption[];
|
|
921
|
+
})[];
|
|
922
|
+
}
|
|
923
|
+
type SessionControlOriginal = {
|
|
924
|
+
action: "compact";
|
|
925
|
+
body: {
|
|
926
|
+
requestId: string;
|
|
927
|
+
expectedRevision: number;
|
|
928
|
+
};
|
|
929
|
+
} | {
|
|
930
|
+
action: "fork";
|
|
931
|
+
body: {
|
|
932
|
+
requestId: string;
|
|
933
|
+
id: string;
|
|
934
|
+
copyHistory?: boolean;
|
|
935
|
+
beforeMessageId?: string;
|
|
936
|
+
afterMessageId?: string;
|
|
937
|
+
storage?: "sqlite";
|
|
938
|
+
};
|
|
939
|
+
};
|
|
940
|
+
interface SessionControlReceipt {
|
|
941
|
+
dataScopeId: string;
|
|
942
|
+
sessionId: string;
|
|
943
|
+
requestId: string;
|
|
944
|
+
action: SessionControlOriginal["action"] | "configure";
|
|
945
|
+
state: "prepared" | "created" | "completed" | "unknown";
|
|
946
|
+
revision?: number;
|
|
947
|
+
targetSessionId?: string;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
type CreateSessionInput = CreateClientSessionInput$1;
|
|
951
|
+
interface ForkSessionInput {
|
|
952
|
+
id?: string;
|
|
953
|
+
requestId?: string;
|
|
954
|
+
copyHistory?: boolean;
|
|
955
|
+
beforeMessageId?: string;
|
|
956
|
+
afterMessageId?: string;
|
|
957
|
+
storage?: SessionStorage;
|
|
958
|
+
}
|
|
959
|
+
interface AdmitPromptAttachmentInput {
|
|
960
|
+
assetId: string;
|
|
961
|
+
draftId?: string;
|
|
962
|
+
intent?: AttachmentIntent;
|
|
963
|
+
displayName?: string;
|
|
964
|
+
}
|
|
965
|
+
/** Public query parameters, independently mapped to storage query options. */
|
|
966
|
+
interface ListMessagePartsOptions {
|
|
967
|
+
afterSeq?: number;
|
|
968
|
+
messageId?: string;
|
|
969
|
+
limit?: number;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/** Atomic, server-owned state used when a client attaches to one session. */
|
|
973
|
+
interface AgentSessionStateSnapshot {
|
|
974
|
+
cursor: number;
|
|
975
|
+
session: SessionRecord;
|
|
976
|
+
inputs: SessionInputRecord[];
|
|
977
|
+
messages: SessionMessageRecord[];
|
|
978
|
+
parts: SessionMessagePartRecord[];
|
|
979
|
+
runs: SessionRunRecord[];
|
|
980
|
+
attempts: SessionRunAttemptRecord[];
|
|
981
|
+
tasks?: SessionExecutionRecord[];
|
|
982
|
+
permissions: PermissionRequestRecord[];
|
|
983
|
+
goal?: SessionGoal | null;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
type JobKind = "terminal" | "shell" | "agent" | "dream" | "workflow";
|
|
987
|
+
type JobTarget = {
|
|
988
|
+
kind: "agent";
|
|
989
|
+
jobId: string;
|
|
990
|
+
runId: string;
|
|
991
|
+
} | {
|
|
992
|
+
kind: "shell" | "terminal" | "workflow" | "dream";
|
|
993
|
+
jobId: string;
|
|
994
|
+
};
|
|
995
|
+
interface JobInputReceipt {
|
|
996
|
+
sessionId: string;
|
|
997
|
+
inputId: string;
|
|
998
|
+
runId: string;
|
|
999
|
+
}
|
|
1000
|
+
interface JobListResult {
|
|
1001
|
+
jobs: JobSnapshot[];
|
|
1002
|
+
errors: Array<{
|
|
1003
|
+
kind: JobKind;
|
|
1004
|
+
message: string;
|
|
1005
|
+
}>;
|
|
1006
|
+
}
|
|
1007
|
+
type JobStatus = "running" | "stopping" | "completed" | "killed" | "failed";
|
|
1008
|
+
interface JobCapabilities {
|
|
1009
|
+
read: boolean;
|
|
1010
|
+
wait: boolean;
|
|
1011
|
+
send: boolean;
|
|
1012
|
+
cancel: boolean;
|
|
1013
|
+
}
|
|
1014
|
+
/** 可以通过 HTTP 返回的 Job 当前状态;不包含进程句柄或等待中的 Promise。 */
|
|
1015
|
+
interface JobSnapshot {
|
|
1016
|
+
id: string;
|
|
1017
|
+
kind: JobKind;
|
|
1018
|
+
target: JobTarget;
|
|
1019
|
+
label: string;
|
|
1020
|
+
ownerSession: string;
|
|
1021
|
+
status: JobStatus;
|
|
1022
|
+
capabilities: JobCapabilities;
|
|
1023
|
+
cwd: string;
|
|
1024
|
+
startedAt: number;
|
|
1025
|
+
updatedAt: number;
|
|
1026
|
+
finishedAt?: number;
|
|
1027
|
+
exitCode?: number | null;
|
|
1028
|
+
detail?: string;
|
|
1029
|
+
metadata?: Record<string, unknown>;
|
|
1030
|
+
}
|
|
1031
|
+
interface JobReadResult {
|
|
1032
|
+
text: string;
|
|
1033
|
+
cursor: number;
|
|
1034
|
+
truncated: boolean;
|
|
1035
|
+
snapshot: JobSnapshot;
|
|
1036
|
+
details?: Record<string, unknown>;
|
|
1037
|
+
}
|
|
1038
|
+
interface JobWaitResult extends JobReadResult {
|
|
1039
|
+
timedOut: boolean;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
type CancelResponseMode = "snapshot" | "receipt";
|
|
1043
|
+
/** Only IDs supplied by the caller and the resulting status. */
|
|
1044
|
+
interface JobCancelReceipt {
|
|
1045
|
+
id: string;
|
|
1046
|
+
status: JobStatus;
|
|
1047
|
+
}
|
|
1048
|
+
interface QueuedPromptCancelReceipt {
|
|
1049
|
+
inputId: string;
|
|
1050
|
+
queuedRunId: string;
|
|
1051
|
+
status: "interrupted";
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
declare function readRuntimeMetadata(metadata: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
1055
|
+
|
|
1056
|
+
interface ApprovalReviewRecord {
|
|
1057
|
+
status: "reviewing" | "approved" | "ask_user" | "denied" | "timed_out";
|
|
1058
|
+
startedAt: number;
|
|
1059
|
+
completedAt?: number;
|
|
1060
|
+
reason?: string;
|
|
1061
|
+
result?: ApprovalReviewResult;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
interface ProtocolError {
|
|
1065
|
+
code: string;
|
|
1066
|
+
message: string;
|
|
1067
|
+
retryable?: boolean;
|
|
1068
|
+
details?: Record<string, unknown>;
|
|
1069
|
+
traceId?: string;
|
|
1070
|
+
}
|
|
1071
|
+
declare class ProtocolValidationError extends Error {
|
|
1072
|
+
readonly code = "invalid_request";
|
|
1073
|
+
readonly details?: Record<string, unknown>;
|
|
1074
|
+
constructor(message: string, field?: string, reason?: string);
|
|
1075
|
+
toProtocolError(): ProtocolError;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
type TerminalRuntime = "local" | "environment";
|
|
1079
|
+
type TerminalSessionStatus = JobStatus;
|
|
1080
|
+
type TerminalSource = "user" | "agent";
|
|
1081
|
+
type TerminalScope = {
|
|
1082
|
+
kind: "project";
|
|
1083
|
+
projectId: string;
|
|
1084
|
+
} | {
|
|
1085
|
+
kind: "session";
|
|
1086
|
+
sessionId: string;
|
|
1087
|
+
};
|
|
1088
|
+
/** 可以通过 HTTP/SSE 发送的终端状态,不包含 PTY 或子进程对象。 */
|
|
1089
|
+
interface TerminalSessionInfo {
|
|
1090
|
+
id: string;
|
|
1091
|
+
name: string;
|
|
1092
|
+
scope: TerminalScope;
|
|
1093
|
+
projectId?: string;
|
|
1094
|
+
runtime: TerminalRuntime;
|
|
1095
|
+
environmentKind?: "native" | "wsl";
|
|
1096
|
+
distribution?: string;
|
|
1097
|
+
source: TerminalSource;
|
|
1098
|
+
sessionId?: string;
|
|
1099
|
+
status: TerminalSessionStatus;
|
|
1100
|
+
cwd: string;
|
|
1101
|
+
shell: string;
|
|
1102
|
+
command?: string;
|
|
1103
|
+
cols: number;
|
|
1104
|
+
rows: number;
|
|
1105
|
+
createdAt: string;
|
|
1106
|
+
exitedAt?: string;
|
|
1107
|
+
exitCode?: number | null;
|
|
1108
|
+
}
|
|
1109
|
+
interface TerminalReadResult {
|
|
1110
|
+
terminalId: string;
|
|
1111
|
+
data: string;
|
|
1112
|
+
sequence: number;
|
|
1113
|
+
truncated: boolean;
|
|
1114
|
+
}
|
|
1115
|
+
type TerminalEvent = {
|
|
1116
|
+
type: "data";
|
|
1117
|
+
terminalId: string;
|
|
1118
|
+
data: string;
|
|
1119
|
+
sequence: number;
|
|
1120
|
+
} | {
|
|
1121
|
+
type: "status";
|
|
1122
|
+
terminalId: string;
|
|
1123
|
+
status: "stopping" | "killed";
|
|
1124
|
+
} | {
|
|
1125
|
+
type: "exit";
|
|
1126
|
+
terminalId: string;
|
|
1127
|
+
exitCode: number | null;
|
|
1128
|
+
} | {
|
|
1129
|
+
type: "title";
|
|
1130
|
+
terminalId: string;
|
|
1131
|
+
title: string;
|
|
1132
|
+
} | {
|
|
1133
|
+
type: "error";
|
|
1134
|
+
terminalId: string;
|
|
1135
|
+
message: string;
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
declare const CURRENT_PROTOCOL_VERSION = 7;
|
|
1139
|
+
interface ProtocolVersion {
|
|
1140
|
+
version: number;
|
|
1141
|
+
}
|
|
1142
|
+
interface ServerCapabilities {
|
|
1143
|
+
daemonStorage?: {
|
|
1144
|
+
instanceId: string;
|
|
1145
|
+
pid: number;
|
|
1146
|
+
configDir: string;
|
|
1147
|
+
dataDir: string;
|
|
1148
|
+
storePath: string;
|
|
1149
|
+
};
|
|
1150
|
+
dataScopeId?: string;
|
|
1151
|
+
serverVersion: string;
|
|
1152
|
+
protocol: ProtocolVersion;
|
|
1153
|
+
features: Record<string, number>;
|
|
1154
|
+
attachments?: AttachmentTransferCapabilities;
|
|
1155
|
+
agentEnvironments?: AgentEnvironmentCapabilities;
|
|
1156
|
+
/**
|
|
1157
|
+
* Present when this daemon instance serves the MCP OAuth operation API.
|
|
1158
|
+
* The random `instanceId` changes on every daemon start so a client can
|
|
1159
|
+
* detect a restart and refuse to replay an operation from an old instance.
|
|
1160
|
+
*/
|
|
1161
|
+
mcpOAuth?: McpOAuthCapabilities;
|
|
1162
|
+
}
|
|
1163
|
+
interface McpOAuthCapabilities {
|
|
1164
|
+
instanceId: string;
|
|
1165
|
+
}
|
|
1166
|
+
interface AgentEnvironmentCapabilities {
|
|
1167
|
+
native: true;
|
|
1168
|
+
wsl: boolean;
|
|
1169
|
+
activeDefault?: {
|
|
1170
|
+
kind: "native" | "wsl";
|
|
1171
|
+
distribution?: string;
|
|
1172
|
+
fingerprint: string;
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
interface AttachmentTransferCapabilities {
|
|
1176
|
+
limits: AttachmentLimits;
|
|
1177
|
+
uploadModes: readonly ["single"] | readonly ["single", "resumable"];
|
|
1178
|
+
}
|
|
1179
|
+
interface ClientProtocolSupport {
|
|
1180
|
+
version: number;
|
|
1181
|
+
}
|
|
1182
|
+
interface ProtocolCompatibility {
|
|
1183
|
+
compatible: boolean;
|
|
1184
|
+
reason?: string;
|
|
1185
|
+
}
|
|
1186
|
+
declare function checkProtocolCompatibility(server: ServerCapabilities, client: ClientProtocolSupport): ProtocolCompatibility;
|
|
1187
|
+
declare function supportsFeature(capabilities: ServerCapabilities, feature: string, minimumVersion?: number): boolean;
|
|
1188
|
+
|
|
1189
|
+
declare const WORKSPACE_CHANGE_REASONS: readonly ["not_git_repository", "preexisting_dirty_overlap", "non_linear_head_change", "post_commit_worktree_changed", "git_inspection_failed", "sensitive_content_path", "concurrent_run_overlap", "execution_environment_unavailable", "daemon_restarted", "observation_budget_exceeded", "observation_cancelled"];
|
|
1190
|
+
interface WorkspaceChangeFile {
|
|
1191
|
+
path: string;
|
|
1192
|
+
oldPath?: string;
|
|
1193
|
+
status: "added" | "modified" | "deleted" | "renamed" | "copied" | "unknown";
|
|
1194
|
+
lines: number;
|
|
1195
|
+
/** 捕获时的增删拆分(lines = additions + deletions)。旧记录没有该字段,读取时按缺失处理。 */
|
|
1196
|
+
additions?: number;
|
|
1197
|
+
deletions?: number;
|
|
1198
|
+
}
|
|
1199
|
+
interface WorkspaceChangesMetadata {
|
|
1200
|
+
version: 1;
|
|
1201
|
+
status: "captured" | "complete" | "unavailable";
|
|
1202
|
+
reason?: (typeof WORKSPACE_CHANGE_REASONS)[number];
|
|
1203
|
+
repositoryRoot?: string;
|
|
1204
|
+
files: WorkspaceChangeFile[];
|
|
1205
|
+
fileCount: number;
|
|
1206
|
+
totalLines: number;
|
|
1207
|
+
truncated: boolean;
|
|
1208
|
+
}
|
|
1209
|
+
declare function readWorkspaceChangesMetadata(value: unknown): WorkspaceChangesMetadata | undefined;
|
|
1210
|
+
|
|
1211
|
+
/** All paths use forward slashes relative to the session workspace; its root is `.`. */
|
|
1212
|
+
interface SessionFileInfo {
|
|
1213
|
+
path: string;
|
|
1214
|
+
name: string;
|
|
1215
|
+
kind: "file" | "directory" | "symlink" | "other";
|
|
1216
|
+
sizeBytes?: number;
|
|
1217
|
+
/** Last modification time in milliseconds since the Unix epoch. */
|
|
1218
|
+
modifiedAt?: number;
|
|
1219
|
+
}
|
|
1220
|
+
interface SessionDirectoryResult {
|
|
1221
|
+
path: string;
|
|
1222
|
+
entries: SessionFileInfo[];
|
|
1223
|
+
truncated: boolean;
|
|
1224
|
+
}
|
|
1225
|
+
interface SessionTextFileResult {
|
|
1226
|
+
path: string;
|
|
1227
|
+
content: string;
|
|
1228
|
+
encoding: "utf-8";
|
|
1229
|
+
truncated: boolean;
|
|
1230
|
+
}
|
|
1231
|
+
interface SessionFindFilesResult {
|
|
1232
|
+
path: string;
|
|
1233
|
+
files: string[];
|
|
1234
|
+
truncated: boolean;
|
|
1235
|
+
}
|
|
1236
|
+
interface SessionFileSearchMatch {
|
|
1237
|
+
path: string;
|
|
1238
|
+
/** One-based line number. */
|
|
1239
|
+
line: number;
|
|
1240
|
+
text: string;
|
|
1241
|
+
}
|
|
1242
|
+
interface SessionSearchFilesResult {
|
|
1243
|
+
path: string;
|
|
1244
|
+
matches: SessionFileSearchMatch[];
|
|
1245
|
+
truncated: boolean;
|
|
1246
|
+
}
|
|
1247
|
+
interface SessionFileListInput {
|
|
1248
|
+
path?: string;
|
|
1249
|
+
limit?: number;
|
|
1250
|
+
}
|
|
1251
|
+
interface SessionFileStatInput {
|
|
1252
|
+
path: string;
|
|
1253
|
+
}
|
|
1254
|
+
interface SessionFileReadInput {
|
|
1255
|
+
path: string;
|
|
1256
|
+
maxBytes?: number;
|
|
1257
|
+
}
|
|
1258
|
+
interface SessionFileFindInput {
|
|
1259
|
+
pattern: string;
|
|
1260
|
+
/** `substring` matches a literal fragment of the relative path without regard to case. Default: `glob`. */
|
|
1261
|
+
match?: "glob" | "substring";
|
|
1262
|
+
path?: string;
|
|
1263
|
+
limit?: number;
|
|
1264
|
+
}
|
|
1265
|
+
interface SessionFileSearchInput {
|
|
1266
|
+
query: string;
|
|
1267
|
+
path?: string;
|
|
1268
|
+
include?: string;
|
|
1269
|
+
caseSensitive?: boolean;
|
|
1270
|
+
limit?: number;
|
|
1271
|
+
}
|
|
1272
|
+
type SessionFileErrorCode = "file_invalid_request" | "file_forbidden" | "file_not_found" | "file_not_text" | "file_not_ready" | "file_not_supported" | "file_timeout" | "file_cancelled" | "file_operation_failed";
|
|
1273
|
+
|
|
1274
|
+
/** Author-provided presentation, separate from live installation and authorization state. */
|
|
1275
|
+
interface PluginPresentation {
|
|
1276
|
+
icon?: string;
|
|
1277
|
+
description?: string;
|
|
1278
|
+
introduction?: string;
|
|
1279
|
+
prompts?: Array<{
|
|
1280
|
+
title: string;
|
|
1281
|
+
prompt: string;
|
|
1282
|
+
}>;
|
|
1283
|
+
author?: {
|
|
1284
|
+
name: string;
|
|
1285
|
+
email?: string;
|
|
1286
|
+
url?: string;
|
|
1287
|
+
};
|
|
1288
|
+
homepage?: string;
|
|
1289
|
+
repository?: string;
|
|
1290
|
+
license?: string;
|
|
1291
|
+
keywords?: string[];
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
interface MarketplaceProvenance {
|
|
1295
|
+
sourceId: string;
|
|
1296
|
+
catalogUrl: string;
|
|
1297
|
+
version: string;
|
|
1298
|
+
archiveDigest: string;
|
|
1299
|
+
repository: string;
|
|
1300
|
+
commit: string;
|
|
1301
|
+
path: string;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
type PluginRuntimeStatus = {
|
|
1305
|
+
state: "disabled";
|
|
1306
|
+
message: string;
|
|
1307
|
+
action: "enable";
|
|
1308
|
+
} | {
|
|
1309
|
+
state: "pending_reload";
|
|
1310
|
+
message: string;
|
|
1311
|
+
action: "reload";
|
|
1312
|
+
} | {
|
|
1313
|
+
state: "loaded";
|
|
1314
|
+
message: string;
|
|
1315
|
+
action: "none";
|
|
1316
|
+
} | {
|
|
1317
|
+
state: "degraded";
|
|
1318
|
+
code: string;
|
|
1319
|
+
message: string;
|
|
1320
|
+
action: "details" | "reimport" | "approve" | "disable";
|
|
1321
|
+
} | {
|
|
1322
|
+
state: "failed";
|
|
1323
|
+
code: string;
|
|
1324
|
+
message: string;
|
|
1325
|
+
action: "reimport" | "approve" | "disable" | "uninstall";
|
|
1326
|
+
};
|
|
1327
|
+
interface PluginInfo {
|
|
1328
|
+
provenance?: MarketplaceProvenance;
|
|
1329
|
+
identity: {
|
|
1330
|
+
id: string;
|
|
1331
|
+
name: string;
|
|
1332
|
+
version: string;
|
|
1333
|
+
displayName?: string;
|
|
1334
|
+
};
|
|
1335
|
+
presentation?: PluginPresentation;
|
|
1336
|
+
origin: "native" | "converted";
|
|
1337
|
+
sourceFormat?: string;
|
|
1338
|
+
scope: "user" | "managed";
|
|
1339
|
+
enabled: boolean;
|
|
1340
|
+
installation: "installed" | "missing" | "invalid";
|
|
1341
|
+
activation: "inactive" | "active" | "partial" | "reload-required";
|
|
1342
|
+
/** Installed-state view. Live Tool Host state belongs to the owning Agent runtime. */
|
|
1343
|
+
toolRuntime?: {
|
|
1344
|
+
state: "inactive" | "reload-required" | "starting" | "active" | "degraded" | "error";
|
|
1345
|
+
declaredEntries: number;
|
|
1346
|
+
activatableEntries: number;
|
|
1347
|
+
hostCount: number;
|
|
1348
|
+
registeredToolCount: number;
|
|
1349
|
+
lastStartedAt?: string;
|
|
1350
|
+
lastError?: string;
|
|
1351
|
+
};
|
|
1352
|
+
runtimeStatus: PluginRuntimeStatus;
|
|
1353
|
+
inventory: Record<string, number>;
|
|
1354
|
+
uiInventory?: PluginUiInventory;
|
|
1355
|
+
permissions: {
|
|
1356
|
+
requested: string[];
|
|
1357
|
+
approved: string[];
|
|
1358
|
+
missing: string[];
|
|
1359
|
+
};
|
|
1360
|
+
diagnostics: Array<{
|
|
1361
|
+
severity: "info" | "warning" | "error";
|
|
1362
|
+
phase: string;
|
|
1363
|
+
code: string;
|
|
1364
|
+
message: string;
|
|
1365
|
+
path?: string;
|
|
1366
|
+
}>;
|
|
1367
|
+
}
|
|
1368
|
+
interface PluginArchivePreview {
|
|
1369
|
+
archiveDigest: string;
|
|
1370
|
+
identity: {
|
|
1371
|
+
id: string;
|
|
1372
|
+
name: string;
|
|
1373
|
+
version: string;
|
|
1374
|
+
displayName?: string;
|
|
1375
|
+
};
|
|
1376
|
+
requestedPermissions: string[];
|
|
1377
|
+
approvalRequired: boolean;
|
|
1378
|
+
replacementRequired?: boolean;
|
|
1379
|
+
inventory: Record<string, number>;
|
|
1380
|
+
diagnostics: PluginInfo["diagnostics"];
|
|
1381
|
+
}
|
|
1382
|
+
interface PluginGitPreview {
|
|
1383
|
+
sourceDigest: string;
|
|
1384
|
+
url: string;
|
|
1385
|
+
ref?: string;
|
|
1386
|
+
commit: string;
|
|
1387
|
+
identity: {
|
|
1388
|
+
id: string;
|
|
1389
|
+
name: string;
|
|
1390
|
+
version: string;
|
|
1391
|
+
displayName?: string;
|
|
1392
|
+
};
|
|
1393
|
+
requestedPermissions: string[];
|
|
1394
|
+
approvalRequired: boolean;
|
|
1395
|
+
replacementRequired?: boolean;
|
|
1396
|
+
inventory: Record<string, number>;
|
|
1397
|
+
diagnostics: PluginInfo["diagnostics"];
|
|
1398
|
+
}
|
|
1399
|
+
interface PluginArchiveError {
|
|
1400
|
+
code: string;
|
|
1401
|
+
message: string;
|
|
1402
|
+
diagnostics?: PluginInfo["diagnostics"];
|
|
1403
|
+
}
|
|
1404
|
+
interface HookInfo {
|
|
1405
|
+
id: string;
|
|
1406
|
+
event: string;
|
|
1407
|
+
type: string;
|
|
1408
|
+
enabled: boolean;
|
|
1409
|
+
origin: "settings" | "runtime";
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/** Read-only descriptors for capabilities already available on the daemon. */
|
|
1413
|
+
interface ModelInfo {
|
|
1414
|
+
id: string;
|
|
1415
|
+
label: string;
|
|
1416
|
+
provider: string;
|
|
1417
|
+
providerName: string;
|
|
1418
|
+
hint?: string;
|
|
1419
|
+
contextWindow?: number;
|
|
1420
|
+
inputLimit?: number;
|
|
1421
|
+
outputLimit?: number;
|
|
1422
|
+
reasoning?: boolean;
|
|
1423
|
+
reasoningEfforts?: string[];
|
|
1424
|
+
vision?: boolean;
|
|
1425
|
+
inputModalities?: string[];
|
|
1426
|
+
inputCapabilities?: {
|
|
1427
|
+
image: "native" | "unsupported" | "unknown";
|
|
1428
|
+
};
|
|
1429
|
+
toolCalling?: boolean;
|
|
1430
|
+
status?: "active" | "beta";
|
|
1431
|
+
}
|
|
1432
|
+
interface ModelProviderInfo {
|
|
1433
|
+
name: string;
|
|
1434
|
+
displayName: string;
|
|
1435
|
+
models: ModelInfo[];
|
|
1436
|
+
}
|
|
1437
|
+
interface McpServerStatus {
|
|
1438
|
+
name: string;
|
|
1439
|
+
status: string;
|
|
1440
|
+
toolCount: number;
|
|
1441
|
+
resourceCount: number;
|
|
1442
|
+
command?: string;
|
|
1443
|
+
error?: string;
|
|
1444
|
+
}
|
|
1445
|
+
type SkillSource = "bundled" | "agent" | "project" | "personal" | "standard";
|
|
1446
|
+
interface SkillInfo {
|
|
1447
|
+
id: string;
|
|
1448
|
+
name: string;
|
|
1449
|
+
description: string;
|
|
1450
|
+
content: string;
|
|
1451
|
+
path: string;
|
|
1452
|
+
source: SkillSource;
|
|
1453
|
+
readOnly: boolean;
|
|
1454
|
+
projectPath?: string;
|
|
1455
|
+
projectName?: string;
|
|
1456
|
+
}
|
|
1457
|
+
interface SkillProject {
|
|
1458
|
+
name: string;
|
|
1459
|
+
path: string;
|
|
1460
|
+
}
|
|
1461
|
+
interface SkillSnapshot {
|
|
1462
|
+
skills: SkillInfo[];
|
|
1463
|
+
projects: SkillProject[];
|
|
1464
|
+
warnings: string[];
|
|
1465
|
+
}
|
|
1466
|
+
interface AgentPersonaInfo {
|
|
1467
|
+
name: string;
|
|
1468
|
+
description: string;
|
|
1469
|
+
source?: string;
|
|
1470
|
+
model?: string;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
interface CustomModelProviderInput {
|
|
1474
|
+
id: string;
|
|
1475
|
+
displayName: string;
|
|
1476
|
+
baseUrl: string;
|
|
1477
|
+
apiFormat: "openai";
|
|
1478
|
+
apiKey?: string;
|
|
1479
|
+
models: {
|
|
1480
|
+
id: string;
|
|
1481
|
+
displayName: string;
|
|
1482
|
+
imageInputSupport?: "native" | "unsupported" | "unknown";
|
|
1483
|
+
contextWindow?: number;
|
|
1484
|
+
maxOutputTokens?: number;
|
|
1485
|
+
}[];
|
|
1486
|
+
headers?: Record<string, string>;
|
|
1487
|
+
secretHeaders?: Record<string, string | null>;
|
|
1488
|
+
}
|
|
1489
|
+
type Removal = {
|
|
1490
|
+
provider: string;
|
|
1491
|
+
disableDefault?: boolean;
|
|
1492
|
+
replacement?: {
|
|
1493
|
+
provider: string;
|
|
1494
|
+
model: string;
|
|
1495
|
+
};
|
|
1496
|
+
};
|
|
1497
|
+
type ModelProviderRequest = {
|
|
1498
|
+
action: "list";
|
|
1499
|
+
} | {
|
|
1500
|
+
action: "refresh";
|
|
1501
|
+
} | {
|
|
1502
|
+
action: "connect";
|
|
1503
|
+
provider: string;
|
|
1504
|
+
apiKey: string;
|
|
1505
|
+
headers?: Record<string, string>;
|
|
1506
|
+
secretHeaders?: Record<string, string | null>;
|
|
1507
|
+
} | {
|
|
1508
|
+
action: "updateHeaders";
|
|
1509
|
+
provider: string;
|
|
1510
|
+
headers: Record<string, string>;
|
|
1511
|
+
secretHeaders?: Record<string, string | null>;
|
|
1512
|
+
} | {
|
|
1513
|
+
action: "createCustom";
|
|
1514
|
+
value: CustomModelProviderInput;
|
|
1515
|
+
} | {
|
|
1516
|
+
action: "updateCustom";
|
|
1517
|
+
provider: string;
|
|
1518
|
+
value: CustomModelProviderInput;
|
|
1519
|
+
} | ({
|
|
1520
|
+
action: "disconnect";
|
|
1521
|
+
} & Removal) | ({
|
|
1522
|
+
action: "removeCustom";
|
|
1523
|
+
} & Removal);
|
|
1524
|
+
interface ModelProviderConnection {
|
|
1525
|
+
name: string;
|
|
1526
|
+
displayName: string;
|
|
1527
|
+
connected: boolean;
|
|
1528
|
+
active: boolean;
|
|
1529
|
+
custom?: boolean;
|
|
1530
|
+
credentialLabel?: string;
|
|
1531
|
+
credentialSource: "credentials" | "environment" | "subscription" | "local" | "configured" | "none";
|
|
1532
|
+
source?: "builtin" | "catalog" | "custom" | "subscription";
|
|
1533
|
+
baseUrl?: string;
|
|
1534
|
+
headers?: Record<string, string>;
|
|
1535
|
+
secretHeaderNames?: string[];
|
|
1536
|
+
models: {
|
|
1537
|
+
id: string;
|
|
1538
|
+
label: string;
|
|
1539
|
+
imageInputSupport?: "native" | "unsupported" | "unknown";
|
|
1540
|
+
declaredLimits?: {
|
|
1541
|
+
contextWindow?: number;
|
|
1542
|
+
maxOutputTokens?: number;
|
|
1543
|
+
};
|
|
1544
|
+
}[];
|
|
1545
|
+
}
|
|
1546
|
+
interface ProviderDefaultsSnapshot {
|
|
1547
|
+
models: {
|
|
1548
|
+
id: string;
|
|
1549
|
+
label: string;
|
|
1550
|
+
provider: string;
|
|
1551
|
+
providerName: string;
|
|
1552
|
+
reasoningEfforts?: string[];
|
|
1553
|
+
contextWindow?: number;
|
|
1554
|
+
inputModalities?: string[];
|
|
1555
|
+
inputCapabilities?: {
|
|
1556
|
+
image: "native" | "unsupported" | "unknown";
|
|
1557
|
+
};
|
|
1558
|
+
}[];
|
|
1559
|
+
provider: string | null;
|
|
1560
|
+
model: string | null;
|
|
1561
|
+
effort: string | null;
|
|
1562
|
+
disabled: boolean;
|
|
1563
|
+
revision: string;
|
|
1564
|
+
verified: Record<string, {
|
|
1565
|
+
model: string;
|
|
1566
|
+
checkedAt: number;
|
|
1567
|
+
}>;
|
|
1568
|
+
fastModeAvailable: false;
|
|
1569
|
+
fastModeReason: string;
|
|
1570
|
+
}
|
|
1571
|
+
interface ProviderConnectionTestResult {
|
|
1572
|
+
status: "verified" | "failed";
|
|
1573
|
+
category?: "authentication" | "address" | "network" | "model" | "unsupported" | "service";
|
|
1574
|
+
detail: string;
|
|
1575
|
+
checkedAt: number;
|
|
1576
|
+
}
|
|
1577
|
+
type ProviderDefaultsRequest = {
|
|
1578
|
+
action: "snapshot";
|
|
1579
|
+
} | {
|
|
1580
|
+
action: "updateModel";
|
|
1581
|
+
provider?: string;
|
|
1582
|
+
model: string;
|
|
1583
|
+
effort?: string | null;
|
|
1584
|
+
expectedRevision?: string;
|
|
1585
|
+
} | {
|
|
1586
|
+
action: "updateEffort";
|
|
1587
|
+
effort: string | null;
|
|
1588
|
+
expectedRevision: string;
|
|
1589
|
+
} | {
|
|
1590
|
+
action: "test";
|
|
1591
|
+
provider: string;
|
|
1592
|
+
model: string;
|
|
1593
|
+
};
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* HttpTransport: BobanNomi HTTP 传输内核。
|
|
1597
|
+
*
|
|
1598
|
+
* 负责:
|
|
1599
|
+
* - Base URL 规范化
|
|
1600
|
+
* - Bearer Token 鉴权头
|
|
1601
|
+
* - fetch 注入与执行
|
|
1602
|
+
* - URL query 拼接
|
|
1603
|
+
* - 请求体序列化与错误转换 (BobanNomiApiError)
|
|
1604
|
+
* - 基础响应解析与流式透传
|
|
1605
|
+
*
|
|
1606
|
+
* 约束:不感知任何业务 Resource 领域逻辑。
|
|
1607
|
+
*/
|
|
1608
|
+
|
|
1609
|
+
interface HttpTransportOptions {
|
|
1610
|
+
baseUrl: string;
|
|
1611
|
+
token?: string;
|
|
1612
|
+
fetch?: typeof fetch;
|
|
1613
|
+
}
|
|
1614
|
+
interface HttpRequestOptions {
|
|
1615
|
+
method?: string;
|
|
1616
|
+
body?: unknown;
|
|
1617
|
+
headers?: RequestInit["headers"];
|
|
1618
|
+
query?: Record<string, unknown>;
|
|
1619
|
+
signal?: AbortSignal;
|
|
1620
|
+
auth?: boolean;
|
|
1621
|
+
}
|
|
1622
|
+
interface RawRequestOptions extends RequestInit {
|
|
1623
|
+
duplex?: "half";
|
|
1624
|
+
query?: Record<string, unknown>;
|
|
1625
|
+
auth?: boolean;
|
|
1626
|
+
}
|
|
1627
|
+
/** HTTP API 非 2xx 时抛出;携带 status 与原始响应体。 */
|
|
1628
|
+
declare class BobanNomiApiError extends Error {
|
|
1629
|
+
readonly status: number;
|
|
1630
|
+
readonly body: unknown;
|
|
1631
|
+
constructor(message: string, status: number, body: unknown);
|
|
1632
|
+
}
|
|
1633
|
+
declare function responseField(value: unknown, field: string): unknown;
|
|
1634
|
+
declare function responseArray<T>(value: unknown, field: string, decode: (item: unknown) => T): T[];
|
|
1635
|
+
/** Normalize a daemon base URL without accepting credentials or request fragments. */
|
|
1636
|
+
declare function normalizeDaemonBaseUrl(value: string): string;
|
|
1637
|
+
interface AttachmentRangeOptions {
|
|
1638
|
+
start?: number;
|
|
1639
|
+
end?: number;
|
|
1640
|
+
suffixBytes?: number;
|
|
1641
|
+
}
|
|
1642
|
+
declare function attachmentRangeHeader(range: AttachmentRangeOptions | undefined): string | undefined;
|
|
1643
|
+
declare class HttpTransport {
|
|
1644
|
+
private protocolHandshake?;
|
|
1645
|
+
private protocolVerified;
|
|
1646
|
+
readonly baseUrl: string;
|
|
1647
|
+
readonly token?: string;
|
|
1648
|
+
readonly fetchImpl: typeof fetch;
|
|
1649
|
+
constructor(options: HttpTransportOptions);
|
|
1650
|
+
isHandshakeExempt(pathname: string): boolean;
|
|
1651
|
+
rememberProtocol(capabilities: ServerCapabilities): void;
|
|
1652
|
+
ensureProtocol(signal?: AbortSignal): Promise<ServerCapabilities>;
|
|
1653
|
+
headers(jsonOrOptions?: boolean | {
|
|
1654
|
+
json?: boolean;
|
|
1655
|
+
auth?: boolean;
|
|
1656
|
+
extra?: Record<string, string>;
|
|
1657
|
+
}, auth?: boolean): Record<string, string>;
|
|
1658
|
+
path(pathname: string, query?: Record<string, unknown>): string;
|
|
1659
|
+
resolveUrl(pathname: string, query?: Record<string, unknown>): string;
|
|
1660
|
+
request<T>(path: string, options?: HttpRequestOptions): Promise<T>;
|
|
1661
|
+
requestUnknown(path: string, options?: HttpRequestOptions): Promise<unknown>;
|
|
1662
|
+
requestResponse(path: string, options?: RawRequestOptions): Promise<Response>;
|
|
1663
|
+
throwResponseError(response: Response): Promise<never>;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* SseTransport: Server-Sent Events 流式传输内核。
|
|
1668
|
+
*
|
|
1669
|
+
* 负责:
|
|
1670
|
+
* - 原始字节流 TextDecoder 解码
|
|
1671
|
+
* - SSE 行解析(data:, event:, id:, retry:, 注释行)
|
|
1672
|
+
* - 多行 data 拼接(\n 间隔)
|
|
1673
|
+
* - CRLF / LF 空行完成单个 frame
|
|
1674
|
+
* - signal / abort 支持
|
|
1675
|
+
* - Last-Event-ID 透传与错误处理
|
|
1676
|
+
*/
|
|
1677
|
+
|
|
1678
|
+
interface SseStreamOptions<T = unknown> {
|
|
1679
|
+
headers?: RequestInit["headers"];
|
|
1680
|
+
signal?: AbortSignal;
|
|
1681
|
+
lastEventId?: string;
|
|
1682
|
+
decode?: (value: unknown) => T;
|
|
1683
|
+
reconnect?: boolean;
|
|
1684
|
+
onOpen?: () => void;
|
|
1685
|
+
reconnectDelayMs?: number;
|
|
1686
|
+
noBodyMessage?: string;
|
|
1687
|
+
/** 超过该毫秒数没有收到任何原始 SSE 帧(含注释帧)就中止当前连接;0/未设置表示关闭。 */
|
|
1688
|
+
idleTimeoutMs?: number;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* 将 SSE 字节流解析为事件异步迭代器。
|
|
1692
|
+
* `open` 负责建立连接并返回 response body,便于重试或注入。
|
|
1693
|
+
*/
|
|
1694
|
+
declare function streamServerSentEvents<T>(open: () => Promise<ReadableStream<Uint8Array>>, decode?: (value: unknown) => T): AsyncIterable<T>;
|
|
1695
|
+
declare class SseTransport {
|
|
1696
|
+
private readonly transport;
|
|
1697
|
+
constructor(transport: HttpTransport);
|
|
1698
|
+
stream<T>(url: string, options?: SseStreamOptions<T>): AsyncIterable<T>;
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
declare class ScheduleResource {
|
|
1702
|
+
private readonly transport;
|
|
1703
|
+
constructor(transport: HttpTransport);
|
|
1704
|
+
getStatus(options?: {
|
|
1705
|
+
signal?: AbortSignal;
|
|
1706
|
+
}): Promise<ScheduledTaskStatusSummary>;
|
|
1707
|
+
listTasks(options?: {
|
|
1708
|
+
status?: ScheduledTaskRecord["status"];
|
|
1709
|
+
signal?: AbortSignal;
|
|
1710
|
+
}): Promise<ScheduledTaskRecord[]>;
|
|
1711
|
+
getTask(id: string, options?: {
|
|
1712
|
+
signal?: AbortSignal;
|
|
1713
|
+
}): Promise<ScheduledTaskRecord>;
|
|
1714
|
+
createTask(input: CreateScheduledTaskInput, options?: {
|
|
1715
|
+
signal?: AbortSignal;
|
|
1716
|
+
}): Promise<ScheduledTaskRecord>;
|
|
1717
|
+
updateTask(id: string, input: UpdateScheduledTaskInput, options?: {
|
|
1718
|
+
signal?: AbortSignal;
|
|
1719
|
+
}): Promise<ScheduledTaskRecord>;
|
|
1720
|
+
removeTask(id: string, options?: {
|
|
1721
|
+
signal?: AbortSignal;
|
|
1722
|
+
}): Promise<void>;
|
|
1723
|
+
triggerTask(id: string, options?: {
|
|
1724
|
+
signal?: AbortSignal;
|
|
1725
|
+
requestId?: string;
|
|
1726
|
+
}): Promise<ScheduledRunRecord>;
|
|
1727
|
+
listRuns(options?: {
|
|
1728
|
+
taskId?: string;
|
|
1729
|
+
unread?: boolean;
|
|
1730
|
+
limit?: number;
|
|
1731
|
+
signal?: AbortSignal;
|
|
1732
|
+
}): Promise<ScheduledRunRecord[]>;
|
|
1733
|
+
setRunUnread(id: string, unread: boolean, options?: {
|
|
1734
|
+
signal?: AbortSignal;
|
|
1735
|
+
}): Promise<ScheduledRunRecord>;
|
|
1736
|
+
}
|
|
1737
|
+
interface ScheduledTaskStatusSummary {
|
|
1738
|
+
running: true;
|
|
1739
|
+
tasks: number;
|
|
1740
|
+
active: number;
|
|
1741
|
+
paused: number;
|
|
1742
|
+
executing: number;
|
|
1743
|
+
unread: number;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
/** A context receipt captured by the host for one session input, not an application action API. */
|
|
1747
|
+
interface SessionComposerContext {
|
|
1748
|
+
/** The actual session and mounted view captured by the producer. */
|
|
1749
|
+
source: {
|
|
1750
|
+
sessionId: string;
|
|
1751
|
+
appId: string;
|
|
1752
|
+
};
|
|
1753
|
+
/** Opaque, short-lived evidence; forward unchanged and never copy it into metadata. */
|
|
1754
|
+
lease: {
|
|
1755
|
+
token: string;
|
|
1756
|
+
backendGeneration: string;
|
|
1757
|
+
};
|
|
1758
|
+
requestId: string;
|
|
1759
|
+
expectedRevision: number;
|
|
1760
|
+
text: string;
|
|
1761
|
+
data: JsonValue;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
interface UploadAttachmentInput {
|
|
1765
|
+
requestId: string;
|
|
1766
|
+
draftId: string;
|
|
1767
|
+
expectedSha256: string;
|
|
1768
|
+
byteLength: number;
|
|
1769
|
+
displayName: string;
|
|
1770
|
+
mediaType?: string;
|
|
1771
|
+
body: Blob | ArrayBuffer | Uint8Array | ReadableStream<Uint8Array>;
|
|
1772
|
+
signal?: AbortSignal;
|
|
1773
|
+
}
|
|
1774
|
+
interface DownloadAttachmentOptions {
|
|
1775
|
+
range?: {
|
|
1776
|
+
start?: number;
|
|
1777
|
+
end?: number;
|
|
1778
|
+
suffixBytes?: number;
|
|
1779
|
+
};
|
|
1780
|
+
signal?: AbortSignal;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* 单个 session 在客户端的聚合视图。
|
|
1785
|
+
* 由事件 reducer 从 event log 归并得出,不是服务端直接返回的结构。
|
|
1786
|
+
*/
|
|
1787
|
+
interface SessionBucket {
|
|
1788
|
+
goal?: SessionGoal | null;
|
|
1789
|
+
session?: SessionRecord;
|
|
1790
|
+
inputs: SessionInputRecord[];
|
|
1791
|
+
messages: SessionMessageRecord[];
|
|
1792
|
+
partsByMessageId: Record<string, SessionMessagePartRecord[]>;
|
|
1793
|
+
runs: Record<string, SessionRunRecord>;
|
|
1794
|
+
attempts: Record<string, SessionRunAttemptRecord>;
|
|
1795
|
+
tasks: Record<string, SessionExecutionRecord>;
|
|
1796
|
+
permissions: Record<string, PermissionRequestRecord>;
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* 客户端权威状态:由 snapshot/live(或全局 replay/live)经 reducer 收敛。
|
|
1800
|
+
* 多端 attach 同一 daemon 时,应得到一致的状态形状。
|
|
1801
|
+
*/
|
|
1802
|
+
interface BobanNomiClientState {
|
|
1803
|
+
sessions: Record<string, SessionRecord>;
|
|
1804
|
+
/** 按 `updatedAt` 降序的 session id 列表。 */
|
|
1805
|
+
sessionOrder: string[];
|
|
1806
|
+
buckets: Record<string, SessionBucket>;
|
|
1807
|
+
/** Durable replay events indexed by seq; live text deltas are not retained. */
|
|
1808
|
+
eventsBySeq: Record<number, SessionEventRecord>;
|
|
1809
|
+
/** Latest atomic snapshot cursor for each session; older delayed SSE events are ignored. */
|
|
1810
|
+
snapshotCursorBySession: Record<string, number>;
|
|
1811
|
+
/** Highest ordered transient event seq already applied; prevents SSE reconnect replay. */
|
|
1812
|
+
transientCursor: number;
|
|
1813
|
+
/** 当前已应用到的最大事件序号,用作 SSE cursor。 */
|
|
1814
|
+
lastSeq: number;
|
|
1815
|
+
}
|
|
1816
|
+
/** `syncEvents` 的过滤、取消与重连选项。 */
|
|
1817
|
+
interface EventSyncOptions {
|
|
1818
|
+
partView?: "summary";
|
|
1819
|
+
sessionId?: string;
|
|
1820
|
+
cursor?: number;
|
|
1821
|
+
signal?: AbortSignal;
|
|
1822
|
+
/**
|
|
1823
|
+
* Delay before a live-stream reconnect attempt (attempt is 0-based).
|
|
1824
|
+
* Defaults to exponential backoff capped at 30s. Tests may pass `() => 0`.
|
|
1825
|
+
*/
|
|
1826
|
+
reconnectDelayMs?: (attempt: number) => number;
|
|
1827
|
+
/** 会话事件流空闲超时(毫秒);默认由 sync 层填 60s。 */
|
|
1828
|
+
idleTimeoutMs?: number;
|
|
1829
|
+
}
|
|
1830
|
+
/** `syncEvents` 产出的单次状态更新。 */
|
|
1831
|
+
interface SyncEventUpdate {
|
|
1832
|
+
event?: SessionEventRecord;
|
|
1833
|
+
state: BobanNomiClientState;
|
|
1834
|
+
/** Session attach starts from an atomic snapshot, then consumes SSE deltas. */
|
|
1835
|
+
source: "snapshot" | "replay" | "live" | "reconnecting";
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
interface SessionFileRequestOptions {
|
|
1839
|
+
signal?: AbortSignal;
|
|
1840
|
+
}
|
|
1841
|
+
interface SessionFileListOptions extends SessionFileListInput, SessionFileRequestOptions {
|
|
1842
|
+
}
|
|
1843
|
+
interface SessionFileReadOptions extends Omit<SessionFileReadInput, "path">, SessionFileRequestOptions {
|
|
1844
|
+
}
|
|
1845
|
+
interface SessionFileFindOptions extends SessionFileFindInput, SessionFileRequestOptions {
|
|
1846
|
+
}
|
|
1847
|
+
interface SessionFileSearchOptions extends SessionFileSearchInput, SessionFileRequestOptions {
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
/** Public Agent lifecycle request, response and synchronization types. */
|
|
1851
|
+
|
|
1852
|
+
/** `BobanNomiClient` 构造参数。 */
|
|
1853
|
+
interface BobanNomiClientOptions {
|
|
1854
|
+
/** daemon HTTP 根地址,例如 `http://127.0.0.1:8787`。 */
|
|
1855
|
+
baseUrl: string;
|
|
1856
|
+
/** Bearer token;与 daemon registry 中的 token 对应。 */
|
|
1857
|
+
token?: string;
|
|
1858
|
+
/** 可注入的 fetch,便于测试或自定义传输。 */
|
|
1859
|
+
fetch?: typeof fetch;
|
|
1860
|
+
}
|
|
1861
|
+
interface BobanNomiServerHealth {
|
|
1862
|
+
ok: true;
|
|
1863
|
+
version?: string;
|
|
1864
|
+
startedAt: number;
|
|
1865
|
+
uptimeMs: number;
|
|
1866
|
+
sessionCount: number;
|
|
1867
|
+
activeRunCount: number;
|
|
1868
|
+
queuedRunCount: number;
|
|
1869
|
+
}
|
|
1870
|
+
/** `GET /sessions` 查询参数。 */
|
|
1871
|
+
interface ListSessionsOptions {
|
|
1872
|
+
cwd?: string;
|
|
1873
|
+
includeArchived?: boolean;
|
|
1874
|
+
includeChildren?: boolean;
|
|
1875
|
+
limit?: number;
|
|
1876
|
+
}
|
|
1877
|
+
/** `POST /sessions` 请求体。 */
|
|
1878
|
+
interface ExecutionInstructions {
|
|
1879
|
+
revision: number;
|
|
1880
|
+
content: string;
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
type CreateClientSessionInput = CreateSessionInput;
|
|
1884
|
+
type ForkClientSessionInput = ForkSessionInput;
|
|
1885
|
+
interface EditLatestClientPromptInput {
|
|
1886
|
+
outputSchema?: Record<string, unknown>;
|
|
1887
|
+
id: string;
|
|
1888
|
+
items: SessionUserInputItem[];
|
|
1889
|
+
sourceMessageId: string;
|
|
1890
|
+
attachments?: AdmitPromptAttachmentInput[];
|
|
1891
|
+
metadata?: Record<string, unknown>;
|
|
1892
|
+
}
|
|
1893
|
+
interface PromoteQueuedClientPromptInput {
|
|
1894
|
+
queuedRunId: string;
|
|
1895
|
+
expectedActiveRunId: string;
|
|
1896
|
+
}
|
|
1897
|
+
interface CancelQueuedClientPromptInput {
|
|
1898
|
+
queuedRunId: string;
|
|
1899
|
+
}
|
|
1900
|
+
interface PromoteQueuedPromptResponse {
|
|
1901
|
+
input: SessionInputRecord;
|
|
1902
|
+
queued_run: SessionRunRecord;
|
|
1903
|
+
active_run: SessionRunRecord;
|
|
1904
|
+
}
|
|
1905
|
+
interface CancelQueuedPromptResponse {
|
|
1906
|
+
input: SessionInputRecord;
|
|
1907
|
+
run: SessionRunRecord;
|
|
1908
|
+
}
|
|
1909
|
+
/** `POST /sessions/:id/prompts` 请求体。 */
|
|
1910
|
+
interface AdmitClientPromptInput {
|
|
1911
|
+
pluginAppContexts?: SessionComposerContext[];
|
|
1912
|
+
id?: string;
|
|
1913
|
+
items: SessionUserInputItem[];
|
|
1914
|
+
delivery?: InputDelivery;
|
|
1915
|
+
outputSchema?: Record<string, unknown>;
|
|
1916
|
+
attachments?: AdmitPromptAttachmentInput[];
|
|
1917
|
+
metadata?: Record<string, unknown>;
|
|
1918
|
+
}
|
|
1919
|
+
/** Session identity is carried by the URL; only lifecycle prompt fields are public. */
|
|
1920
|
+
type PromptInputForClient = AdmitClientPromptInput;
|
|
1921
|
+
/** `POST /sessions/:id/runs/:runId/resume` 请求体。`id` 用于安全重试。 */
|
|
1922
|
+
interface ResumeInterruptedRunInput {
|
|
1923
|
+
/** If supplied, must equal the original prompt's contract. */
|
|
1924
|
+
outputSchema?: Record<string, unknown>;
|
|
1925
|
+
id?: string;
|
|
1926
|
+
metadata?: Record<string, unknown>;
|
|
1927
|
+
}
|
|
1928
|
+
/** `GET /sessions/:id/messages` 查询参数。 */
|
|
1929
|
+
interface ListMessagesOptions {
|
|
1930
|
+
cursor?: number;
|
|
1931
|
+
afterSeq?: number;
|
|
1932
|
+
limit?: number;
|
|
1933
|
+
}
|
|
1934
|
+
/** `GET /sessions/:id/parts` 查询参数。 */
|
|
1935
|
+
interface ListClientMessagePartsOptions {
|
|
1936
|
+
partView?: "summary";
|
|
1937
|
+
cursor?: number;
|
|
1938
|
+
afterSeq?: number;
|
|
1939
|
+
messageId?: string;
|
|
1940
|
+
limit?: number;
|
|
1941
|
+
}
|
|
1942
|
+
/** `GET /events` 查询参数。 */
|
|
1943
|
+
interface ListEventsOptions {
|
|
1944
|
+
partView?: "summary";
|
|
1945
|
+
cursor?: number;
|
|
1946
|
+
afterSeq?: number;
|
|
1947
|
+
sessionId?: string;
|
|
1948
|
+
limit?: number;
|
|
1949
|
+
}
|
|
1950
|
+
/** `GET /permissions` 查询参数。 */
|
|
1951
|
+
interface ListPermissionsOptions {
|
|
1952
|
+
sessionId?: string;
|
|
1953
|
+
status?: PermissionStatus;
|
|
1954
|
+
toolName?: string;
|
|
1955
|
+
limit?: number;
|
|
1956
|
+
}
|
|
1957
|
+
/** `POST /permissions/:id/reply` 请求体。 */
|
|
1958
|
+
interface ReplyPermissionInput {
|
|
1959
|
+
status: Extract<PermissionStatus, "approved" | "denied" | "expired">;
|
|
1960
|
+
decision?: "once" | "session";
|
|
1961
|
+
clientId?: string;
|
|
1962
|
+
answer?: string;
|
|
1963
|
+
}
|
|
1964
|
+
/** `POST /sessions/:id/prompts` 响应。 */
|
|
1965
|
+
interface PromptResponse {
|
|
1966
|
+
input: SessionInputRecord;
|
|
1967
|
+
run?: SessionRunRecord;
|
|
1968
|
+
queue_state?: "running" | "queued";
|
|
1969
|
+
}
|
|
1970
|
+
/** `POST /sessions/:id/runs/:runId/resume` 响应。旧 run 保持 interrupted,新 run 独立执行。 */
|
|
1971
|
+
interface ResumeInterruptedRunResponse extends PromptResponse {
|
|
1972
|
+
source_run: SessionRunRecord;
|
|
1973
|
+
}
|
|
1974
|
+
/** `PATCH /sessions/:id` 请求体。 */
|
|
1975
|
+
interface UpdateClientSessionInput {
|
|
1976
|
+
title?: string;
|
|
1977
|
+
metadata?: {
|
|
1978
|
+
app?: Record<string, unknown>;
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
interface CompactSessionResponse {
|
|
1982
|
+
messageCount: number;
|
|
1983
|
+
messages: SessionMessageRecord[];
|
|
1984
|
+
parts: SessionMessagePartRecord[];
|
|
1985
|
+
}
|
|
1986
|
+
interface RewindSessionResponse {
|
|
1987
|
+
turns: number;
|
|
1988
|
+
removed: number;
|
|
1989
|
+
messages: SessionMessageRecord[];
|
|
1990
|
+
parts: SessionMessagePartRecord[];
|
|
1991
|
+
}
|
|
1992
|
+
interface RememberSessionResponse {
|
|
1993
|
+
skipped: boolean;
|
|
1994
|
+
reason?: string;
|
|
1995
|
+
writtenIds: string[];
|
|
1996
|
+
titles: string[];
|
|
1997
|
+
}
|
|
1998
|
+
interface SessionUsageResponse {
|
|
1999
|
+
model: string;
|
|
2000
|
+
inputTokens: number;
|
|
2001
|
+
outputTokens: number;
|
|
2002
|
+
cacheCreationTokens: number;
|
|
2003
|
+
cacheReadTokens: number;
|
|
2004
|
+
messageCount: number;
|
|
2005
|
+
estimatedCost: string;
|
|
2006
|
+
}
|
|
2007
|
+
interface SessionExportResponse {
|
|
2008
|
+
format: "md" | "json";
|
|
2009
|
+
filepath: string;
|
|
2010
|
+
messageCount: number;
|
|
2011
|
+
}
|
|
2012
|
+
/** `POST /background-shells` 请求体。 */
|
|
2013
|
+
interface CreateBackgroundShellInput {
|
|
2014
|
+
/** Stable caller identity for safe retries of one logical creation request. */
|
|
2015
|
+
requestId?: string;
|
|
2016
|
+
sessionId: string;
|
|
2017
|
+
command: string;
|
|
2018
|
+
cwd?: string;
|
|
2019
|
+
description?: string;
|
|
2020
|
+
}
|
|
2021
|
+
/** `POST /background-shells` 响应。 */
|
|
2022
|
+
interface CreateBackgroundShellResult {
|
|
2023
|
+
jobId: string;
|
|
2024
|
+
snapshot: JobSnapshot;
|
|
2025
|
+
}
|
|
2026
|
+
/** `POST /sessions/:id/interrupt` 响应。 */
|
|
2027
|
+
interface InterruptSessionResponse {
|
|
2028
|
+
activeRunId?: string;
|
|
2029
|
+
queuedRunIds: string[];
|
|
2030
|
+
interrupted: boolean;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
/**
|
|
2034
|
+
* ProtocolClient: 协议协商与健康检查客户端。
|
|
2035
|
+
*
|
|
2036
|
+
* 负责:
|
|
2037
|
+
* - GET /health 服务健康探测 (无需鉴权)
|
|
2038
|
+
* - GET /capabilities 服务协议能力探测与版本协商 (无需鉴权)
|
|
2039
|
+
* - 协议兼容性断言与 IncompatibleProtocolError 抛出
|
|
2040
|
+
*
|
|
2041
|
+
* 约束:
|
|
2042
|
+
* - 构造只接收 HttpTransport
|
|
2043
|
+
* - 业务请求的强制握手由 HttpTransport 缓存并执行
|
|
2044
|
+
*/
|
|
2045
|
+
|
|
2046
|
+
declare class IncompatibleProtocolError extends Error {
|
|
2047
|
+
readonly capabilities: ServerCapabilities;
|
|
2048
|
+
constructor(capabilities: ServerCapabilities, message: string);
|
|
2049
|
+
}
|
|
2050
|
+
interface CapabilitiesOptions {
|
|
2051
|
+
/** Native callers may request identity metadata using this connection's existing token. */
|
|
2052
|
+
authenticated?: boolean;
|
|
2053
|
+
/** Read protocol and identity without probing optional execution environments. */
|
|
2054
|
+
scope?: "protocol";
|
|
2055
|
+
signal?: AbortSignal;
|
|
2056
|
+
support?: ClientProtocolSupport;
|
|
2057
|
+
}
|
|
2058
|
+
interface HealthOptions {
|
|
2059
|
+
signal?: AbortSignal;
|
|
2060
|
+
}
|
|
2061
|
+
declare class ProtocolClient {
|
|
2062
|
+
private readonly transport;
|
|
2063
|
+
constructor(transport: HttpTransport);
|
|
2064
|
+
/** `GET /health` */
|
|
2065
|
+
health(options?: HealthOptions): Promise<BobanNomiServerHealth>;
|
|
2066
|
+
/**
|
|
2067
|
+
* `GET /capabilities`
|
|
2068
|
+
* 连接产品应先调用它,再根据 features 决定显示哪些功能。
|
|
2069
|
+
*/
|
|
2070
|
+
capabilities(options?: CapabilitiesOptions): Promise<ServerCapabilities>;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
/** Runtime discovery and authorized model-provider management. */
|
|
2074
|
+
declare class RuntimeResource {
|
|
2075
|
+
private readonly transport;
|
|
2076
|
+
constructor(transport: HttpTransport);
|
|
2077
|
+
listModels(options?: {
|
|
2078
|
+
signal?: AbortSignal;
|
|
2079
|
+
}): Promise<ModelProviderInfo[]>;
|
|
2080
|
+
modelProviders(input?: ModelProviderRequest, options?: {
|
|
2081
|
+
signal?: AbortSignal;
|
|
2082
|
+
}): Promise<ModelProviderConnection[]>;
|
|
2083
|
+
providerDefaults(input: Extract<ProviderDefaultsRequest, {
|
|
2084
|
+
action: "test";
|
|
2085
|
+
}>, options?: {
|
|
2086
|
+
signal?: AbortSignal;
|
|
2087
|
+
}): Promise<ProviderConnectionTestResult>;
|
|
2088
|
+
providerDefaults(input?: Exclude<ProviderDefaultsRequest, {
|
|
2089
|
+
action: "test";
|
|
2090
|
+
}>, options?: {
|
|
2091
|
+
signal?: AbortSignal;
|
|
2092
|
+
}): Promise<ProviderDefaultsSnapshot>;
|
|
2093
|
+
listAgentPersonas(options?: {
|
|
2094
|
+
signal?: AbortSignal;
|
|
2095
|
+
}): Promise<AgentPersonaInfo[]>;
|
|
2096
|
+
listSkills(options?: {
|
|
2097
|
+
signal?: AbortSignal;
|
|
2098
|
+
}): Promise<SkillSnapshot>;
|
|
2099
|
+
getSessionMcp(sessionId: string, options?: {
|
|
2100
|
+
signal?: AbortSignal;
|
|
2101
|
+
}): Promise<McpServerStatus[]>;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
type ReadOptions = {
|
|
2105
|
+
signal?: AbortSignal;
|
|
2106
|
+
};
|
|
2107
|
+
/** Observation of terminals belonging to one authorized session. */
|
|
2108
|
+
declare class SessionTerminalResource {
|
|
2109
|
+
private readonly transport;
|
|
2110
|
+
constructor(transport: HttpTransport);
|
|
2111
|
+
list(sessionId: string, options?: ReadOptions): Promise<TerminalSessionInfo[]>;
|
|
2112
|
+
read(sessionId: string, terminalId: string, options?: ReadOptions & {
|
|
2113
|
+
after?: number;
|
|
2114
|
+
maxChars?: number;
|
|
2115
|
+
}): Promise<TerminalReadResult>;
|
|
2116
|
+
stream(sessionId: string, terminalId: string, options?: ReadOptions): Promise<AsyncIterable<TerminalEvent>>;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
type Options = {
|
|
2120
|
+
signal?: AbortSignal;
|
|
2121
|
+
};
|
|
2122
|
+
declare class SessionManagementResource {
|
|
2123
|
+
private readonly transport;
|
|
2124
|
+
private authenticatedCapabilities?;
|
|
2125
|
+
constructor(transport: HttpTransport);
|
|
2126
|
+
private ready;
|
|
2127
|
+
getRevision(sessionId: string, input: {
|
|
2128
|
+
action: SessionManagementAction;
|
|
2129
|
+
}, options?: Options): Promise<SessionResourceRevision>;
|
|
2130
|
+
private mutate;
|
|
2131
|
+
rename(id: string, input: {
|
|
2132
|
+
requestId: string;
|
|
2133
|
+
title: string;
|
|
2134
|
+
expectedRevision: number;
|
|
2135
|
+
}, options?: Options): Promise<SessionMutationPublicReceipt>;
|
|
2136
|
+
setPinned(id: string, input: {
|
|
2137
|
+
requestId: string;
|
|
2138
|
+
pinned: boolean;
|
|
2139
|
+
expectedRevision: number;
|
|
2140
|
+
}, options?: Options): Promise<SessionMutationPublicReceipt>;
|
|
2141
|
+
archive(id: string, input: {
|
|
2142
|
+
requestId: string;
|
|
2143
|
+
expectedTreeRevision: string;
|
|
2144
|
+
}, options?: Options): Promise<SessionMutationPublicReceipt>;
|
|
2145
|
+
delete(id: string, input: {
|
|
2146
|
+
requestId: string;
|
|
2147
|
+
expectedTreeRevision: string;
|
|
2148
|
+
}, options?: Options): Promise<SessionMutationPublicReceipt>;
|
|
2149
|
+
getMutation(sessionId: string, requestId: string, options?: Options): Promise<SessionMutationPublicReceipt | null>;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
/** Generate a caller-stable id for one prompt admission attempt. */
|
|
2153
|
+
declare function createPromptRequestId(): string;
|
|
2154
|
+
declare class SessionResource {
|
|
2155
|
+
private readonly transport;
|
|
2156
|
+
readonly resources: SessionManagementResource;
|
|
2157
|
+
readonly terminals: SessionTerminalResource;
|
|
2158
|
+
constructor(transport: HttpTransport);
|
|
2159
|
+
private checkOutputSchema;
|
|
2160
|
+
/** `GET /sessions/search` - search saved conversation text without opening it. */
|
|
2161
|
+
search(options: SearchSessionsOptions & {
|
|
2162
|
+
signal?: AbortSignal;
|
|
2163
|
+
}): Promise<SessionSearchResult[]>;
|
|
2164
|
+
/** `GET /sessions` */
|
|
2165
|
+
list(options?: ListSessionsOptions & {
|
|
2166
|
+
signal?: AbortSignal;
|
|
2167
|
+
}): Promise<SessionRecord[]>;
|
|
2168
|
+
listDirectory(options?: {
|
|
2169
|
+
includeArchived?: boolean;
|
|
2170
|
+
cursor?: string;
|
|
2171
|
+
signal?: AbortSignal;
|
|
2172
|
+
}): Promise<SessionDirectoryPage>;
|
|
2173
|
+
getActivity(options?: {
|
|
2174
|
+
signal?: AbortSignal;
|
|
2175
|
+
}): Promise<SessionActivityPage>;
|
|
2176
|
+
getDraftComposerOptions(input: DraftComposerTarget, options?: {
|
|
2177
|
+
signal?: AbortSignal;
|
|
2178
|
+
}): Promise<DraftComposerOptions>;
|
|
2179
|
+
getControls(sessionId: string, options?: {
|
|
2180
|
+
signal?: AbortSignal;
|
|
2181
|
+
}): Promise<SessionControls>;
|
|
2182
|
+
getControlResult(sessionId: string, input: {
|
|
2183
|
+
requestId: string;
|
|
2184
|
+
original: SessionControlOriginal;
|
|
2185
|
+
}, options?: {
|
|
2186
|
+
signal?: AbortSignal;
|
|
2187
|
+
}): Promise<SessionControlReceipt | null>;
|
|
2188
|
+
/** Current context assembly requires execution authority; /usage is historical billing. */
|
|
2189
|
+
getContextUsage(sessionId: string, options?: {
|
|
2190
|
+
signal?: AbortSignal;
|
|
2191
|
+
}): Promise<ContextUsageSnapshot>;
|
|
2192
|
+
/** `GET /sessions/:id` */
|
|
2193
|
+
get(sessionId: string, options?: {
|
|
2194
|
+
signal?: AbortSignal;
|
|
2195
|
+
}): Promise<SessionRecord>;
|
|
2196
|
+
/** `POST /sessions` */
|
|
2197
|
+
create(input: CreateClientSessionInput, options?: {
|
|
2198
|
+
signal?: AbortSignal;
|
|
2199
|
+
}): Promise<SessionRecord>;
|
|
2200
|
+
getConfigurationOptions(input: {
|
|
2201
|
+
cwd: string;
|
|
2202
|
+
projectId?: string;
|
|
2203
|
+
}, options?: {
|
|
2204
|
+
signal?: AbortSignal;
|
|
2205
|
+
}): Promise<SessionConfigurationOptions>;
|
|
2206
|
+
getCreationResult(input: {
|
|
2207
|
+
requestId: string;
|
|
2208
|
+
sessionId: string;
|
|
2209
|
+
original: DispatchedSessionCreation;
|
|
2210
|
+
}, options?: {
|
|
2211
|
+
signal?: AbortSignal;
|
|
2212
|
+
}): Promise<SessionCreationReceipt | null>;
|
|
2213
|
+
getConfiguration(sessionId: string, options?: {
|
|
2214
|
+
signal?: AbortSignal;
|
|
2215
|
+
}): Promise<SessionConfigurationSnapshot>;
|
|
2216
|
+
configure(sessionId: string, input: ConfigureClientSessionInput, options?: {
|
|
2217
|
+
signal?: AbortSignal;
|
|
2218
|
+
}): Promise<SessionControlReceipt>;
|
|
2219
|
+
getConfigurationResult(sessionId: string, input: SessionConfigurationResultInput, options?: {
|
|
2220
|
+
signal?: AbortSignal;
|
|
2221
|
+
}): Promise<SessionControlReceipt | null>;
|
|
2222
|
+
/** `PATCH /sessions/:id` - update title or application metadata. */
|
|
2223
|
+
update(sessionId: string, input: UpdateClientSessionInput, options?: {
|
|
2224
|
+
signal?: AbortSignal;
|
|
2225
|
+
}): Promise<SessionRecord>;
|
|
2226
|
+
/** `POST /sessions/:id/fork` */
|
|
2227
|
+
fork(sessionId: string, input?: ForkClientSessionInput, options?: {
|
|
2228
|
+
signal?: AbortSignal;
|
|
2229
|
+
}): Promise<SessionRecord>;
|
|
2230
|
+
/** `DELETE /sessions/:id` */
|
|
2231
|
+
archive(sessionId: string, options?: {
|
|
2232
|
+
signal?: AbortSignal;
|
|
2233
|
+
}): Promise<SessionRecord>;
|
|
2234
|
+
/** `DELETE /sessions/:id/hard` */
|
|
2235
|
+
delete(sessionId: string, options?: {
|
|
2236
|
+
signal?: AbortSignal;
|
|
2237
|
+
}): Promise<string[]>;
|
|
2238
|
+
/** `GET /sessions/:id/state` - atomic attach snapshot plus SSE cursor. */
|
|
2239
|
+
getState(sessionId: string, options?: {
|
|
2240
|
+
signal?: AbortSignal;
|
|
2241
|
+
partView?: "summary";
|
|
2242
|
+
}): Promise<AgentSessionStateSnapshot>;
|
|
2243
|
+
/** `GET /sessions/:id/messages` */
|
|
2244
|
+
listMessages(sessionId: string, options?: ListMessagesOptions & {
|
|
2245
|
+
signal?: AbortSignal;
|
|
2246
|
+
}): Promise<SessionMessageRecord[]>;
|
|
2247
|
+
/** `GET /sessions/:id/parts` */
|
|
2248
|
+
listMessageParts(sessionId: string, options?: ListClientMessagePartsOptions & {
|
|
2249
|
+
signal?: AbortSignal;
|
|
2250
|
+
}): Promise<SessionMessagePartRecord[]>;
|
|
2251
|
+
/** Read full canonical content for one part in its session/message scope. */
|
|
2252
|
+
getMessagePart(sessionId: string, messageId: string, partId: string, options?: {
|
|
2253
|
+
signal?: AbortSignal;
|
|
2254
|
+
}): Promise<SessionMessagePartRecord>;
|
|
2255
|
+
/** `POST /sessions/:id/prompts` — 提交用户输入并触发/排队一次 run。 */
|
|
2256
|
+
admitPrompt(sessionId: string, input: AdmitClientPromptInput, options?: {
|
|
2257
|
+
signal?: AbortSignal;
|
|
2258
|
+
}): Promise<PromptResponse>;
|
|
2259
|
+
/** `POST /sessions/:id/prompts/latest/edit` */
|
|
2260
|
+
editLatestPrompt(sessionId: string, input: EditLatestClientPromptInput, options?: {
|
|
2261
|
+
signal?: AbortSignal;
|
|
2262
|
+
}): Promise<PromptResponse>;
|
|
2263
|
+
/** Promote one durable queued prompt into the exact active run. */
|
|
2264
|
+
promoteQueuedPrompt(sessionId: string, inputId: string, input: PromoteQueuedClientPromptInput, options?: {
|
|
2265
|
+
signal?: AbortSignal;
|
|
2266
|
+
}): Promise<PromoteQueuedPromptResponse>;
|
|
2267
|
+
/** Cancel one durable prompt that is still waiting in the run queue. */
|
|
2268
|
+
cancelQueuedPrompt(sessionId: string, inputId: string, input: CancelQueuedClientPromptInput, options: {
|
|
2269
|
+
signal?: AbortSignal;
|
|
2270
|
+
responseMode: "receipt";
|
|
2271
|
+
}): Promise<QueuedPromptCancelReceipt>;
|
|
2272
|
+
cancelQueuedPrompt(sessionId: string, inputId: string, input: CancelQueuedClientPromptInput, options?: {
|
|
2273
|
+
signal?: AbortSignal;
|
|
2274
|
+
responseMode?: "snapshot";
|
|
2275
|
+
}): Promise<CancelQueuedPromptResponse>;
|
|
2276
|
+
/**
|
|
2277
|
+
* `POST /sessions/:id/runs/:runId/resume` — 显式重放一次中断 run 的原始 prompt。
|
|
2278
|
+
* 不会继续旧 provider stream;服务端会创建一个带恢复溯源的新 input/run。
|
|
2279
|
+
*/
|
|
2280
|
+
resumeInterruptedRun(sessionId: string, runId: string, input?: ResumeInterruptedRunInput, options?: {
|
|
2281
|
+
signal?: AbortSignal;
|
|
2282
|
+
}): Promise<ResumeInterruptedRunResponse>;
|
|
2283
|
+
/** `POST /sessions/:id/interrupt` — 中断当前/排队中的 run。 */
|
|
2284
|
+
interrupt(sessionId: string, options?: {
|
|
2285
|
+
signal?: AbortSignal;
|
|
2286
|
+
expectedRunId?: string;
|
|
2287
|
+
source?: "user" | "system";
|
|
2288
|
+
}): Promise<InterruptSessionResponse>;
|
|
2289
|
+
/** `POST /sessions/:id/compact` */
|
|
2290
|
+
compact(sessionId: string, options?: {
|
|
2291
|
+
signal?: AbortSignal;
|
|
2292
|
+
requestId?: string;
|
|
2293
|
+
expectedRevision?: number;
|
|
2294
|
+
}): Promise<CompactSessionResponse>;
|
|
2295
|
+
/** `POST /sessions/:id/rewind` */
|
|
2296
|
+
rewind(sessionId: string, input?: {
|
|
2297
|
+
count?: number;
|
|
2298
|
+
}, options?: {
|
|
2299
|
+
signal?: AbortSignal;
|
|
2300
|
+
}): Promise<RewindSessionResponse>;
|
|
2301
|
+
/** `POST /sessions/:id/remember` */
|
|
2302
|
+
remember(sessionId: string, options?: {
|
|
2303
|
+
signal?: AbortSignal;
|
|
2304
|
+
}): Promise<RememberSessionResponse>;
|
|
2305
|
+
/** `POST /sessions/:id/export` */
|
|
2306
|
+
export(sessionId: string, input?: {
|
|
2307
|
+
filename?: string;
|
|
2308
|
+
json?: boolean;
|
|
2309
|
+
}, options?: {
|
|
2310
|
+
signal?: AbortSignal;
|
|
2311
|
+
}): Promise<SessionExportResponse>;
|
|
2312
|
+
/** `GET /sessions/:id/usage` */
|
|
2313
|
+
getUsage(sessionId: string, options?: {
|
|
2314
|
+
signal?: AbortSignal;
|
|
2315
|
+
}): Promise<SessionUsageResponse>;
|
|
2316
|
+
/** `GET /sessions/:id/goal` */
|
|
2317
|
+
getGoal(sessionId: string): Promise<SessionGoal | null>;
|
|
2318
|
+
/** Reads the original durable action receipt after a response was lost. */
|
|
2319
|
+
getGoalRequest(sessionId: string, requestId: string): Promise<SessionGoalRequestReceipt>;
|
|
2320
|
+
/** `POST /sessions/:id/goals` */
|
|
2321
|
+
createGoal(sessionId: string, input: CreateSessionGoalInput): Promise<SessionGoal>;
|
|
2322
|
+
/** `PATCH /sessions/:id/goals/:goalId` */
|
|
2323
|
+
updateGoal(sessionId: string, goalId: string, input: UpdateSessionGoalInput): Promise<SessionGoal>;
|
|
2324
|
+
/** `POST /sessions/:id/goals/:goalId/actions` */
|
|
2325
|
+
applyGoalAction(sessionId: string, goalId: string, input: GoalActionInput): Promise<SessionGoal>;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
declare class AttachmentResource {
|
|
2329
|
+
private readonly transport;
|
|
2330
|
+
constructor(transport: HttpTransport);
|
|
2331
|
+
/** `POST /attachments` — upload bytes without JSON or multipart buffering. */
|
|
2332
|
+
upload(input: UploadAttachmentInput): Promise<AttachmentAssetRecord>;
|
|
2333
|
+
getUpload(input: Omit<UploadAttachmentInput, "body">): Promise<AttachmentAssetRecord | null>;
|
|
2334
|
+
get(id: string, options?: {
|
|
2335
|
+
signal?: AbortSignal;
|
|
2336
|
+
}): Promise<AttachmentAssetRecord>;
|
|
2337
|
+
/** Returns the raw response so callers can consume the body as a stream. */
|
|
2338
|
+
download(id: string, options?: DownloadAttachmentOptions): Promise<Response>;
|
|
2339
|
+
delete(id: string, options?: {
|
|
2340
|
+
signal?: AbortSignal;
|
|
2341
|
+
}): Promise<AttachmentAssetRecord>;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
declare class PermissionResource {
|
|
2345
|
+
private readonly transport;
|
|
2346
|
+
constructor(transport: HttpTransport);
|
|
2347
|
+
/** Answer an actual AskUser question; this cannot approve tools. */
|
|
2348
|
+
answerQuestion(requestId: string, input: {
|
|
2349
|
+
answer: string;
|
|
2350
|
+
}, options?: {
|
|
2351
|
+
signal?: AbortSignal;
|
|
2352
|
+
}): Promise<PermissionRequestRecord>;
|
|
2353
|
+
listApprovals(): Promise<PermissionRequestRecord[]>;
|
|
2354
|
+
revokeApproval(requestId: string): Promise<PermissionRequestRecord>;
|
|
2355
|
+
/** `GET /permissions` */
|
|
2356
|
+
list(options?: ListPermissionsOptions & {
|
|
2357
|
+
signal?: AbortSignal;
|
|
2358
|
+
}): Promise<PermissionRequestRecord[]>;
|
|
2359
|
+
/** `POST /permissions/:id/reply` — 批准/拒绝工具权限请求。 */
|
|
2360
|
+
reply(requestId: string, input: ReplyPermissionInput, options?: {
|
|
2361
|
+
signal?: AbortSignal;
|
|
2362
|
+
}): Promise<PermissionRequestRecord>;
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
declare class JobResource {
|
|
2366
|
+
private readonly transport;
|
|
2367
|
+
constructor(transport: HttpTransport);
|
|
2368
|
+
list(options: {
|
|
2369
|
+
sessionId: string;
|
|
2370
|
+
kinds?: JobKind[];
|
|
2371
|
+
statuses?: JobStatus[];
|
|
2372
|
+
startedAfter?: number;
|
|
2373
|
+
startedBefore?: number;
|
|
2374
|
+
updatedAfter?: number;
|
|
2375
|
+
updatedBefore?: number;
|
|
2376
|
+
includeFinished?: boolean;
|
|
2377
|
+
limit?: number;
|
|
2378
|
+
signal?: AbortSignal;
|
|
2379
|
+
}): Promise<JobListResult>;
|
|
2380
|
+
createBackgroundShell(input: CreateBackgroundShellInput, options?: {
|
|
2381
|
+
signal?: AbortSignal;
|
|
2382
|
+
}): Promise<CreateBackgroundShellResult>;
|
|
2383
|
+
read(target: JobTarget, options: {
|
|
2384
|
+
sessionId: string;
|
|
2385
|
+
after?: number;
|
|
2386
|
+
maxChars?: number;
|
|
2387
|
+
signal?: AbortSignal;
|
|
2388
|
+
}): Promise<JobReadResult>;
|
|
2389
|
+
wait(target: JobTarget, input: {
|
|
2390
|
+
sessionId: string;
|
|
2391
|
+
timeoutMs?: number;
|
|
2392
|
+
after?: number;
|
|
2393
|
+
maxChars?: number;
|
|
2394
|
+
}, options?: {
|
|
2395
|
+
signal?: AbortSignal;
|
|
2396
|
+
}): Promise<JobWaitResult>;
|
|
2397
|
+
send(target: JobTarget, input: {
|
|
2398
|
+
sessionId: string;
|
|
2399
|
+
data: string;
|
|
2400
|
+
}, options?: {
|
|
2401
|
+
signal?: AbortSignal;
|
|
2402
|
+
}): Promise<JobInputReceipt | void>;
|
|
2403
|
+
cancel(target: JobTarget, input: {
|
|
2404
|
+
sessionId: string;
|
|
2405
|
+
reason?: string;
|
|
2406
|
+
}, options: {
|
|
2407
|
+
signal?: AbortSignal;
|
|
2408
|
+
responseMode: "receipt";
|
|
2409
|
+
}): Promise<JobCancelReceipt>;
|
|
2410
|
+
cancel(target: JobTarget, input: {
|
|
2411
|
+
sessionId: string;
|
|
2412
|
+
reason?: string;
|
|
2413
|
+
}, options?: {
|
|
2414
|
+
signal?: AbortSignal;
|
|
2415
|
+
responseMode?: "snapshot";
|
|
2416
|
+
}): Promise<JobSnapshot>;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
declare class EventResource {
|
|
2420
|
+
private readonly transport;
|
|
2421
|
+
private readonly sse;
|
|
2422
|
+
constructor(transport: HttpTransport, sse: SseTransport);
|
|
2423
|
+
/** `GET /events` — 用于 attach 时的历史 replay。 */
|
|
2424
|
+
list(options?: ListEventsOptions & {
|
|
2425
|
+
signal?: AbortSignal;
|
|
2426
|
+
}): Promise<SessionEventRecord[]>;
|
|
2427
|
+
stream(options?: Omit<EventSyncOptions, "reconnectDelayMs"> & {
|
|
2428
|
+
transportReconnect?: boolean;
|
|
2429
|
+
onOpen?: () => void;
|
|
2430
|
+
}): AsyncIterable<SessionEventRecord>;
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
/** Read-only files in the workspace chosen by the session, without starting an Agent. */
|
|
2434
|
+
declare class FilesResource {
|
|
2435
|
+
private readonly transport;
|
|
2436
|
+
constructor(transport: HttpTransport);
|
|
2437
|
+
list(sessionId: string, options?: SessionFileListOptions): Promise<SessionDirectoryResult>;
|
|
2438
|
+
stat(sessionId: string, path: string, options?: SessionFileRequestOptions): Promise<SessionFileInfo>;
|
|
2439
|
+
readText(sessionId: string, path: string, options?: SessionFileReadOptions): Promise<SessionTextFileResult>;
|
|
2440
|
+
find(sessionId: string, options: SessionFileFindOptions): Promise<SessionFindFilesResult>;
|
|
2441
|
+
search(sessionId: string, options: SessionFileSearchOptions): Promise<SessionSearchFilesResult>;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
declare class BobanNomiClient {
|
|
2445
|
+
readonly protocol: ProtocolClient;
|
|
2446
|
+
readonly runtime: RuntimeResource;
|
|
2447
|
+
readonly schedules: ScheduleResource;
|
|
2448
|
+
readonly sessions: SessionResource;
|
|
2449
|
+
readonly attachments: AttachmentResource;
|
|
2450
|
+
readonly permissions: PermissionResource;
|
|
2451
|
+
readonly jobs: JobResource;
|
|
2452
|
+
readonly events: EventResource;
|
|
2453
|
+
readonly files: FilesResource;
|
|
2454
|
+
constructor(options: BobanNomiClientOptions);
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
/**
|
|
2458
|
+
* 事件 → 客户端状态 reducer。
|
|
2459
|
+
*
|
|
2460
|
+
* 幂等:同一 `seq` 只应用一次。多端用同一套事件流应收敛到相同状态。
|
|
2461
|
+
*/
|
|
2462
|
+
|
|
2463
|
+
declare class UnsupportedSessionEventSchemaVersionError extends Error {
|
|
2464
|
+
readonly event: Pick<SessionEventRecord, "seq" | "type" | "schemaVersion">;
|
|
2465
|
+
constructor(event: SessionEventRecord);
|
|
2466
|
+
}
|
|
2467
|
+
/** 空客户端状态,作为 replay/hydrate 起点。 */
|
|
2468
|
+
declare function createInitialClientState(): BobanNomiClientState;
|
|
2469
|
+
/** 按序批量应用事件。 */
|
|
2470
|
+
declare function applyEvents(state: BobanNomiClientState, events: Iterable<SessionEventRecord>): BobanNomiClientState;
|
|
2471
|
+
/** Replace one session bucket with an atomic server snapshot. */
|
|
2472
|
+
declare function applySessionSnapshot(state: BobanNomiClientState, snapshot: AgentSessionStateSnapshot): BobanNomiClientState;
|
|
2473
|
+
/**
|
|
2474
|
+
* 应用单条事件。已见过的 `seq` 直接返回原 state(引用相等,便于 live 去重)。
|
|
2475
|
+
*/
|
|
2476
|
+
declare function applyEvent(state: BobanNomiClientState, event: SessionEventRecord): BobanNomiClientState;
|
|
2477
|
+
|
|
2478
|
+
interface SessionMessageWithParts {
|
|
2479
|
+
message: SessionMessageRecord;
|
|
2480
|
+
parts: SessionMessagePartRecord[];
|
|
2481
|
+
}
|
|
2482
|
+
declare function selectSessionMessagesWithParts(bucket: SessionBucket | undefined): SessionMessageWithParts[];
|
|
2483
|
+
/**
|
|
2484
|
+
* Default display view: hides superseded parts and drops assistant messages that
|
|
2485
|
+
* have no visible parts left. The raw state keeps the diagnostic records.
|
|
2486
|
+
*/
|
|
2487
|
+
declare function selectVisibleSessionMessagesWithParts(bucket: SessionBucket | undefined): SessionMessageWithParts[];
|
|
2488
|
+
declare function selectSessionInputs(bucket: SessionBucket | undefined): SessionInputRecord[];
|
|
2489
|
+
declare function selectSessionOrderedMessages(bucket: SessionBucket | undefined): SessionMessageRecord[];
|
|
2490
|
+
declare function selectSessionParts(bucket: SessionBucket | undefined): SessionMessagePartRecord[];
|
|
2491
|
+
declare function selectSessionRuns(bucket: SessionBucket | undefined): SessionRunRecord[];
|
|
2492
|
+
/** Current bounded-retry wait, if the latest active run is waiting. */
|
|
2493
|
+
declare function selectSessionModelRetry(bucket: SessionBucket | undefined): SessionModelRetryState | undefined;
|
|
2494
|
+
/** Aggregated usage completeness for the most recently updated run. */
|
|
2495
|
+
declare function selectSessionModelUsage(bucket: SessionBucket | undefined): SessionModelUsageSummary | undefined;
|
|
2496
|
+
declare function selectSessionTasks(bucket: SessionBucket | undefined): SessionExecutionRecord[];
|
|
2497
|
+
declare function selectSessionPermissions(bucket: SessionBucket | undefined): PermissionRequestRecord[];
|
|
2498
|
+
declare function selectFirstPendingPermission(state: BobanNomiClientState, sessionId?: string): PermissionRequestRecord | undefined;
|
|
2499
|
+
|
|
2500
|
+
interface SyncEventsClient {
|
|
2501
|
+
sessions: {
|
|
2502
|
+
getState(sessionId: string, options?: {
|
|
2503
|
+
signal?: AbortSignal;
|
|
2504
|
+
partView?: "summary";
|
|
2505
|
+
}): Promise<AgentSessionStateSnapshot>;
|
|
2506
|
+
};
|
|
2507
|
+
events: {
|
|
2508
|
+
list(options?: ListEventsOptions & {
|
|
2509
|
+
signal?: AbortSignal;
|
|
2510
|
+
}): Promise<SessionEventRecord[]>;
|
|
2511
|
+
stream(options?: Omit<EventSyncOptions, "reconnectDelayMs"> & {
|
|
2512
|
+
transportReconnect?: boolean;
|
|
2513
|
+
}): AsyncIterable<SessionEventRecord>;
|
|
2514
|
+
};
|
|
2515
|
+
}
|
|
2516
|
+
type GlobalEventReducer = (state: BobanNomiClientState, event: SessionEventRecord) => BobanNomiClientState;
|
|
2517
|
+
declare function hydrateState(events: Iterable<SessionEventRecord>): BobanNomiClientState;
|
|
2518
|
+
/** 公开迭代接口保留原有默认空闲超时和全局 replay 结束标记。 */
|
|
2519
|
+
declare function syncEvents(client: SyncEventsClient, options?: EventSyncOptions & {
|
|
2520
|
+
globalReducer?: GlobalEventReducer;
|
|
2521
|
+
}): AsyncIterable<SyncEventUpdate>;
|
|
2522
|
+
|
|
2523
|
+
type SyncConnectionStatus = "idle" | "connecting" | "connected" | "reconnecting" | "error";
|
|
2524
|
+
interface SessionSyncControllerOptions {
|
|
2525
|
+
client: SyncEventsClient;
|
|
2526
|
+
sessionId?: string;
|
|
2527
|
+
initialState?: BobanNomiClientState;
|
|
2528
|
+
cursor?: number;
|
|
2529
|
+
generation?: number;
|
|
2530
|
+
signal?: AbortSignal;
|
|
2531
|
+
reconnectDelayMs?: (attempt: number) => number;
|
|
2532
|
+
/** Return false when the caller must replace the underlying client connection. */
|
|
2533
|
+
shouldRetry?: (error: unknown) => boolean;
|
|
2534
|
+
onUpdate?: (update: SyncEventUpdate, generation: number) => void;
|
|
2535
|
+
onStatusChange?: (status: SyncConnectionStatus, generation: number) => void;
|
|
2536
|
+
onError?: (error: unknown, generation: number) => void;
|
|
2537
|
+
}
|
|
2538
|
+
declare class SessionSyncController {
|
|
2539
|
+
private readonly options;
|
|
2540
|
+
private readonly initialCursor;
|
|
2541
|
+
private readonly generation;
|
|
2542
|
+
private readonly abortController;
|
|
2543
|
+
private state;
|
|
2544
|
+
private status;
|
|
2545
|
+
private running;
|
|
2546
|
+
constructor(options: SessionSyncControllerOptions);
|
|
2547
|
+
get currentStatus(): SyncConnectionStatus;
|
|
2548
|
+
get currentState(): BobanNomiClientState;
|
|
2549
|
+
get currentGeneration(): number;
|
|
2550
|
+
get signal(): AbortSignal;
|
|
2551
|
+
abort(reason?: unknown): void;
|
|
2552
|
+
private setStatus;
|
|
2553
|
+
/** 不可恢复错误通过 onError 上报;取消和正常结束都 resolve。 */
|
|
2554
|
+
start(): Promise<void>;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
interface WaitForRunOptions {
|
|
2558
|
+
sessionId: string;
|
|
2559
|
+
runId: string;
|
|
2560
|
+
signal?: AbortSignal;
|
|
2561
|
+
}
|
|
2562
|
+
interface RunResult {
|
|
2563
|
+
run: SessionRunRecord;
|
|
2564
|
+
messages: SessionMessageWithParts[];
|
|
2565
|
+
}
|
|
2566
|
+
/** Wait for this Run's durable terminal state using the shared snapshot/recovery algorithm. */
|
|
2567
|
+
declare function waitForRun(client: SyncEventsClient, options: WaitForRunOptions): Promise<RunResult>;
|
|
2568
|
+
|
|
2569
|
+
/** Normalize stored presets for client display and request construction. */
|
|
2570
|
+
declare function normalizeApprovalMode(value: unknown): ApprovalMode | undefined;
|
|
2571
|
+
declare function isWorkMode(value: unknown): value is WorkMode;
|
|
2572
|
+
/** Project validated metadata for client controls without authorizing execution. */
|
|
2573
|
+
declare function readSessionRuntimeConfig(session: SessionRecord, defaults?: Partial<SessionRuntimeConfig>): SessionRuntimeConfig;
|
|
2574
|
+
declare function patchSessionRuntimeMetadata(metadata: Record<string, unknown>, patch: SessionRuntimeConfigPatch): Record<string, unknown>;
|
|
2575
|
+
|
|
2576
|
+
export { AttachmentResource, BobanNomiApiError, BobanNomiClient, CURRENT_PROTOCOL_VERSION, EventResource, FilesResource, HttpTransport, IncompatibleProtocolError, JobResource, PermissionResource, ProtocolClient, ProtocolValidationError, RuntimeResource, ScheduleResource, SessionManagementResource, SessionResource, SessionSyncController, SseTransport, UnsupportedSessionEventSchemaVersionError, applyEvent, applyEvents, applySessionSnapshot, attachmentRangeHeader, checkProtocolCompatibility, createInitialClientState, createPromptRequestId, hydrateState, isSupersededModelPart, isWorkMode, normalizeApprovalMode, normalizeDaemonBaseUrl, parseCreateSessionGoalInput, parseGoalActionInput, parseMcpCallResultData, parseUpdateSessionGoalInput, patchSessionRuntimeMetadata, readPluginUiInstance, readRuntimeMetadata, readSessionModelRetryState, readSessionModelUsage, readSessionRuntimeConfig, readWorkspaceChangesMetadata, responseArray, responseField, selectFirstPendingPermission, selectSessionInputs, selectSessionMessagesWithParts, selectSessionModelRetry, selectSessionModelUsage, selectSessionOrderedMessages, selectSessionParts, selectSessionPermissions, selectSessionRuns, selectSessionTasks, selectVisibleSessionMessagesWithParts, streamServerSentEvents, supportsFeature, syncEvents, waitForRun };
|
|
2577
|
+
export type { AdmitClientPromptInput, AdmitPromptAttachmentInput, AgentEnvironmentCapabilities, AgentPersonaInfo, ApprovalMode, ApprovalReviewRecord, AttachmentAssetRecord, BobanNomiClientOptions, BobanNomiClientState, BobanNomiServerHealth, CancelQueuedClientPromptInput, CancelQueuedPromptResponse, CancelResponseMode, ClientProtocolSupport, CompactSessionResponse, ConfigureClientSessionInput, ContextBucketId, ContextUsageBucket, ContextUsageSnapshot, ContextUsageTip, ContextUsageTipCode, CreateBackgroundShellInput, CreateBackgroundShellResult, CreateClientSessionInput, CreateScheduledTaskInput, CreateSessionGoalInput, CustomModelProviderInput, DispatchedSessionCreation, DownloadAttachmentOptions, DraftComposerOptions, DraftComposerTarget, EditLatestClientPromptInput, EventSyncOptions, ExecutionInstructions, ForkClientSessionInput, GoalActionInput, GoalExternalWait, GoalStopReason, HookInfo, HttpRequestOptions, HttpTransportOptions, InputDelivery, InterruptSessionResponse, JobCancelReceipt, JobCapabilities, JobInputReceipt, JobKind, JobListResult, JobReadResult, JobSnapshot, JobStatus, JobTarget, JobWaitResult, JsonValue, ListClientMessagePartsOptions, ListEventsOptions, ListMessagePartsOptions, ListMessagesOptions, ListPermissionsOptions, ListSessionsOptions, McpServerStatus, ModelInfo, ModelProviderConnection, ModelProviderInfo, ModelProviderRequest, PermissionRequestRecord, PermissionStatus, PluginArchiveError, PluginArchivePreview, PluginGitPreview, PluginInfo, PluginRuntimeStatus, PluginUiInstanceRecord, PluginUiInventory, PromoteQueuedClientPromptInput, PromoteQueuedPromptResponse, PromptInputForClient, PromptResponse, ProtocolCompatibility, ProviderConnectionTestResult, ProviderDefaultsRequest, ProviderDefaultsSnapshot, QueuedPromptCancelReceipt, RawRequestOptions, RememberSessionResponse, ReplyPermissionInput, ResolvedSessionConfiguration, ResumeInterruptedRunInput, ResumeInterruptedRunResponse, RewindSessionResponse, RunResult, ScheduledRunRecord, ScheduledTaskRecord, ScheduledTaskStatusSummary, SearchSessionsOptions, ServerCapabilities, SessionActivityPage, SessionAttachmentMessagePartRecord, SessionBucket, SessionComposerContext, SessionConfigurationInput, SessionConfigurationOptions, SessionConfigurationResultInput, SessionConfigurationSnapshot, SessionControlOriginal, SessionControlReceipt, SessionControls, SessionCreationReceipt, SessionDirectoryEntry, SessionDirectoryPage, SessionDirectoryResult, SessionEventRecord, SessionExecutionRecord, SessionExportResponse, SessionFileErrorCode, SessionFileFindInput, SessionFileFindOptions, SessionFileInfo, SessionFileListInput, SessionFileListOptions, SessionFileReadInput, SessionFileReadOptions, SessionFileRequestOptions, SessionFileSearchInput, SessionFileSearchMatch, SessionFileSearchOptions, SessionFileStatInput, SessionFindFilesResult, SessionGoal, SessionGoalRequestReceipt, SessionInputAttachmentRecord, SessionInputRecord, SessionManagementAction, SessionMessagePartRecord, SessionMessageRecord, SessionMessageWithParts, SessionModelRetryState, SessionModelUsageSummary, SessionMutationPublicReceipt, SessionRecord, SessionResourceRevision, SessionRunAttemptRecord, SessionRunRecord, SessionRuntimeConfig, SessionRuntimeConfigPatch, SessionSearchFilesResult, SessionSearchResult, AgentSessionStateSnapshot as SessionStateSnapshot, SessionSyncControllerOptions, SessionTextFileResult, SessionTransformationMessagePartRecord, SessionUsageResponse, SessionUserInputItem, SkillInfo, SkillProject, SkillSnapshot, SkillSource, SyncConnectionStatus, SyncEventUpdate, SyncEventsClient, UpdateClientSessionInput, UpdateScheduledTaskInput, UpdateSessionGoalInput, UploadAttachmentInput, WaitForRunOptions, WorkMode, WorkspaceChangeFile, WorkspaceChangesMetadata };
|