@blade-hq/agent-react 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/public-api.md ADDED
@@ -0,0 +1,1206 @@
1
+ # @blade-hq/agent-react 公共 API 报告
2
+
3
+ > 本文件由 `scripts/public-api-report.mjs` 生成,请勿手改。
4
+ > 公共面变更时重新生成本报告,并同步更新 README 对应章节——CI 会校验两者。
5
+
6
+ 共 118 个公开声明。
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
+ ## `BladeProvider` (function)
209
+
210
+ ```ts
211
+ BladeProvider: ({ client, children }: BladeProviderProps) => JSX.Element
212
+ ```
213
+
214
+ ## `BladeProviderProps` (interface)
215
+
216
+ ```ts
217
+ children: ReactNode
218
+ client: BladeClient
219
+ ```
220
+
221
+ ## `buildMessageContent` (function)
222
+
223
+ ```ts
224
+ buildMessageContent: (text: string, attachments: Array<{ kind: "file"; name: string; uploadedPath?: string; textContent?: string | null; mimeType?: string; }>) => MessageContent
225
+ ```
226
+
227
+ ## `ChatMessage` (interface)
228
+
229
+ ```ts
230
+ blocks: ContentBlock[] | undefined
231
+ compaction: CompactionInfo | undefined
232
+ content: MessageContent
233
+ duration_ms: number | undefined
234
+ entry_id: string | undefined
235
+ kind: string | undefined
236
+ loop_name: string | undefined
237
+ memory_refs: MemoryRefInfo[] | undefined
238
+ parent_id: string | null | undefined
239
+ reasoning: string | undefined
240
+ role: "error" | "user" | "assistant" | "tool"
241
+ status: "streaming" | "completed" | "paused" | "failed" | "interrupted" | undefined
242
+ timestamp: string | undefined
243
+ tool_calls: ToolCallInfo[] | undefined
244
+ ```
245
+
246
+ ## `ChatView` (function)
247
+
248
+ ```ts
249
+ ChatView: (props: ChatViewProps) => JSX.Element
250
+ ```
251
+
252
+ ## `ChatViewClassNames` (interface)
253
+
254
+ ```ts
255
+ banner: string | undefined
256
+ chatInput: string | undefined
257
+ messageList: string | undefined
258
+ root: string | undefined
259
+ ```
260
+
261
+ ## `ChatViewProps` (interface)
262
+
263
+ ```ts
264
+ classNames: ChatViewClassNames | undefined
265
+ commands: Record<string, (data: unknown) => void> | undefined
266
+ createOptions: CreateSessionRequest | undefined
267
+ onSessionCreated: ((sessionId: string) => void) | undefined
268
+ onSessionReady: ((session: AgentSession) => void) | undefined
269
+ placeholder: string | undefined
270
+ renderers: ChatViewRenderers | undefined
271
+ sessionId: string | undefined
272
+ slots: ChatViewSlots | undefined
273
+ ```
274
+
275
+ ## `ChatViewRenderers` (interface)
276
+
277
+ ```ts
278
+ toolCall: ToolCallRenderer | undefined
279
+ ```
280
+
281
+ ## `ChatViewSlots` (interface)
282
+
283
+ ```ts
284
+ emptyState: ReactNode
285
+ footer: ReactNode
286
+ header: ReactNode
287
+ ```
288
+
289
+ ## `ClientProjectionBuilder` (class)
290
+
291
+ ```ts
292
+ processBatch: (events: RawEvent[]) => ProjectionUpdate[]
293
+ processEvent: (event: RawEvent) => ProjectionUpdate[] | null
294
+ reset: () => void
295
+ seedSequence: (maxSeq: number) => void
296
+ ```
297
+
298
+ ## `CommandEnvelope` (interface)
299
+
300
+ ```ts
301
+ action: string
302
+ direction: "agent-to-host"
303
+ meta: { sessionId: string; toolCallId?: string; timestamp: number; }
304
+ payload: unknown
305
+ ```
306
+
307
+ ## `CommandHandler` (type)
308
+
309
+ ```ts
310
+ export type CommandHandler = (payload: unknown, meta: { toolCallId?: string }) => void
311
+ ```
312
+
313
+ ## `CompactionInfo` (interface)
314
+
315
+ ```ts
316
+ archived_count: number | null | undefined
317
+ archived_files: ArchivedFileInfo[] | null | undefined
318
+ archived_tool_calls: ArchivedToolCallInfo[] | null | undefined
319
+ compaction_id: string
320
+ failure_reason: string | null | undefined
321
+ fallback_applied: boolean | null | undefined
322
+ saved_ratio: number | null | undefined
323
+ summary_full: string | null | undefined
324
+ summary_preview: string | null | undefined
325
+ tokens_after: number | null | undefined
326
+ tokens_before: number | null | undefined
327
+ trigger: "auto" | "manual" | "forced_retry" | null | undefined
328
+ ```
329
+
330
+ ## `connectEmbedded` (function)
331
+
332
+ ```ts
333
+ connectEmbedded: (options: EmbeddedChatOptions) => EmbeddedChat
334
+ ```
335
+
336
+ ## `ConnectionStatus` (type)
337
+
338
+ ```ts
339
+ export type ConnectionStatus = "connecting" | "connected" | "reconnecting" | "disconnected"
340
+ ```
341
+
342
+ ## `ContentBlock` (interface)
343
+
344
+ ```ts
345
+ content: unknown
346
+ display_name: string | null | undefined
347
+ tool_call_id: string | null | undefined
348
+ tool_name: string | null | undefined
349
+ type: "text" | "thinking" | "tool_use" | "tool_result" | "tool_ui" | "tool_bridge" | "system_notification" | "mode_change" | "plan_status" | "ask_user_answer"
350
+ ```
351
+
352
+ ## `contentPreview` (function)
353
+
354
+ ```ts
355
+ contentPreview: (content: MessageContent, maxLen?: number) => string
356
+ ```
357
+
358
+ ## `createInitialSessionState` (function)
359
+
360
+ ```ts
361
+ createInitialSessionState: (sessionId: string) => SessionState
362
+ ```
363
+
364
+ ## `CreateSessionRequest` (interface)
365
+
366
+ ```ts
367
+ biz_role_id: string | null | undefined
368
+ compaction_ratio: number | null | undefined
369
+ daemon_id: string | null | undefined
370
+ disable_tools: string[] | null | undefined
371
+ enable_thinking: boolean | null | undefined
372
+ env: Record<string, string> | undefined
373
+ intent: string | undefined
374
+ memory_enabled: boolean | null | undefined
375
+ model: string | null | undefined
376
+ primary_skill_id: string | null | undefined
377
+ runtime_type: "sandbox" | "daemon" | null | undefined
378
+ session_solution_asset_id: string | null | undefined
379
+ solution_id: string | undefined
380
+ template_id: TemplateId | undefined
381
+ ```
382
+
383
+ ## `createSocket` (function)
384
+
385
+ ```ts
386
+ createSocket: (options: CreateSocketOptions) => TypedSocket
387
+ ```
388
+
389
+ ## `CreateSocketOptions` (interface)
390
+
391
+ ```ts
392
+ baseUrl: string
393
+ path: string | undefined
394
+ token: string | (() => string | null | undefined) | undefined
395
+ ```
396
+
397
+ ## `EmbeddedChat` (interface)
398
+
399
+ ```ts
400
+ attach: (label: string, data: unknown) => void
401
+ dispose: () => void
402
+ insertText: (text: string) => void
403
+ onCommand: (action: string, handler: CommandHandler) => () => void
404
+ send: (text: string) => void
405
+ ```
406
+
407
+ ## `EmbeddedChatOptions` (interface)
408
+
409
+ ```ts
410
+ allowedOrigins: string[]
411
+ iframe: HTMLIFrameElement | undefined
412
+ ```
413
+
414
+ ## `ExistingSolutionRef` (interface)
415
+
416
+ ```ts
417
+ bizRoleId: string | undefined
418
+ kind: "existing"
419
+ solutionId: string
420
+ ```
421
+
422
+ ## `extractTextAttachments` (function)
423
+
424
+ ```ts
425
+ extractTextAttachments: (content: MessageContent) => { cleanText: string; attachments: ParsedTextAttachment[]; contexts: ParsedTextContext[]; }
426
+ ```
427
+
428
+ ## `FileContentPart` (interface)
429
+
430
+ ```ts
431
+ data: string
432
+ name: string
433
+ type: "file"
434
+ ```
435
+
436
+ ## `FileEntry` (interface)
437
+
438
+ ```ts
439
+ created_at: number
440
+ is_dir: boolean
441
+ name: string
442
+ path: string
443
+ tags: string[] | undefined
444
+ ```
445
+
446
+ ## `getFileParts` (function)
447
+
448
+ ```ts
449
+ getFileParts: (content: MessageContent) => FileContentPart[]
450
+ ```
451
+
452
+ ## `getImageParts` (function)
453
+
454
+ ```ts
455
+ getImageParts: (content: MessageContent) => ImageUrlContentPart[]
456
+ ```
457
+
458
+ ## `getTextContent` (function)
459
+
460
+ ```ts
461
+ getTextContent: (content: MessageContent) => string
462
+ ```
463
+
464
+ ## `groupMessagesByLoop` (function)
465
+
466
+ ```ts
467
+ groupMessagesByLoop: (messages: ChatMessage[]) => MessageGroup[]
468
+ ```
469
+
470
+ ## `HeadlessResource` (class)
471
+
472
+ ```ts
473
+ run: { <T = unknown>(prompt: string, options: HeadlessRunOptions & { schema: JsonSchemaObject; }): Promise<T>; (prompt: string, options?: HeadlessRunOptions): Promise<string>; }
474
+ runInSession: { <T = unknown>(sessionId: string, prompt: string, options: HeadlessRunOptions & { schema: JsonSchemaObject; }): Promise<T>; (sessionId: string, prompt: string, options?: HeadlessRunOptions): Promise<string>; }
475
+ runWithSession: { <T = unknown>(prompt: string, options: HeadlessRunOptions & { schema: JsonSchemaObject; }): Promise<HeadlessRunInSessionResult<T>>; (prompt: string, options?: HeadlessRunOptions): Promise<HeadlessRunInSessionResult<string>>; }
476
+ ```
477
+
478
+ ## `ImageUrlContentPart` (interface)
479
+
480
+ ```ts
481
+ image_url: { url: string; }
482
+ type: "image_url"
483
+ ```
484
+
485
+ ## `InboundAction` (type)
486
+
487
+ ```ts
488
+ export type InboundAction = "addContext" | "appendInput" | "sendMessage"
489
+ ```
490
+
491
+ ## `InboundEnvelope` (interface)
492
+
493
+ ```ts
494
+ action: InboundAction
495
+ direction: "host-to-agent"
496
+ payload: unknown
497
+ ```
498
+
499
+ ## `isCommandEnvelope` (function)
500
+
501
+ ```ts
502
+ isCommandEnvelope: (value: unknown) => value is CommandEnvelope
503
+ ```
504
+
505
+ ## `isHiddenInternalMessage` (function)
506
+
507
+ ```ts
508
+ isHiddenInternalMessage: (message: Pick<ChatMessage, "role" | "content">) => boolean
509
+ ```
510
+
511
+ ## `isInboundEnvelope` (function)
512
+
513
+ ```ts
514
+ isInboundEnvelope: (value: unknown) => value is InboundEnvelope
515
+ ```
516
+
517
+ ## `LayoutType` (enum)
518
+
519
+ ```ts
520
+ export enum LayoutType {
521
+ Default = "default",
522
+ SkillEditor = "skill-editor",
523
+ BladeCoa = "blade-coa",
524
+ SolutionEditor = "solution-editor",
525
+ SolutionEditor2 = "solution-editor2",
526
+ ChatPreview = "chat-preview",
527
+ ChatOnly = "chat-only",
528
+ SolutionApp = "solution-app",
529
+ Custom = "custom",
530
+ }
531
+ ```
532
+
533
+ ## `LoginOptions` (interface)
534
+
535
+ ```ts
536
+ height: number | undefined
537
+ timeoutMs: number | undefined
538
+ width: number | undefined
539
+ ```
540
+
541
+ ## `LoginResult` (interface)
542
+
543
+ ```ts
544
+ token: string
545
+ user: { id?: string; username?: string; display_name?: string; } | undefined
546
+ ```
547
+
548
+ ## `MarkdownContent` (function)
549
+
550
+ ```ts
551
+ MarkdownContent: ({ children, className, mode }: MarkdownContentProps) => JSX.Element
552
+ ```
553
+
554
+ ## `MarkdownContentProps` (interface)
555
+
556
+ ```ts
557
+ children: string
558
+ className: string | undefined
559
+ mode: "streaming" | "static" | undefined
560
+ ```
561
+
562
+ ## `MemoryRef` (interface)
563
+
564
+ ```ts
565
+ content_preview: string
566
+ id: number
567
+ skill_name: string | null | undefined
568
+ ```
569
+
570
+ ## `MemoryRefInfo` (interface)
571
+
572
+ ```ts
573
+ content_preview: string
574
+ id: number
575
+ skill_name: string | null | undefined
576
+ ```
577
+
578
+ ## `MessageContent` (type)
579
+
580
+ ```ts
581
+ export type MessageContent = string | MessageContentPart[]
582
+ ```
583
+
584
+ ## `MessageContentPart` (type)
585
+
586
+ ```ts
587
+ export type MessageContentPart = TextContentPart | ImageUrlContentPart | FileContentPart
588
+ ```
589
+
590
+ ## `MIN_SERVER_VERSION` (const)
591
+
592
+ ```ts
593
+ MIN_SERVER_VERSION: "1.1.1"
594
+ ```
595
+
596
+ ## `ModeId` (type)
597
+
598
+ ```ts
599
+ export type ModeId = "planning" | "executing"
600
+ ```
601
+
602
+ ## `normalizeMessageContent` (function)
603
+
604
+ ```ts
605
+ normalizeMessageContent: (content: unknown) => MessageContent
606
+ ```
607
+
608
+ ## `PaginatedSessionsResult` (interface)
609
+
610
+ ```ts
611
+ content_match_truncated: boolean | undefined
612
+ items: SessionInfo[]
613
+ limit: number
614
+ offset: number
615
+ total: number
616
+ ```
617
+
618
+ ## `ParsedTextAttachment` (interface)
619
+
620
+ ```ts
621
+ name: string
622
+ uploadedPath: string | undefined
623
+ ```
624
+
625
+ ## `ParsedTextContext` (interface)
626
+
627
+ ```ts
628
+ content: string
629
+ label: string
630
+ ```
631
+
632
+ ## `PatchEnvelope` (interface)
633
+
634
+ ```ts
635
+ data: { turn?: TurnProjection; workspace_changed?: { tool_call_id?: string; tool_name?: string; }; }
636
+ loop_id: string
637
+ patch_type: string
638
+ sequence: number
639
+ turn_id: string
640
+ ```
641
+
642
+ ## `PreparedSolution` (interface)
643
+
644
+ ```ts
645
+ assetId: string
646
+ bizRoleId: string | undefined
647
+ expiresAt: string
648
+ kind: "prepared"
649
+ roles: string[]
650
+ solutionId: string
651
+ ```
652
+
653
+ ## `PreparedSolutionAsset` (interface)
654
+
655
+ ```ts
656
+ assetId: string
657
+ bizRoleId: string | undefined
658
+ kind: "prepared"
659
+ ```
660
+
661
+ ## `PrimarySkillParallelMode` (interface)
662
+
663
+ ```ts
664
+ id: string
665
+ name: string
666
+ prompt_hint: string
667
+ ```
668
+
669
+ ## `PrimarySkillSnapshot` (interface)
670
+
671
+ ```ts
672
+ captured_at: string
673
+ description: string
674
+ parallel_modes: PrimarySkillParallelMode[]
675
+ skill_id: string
676
+ stages: PrimarySkillStageSpec[]
677
+ title: string
678
+ version: number
679
+ ```
680
+
681
+ ## `ProvidersResponse` (interface)
682
+
683
+ ```ts
684
+ password_enabled: boolean
685
+ providers: { name: string; authorize_url: string; }[]
686
+ ```
687
+
688
+ ## `RawEvent` (interface)
689
+
690
+ ```ts
691
+ payload: Record<string, unknown>
692
+ type: string
693
+ ```
694
+
695
+ ## `RunOptions` (interface)
696
+
697
+ ```ts
698
+ compactionRatio: number | undefined
699
+ headless: boolean | undefined
700
+ model: string | undefined
701
+ outputSchema: Record<string, unknown> | undefined
702
+ runtimeEnv: Record<string, string> | undefined
703
+ timeoutMs: number | undefined
704
+ trace: boolean | undefined
705
+ ```
706
+
707
+ ## `RunResult` (interface)
708
+
709
+ ```ts
710
+ chatRunId: string | undefined
711
+ events: unknown[]
712
+ result: unknown
713
+ sessionId: string
714
+ ```
715
+
716
+ ## `RunTrace` (interface)
717
+
718
+ ```ts
719
+ configSnapshot: Record<string, unknown>
720
+ events: unknown[]
721
+ history: unknown[]
722
+ result: unknown
723
+ ```
724
+
725
+ ## `SDK_NAME` (const)
726
+
727
+ ```ts
728
+ SDK_NAME: "agent-client"
729
+ ```
730
+
731
+ ## `SDK_VERSION` (const)
732
+
733
+ ```ts
734
+ SDK_VERSION: "2.0.0"
735
+ ```
736
+
737
+ ## `SendOptions` (interface)
738
+
739
+ ```ts
740
+ askUserAnswer: Record<string, unknown> | undefined
741
+ mode: string | undefined
742
+ model: string | undefined
743
+ replayDecision: "keep_replay" | "continue_replay" | undefined
744
+ thinkingOverride: boolean | undefined
745
+ whatif: { from_step: number; quotes: Array<Record<string, unknown>>; deprecate_entry_ids: string[]; } | undefined
746
+ ```
747
+
748
+ ## `ServerVersionInfo` (interface)
749
+
750
+ ```ts
751
+ min_sdk: string | undefined
752
+ version: string
753
+ ```
754
+
755
+ ## `SessionContextStats` (interface)
756
+
757
+ ```ts
758
+ compaction_ratio: number
759
+ context_window: number
760
+ tokens_used: number
761
+ ```
762
+
763
+ ## `SessionDetail` (interface)
764
+
765
+ ```ts
766
+ biz_role_id: string | null | undefined
767
+ bound_skill_id: string | null | undefined
768
+ created_at: string
769
+ daemon_id: string | null | undefined
770
+ disable_tools: (string[] & string[]) | undefined
771
+ enable_thinking: boolean | null | undefined
772
+ env: Record<string, string> | undefined
773
+ id: string
774
+ intent: string
775
+ is_example: boolean | undefined
776
+ is_headless: boolean | undefined
777
+ is_persistent: boolean | undefined
778
+ is_pinned: boolean | undefined
779
+ match: SessionSearchMatch | null | undefined
780
+ memory_enabled: boolean | undefined
781
+ model: string | null | undefined
782
+ pinned_at: string | null | undefined
783
+ plan_summary: string | null | undefined
784
+ ports: SessionPortMapping[] | undefined
785
+ preview_url: string | null | undefined
786
+ primary_skill_id: string | null | undefined
787
+ primary_skill_snapshot: PrimarySkillSnapshot | null | undefined
788
+ replay_state: ReplayState | null | undefined
789
+ runtime_type: string | null | undefined
790
+ shared: boolean | undefined
791
+ solution: Solution | null | undefined
792
+ solution_id: string | null | undefined
793
+ status: "completed" | "failed" | "interrupted" | "running" | "created" | "waiting_for_input"
794
+ template_id: TemplateId | null | undefined
795
+ updated_at: string
796
+ viewer_role: "owner" | "viewer" | undefined
797
+ ```
798
+
799
+ ## `SessionHistory` (interface)
800
+
801
+ ```ts
802
+ active_branch: string | null
803
+ branches: string[]
804
+ nodes: HistoryNode[]
805
+ system_prompt_tokens: number | null | undefined
806
+ tokenizer_model: string | null | undefined
807
+ tools_tokens: number | null | undefined
808
+ ```
809
+
810
+ ## `SessionHub` (class)
811
+
812
+ ```ts
813
+ connect: (sessionId: string) => Promise<AgentSession>
814
+ disconnect: () => void
815
+ disposeAll: () => void
816
+ getConnection: () => ConnectionStatus
817
+ onConnectionChange: (listener: (status: ConnectionStatus) => void) => () => void
818
+ peek: (sessionId: string) => AgentSession | undefined
819
+ reconnect: () => void
820
+ ```
821
+
822
+ ## `SessionInfo` (type)
823
+
824
+ ```ts
825
+ SessionInfo = type({
826
+ id: "string",
827
+ intent: "string",
828
+ status: SessionStatus,
829
+ created_at: "string",
830
+ updated_at: "string",
831
+ "shared?": "boolean",
832
+ "memory_enabled?": "boolean",
833
+ "is_persistent?": "boolean",
834
+ "is_headless?": "boolean",
835
+ "viewer_role?": "'owner' | 'viewer'",
836
+ "template_id?": "string | null",
837
+ "model?": "string | null",
838
+ "enable_thinking?": "boolean | null",
839
+ "solution_id?": "string | null",
840
+ "biz_role_id?": "string | null",
841
+ "solution?": "unknown",
842
+ "plan_summary?": "string | null",
843
+ "primary_skill_id?": "string | null",
844
+ // ship-attack v2:后端 engine.set_bound_skill 写入的"绑定 skill id"。
845
+ // 未绑定 / 非 ship-attack session 为 null。
846
+ "bound_skill_id?": "string | null",
847
+ "replay_state?": "unknown",
848
+ "is_pinned?": "boolean",
849
+ "pinned_at?": "string | null",
850
+ "is_example?": "boolean",
851
+ "ports?": "unknown",
852
+ "disable_tools?": "string[]",
853
+ "runtime_type?": "string | null",
854
+ "daemon_id?": "string | null",
855
+ "match?": "unknown",
856
+ })
857
+ ```
858
+
859
+ ## `SessionPortMapping` (interface)
860
+
861
+ ```ts
862
+ container_port: number
863
+ host_port: number
864
+ ```
865
+
866
+ ## `SessionProfile` (interface)
867
+
868
+ ```ts
869
+ compactionRatio: number | undefined
870
+ disableTools: string[] | undefined
871
+ enableThinking: boolean | undefined
872
+ env: Record<string, string> | undefined
873
+ memoryEnabled: boolean | undefined
874
+ model: string | undefined
875
+ solution: SolutionRef | undefined
876
+ ```
877
+
878
+ ## `SessionsResource` (class)
879
+
880
+ ```ts
881
+ 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; }>
882
+ connect: (sessionId: string) => Promise<AgentSession>
883
+ copyFile: (sessionId: string, filePath: string) => Promise<{ path: string; }>
884
+ create: (request?: CreateSessionRequest) => Promise<AgentSession>
885
+ createSession: (intent?: string, template_id?: TemplateId, primary_skill_id?: string | null) => Promise<{ session_id: string; }>
886
+ createSessionWithRequest: (request: CreateSessionRequest) => Promise<{ session_id: string; }>
887
+ createShare: (sessionId: string) => Promise<ShareLinkResult>
888
+ createWithProfile: (params: { intent: string; profile: SessionProfile; }) => Promise<{ session_id: string; }>
889
+ deleteFile: (sessionId: string, filePath: string) => Promise<void>
890
+ deleteSession: (sessionId: string) => Promise<{ deleted: boolean; }>
891
+ exportSession: (sessionId: string) => Promise<void>
892
+ getBackgroundTask: (sessionId: string, taskId: string, tail?: number, init?: RequestInit) => Promise<BackgroundTask>
893
+ getDownloadDirUrl: (sessionId: string, dirPath: string) => string
894
+ getSession: (sessionId: string, init?: RequestInit) => Promise<SessionDetail>
895
+ getSessionCheckpoints: (sessionId: string, init?: RequestInit) => Promise<{ nodes: CheckpointNode[]; leaf_id: string | null; }>
896
+ getSessionContextStats: (sessionId: string, init?: RequestInit) => Promise<SessionContextStats>
897
+ getSessionHistory: (sessionId: string, init?: RequestInit) => Promise<SessionHistory>
898
+ getSessionTasks: (sessionId: string) => Promise<Task[]>
899
+ getSessionTurns: (sessionId: string) => Promise<TurnProjection[]>
900
+ getSharedSession: (token: string) => Promise<TurnProjection[]>
901
+ importSession: (file: File, name?: string, solutionId?: string | null) => Promise<{ session_id: string; }>
902
+ listBackgroundTasks: (sessionId: string, init?: RequestInit) => Promise<BackgroundTask[]>
903
+ listDir: (sessionId: string, dirPath: string) => Promise<FileEntry[]>
904
+ listSessions: (template_id_prefix?: string, solution_id?: string) => Promise<SessionInfo[]>
905
+ listSessionsPaginated: (params: { limit: number; offset: number; template_id_prefix?: string; solution_id?: string; q?: string; }) => Promise<PaginatedSessionsResult>
906
+ listSessionsWithSkillData: () => Promise<SkillDevSession[]>
907
+ pinSession: (sessionId: string, pinned: boolean) => Promise<SessionInfo>
908
+ previewImport: (file: File) => Promise<ImportPreview>
909
+ probeSessionUrl: (sessionId: string, url: string) => Promise<{ reachable: boolean; }>
910
+ renameFile: (sessionId: string, filePath: string, newName: string) => Promise<{ path: string; }>
911
+ revokeShare: (sessionId: string, token: string) => Promise<{ revoked: boolean; }>
912
+ rewindSession: (sessionId: string, checkpointId: string) => Promise<{ id: string; content: string; }>
913
+ setSessionEnv: (sessionId: string, env: Record<string, string>) => Promise<SessionDetail>
914
+ shareFile: (sessionId: string, sourcePath: string, linkName?: string, shareFolder?: string) => Promise<{ path: string; target: string; }>
915
+ startReplaySession: (sourceSessionId: string, speed?: 1 | 2 | 5) => Promise<{ session_id: string; }>
916
+ stopBackgroundTask: (sessionId: string, taskId: string) => Promise<{ message: string; task?: BackgroundTask | null; }>
917
+ switchBranch: (sessionId: string, checkpointId: string) => Promise<{ id: string; leaf_id: string; }>
918
+ tokenizeMessages: (messages: Array<Record<string, unknown>>, options?: { model?: string; add_generation_prompt?: boolean; enable_thinking?: boolean | null; tools?: Array<Record<string, unknown>>; }) => Promise<TokenizeResult>
919
+ tokenizePrompt: (prompt: string, model?: string) => Promise<TokenizeResult>
920
+ updateReplaySession: (sessionId: string, payload: { speed?: 1 | 2 | 5; status?: "autonomous"; }) => Promise<{ replay_state: SessionInfo["replay_state"]; }>
921
+ updateSession: (sessionId: string, payload: { intent?: string; }) => Promise<SessionDetail>
922
+ updateSessionMemory: (sessionId: string, memoryEnabled: boolean) => Promise<{ memory_enabled: boolean; }>
923
+ updateSharing: (sessionId: string, shared: boolean) => Promise<{ shared: boolean; }>
924
+ uploadFiles: (sessionId: string, dirPath: string, files: FileList | File[] | UploadFileEntry[], options?: UploadFilesOptions) => Promise<{ uploaded: string[]; failed: string[]; }>
925
+ writeFile: (sessionId: string, filePath: string, content: string) => Promise<{ success: boolean; }>
926
+ ```
927
+
928
+ ## `SessionState` (interface)
929
+
930
+ ```ts
931
+ activeCompaction: ActiveCompactionState | null
932
+ agentLoops: Record<string, AgentLoopInfo>
933
+ askAnswers: Record<string, AskUserAnswerData>
934
+ connection: ConnectionStatus
935
+ errorMessage: string | null
936
+ isStreaming: boolean
937
+ messages: ChatMessage[]
938
+ mode: "planning" | "executing" | null
939
+ sessionId: string
940
+ status: "completed" | "failed" | "interrupted" | "running" | "created" | "waiting_for_input" | null
941
+ turns: TurnProjection[]
942
+ ```
943
+
944
+ ## `SessionStatus` (type)
945
+
946
+ ```ts
947
+ SessionStatus = type(
948
+ "'created' | 'running' | 'completed' | 'failed' | 'interrupted' | 'waiting_for_input'",
949
+ )
950
+ ```
951
+
952
+ ## `ShareLinkResult` (interface)
953
+
954
+ ```ts
955
+ expires_at: string | null
956
+ token: string
957
+ url: string
958
+ ```
959
+
960
+ ## `Solution` (interface)
961
+
962
+ ```ts
963
+ data: Record<string, unknown> | null | undefined
964
+ description: string | null | undefined
965
+ id: string
966
+ initial_message: string | null | undefined
967
+ initial_mode: string | null | undefined
968
+ layout: { available?: boolean; source_dir?: string; entry?: string; export?: string; } | null | undefined
969
+ layout_type: string
970
+ name: string
971
+ preview: { url: string; title?: string | null; } | null | undefined
972
+ roles: BizRole[] | null | undefined
973
+ source: string | null | undefined
974
+ ui_config: SolutionAppUiConfig | null | undefined
975
+ version: string
976
+ ```
977
+
978
+ ## `SolutionAppField` (type)
979
+
980
+ ```ts
981
+ export type SolutionAppField =
982
+ | {
983
+ id: string
984
+ kind: "textarea"
985
+ label: string
986
+ placeholder?: string
987
+ }
988
+ | {
989
+ id: string
990
+ kind: "file-upload"
991
+ accept?: string[]
992
+ categories?: Array<{
993
+ label: string
994
+ description: string
995
+ color: string
996
+ }>
997
+ }
998
+ ```
999
+
1000
+ ## `SolutionAppState` (interface)
1001
+
1002
+ ```ts
1003
+ meta: Record<string, { label: string; value: string; color?: string; }>
1004
+ pipeline: { id: string; label: string; status: "done" | "active" | "pending" | "error"; }[]
1005
+ ```
1006
+
1007
+ ## `SolutionAppUiConfig` (interface)
1008
+
1009
+ ```ts
1010
+ branding: { name: string; subtitle?: string; icon_text: string; icon_gradient?: string; }
1011
+ create: { title: string; description?: string; submit_button: string; sections: Array<{ id: string; title: string; description?: string; fields: Array<SolutionAppField>; }>; }
1012
+ list: { title: string; create_button: string; card?: { subtitle?: string; stats?: Array<{ label: string; value: string; color?: string; }>; }; }
1013
+ ```
1014
+
1015
+ ## `SolutionRef` (type)
1016
+
1017
+ ```ts
1018
+ export type SolutionRef = ExistingSolutionRef | PreparedSolutionAsset
1019
+ ```
1020
+
1021
+ ## `Task` (type)
1022
+
1023
+ ```ts
1024
+ Task = type({
1025
+ id: "string",
1026
+ goal: "string",
1027
+ skills: "string[]",
1028
+ depends_on: "string[]",
1029
+ status: TaskStatus,
1030
+ result_summary: "string",
1031
+ number: "string",
1032
+ })
1033
+ ```
1034
+
1035
+ ## `TaskStatus` (type)
1036
+
1037
+ ```ts
1038
+ TaskStatus = type("'pending' | 'in_progress' | 'done' | 'failed' | 'skipped'")
1039
+ ```
1040
+
1041
+ ## `TemplateId` (type)
1042
+
1043
+ ```ts
1044
+ export type TemplateId =
1045
+ | "default"
1046
+ | "skill_editor"
1047
+ // ship-attack v2:用户从 ship-attack 页面点"新建 session"创建的会话。
1048
+ // 后端 _maybe_bind_first_skill 只对此模板触发首次绑定。
1049
+ | "ship_attack"
1050
+ ```
1051
+
1052
+ ## `TextContentPart` (interface)
1053
+
1054
+ ```ts
1055
+ text: string
1056
+ type: "text"
1057
+ ```
1058
+
1059
+ ## `TokenStorageMode` (type)
1060
+
1061
+ ```ts
1062
+ export type TokenStorageMode = "local" | "memory"
1063
+ ```
1064
+
1065
+ ## `ToolBridgeContent` (interface)
1066
+
1067
+ ```ts
1068
+ action: string
1069
+ payload: unknown
1070
+ ```
1071
+
1072
+ ## `ToolCallInfo` (interface)
1073
+
1074
+ ```ts
1075
+ arguments: string
1076
+ display_name: string | null | undefined
1077
+ duration_ms: number | null | undefined
1078
+ id: string
1079
+ name: string
1080
+ pending_question_ref: PendingQuestionRef | null | undefined
1081
+ result: unknown
1082
+ status: "done" | "error" | "cancelled" | "awaiting_answer" | "pending" | undefined
1083
+ ```
1084
+
1085
+ ## `ToolCallRenderer` (type)
1086
+
1087
+ ```ts
1088
+ export type ToolCallRenderer = (info: ToolCallInfo) => ReactNode | null
1089
+ ```
1090
+
1091
+ ## `transformSlashCommand` (function)
1092
+
1093
+ ```ts
1094
+ transformSlashCommand: (skillName: string, rawInput: string) => string
1095
+ ```
1096
+
1097
+ ## `TurnProjection` (interface)
1098
+
1099
+ ```ts
1100
+ archived_count: number | null | undefined
1101
+ archived_files: ArchivedFileInfo[] | null | undefined
1102
+ archived_tool_calls: ArchivedToolCallInfo[] | null | undefined
1103
+ blocks: ContentBlock[]
1104
+ compaction_id: string | null | undefined
1105
+ context_window: number | undefined
1106
+ duration_ms: number | undefined
1107
+ failure_reason: string | null | undefined
1108
+ fallback_applied: boolean | null | undefined
1109
+ id: string
1110
+ kind: "message" | "compaction" | undefined
1111
+ loop_id: string
1112
+ memory_refs: MemoryRef[] | null | undefined
1113
+ model: string | null | undefined
1114
+ parent_fork_tool_call_id: string | null | undefined
1115
+ role: "user" | "assistant" | "system"
1116
+ saved_ratio: number | null | undefined
1117
+ sequence: number
1118
+ started_at: string | null | undefined
1119
+ status: "streaming" | "completed" | "paused" | "failed" | "interrupted"
1120
+ summary_full: string | null | undefined
1121
+ summary_preview: string | null | undefined
1122
+ tokens_after: number | null | undefined
1123
+ tokens_before: number | null | undefined
1124
+ tool_calls: ToolCallProjection[]
1125
+ trigger: "auto" | "manual" | "forced_retry" | null | undefined
1126
+ turn_id: string
1127
+ usage: Record<string, unknown> | null | undefined
1128
+ ```
1129
+
1130
+ ## `TypedSocket` (type)
1131
+
1132
+ ```ts
1133
+ export type TypedSocket = Socket<ServerToClientEvents, ClientToServerEvents>
1134
+ ```
1135
+
1136
+ ## `UploadFileEntry` (type)
1137
+
1138
+ ```ts
1139
+ export type UploadFileEntry = File | { file: File; name: string }
1140
+ ```
1141
+
1142
+ ## `UploadFilesOptions` (interface)
1143
+
1144
+ ```ts
1145
+ onProgress: ((progress: UploadProgress) => void) | undefined
1146
+ ```
1147
+
1148
+ ## `UploadProgress` (interface)
1149
+
1150
+ ```ts
1151
+ loaded: number
1152
+ percent: number | undefined
1153
+ total: number | undefined
1154
+ ```
1155
+
1156
+ ## `useAgentSession` (function)
1157
+
1158
+ ```ts
1159
+ useAgentSession: (sessionId?: string, options?: UseAgentSessionOptions) => UseAgentSessionResult
1160
+ ```
1161
+
1162
+ ## `UseAgentSessionOptions` (interface)
1163
+
1164
+ ```ts
1165
+ createOptions: CreateSessionRequest | undefined
1166
+ onSessionCreated: ((sessionId: string) => void) | undefined
1167
+ ```
1168
+
1169
+ ## `UseAgentSessionResult` (interface)
1170
+
1171
+ ```ts
1172
+ error: Error | null
1173
+ session: AgentSession | null
1174
+ state: SessionState | null
1175
+ ```
1176
+
1177
+ ## `useBladeClient` (function)
1178
+
1179
+ ```ts
1180
+ useBladeClient: () => BladeClient
1181
+ ```
1182
+
1183
+ ## `UserInfo` (interface)
1184
+
1185
+ ```ts
1186
+ auth_type: "casdoor"
1187
+ avatar_url: string | null
1188
+ display_name: string | null | undefined
1189
+ id: string
1190
+ is_admin: boolean | undefined
1191
+ token: string
1192
+ username: string
1193
+ ```
1194
+
1195
+ ## `VersionMismatchError` (class)
1196
+
1197
+ ```ts
1198
+ cause: unknown
1199
+ hint: string
1200
+ message: string
1201
+ name: string
1202
+ sdkVersion: string
1203
+ serverVersion: string | null
1204
+ stack: string | undefined
1205
+ ```
1206
+