@blade-hq/agent-client 1.1.1
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 +351 -0
- package/dist/auth-login.d.ts +29 -0
- package/dist/auth.d.ts +8 -0
- package/dist/blade-client.d.ts +113 -0
- package/dist/commands/embedded.d.ts +32 -0
- package/dist/commands/protocol.d.ts +38 -0
- package/dist/commands/registry.d.ts +21 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +4182 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/auth.d.ts +34 -0
- package/dist/resources/headless.d.ts +33 -0
- package/dist/resources/sessions.d.ts +263 -0
- package/dist/rest.d.ts +21 -0
- package/dist/schemas/background.d.ts +16 -0
- package/dist/schemas/event.d.ts +51 -0
- package/dist/schemas/message-utils.d.ts +48 -0
- package/dist/schemas/message.d.ts +83 -0
- package/dist/schemas/projection.d.ts +87 -0
- package/dist/schemas/session.d.ts +126 -0
- package/dist/schemas/solution.d.ts +101 -0
- package/dist/schemas/task.d.ts +12 -0
- package/dist/session/agent-session.d.ts +179 -0
- package/dist/session/events.d.ts +143 -0
- package/dist/session/hub.d.ts +44 -0
- package/dist/session/state.d.ts +57 -0
- package/dist/shared/projection/builder.d.ts +59 -0
- package/dist/shared/projection/helpers.d.ts +34 -0
- package/dist/shared/projection/history.d.ts +12 -0
- package/dist/shared/projection/index.d.ts +3 -0
- package/dist/shared/projection/state.d.ts +22 -0
- package/dist/socket.d.ts +9 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/rest.d.ts +17315 -0
- package/dist/types/sdk-profile.d.ts +47 -0
- package/dist/types/socket-events.d.ts +401 -0
- package/dist/version.d.ts +45 -0
- package/package.json +29 -0
- package/public-api.md +1103 -0
package/public-api.md
ADDED
|
@@ -0,0 +1,1103 @@
|
|
|
1
|
+
# @blade-hq/agent-client 公共 API 报告
|
|
2
|
+
|
|
3
|
+
> 本文件由 `scripts/public-api-report.mjs` 生成,请勿手改。
|
|
4
|
+
> 公共面变更时重新生成本报告,并同步更新 README 对应章节——CI 会校验两者。
|
|
5
|
+
|
|
6
|
+
共 104 个公开声明。
|
|
7
|
+
|
|
8
|
+
## `ActiveCompactionState` (interface)
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
archived_count: number | null | undefined
|
|
12
|
+
archived_files: ArchivedFileInfo[] | null | undefined
|
|
13
|
+
archived_tool_calls: ArchivedToolCallInfo[] | null | undefined
|
|
14
|
+
compaction_id: string
|
|
15
|
+
failure_reason: string | null | undefined
|
|
16
|
+
fallback_applied: boolean | null | undefined
|
|
17
|
+
saved_ratio: number | null | undefined
|
|
18
|
+
status: "streaming" | "completed" | "paused" | "failed" | "interrupted"
|
|
19
|
+
summary_full: string | null | undefined
|
|
20
|
+
summary_preview: string | null | undefined
|
|
21
|
+
tokens_after: number | null | undefined
|
|
22
|
+
tokens_before: number | null | undefined
|
|
23
|
+
trigger: "auto" | "manual" | "forced_retry" | null | undefined
|
|
24
|
+
turn_id: string
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## `AgentLoopInfo` (interface)
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
description: string
|
|
31
|
+
status: "running" | "done" | "error" | "cancelled" | "awaiting_answer"
|
|
32
|
+
toolCallId: string
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## `AgentSession` (class)
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
append: (text: string) => void
|
|
39
|
+
attach: (label: string, data: unknown) => void
|
|
40
|
+
compact: () => Promise<Record<string, unknown>>
|
|
41
|
+
dispose: () => void
|
|
42
|
+
getState: () => SessionState
|
|
43
|
+
insertText: (text: string) => void
|
|
44
|
+
isDisposed: boolean
|
|
45
|
+
off: <K extends keyof AgentSessionEvents>(name: K, handler: (event: AgentSessionEvents[K]) => void) => void
|
|
46
|
+
on: <K extends keyof AgentSessionEvents>(name: K, handler: (event: AgentSessionEvents[K]) => void) => () => void
|
|
47
|
+
onCommand: (action: string, handler: CommandHandler) => () => void
|
|
48
|
+
send: (content: MessageContent, options?: SendOptions) => Promise<void>
|
|
49
|
+
sessionId: string
|
|
50
|
+
stop: () => Promise<Record<string, unknown>>
|
|
51
|
+
subscribe: (listener: () => void) => () => void
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## `AgentSessionEventName` (type)
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
export type AgentSessionEventName = keyof AgentSessionEvents
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## `AgentSessionEvents` (interface)
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
artifact: { filePath: string; contentType: string; title: string; content: string; oldString?: string; newString?: string; kind: "created" | "updated"; }
|
|
64
|
+
attachRequested: { label: string; content: string; }
|
|
65
|
+
backgroundTask: { id: string; command: string; description?: string; status: "running" | "done" | "failed"; exitCode?: number | null; elapsedSeconds: number; output?: string; }
|
|
66
|
+
chatEnd: { status: string; }
|
|
67
|
+
command: { action: string; payload: unknown; toolCallId?: string; }
|
|
68
|
+
error: { message: string; }
|
|
69
|
+
insertTextRequested: { text: string; }
|
|
70
|
+
message: { message: ChatMessage; turn: TurnProjection; }
|
|
71
|
+
modeChange: { mode: "planning" | "executing"; }
|
|
72
|
+
notification: { type: string; title: string; detail?: string; status: "info" | "running" | "done" | "error"; loopId?: string; metadata?: Record<string, unknown>; }
|
|
73
|
+
replayMismatch: { actualMessage?: string; expectedMessage?: string; respond: (decision: "keep_replay" | "continue_replay") => void; }
|
|
74
|
+
rewind: { checkpointId: string; }
|
|
75
|
+
sandboxOom: { toolCallId: string; }
|
|
76
|
+
sessionUpdated: { intent?: string; status?: SessionStatus; model?: string | null; boundSkillId?: string | null; replayState?: Record<string, unknown> | null; }
|
|
77
|
+
taskListUpdated: { tasks: unknown[]; }
|
|
78
|
+
toolCall: { toolCall: ToolCallInfo; turn: TurnProjection; }
|
|
79
|
+
toolPreview: { toolCallId: string; type: "resource-html" | "resource-uri"; content: string; title: string; }
|
|
80
|
+
toolResult: { toolCall: ToolCallInfo; turn: TurnProjection; }
|
|
81
|
+
workspaceChanged: { filePath?: string; }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## `ArchivedFileInfo` (interface)
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
filename: string | null | undefined
|
|
88
|
+
relative_path: string | null | undefined
|
|
89
|
+
size_bytes: number | null | undefined
|
|
90
|
+
tool_name: string | null | undefined
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## `ArchivedToolCallInfo` (interface)
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
archive_path: string | null | undefined
|
|
97
|
+
entry_id: string | null | undefined
|
|
98
|
+
replacement_content: string | null | undefined
|
|
99
|
+
tool_call_id: string | null | undefined
|
|
100
|
+
tool_name: string | null | undefined
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## `AskUserAnswerData` (interface)
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
custom: Record<number, string>
|
|
107
|
+
selections: Record<number, number[]>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## `AsrAudioPayload` (type)
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
export type AsrAudioPayload =
|
|
114
|
+
| ArrayBuffer
|
|
115
|
+
| Uint8Array
|
|
116
|
+
| { pcm: ArrayBuffer | Uint8Array; request_id?: string }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## `AuthResource` (class)
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
getMe: () => Promise<UserInfo>
|
|
123
|
+
getProviders: () => Promise<ProvidersResponse>
|
|
124
|
+
login: (options?: LoginOptions) => Promise<LoginResult>
|
|
125
|
+
logout: () => Promise<{ logout_url: string; }>
|
|
126
|
+
logoutToken: () => void
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## `BackgroundTask` (interface)
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
command: string
|
|
133
|
+
description: string | undefined
|
|
134
|
+
elapsed_seconds: number
|
|
135
|
+
exit_code: number | null | undefined
|
|
136
|
+
finished_at: number | null | undefined
|
|
137
|
+
heartbeat_at: number | null | undefined
|
|
138
|
+
id: string
|
|
139
|
+
legacy_status: "failed" | "running" | "done" | undefined
|
|
140
|
+
log_path: string | null | undefined
|
|
141
|
+
output: string | undefined
|
|
142
|
+
output_lines_count: number | undefined
|
|
143
|
+
output_preview: string[] | undefined
|
|
144
|
+
started_at: number | null | undefined
|
|
145
|
+
status: "failed" | "running" | "done" | "cancelled" | "queued" | "starting" | "succeeded" | "timeout" | "lost"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## `BizRole` (interface)
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
description: string | null | undefined
|
|
152
|
+
id: string
|
|
153
|
+
name: string
|
|
154
|
+
preview: { url: string; title?: string | null; } | null | undefined
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## `BladeApiError` (class)
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
cause: unknown
|
|
161
|
+
message: string
|
|
162
|
+
name: string
|
|
163
|
+
response: Response
|
|
164
|
+
stack: string | undefined
|
|
165
|
+
status: number
|
|
166
|
+
statusText: string
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## `BladeClient` (class)
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
auth: AuthResource
|
|
173
|
+
blob: (method: HttpMethod, path: string) => Promise<Blob>
|
|
174
|
+
buildAuthedUrl: (path: string) => string
|
|
175
|
+
ensureVersionCompatible: () => Promise<void>
|
|
176
|
+
fetch: (method: HttpMethod, path: string, init?: BladeFetchInit, isRetry?: boolean) => Promise<Response>
|
|
177
|
+
formData: (method: HttpMethod, path: string, form: FormData, options?: { expectOk?: boolean; onUploadProgress?: (progress: UploadProgress) => void; }) => Promise<Response>
|
|
178
|
+
hasToken: () => boolean
|
|
179
|
+
headless: HeadlessResource
|
|
180
|
+
hub: SessionHub
|
|
181
|
+
json: <T>(method: HttpMethod, path: string, body?: unknown) => Promise<T>
|
|
182
|
+
jsonFromInit: <T>(path: string, init?: RequestInit) => Promise<T>
|
|
183
|
+
login: (options?: LoginOptions) => Promise<LoginResult>
|
|
184
|
+
logoutToken: () => void
|
|
185
|
+
onSocketReplaced: (listener: () => void) => () => void
|
|
186
|
+
options: BladeClientOptions
|
|
187
|
+
responseFromInit: (path: string, init?: RequestInit) => Promise<Response>
|
|
188
|
+
sessions: SessionsResource
|
|
189
|
+
setBaseUrl: (baseUrl: string) => void
|
|
190
|
+
setToken: (token: string | null) => void
|
|
191
|
+
socket: () => TypedSocket
|
|
192
|
+
text: (method: HttpMethod, path: string) => Promise<string>
|
|
193
|
+
textFromInit: (path: string, init?: RequestInit) => Promise<string>
|
|
194
|
+
token: string | null
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## `BladeClientOptions` (interface)
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
baseUrl: string
|
|
201
|
+
fetchImpl: { (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined
|
|
202
|
+
onRefreshSuccess: (() => void | Promise<void>) | undefined
|
|
203
|
+
socketToken: string | (() => string | null | undefined) | undefined
|
|
204
|
+
token: string | (() => string | null | undefined) | undefined
|
|
205
|
+
tokenStorage: TokenStorageMode | undefined
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## `buildMessageContent` (function)
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
buildMessageContent: (text: string, attachments: Array<{ kind: "file"; name: string; uploadedPath?: string; textContent?: string | null; mimeType?: string; }>) => MessageContent
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## `ChatMessage` (interface)
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
blocks: ContentBlock[] | undefined
|
|
218
|
+
compaction: CompactionInfo | undefined
|
|
219
|
+
content: MessageContent
|
|
220
|
+
duration_ms: number | undefined
|
|
221
|
+
entry_id: string | undefined
|
|
222
|
+
kind: string | undefined
|
|
223
|
+
loop_name: string | undefined
|
|
224
|
+
memory_refs: MemoryRefInfo[] | undefined
|
|
225
|
+
parent_id: string | null | undefined
|
|
226
|
+
reasoning: string | undefined
|
|
227
|
+
role: "error" | "user" | "assistant" | "tool"
|
|
228
|
+
status: "streaming" | "completed" | "paused" | "failed" | "interrupted" | undefined
|
|
229
|
+
timestamp: string | undefined
|
|
230
|
+
tool_calls: ToolCallInfo[] | undefined
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## `ClientProjectionBuilder` (class)
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
processBatch: (events: RawEvent[]) => ProjectionUpdate[]
|
|
237
|
+
processEvent: (event: RawEvent) => ProjectionUpdate[] | null
|
|
238
|
+
reset: () => void
|
|
239
|
+
seedSequence: (maxSeq: number) => void
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## `CommandEnvelope` (interface)
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
action: string
|
|
246
|
+
direction: "agent-to-host"
|
|
247
|
+
meta: { sessionId: string; toolCallId?: string; timestamp: number; }
|
|
248
|
+
payload: unknown
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## `CommandHandler` (type)
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
export type CommandHandler = (payload: unknown, meta: { toolCallId?: string }) => void
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## `CompactionInfo` (interface)
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
archived_count: number | null | undefined
|
|
261
|
+
archived_files: ArchivedFileInfo[] | null | undefined
|
|
262
|
+
archived_tool_calls: ArchivedToolCallInfo[] | null | undefined
|
|
263
|
+
compaction_id: string
|
|
264
|
+
failure_reason: string | null | undefined
|
|
265
|
+
fallback_applied: boolean | null | undefined
|
|
266
|
+
saved_ratio: number | null | undefined
|
|
267
|
+
summary_full: string | null | undefined
|
|
268
|
+
summary_preview: string | null | undefined
|
|
269
|
+
tokens_after: number | null | undefined
|
|
270
|
+
tokens_before: number | null | undefined
|
|
271
|
+
trigger: "auto" | "manual" | "forced_retry" | null | undefined
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## `connectEmbedded` (function)
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
connectEmbedded: (options: EmbeddedChatOptions) => EmbeddedChat
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## `ConnectionStatus` (type)
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
export type ConnectionStatus = "connecting" | "connected" | "reconnecting" | "disconnected"
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## `ContentBlock` (interface)
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
content: unknown
|
|
290
|
+
display_name: string | null | undefined
|
|
291
|
+
tool_call_id: string | null | undefined
|
|
292
|
+
tool_name: string | null | undefined
|
|
293
|
+
type: "text" | "thinking" | "tool_use" | "tool_result" | "tool_ui" | "tool_bridge" | "system_notification" | "mode_change" | "plan_status" | "ask_user_answer"
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## `contentPreview` (function)
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
contentPreview: (content: MessageContent, maxLen?: number) => string
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## `createInitialSessionState` (function)
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
createInitialSessionState: (sessionId: string) => SessionState
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## `CreateSessionRequest` (interface)
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
biz_role_id: string | null | undefined
|
|
312
|
+
compaction_ratio: number | null | undefined
|
|
313
|
+
daemon_id: string | null | undefined
|
|
314
|
+
disable_tools: string[] | null | undefined
|
|
315
|
+
enable_thinking: boolean | null | undefined
|
|
316
|
+
env: Record<string, string> | undefined
|
|
317
|
+
intent: string | undefined
|
|
318
|
+
memory_enabled: boolean | null | undefined
|
|
319
|
+
model: string | null | undefined
|
|
320
|
+
primary_skill_id: string | null | undefined
|
|
321
|
+
runtime_type: "sandbox" | "daemon" | null | undefined
|
|
322
|
+
session_solution_asset_id: string | null | undefined
|
|
323
|
+
solution_id: string | undefined
|
|
324
|
+
template_id: TemplateId | undefined
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## `createSocket` (function)
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
createSocket: (options: CreateSocketOptions) => TypedSocket
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## `CreateSocketOptions` (interface)
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
baseUrl: string
|
|
337
|
+
path: string | undefined
|
|
338
|
+
token: string | (() => string | null | undefined) | undefined
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## `EmbeddedChat` (interface)
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
attach: (label: string, data: unknown) => void
|
|
345
|
+
dispose: () => void
|
|
346
|
+
insertText: (text: string) => void
|
|
347
|
+
onCommand: (action: string, handler: CommandHandler) => () => void
|
|
348
|
+
send: (text: string) => void
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## `EmbeddedChatOptions` (interface)
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
allowedOrigins: string[]
|
|
355
|
+
iframe: HTMLIFrameElement | undefined
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## `ExistingSolutionRef` (interface)
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
bizRoleId: string | undefined
|
|
362
|
+
kind: "existing"
|
|
363
|
+
solutionId: string
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## `extractTextAttachments` (function)
|
|
367
|
+
|
|
368
|
+
```ts
|
|
369
|
+
extractTextAttachments: (content: MessageContent) => { cleanText: string; attachments: ParsedTextAttachment[]; contexts: ParsedTextContext[]; }
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## `FileContentPart` (interface)
|
|
373
|
+
|
|
374
|
+
```ts
|
|
375
|
+
data: string
|
|
376
|
+
name: string
|
|
377
|
+
type: "file"
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
## `FileEntry` (interface)
|
|
381
|
+
|
|
382
|
+
```ts
|
|
383
|
+
created_at: number
|
|
384
|
+
is_dir: boolean
|
|
385
|
+
name: string
|
|
386
|
+
path: string
|
|
387
|
+
tags: string[] | undefined
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## `getFileParts` (function)
|
|
391
|
+
|
|
392
|
+
```ts
|
|
393
|
+
getFileParts: (content: MessageContent) => FileContentPart[]
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## `getImageParts` (function)
|
|
397
|
+
|
|
398
|
+
```ts
|
|
399
|
+
getImageParts: (content: MessageContent) => ImageUrlContentPart[]
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## `getTextContent` (function)
|
|
403
|
+
|
|
404
|
+
```ts
|
|
405
|
+
getTextContent: (content: MessageContent) => string
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## `groupMessagesByLoop` (function)
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
groupMessagesByLoop: (messages: ChatMessage[]) => MessageGroup[]
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
## `HeadlessResource` (class)
|
|
415
|
+
|
|
416
|
+
```ts
|
|
417
|
+
run: { <T = unknown>(prompt: string, options: HeadlessRunOptions & { schema: JsonSchemaObject; }): Promise<T>; (prompt: string, options?: HeadlessRunOptions): Promise<string>; }
|
|
418
|
+
runInSession: { <T = unknown>(sessionId: string, prompt: string, options: HeadlessRunOptions & { schema: JsonSchemaObject; }): Promise<T>; (sessionId: string, prompt: string, options?: HeadlessRunOptions): Promise<string>; }
|
|
419
|
+
runWithSession: { <T = unknown>(prompt: string, options: HeadlessRunOptions & { schema: JsonSchemaObject; }): Promise<HeadlessRunInSessionResult<T>>; (prompt: string, options?: HeadlessRunOptions): Promise<HeadlessRunInSessionResult<string>>; }
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## `ImageUrlContentPart` (interface)
|
|
423
|
+
|
|
424
|
+
```ts
|
|
425
|
+
image_url: { url: string; }
|
|
426
|
+
type: "image_url"
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
## `InboundAction` (type)
|
|
430
|
+
|
|
431
|
+
```ts
|
|
432
|
+
export type InboundAction = "addContext" | "appendInput" | "sendMessage"
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
## `InboundEnvelope` (interface)
|
|
436
|
+
|
|
437
|
+
```ts
|
|
438
|
+
action: InboundAction
|
|
439
|
+
direction: "host-to-agent"
|
|
440
|
+
payload: unknown
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## `isCommandEnvelope` (function)
|
|
444
|
+
|
|
445
|
+
```ts
|
|
446
|
+
isCommandEnvelope: (value: unknown) => value is CommandEnvelope
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## `isHiddenInternalMessage` (function)
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
isHiddenInternalMessage: (message: Pick<ChatMessage, "role" | "content">) => boolean
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## `isInboundEnvelope` (function)
|
|
456
|
+
|
|
457
|
+
```ts
|
|
458
|
+
isInboundEnvelope: (value: unknown) => value is InboundEnvelope
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## `LayoutType` (enum)
|
|
462
|
+
|
|
463
|
+
```ts
|
|
464
|
+
export enum LayoutType {
|
|
465
|
+
Default = "default",
|
|
466
|
+
SkillEditor = "skill-editor",
|
|
467
|
+
BladeCoa = "blade-coa",
|
|
468
|
+
SolutionEditor = "solution-editor",
|
|
469
|
+
SolutionEditor2 = "solution-editor2",
|
|
470
|
+
ChatPreview = "chat-preview",
|
|
471
|
+
ChatOnly = "chat-only",
|
|
472
|
+
SolutionApp = "solution-app",
|
|
473
|
+
Custom = "custom",
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## `LoginOptions` (interface)
|
|
478
|
+
|
|
479
|
+
```ts
|
|
480
|
+
height: number | undefined
|
|
481
|
+
timeoutMs: number | undefined
|
|
482
|
+
width: number | undefined
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
## `LoginResult` (interface)
|
|
486
|
+
|
|
487
|
+
```ts
|
|
488
|
+
token: string
|
|
489
|
+
user: { id?: string; username?: string; display_name?: string; } | undefined
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## `MemoryRef` (interface)
|
|
493
|
+
|
|
494
|
+
```ts
|
|
495
|
+
content_preview: string
|
|
496
|
+
id: number
|
|
497
|
+
skill_name: string | null | undefined
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
## `MemoryRefInfo` (interface)
|
|
501
|
+
|
|
502
|
+
```ts
|
|
503
|
+
content_preview: string
|
|
504
|
+
id: number
|
|
505
|
+
skill_name: string | null | undefined
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
## `MessageContent` (type)
|
|
509
|
+
|
|
510
|
+
```ts
|
|
511
|
+
export type MessageContent = string | MessageContentPart[]
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
## `MessageContentPart` (type)
|
|
515
|
+
|
|
516
|
+
```ts
|
|
517
|
+
export type MessageContentPart = TextContentPart | ImageUrlContentPart | FileContentPart
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
## `MIN_SERVER_VERSION` (const)
|
|
521
|
+
|
|
522
|
+
```ts
|
|
523
|
+
MIN_SERVER_VERSION: "1.1.1"
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
## `ModeId` (type)
|
|
527
|
+
|
|
528
|
+
```ts
|
|
529
|
+
export type ModeId = "planning" | "executing"
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
## `normalizeMessageContent` (function)
|
|
533
|
+
|
|
534
|
+
```ts
|
|
535
|
+
normalizeMessageContent: (content: unknown) => MessageContent
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
## `PaginatedSessionsResult` (interface)
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
content_match_truncated: boolean | undefined
|
|
542
|
+
items: SessionInfo[]
|
|
543
|
+
limit: number
|
|
544
|
+
offset: number
|
|
545
|
+
total: number
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
## `ParsedTextAttachment` (interface)
|
|
549
|
+
|
|
550
|
+
```ts
|
|
551
|
+
name: string
|
|
552
|
+
uploadedPath: string | undefined
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
## `ParsedTextContext` (interface)
|
|
556
|
+
|
|
557
|
+
```ts
|
|
558
|
+
content: string
|
|
559
|
+
label: string
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
## `PatchEnvelope` (interface)
|
|
563
|
+
|
|
564
|
+
```ts
|
|
565
|
+
data: { turn?: TurnProjection; workspace_changed?: { tool_call_id?: string; tool_name?: string; }; }
|
|
566
|
+
loop_id: string
|
|
567
|
+
patch_type: string
|
|
568
|
+
sequence: number
|
|
569
|
+
turn_id: string
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
## `PreparedSolution` (interface)
|
|
573
|
+
|
|
574
|
+
```ts
|
|
575
|
+
assetId: string
|
|
576
|
+
bizRoleId: string | undefined
|
|
577
|
+
expiresAt: string
|
|
578
|
+
kind: "prepared"
|
|
579
|
+
roles: string[]
|
|
580
|
+
solutionId: string
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
## `PreparedSolutionAsset` (interface)
|
|
584
|
+
|
|
585
|
+
```ts
|
|
586
|
+
assetId: string
|
|
587
|
+
bizRoleId: string | undefined
|
|
588
|
+
kind: "prepared"
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
## `PrimarySkillParallelMode` (interface)
|
|
592
|
+
|
|
593
|
+
```ts
|
|
594
|
+
id: string
|
|
595
|
+
name: string
|
|
596
|
+
prompt_hint: string
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
## `PrimarySkillSnapshot` (interface)
|
|
600
|
+
|
|
601
|
+
```ts
|
|
602
|
+
captured_at: string
|
|
603
|
+
description: string
|
|
604
|
+
parallel_modes: PrimarySkillParallelMode[]
|
|
605
|
+
skill_id: string
|
|
606
|
+
stages: PrimarySkillStageSpec[]
|
|
607
|
+
title: string
|
|
608
|
+
version: number
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
## `ProvidersResponse` (interface)
|
|
612
|
+
|
|
613
|
+
```ts
|
|
614
|
+
password_enabled: boolean
|
|
615
|
+
providers: { name: string; authorize_url: string; }[]
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
## `RawEvent` (interface)
|
|
619
|
+
|
|
620
|
+
```ts
|
|
621
|
+
payload: Record<string, unknown>
|
|
622
|
+
type: string
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
## `RunOptions` (interface)
|
|
626
|
+
|
|
627
|
+
```ts
|
|
628
|
+
compactionRatio: number | undefined
|
|
629
|
+
headless: boolean | undefined
|
|
630
|
+
model: string | undefined
|
|
631
|
+
outputSchema: Record<string, unknown> | undefined
|
|
632
|
+
runtimeEnv: Record<string, string> | undefined
|
|
633
|
+
timeoutMs: number | undefined
|
|
634
|
+
trace: boolean | undefined
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
## `RunResult` (interface)
|
|
638
|
+
|
|
639
|
+
```ts
|
|
640
|
+
chatRunId: string | undefined
|
|
641
|
+
events: unknown[]
|
|
642
|
+
result: unknown
|
|
643
|
+
sessionId: string
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
## `RunTrace` (interface)
|
|
647
|
+
|
|
648
|
+
```ts
|
|
649
|
+
configSnapshot: Record<string, unknown>
|
|
650
|
+
events: unknown[]
|
|
651
|
+
history: unknown[]
|
|
652
|
+
result: unknown
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
## `SDK_NAME` (const)
|
|
656
|
+
|
|
657
|
+
```ts
|
|
658
|
+
SDK_NAME: "agent-client"
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
## `SDK_VERSION` (const)
|
|
662
|
+
|
|
663
|
+
```ts
|
|
664
|
+
SDK_VERSION: "2.0.0"
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
## `SendOptions` (interface)
|
|
668
|
+
|
|
669
|
+
```ts
|
|
670
|
+
askUserAnswer: Record<string, unknown> | undefined
|
|
671
|
+
mode: string | undefined
|
|
672
|
+
model: string | undefined
|
|
673
|
+
replayDecision: "keep_replay" | "continue_replay" | undefined
|
|
674
|
+
thinkingOverride: boolean | undefined
|
|
675
|
+
whatif: { from_step: number; quotes: Array<Record<string, unknown>>; deprecate_entry_ids: string[]; } | undefined
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
## `ServerVersionInfo` (interface)
|
|
679
|
+
|
|
680
|
+
```ts
|
|
681
|
+
min_sdk: string | undefined
|
|
682
|
+
version: string
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
## `SessionContextStats` (interface)
|
|
686
|
+
|
|
687
|
+
```ts
|
|
688
|
+
compaction_ratio: number
|
|
689
|
+
context_window: number
|
|
690
|
+
tokens_used: number
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
## `SessionDetail` (interface)
|
|
694
|
+
|
|
695
|
+
```ts
|
|
696
|
+
biz_role_id: string | null | undefined
|
|
697
|
+
bound_skill_id: string | null | undefined
|
|
698
|
+
created_at: string
|
|
699
|
+
daemon_id: string | null | undefined
|
|
700
|
+
disable_tools: (string[] & string[]) | undefined
|
|
701
|
+
enable_thinking: boolean | null | undefined
|
|
702
|
+
env: Record<string, string> | undefined
|
|
703
|
+
id: string
|
|
704
|
+
intent: string
|
|
705
|
+
is_example: boolean | undefined
|
|
706
|
+
is_headless: boolean | undefined
|
|
707
|
+
is_persistent: boolean | undefined
|
|
708
|
+
is_pinned: boolean | undefined
|
|
709
|
+
match: SessionSearchMatch | null | undefined
|
|
710
|
+
memory_enabled: boolean | undefined
|
|
711
|
+
model: string | null | undefined
|
|
712
|
+
pinned_at: string | null | undefined
|
|
713
|
+
plan_summary: string | null | undefined
|
|
714
|
+
ports: SessionPortMapping[] | undefined
|
|
715
|
+
preview_url: string | null | undefined
|
|
716
|
+
primary_skill_id: string | null | undefined
|
|
717
|
+
primary_skill_snapshot: PrimarySkillSnapshot | null | undefined
|
|
718
|
+
replay_state: ReplayState | null | undefined
|
|
719
|
+
runtime_type: string | null | undefined
|
|
720
|
+
shared: boolean | undefined
|
|
721
|
+
solution: Solution | null | undefined
|
|
722
|
+
solution_id: string | null | undefined
|
|
723
|
+
status: "completed" | "failed" | "interrupted" | "running" | "created" | "waiting_for_input"
|
|
724
|
+
template_id: TemplateId | null | undefined
|
|
725
|
+
updated_at: string
|
|
726
|
+
viewer_role: "owner" | "viewer" | undefined
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
## `SessionHistory` (interface)
|
|
730
|
+
|
|
731
|
+
```ts
|
|
732
|
+
active_branch: string | null
|
|
733
|
+
branches: string[]
|
|
734
|
+
nodes: HistoryNode[]
|
|
735
|
+
system_prompt_tokens: number | null | undefined
|
|
736
|
+
tokenizer_model: string | null | undefined
|
|
737
|
+
tools_tokens: number | null | undefined
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
## `SessionHub` (class)
|
|
741
|
+
|
|
742
|
+
```ts
|
|
743
|
+
connect: (sessionId: string) => Promise<AgentSession>
|
|
744
|
+
disconnect: () => void
|
|
745
|
+
disposeAll: () => void
|
|
746
|
+
getConnection: () => ConnectionStatus
|
|
747
|
+
onConnectionChange: (listener: (status: ConnectionStatus) => void) => () => void
|
|
748
|
+
peek: (sessionId: string) => AgentSession | undefined
|
|
749
|
+
reconnect: () => void
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
## `SessionInfo` (type)
|
|
753
|
+
|
|
754
|
+
```ts
|
|
755
|
+
SessionInfo = type({
|
|
756
|
+
id: "string",
|
|
757
|
+
intent: "string",
|
|
758
|
+
status: SessionStatus,
|
|
759
|
+
created_at: "string",
|
|
760
|
+
updated_at: "string",
|
|
761
|
+
"shared?": "boolean",
|
|
762
|
+
"memory_enabled?": "boolean",
|
|
763
|
+
"is_persistent?": "boolean",
|
|
764
|
+
"is_headless?": "boolean",
|
|
765
|
+
"viewer_role?": "'owner' | 'viewer'",
|
|
766
|
+
"template_id?": "string | null",
|
|
767
|
+
"model?": "string | null",
|
|
768
|
+
"enable_thinking?": "boolean | null",
|
|
769
|
+
"solution_id?": "string | null",
|
|
770
|
+
"biz_role_id?": "string | null",
|
|
771
|
+
"solution?": "unknown",
|
|
772
|
+
"plan_summary?": "string | null",
|
|
773
|
+
"primary_skill_id?": "string | null",
|
|
774
|
+
// ship-attack v2:后端 engine.set_bound_skill 写入的"绑定 skill id"。
|
|
775
|
+
// 未绑定 / 非 ship-attack session 为 null。
|
|
776
|
+
"bound_skill_id?": "string | null",
|
|
777
|
+
"replay_state?": "unknown",
|
|
778
|
+
"is_pinned?": "boolean",
|
|
779
|
+
"pinned_at?": "string | null",
|
|
780
|
+
"is_example?": "boolean",
|
|
781
|
+
"ports?": "unknown",
|
|
782
|
+
"disable_tools?": "string[]",
|
|
783
|
+
"runtime_type?": "string | null",
|
|
784
|
+
"daemon_id?": "string | null",
|
|
785
|
+
"match?": "unknown",
|
|
786
|
+
})
|
|
787
|
+
```
|
|
788
|
+
|
|
789
|
+
## `SessionPortMapping` (interface)
|
|
790
|
+
|
|
791
|
+
```ts
|
|
792
|
+
container_port: number
|
|
793
|
+
host_port: number
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
## `SessionProfile` (interface)
|
|
797
|
+
|
|
798
|
+
```ts
|
|
799
|
+
compactionRatio: number | undefined
|
|
800
|
+
disableTools: string[] | undefined
|
|
801
|
+
enableThinking: boolean | undefined
|
|
802
|
+
env: Record<string, string> | undefined
|
|
803
|
+
memoryEnabled: boolean | undefined
|
|
804
|
+
model: string | undefined
|
|
805
|
+
solution: SolutionRef | undefined
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
## `SessionsResource` (class)
|
|
809
|
+
|
|
810
|
+
```ts
|
|
811
|
+
checkoutSession: (sessionId: string, checkpointId: string, position: "before" | "turn_end", mode?: "both" | "conversation" | "code", linear?: boolean) => Promise<{ id: string; content: string; position: string; mode?: string; files_restored?: boolean; linear?: boolean; }>
|
|
812
|
+
connect: (sessionId: string) => Promise<AgentSession>
|
|
813
|
+
copyFile: (sessionId: string, filePath: string) => Promise<{ path: string; }>
|
|
814
|
+
create: (request?: CreateSessionRequest) => Promise<AgentSession>
|
|
815
|
+
createSession: (intent?: string, template_id?: TemplateId, primary_skill_id?: string | null) => Promise<{ session_id: string; }>
|
|
816
|
+
createSessionWithRequest: (request: CreateSessionRequest) => Promise<{ session_id: string; }>
|
|
817
|
+
createShare: (sessionId: string) => Promise<ShareLinkResult>
|
|
818
|
+
createWithProfile: (params: { intent: string; profile: SessionProfile; }) => Promise<{ session_id: string; }>
|
|
819
|
+
deleteFile: (sessionId: string, filePath: string) => Promise<void>
|
|
820
|
+
deleteSession: (sessionId: string) => Promise<{ deleted: boolean; }>
|
|
821
|
+
exportSession: (sessionId: string) => Promise<void>
|
|
822
|
+
getBackgroundTask: (sessionId: string, taskId: string, tail?: number, init?: RequestInit) => Promise<BackgroundTask>
|
|
823
|
+
getDownloadDirUrl: (sessionId: string, dirPath: string) => string
|
|
824
|
+
getSession: (sessionId: string, init?: RequestInit) => Promise<SessionDetail>
|
|
825
|
+
getSessionCheckpoints: (sessionId: string, init?: RequestInit) => Promise<{ nodes: CheckpointNode[]; leaf_id: string | null; }>
|
|
826
|
+
getSessionContextStats: (sessionId: string, init?: RequestInit) => Promise<SessionContextStats>
|
|
827
|
+
getSessionHistory: (sessionId: string, init?: RequestInit) => Promise<SessionHistory>
|
|
828
|
+
getSessionTasks: (sessionId: string) => Promise<Task[]>
|
|
829
|
+
getSessionTurns: (sessionId: string) => Promise<TurnProjection[]>
|
|
830
|
+
getSharedSession: (token: string) => Promise<TurnProjection[]>
|
|
831
|
+
importSession: (file: File, name?: string, solutionId?: string | null) => Promise<{ session_id: string; }>
|
|
832
|
+
listBackgroundTasks: (sessionId: string, init?: RequestInit) => Promise<BackgroundTask[]>
|
|
833
|
+
listDir: (sessionId: string, dirPath: string) => Promise<FileEntry[]>
|
|
834
|
+
listSessions: (template_id_prefix?: string, solution_id?: string) => Promise<SessionInfo[]>
|
|
835
|
+
listSessionsPaginated: (params: { limit: number; offset: number; template_id_prefix?: string; solution_id?: string; q?: string; }) => Promise<PaginatedSessionsResult>
|
|
836
|
+
listSessionsWithSkillData: () => Promise<SkillDevSession[]>
|
|
837
|
+
pinSession: (sessionId: string, pinned: boolean) => Promise<SessionInfo>
|
|
838
|
+
previewImport: (file: File) => Promise<ImportPreview>
|
|
839
|
+
probeSessionUrl: (sessionId: string, url: string) => Promise<{ reachable: boolean; }>
|
|
840
|
+
renameFile: (sessionId: string, filePath: string, newName: string) => Promise<{ path: string; }>
|
|
841
|
+
revokeShare: (sessionId: string, token: string) => Promise<{ revoked: boolean; }>
|
|
842
|
+
rewindSession: (sessionId: string, checkpointId: string) => Promise<{ id: string; content: string; }>
|
|
843
|
+
setSessionEnv: (sessionId: string, env: Record<string, string>) => Promise<SessionDetail>
|
|
844
|
+
shareFile: (sessionId: string, sourcePath: string, linkName?: string, shareFolder?: string) => Promise<{ path: string; target: string; }>
|
|
845
|
+
startReplaySession: (sourceSessionId: string, speed?: 1 | 2 | 5) => Promise<{ session_id: string; }>
|
|
846
|
+
stopBackgroundTask: (sessionId: string, taskId: string) => Promise<{ message: string; task?: BackgroundTask | null; }>
|
|
847
|
+
switchBranch: (sessionId: string, checkpointId: string) => Promise<{ id: string; leaf_id: string; }>
|
|
848
|
+
tokenizeMessages: (messages: Array<Record<string, unknown>>, options?: { model?: string; add_generation_prompt?: boolean; enable_thinking?: boolean | null; tools?: Array<Record<string, unknown>>; }) => Promise<TokenizeResult>
|
|
849
|
+
tokenizePrompt: (prompt: string, model?: string) => Promise<TokenizeResult>
|
|
850
|
+
updateReplaySession: (sessionId: string, payload: { speed?: 1 | 2 | 5; status?: "autonomous"; }) => Promise<{ replay_state: SessionInfo["replay_state"]; }>
|
|
851
|
+
updateSession: (sessionId: string, payload: { intent?: string; }) => Promise<SessionDetail>
|
|
852
|
+
updateSessionMemory: (sessionId: string, memoryEnabled: boolean) => Promise<{ memory_enabled: boolean; }>
|
|
853
|
+
updateSharing: (sessionId: string, shared: boolean) => Promise<{ shared: boolean; }>
|
|
854
|
+
uploadFiles: (sessionId: string, dirPath: string, files: FileList | File[] | UploadFileEntry[], options?: UploadFilesOptions) => Promise<{ uploaded: string[]; failed: string[]; }>
|
|
855
|
+
writeFile: (sessionId: string, filePath: string, content: string) => Promise<{ success: boolean; }>
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
## `SessionState` (interface)
|
|
859
|
+
|
|
860
|
+
```ts
|
|
861
|
+
activeCompaction: ActiveCompactionState | null
|
|
862
|
+
agentLoops: Record<string, AgentLoopInfo>
|
|
863
|
+
askAnswers: Record<string, AskUserAnswerData>
|
|
864
|
+
connection: ConnectionStatus
|
|
865
|
+
errorMessage: string | null
|
|
866
|
+
isStreaming: boolean
|
|
867
|
+
messages: ChatMessage[]
|
|
868
|
+
mode: "planning" | "executing" | null
|
|
869
|
+
sessionId: string
|
|
870
|
+
status: "completed" | "failed" | "interrupted" | "running" | "created" | "waiting_for_input" | null
|
|
871
|
+
turns: TurnProjection[]
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
## `SessionStatus` (type)
|
|
875
|
+
|
|
876
|
+
```ts
|
|
877
|
+
SessionStatus = type(
|
|
878
|
+
"'created' | 'running' | 'completed' | 'failed' | 'interrupted' | 'waiting_for_input'",
|
|
879
|
+
)
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
## `ShareLinkResult` (interface)
|
|
883
|
+
|
|
884
|
+
```ts
|
|
885
|
+
expires_at: string | null
|
|
886
|
+
token: string
|
|
887
|
+
url: string
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
## `Solution` (interface)
|
|
891
|
+
|
|
892
|
+
```ts
|
|
893
|
+
data: Record<string, unknown> | null | undefined
|
|
894
|
+
description: string | null | undefined
|
|
895
|
+
id: string
|
|
896
|
+
initial_message: string | null | undefined
|
|
897
|
+
initial_mode: string | null | undefined
|
|
898
|
+
layout: { available?: boolean; source_dir?: string; entry?: string; export?: string; } | null | undefined
|
|
899
|
+
layout_type: string
|
|
900
|
+
name: string
|
|
901
|
+
preview: { url: string; title?: string | null; } | null | undefined
|
|
902
|
+
roles: BizRole[] | null | undefined
|
|
903
|
+
source: string | null | undefined
|
|
904
|
+
ui_config: SolutionAppUiConfig | null | undefined
|
|
905
|
+
version: string
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
## `SolutionAppField` (type)
|
|
909
|
+
|
|
910
|
+
```ts
|
|
911
|
+
export type SolutionAppField =
|
|
912
|
+
| {
|
|
913
|
+
id: string
|
|
914
|
+
kind: "textarea"
|
|
915
|
+
label: string
|
|
916
|
+
placeholder?: string
|
|
917
|
+
}
|
|
918
|
+
| {
|
|
919
|
+
id: string
|
|
920
|
+
kind: "file-upload"
|
|
921
|
+
accept?: string[]
|
|
922
|
+
categories?: Array<{
|
|
923
|
+
label: string
|
|
924
|
+
description: string
|
|
925
|
+
color: string
|
|
926
|
+
}>
|
|
927
|
+
}
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
## `SolutionAppState` (interface)
|
|
931
|
+
|
|
932
|
+
```ts
|
|
933
|
+
meta: Record<string, { label: string; value: string; color?: string; }>
|
|
934
|
+
pipeline: { id: string; label: string; status: "done" | "active" | "pending" | "error"; }[]
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
## `SolutionAppUiConfig` (interface)
|
|
938
|
+
|
|
939
|
+
```ts
|
|
940
|
+
branding: { name: string; subtitle?: string; icon_text: string; icon_gradient?: string; }
|
|
941
|
+
create: { title: string; description?: string; submit_button: string; sections: Array<{ id: string; title: string; description?: string; fields: Array<SolutionAppField>; }>; }
|
|
942
|
+
list: { title: string; create_button: string; card?: { subtitle?: string; stats?: Array<{ label: string; value: string; color?: string; }>; }; }
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
## `SolutionRef` (type)
|
|
946
|
+
|
|
947
|
+
```ts
|
|
948
|
+
export type SolutionRef = ExistingSolutionRef | PreparedSolutionAsset
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
## `Task` (type)
|
|
952
|
+
|
|
953
|
+
```ts
|
|
954
|
+
Task = type({
|
|
955
|
+
id: "string",
|
|
956
|
+
goal: "string",
|
|
957
|
+
skills: "string[]",
|
|
958
|
+
depends_on: "string[]",
|
|
959
|
+
status: TaskStatus,
|
|
960
|
+
result_summary: "string",
|
|
961
|
+
number: "string",
|
|
962
|
+
})
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
## `TaskStatus` (type)
|
|
966
|
+
|
|
967
|
+
```ts
|
|
968
|
+
TaskStatus = type("'pending' | 'in_progress' | 'done' | 'failed' | 'skipped'")
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
## `TemplateId` (type)
|
|
972
|
+
|
|
973
|
+
```ts
|
|
974
|
+
export type TemplateId =
|
|
975
|
+
| "default"
|
|
976
|
+
| "skill_editor"
|
|
977
|
+
// ship-attack v2:用户从 ship-attack 页面点"新建 session"创建的会话。
|
|
978
|
+
// 后端 _maybe_bind_first_skill 只对此模板触发首次绑定。
|
|
979
|
+
| "ship_attack"
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
## `TextContentPart` (interface)
|
|
983
|
+
|
|
984
|
+
```ts
|
|
985
|
+
text: string
|
|
986
|
+
type: "text"
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
## `TokenStorageMode` (type)
|
|
990
|
+
|
|
991
|
+
```ts
|
|
992
|
+
export type TokenStorageMode = "local" | "memory"
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
## `ToolBridgeContent` (interface)
|
|
996
|
+
|
|
997
|
+
```ts
|
|
998
|
+
action: string
|
|
999
|
+
payload: unknown
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
## `ToolCallInfo` (interface)
|
|
1003
|
+
|
|
1004
|
+
```ts
|
|
1005
|
+
arguments: string
|
|
1006
|
+
display_name: string | null | undefined
|
|
1007
|
+
duration_ms: number | null | undefined
|
|
1008
|
+
id: string
|
|
1009
|
+
name: string
|
|
1010
|
+
pending_question_ref: PendingQuestionRef | null | undefined
|
|
1011
|
+
result: unknown
|
|
1012
|
+
status: "done" | "error" | "cancelled" | "awaiting_answer" | "pending" | undefined
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
## `transformSlashCommand` (function)
|
|
1016
|
+
|
|
1017
|
+
```ts
|
|
1018
|
+
transformSlashCommand: (skillName: string, rawInput: string) => string
|
|
1019
|
+
```
|
|
1020
|
+
|
|
1021
|
+
## `TurnProjection` (interface)
|
|
1022
|
+
|
|
1023
|
+
```ts
|
|
1024
|
+
archived_count: number | null | undefined
|
|
1025
|
+
archived_files: ArchivedFileInfo[] | null | undefined
|
|
1026
|
+
archived_tool_calls: ArchivedToolCallInfo[] | null | undefined
|
|
1027
|
+
blocks: ContentBlock[]
|
|
1028
|
+
compaction_id: string | null | undefined
|
|
1029
|
+
context_window: number | undefined
|
|
1030
|
+
duration_ms: number | undefined
|
|
1031
|
+
failure_reason: string | null | undefined
|
|
1032
|
+
fallback_applied: boolean | null | undefined
|
|
1033
|
+
id: string
|
|
1034
|
+
kind: "message" | "compaction" | undefined
|
|
1035
|
+
loop_id: string
|
|
1036
|
+
memory_refs: MemoryRef[] | null | undefined
|
|
1037
|
+
model: string | null | undefined
|
|
1038
|
+
parent_fork_tool_call_id: string | null | undefined
|
|
1039
|
+
role: "user" | "assistant" | "system"
|
|
1040
|
+
saved_ratio: number | null | undefined
|
|
1041
|
+
sequence: number
|
|
1042
|
+
started_at: string | null | undefined
|
|
1043
|
+
status: "streaming" | "completed" | "paused" | "failed" | "interrupted"
|
|
1044
|
+
summary_full: string | null | undefined
|
|
1045
|
+
summary_preview: string | null | undefined
|
|
1046
|
+
tokens_after: number | null | undefined
|
|
1047
|
+
tokens_before: number | null | undefined
|
|
1048
|
+
tool_calls: ToolCallProjection[]
|
|
1049
|
+
trigger: "auto" | "manual" | "forced_retry" | null | undefined
|
|
1050
|
+
turn_id: string
|
|
1051
|
+
usage: Record<string, unknown> | null | undefined
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
## `TypedSocket` (type)
|
|
1055
|
+
|
|
1056
|
+
```ts
|
|
1057
|
+
export type TypedSocket = Socket<ServerToClientEvents, ClientToServerEvents>
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
## `UploadFileEntry` (type)
|
|
1061
|
+
|
|
1062
|
+
```ts
|
|
1063
|
+
export type UploadFileEntry = File | { file: File; name: string }
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
## `UploadFilesOptions` (interface)
|
|
1067
|
+
|
|
1068
|
+
```ts
|
|
1069
|
+
onProgress: ((progress: UploadProgress) => void) | undefined
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
## `UploadProgress` (interface)
|
|
1073
|
+
|
|
1074
|
+
```ts
|
|
1075
|
+
loaded: number
|
|
1076
|
+
percent: number | undefined
|
|
1077
|
+
total: number | undefined
|
|
1078
|
+
```
|
|
1079
|
+
|
|
1080
|
+
## `UserInfo` (interface)
|
|
1081
|
+
|
|
1082
|
+
```ts
|
|
1083
|
+
auth_type: "casdoor"
|
|
1084
|
+
avatar_url: string | null
|
|
1085
|
+
display_name: string | null | undefined
|
|
1086
|
+
id: string
|
|
1087
|
+
is_admin: boolean | undefined
|
|
1088
|
+
token: string
|
|
1089
|
+
username: string
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1092
|
+
## `VersionMismatchError` (class)
|
|
1093
|
+
|
|
1094
|
+
```ts
|
|
1095
|
+
cause: unknown
|
|
1096
|
+
hint: string
|
|
1097
|
+
message: string
|
|
1098
|
+
name: string
|
|
1099
|
+
sdkVersion: string
|
|
1100
|
+
serverVersion: string | null
|
|
1101
|
+
stack: string | undefined
|
|
1102
|
+
```
|
|
1103
|
+
|