@blade-hq/agent-react 2608.0.5-beta.0 → 2608.0.5-beta.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 CHANGED
@@ -3,13 +3,7 @@
3
3
  > 本文件由 `scripts/public-api-report.mjs` 生成,请勿手改。
4
4
  > 公共面变更时重新生成本报告,并同步更新 README 对应章节——CI 会校验两者。
5
5
 
6
- 共 170 个公开声明。
7
-
8
- ## `acceptedPostChatFollowupCompletesLatestRun` (function)
9
-
10
- ```ts
11
- acceptedPostChatFollowupCompletesLatestRun: (events: RawEvent[], updates: ProjectionUpdate[]) => boolean
12
- ```
6
+ 共 131 个公开声明。
13
7
 
14
8
  ## `ActiveCompactionState` (interface)
15
9
 
@@ -30,28 +24,6 @@ trigger: "auto" | "manual" | "forced_retry" | null | undefined
30
24
  turn_id: string
31
25
  ```
32
26
 
33
- ## `AgentChat` (function)
34
-
35
- ```ts
36
- AgentChat: (props: AgentChatProps) => JSX.Element
37
- ```
38
-
39
- ## `AgentChatProps` (interface)
40
-
41
- ```ts
42
- classNames: ChatViewClassNames | undefined
43
- commands: Record<string, (data: unknown) => void> | undefined
44
- createOptions: CreateSessionRequest | undefined
45
- onFollowupInteraction: ((event: FollowupInteractionEvent) => void) | undefined
46
- onSessionCreated: ((sessionId: string) => void) | undefined
47
- onSessionReady: ((session: AgentSession) => void) | undefined
48
- placeholder: string | undefined
49
- renderers: ChatViewRenderers | undefined
50
- sessionId: string | undefined
51
- slots: ChatViewSlots | undefined
52
- theme: "light" | "dark" | undefined
53
- ```
54
-
55
27
  ## `AgentLoopInfo` (interface)
56
28
 
57
29
  ```ts
@@ -70,7 +42,6 @@ compact: () => Promise<Record<string, unknown>>
70
42
  countFiles: (dirPath?: string) => Promise<number>
71
43
  dispose: () => void
72
44
  downloadFile: (filePath: string, downloadName?: string) => Promise<void>
73
- exitReplay: () => Promise<void>
74
45
  getState: () => SessionState
75
46
  insertText: (text: string) => void
76
47
  isDisposed: boolean
@@ -80,7 +51,6 @@ on: <K extends keyof AgentSessionEvents>(name: K, handler: (event: AgentSessionE
80
51
  onCommand: (action: string, handler: CommandHandler) => () => void
81
52
  send: (content: MessageContent, options?: SendOptions) => Promise<boolean>
82
53
  sessionId: string
83
- setReplaySpeed: (speed: ReplaySpeed) => Promise<void>
84
54
  stop: () => Promise<Record<string, unknown>>
85
55
  subscribe: (listener: () => void) => () => void
86
56
  ```
@@ -177,7 +147,6 @@ getContext: () => Record<string, unknown> | Promise<Record<string, unknown>>
177
147
  ## `AuthResource` (class)
178
148
 
179
149
  ```ts
180
- exchangeCode: (params: ExchangeCodeParams) => Promise<ExchangeCodeResult>
181
150
  getMe: () => Promise<UserInfo>
182
151
  getProviders: () => Promise<ProvidersResponse>
183
152
  login: (options?: LoginOptions) => Promise<LoginResult>
@@ -268,7 +237,6 @@ baseUrl: string
268
237
  fetchImpl: { (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined
269
238
  onRefreshSuccess: (() => void | Promise<void>) | undefined
270
239
  socketToken: string | (() => string | null | undefined) | undefined
271
- streamTokens: boolean | undefined
272
240
  token: string | (() => string | null | undefined) | undefined
273
241
  tokenStorage: TokenStorageMode | undefined
274
242
  ```
@@ -292,13 +260,6 @@ client: BladeClient
292
260
  buildMessageContent: (text: string, attachments: Array<{ kind: "file"; name: string; uploadedPath?: string; textContent?: string | null; mimeType?: string; }>) => MessageContent
293
261
  ```
294
262
 
295
- ## `ChatCompletionTool` (interface)
296
-
297
- ```ts
298
- function: { name: string; description?: string; parameters?: Record<string, unknown>; }
299
- type: "function"
300
- ```
301
-
302
263
  ## `ChatMessage` (interface)
303
264
 
304
265
  ```ts
@@ -339,10 +300,6 @@ root: string | undefined
339
300
  classNames: ChatViewClassNames | undefined
340
301
  commands: Record<string, (data: unknown) => void> | undefined
341
302
  createOptions: CreateSessionRequest | undefined
342
- llm: (LlmChatOptions & { advanced?: boolean | LlmAdvancedSettings; onOverrideChange?: (override: LlmOverride) => void; }) | undefined
343
- mode: "agent" | "llm" | undefined
344
- onFollowupInteraction: ((event: FollowupInteractionEvent) => void) | undefined
345
- onLlmReady: ((handle: LlmChatHandle) => void) | undefined
346
303
  onSessionCreated: ((sessionId: string) => void) | undefined
347
304
  onSessionReady: ((session: AgentSession) => void) | undefined
348
305
  placeholder: string | undefined
@@ -476,12 +433,6 @@ path: string | undefined
476
433
  token: string | (() => string | null | undefined) | undefined
477
434
  ```
478
435
 
479
- ## `DEFAULT_REPLAY_SPEED` (const)
480
-
481
- ```ts
482
- DEFAULT_REPLAY_SPEED: ReplaySpeed
483
- ```
484
-
485
436
  ## `EmbeddedChat` (interface)
486
437
 
487
438
  ```ts
@@ -499,22 +450,6 @@ allowedOrigins: string[]
499
450
  iframe: HTMLIFrameElement | undefined
500
451
  ```
501
452
 
502
- ## `ExchangeCodeParams` (interface)
503
-
504
- ```ts
505
- clientOrigin: string
506
- code: string
507
- state: string
508
- ```
509
-
510
- ## `ExchangeCodeResult` (interface)
511
-
512
- ```ts
513
- access_token: string
514
- token_type: string
515
- user: { id: string; username: string; display_name: string; avatar_url: string | null; }
516
- ```
517
-
518
453
  ## `ExistingSolutionRef` (interface)
519
454
 
520
455
  ```ts
@@ -547,59 +482,6 @@ path: string
547
482
  tags: string[] | undefined
548
483
  ```
549
484
 
550
- ## `FinalArtifact` (interface)
551
-
552
- ```ts
553
- kind: "link" | "file"
554
- label: string
555
- target: string
556
- ```
557
-
558
- ## `FollowupInteractionEvent` (type)
559
-
560
- ```ts
561
- export type FollowupInteractionEvent =
562
- | {
563
- type: "suggestions_shown"
564
- sessionId?: string
565
- assistantEntryId: string
566
- count: number
567
- }
568
- | {
569
- type: "suggestion_adopted"
570
- sessionId?: string
571
- assistantEntryId: string
572
- suggestionIndex: number
573
- }
574
- | {
575
- type: "artifact_shown"
576
- sessionId?: string
577
- assistantEntryId: string
578
- artifactIndex: number
579
- artifactKind: FinalArtifact["kind"]
580
- }
581
- | {
582
- type: "artifact_opened"
583
- sessionId?: string
584
- assistantEntryId: string
585
- artifactIndex: number
586
- artifactKind: FinalArtifact["kind"]
587
- }
588
- | {
589
- type: "artifact_download_started"
590
- sessionId?: string
591
- assistantEntryId: string
592
- artifactIndex: number
593
- artifactKind: "file"
594
- }
595
- | {
596
- type: "artifact_download_succeeded"
597
- sessionId?: string
598
- assistantEntryId: string
599
- artifactIndex: number
600
- artifactKind: "file"
601
- ```
602
-
603
485
  ## `getFileParts` (function)
604
486
 
605
487
  ```ts
@@ -618,42 +500,6 @@ getImageParts: (content: MessageContent) => ImageUrlContentPart[]
618
500
  getTextContent: (content: MessageContent) => string
619
501
  ```
620
502
 
621
- ## `GlobalSearchConversationResult` (interface)
622
-
623
- ```ts
624
- matched: "title" | "content"
625
- session: SessionInfo
626
- snippet: string
627
- type: "conversation"
628
- ```
629
-
630
- ## `GlobalSearchFileResult` (interface)
631
-
632
- ```ts
633
- matched: "name" | "path"
634
- name: string
635
- path: string
636
- session: SessionInfo
637
- snippet: string
638
- type: "file"
639
- ```
640
-
641
- ## `GlobalSearchResult` (interface)
642
-
643
- ```ts
644
- indexing: boolean
645
- items: GlobalSearchResultItem[]
646
- truncated: boolean
647
- ```
648
-
649
- ## `GlobalSearchResultItem` (type)
650
-
651
- ```ts
652
- export type GlobalSearchResultItem =
653
- | GlobalSearchConversationResult
654
- | GlobalSearchFileResult
655
- ```
656
-
657
503
  ## `groupMessagesByLoop` (function)
658
504
 
659
505
  ```ts
@@ -714,12 +560,6 @@ isHiddenInternalMessage: (message: Pick<ChatMessage, "role" | "content">) => boo
714
560
  isInboundEnvelope: (value: unknown) => value is InboundEnvelope
715
561
  ```
716
562
 
717
- ## `latestPostChatFollowup` (function)
718
-
719
- ```ts
720
- latestPostChatFollowup: (turns: TurnProjection[]) => PostChatFollowup | null
721
- ```
722
-
723
563
  ## `LayoutType` (enum)
724
564
 
725
565
  ```ts
@@ -736,88 +576,6 @@ export enum LayoutType {
736
576
  }
737
577
  ```
738
578
 
739
- ## `LlmAdvancedSettings` (interface)
740
-
741
- ```ts
742
- apiKey: boolean | undefined
743
- baseURL: boolean | undefined
744
- model: boolean | undefined
745
- storage: "local" | "memory" | undefined
746
- storageKey: string | undefined
747
- ```
748
-
749
- ## `LlmChat` (function)
750
-
751
- ```ts
752
- LlmChat: ({ classNames, renderers, slots, placeholder, theme, onReady, advanced, onOverrideChange, ...options }: LlmChatProps) => JSX.Element
753
- ```
754
-
755
- ## `LlmChatHandle` (interface)
756
-
757
- ```ts
758
- insertText: (text: string) => void
759
- reset: () => void
760
- send: (text: string) => Promise<boolean>
761
- ```
762
-
763
- ## `LlmChatOptions` (interface)
764
-
765
- ```ts
766
- apiKey: string | undefined
767
- baseURL: string
768
- extraBody: Record<string, unknown> | undefined
769
- fetchImpl: { (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined
770
- headers: Record<string, string> | undefined
771
- historyTurns: number | undefined
772
- maxToolRounds: number | undefined
773
- model: string
774
- onToolCall: ((call: LlmToolCall) => Promise<unknown>) | undefined
775
- system: string | undefined
776
- temperature: number | undefined
777
- tools: ChatCompletionTool[] | undefined
778
- ```
779
-
780
- ## `LlmChatProps` (interface)
781
-
782
- ```ts
783
- advanced: boolean | LlmAdvancedSettings | undefined
784
- apiKey: string | undefined
785
- baseURL: string
786
- classNames: ChatViewClassNames | undefined
787
- extraBody: Record<string, unknown> | undefined
788
- fetchImpl: { (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined
789
- headers: Record<string, string> | undefined
790
- historyTurns: number | undefined
791
- maxToolRounds: number | undefined
792
- model: string
793
- onOverrideChange: ((override: LlmOverride) => void) | undefined
794
- onReady: ((handle: LlmChatHandle) => void) | undefined
795
- onToolCall: ((call: LlmToolCall) => Promise<unknown>) | undefined
796
- placeholder: string | undefined
797
- renderers: ChatViewRenderers | undefined
798
- slots: ChatViewSlots | undefined
799
- system: string | undefined
800
- temperature: number | undefined
801
- theme: "light" | "dark" | undefined
802
- tools: ChatCompletionTool[] | undefined
803
- ```
804
-
805
- ## `LlmOverride` (interface)
806
-
807
- ```ts
808
- apiKey: string | undefined
809
- baseURL: string | undefined
810
- model: string | undefined
811
- ```
812
-
813
- ## `LlmToolCall` (interface)
814
-
815
- ```ts
816
- arguments: string
817
- id: string
818
- name: string
819
- ```
820
-
821
579
  ## `LoginOptions` (interface)
822
580
 
823
581
  ```ts
@@ -885,9 +643,7 @@ export type ModeId = "planning" | "executing"
885
643
  ## `ModelCatalog` (interface)
886
644
 
887
645
  ```ts
888
- baseUrl: string | undefined
889
646
  default: string
890
- defaultServiceModel: string | undefined
891
647
  models: ModelOption[]
892
648
  ```
893
649
 
@@ -896,7 +652,6 @@ models: ModelOption[]
896
652
  ```ts
897
653
  id: string
898
654
  label: string
899
- serviceModelId: string | undefined
900
655
  ```
901
656
 
902
657
  ## `ModelsResource` (class)
@@ -945,17 +700,6 @@ sequence: number
945
700
  turn_id: string
946
701
  ```
947
702
 
948
- ## `PostChatFollowup` (interface)
949
-
950
- ```ts
951
- assistant_entry_id: string
952
- feedback_eligible: boolean
953
- feedback_scope: "latest_result"
954
- final_artifacts: FinalArtifact[] | undefined
955
- recaption: string | undefined
956
- suggestions: string[]
957
- ```
958
-
959
703
  ## `PreparedSolution` (interface)
960
704
 
961
705
  ```ts
@@ -1017,103 +761,6 @@ payload: Record<string, unknown>
1017
761
  type: string
1018
762
  ```
1019
763
 
1020
- ## `ReplayBar` (function)
1021
-
1022
- ```ts
1023
- ReplayBar: ({ isReplay, speed, onSpeedChange, onExit, canControl, className, }: ReplayBarProps) => JSX.Element | null
1024
- ```
1025
-
1026
- ## `ReplayBarProps` (interface)
1027
-
1028
- ```ts
1029
- canControl: boolean | undefined
1030
- className: string | undefined
1031
- isReplay: boolean
1032
- onExit: () => void
1033
- onSpeedChange: (speed: ReplaySpeed) => void
1034
- speed: ReplaySpeed
1035
- ```
1036
-
1037
- ## `ReplayMismatch` (interface)
1038
-
1039
- ```ts
1040
- actualMessage: string
1041
- expectedMessage: string
1042
- resolve: (decision: "keep_replay" | "continue_replay") => void
1043
- ```
1044
-
1045
- ## `ReplayMismatchPrompt` (function)
1046
-
1047
- ```ts
1048
- ReplayMismatchPrompt: ({ mismatch, className }: ReplayMismatchPromptProps) => JSX.Element | null
1049
- ```
1050
-
1051
- ## `ReplayMismatchPromptProps` (interface)
1052
-
1053
- ```ts
1054
- className: string | undefined
1055
- mismatch: ReplayMismatch | null
1056
- ```
1057
-
1058
- ## `ReplayPreview` (interface)
1059
-
1060
- ```ts
1061
- intent: string | null | undefined
1062
- reason: string | null | undefined
1063
- session_id: string
1064
- supported: boolean
1065
- ```
1066
-
1067
- ## `ReplaySnapshot` (interface)
1068
-
1069
- ```ts
1070
- isReplay: boolean
1071
- sourceSessionId: string | null
1072
- speed: ReplaySpeed
1073
- ```
1074
-
1075
- ## `ReplaySpeed` (type)
1076
-
1077
- ```ts
1078
- export type ReplaySpeed = 1 | 2 | 5
1079
- ```
1080
-
1081
- ## `ReplayState` (interface)
1082
-
1083
- ```ts
1084
- autonomous_reason: string | null | undefined
1085
- ended_at: string | null | undefined
1086
- next_source_entry_id: string | null | undefined
1087
- source_session_id: string | undefined
1088
- speed: ReplaySpeed | undefined
1089
- status: "replay" | "autonomous" | undefined
1090
- ```
1091
-
1092
- ## `ResultFeedback` (interface)
1093
-
1094
- ```ts
1095
- assistant_entry_id: string
1096
- created_at: string
1097
- helpful: boolean
1098
- project_id: string | null
1099
- reason: ResultFeedbackReason | null
1100
- session_id: string
1101
- surface: "unknown" | "chat" | "software_factory"
1102
- updated_at: string
1103
- ```
1104
-
1105
- ## `ResultFeedbackReason` (type)
1106
-
1107
- ```ts
1108
- export type ResultFeedbackReason =
1109
- | "not_solved"
1110
- | "inaccurate"
1111
- | "incomplete"
1112
- | "needs_major_changes"
1113
- | "too_slow"
1114
- | "other"
1115
- ```
1116
-
1117
764
  ## `RunOptions` (interface)
1118
765
 
1119
766
  ```ts
@@ -1350,7 +997,6 @@ downloadFile: (sessionId: string, filePath: string, downloadName?: string) => Pr
1350
997
  exportSession: (sessionId: string) => Promise<void>
1351
998
  getBackgroundTask: (sessionId: string, taskId: string, tail?: number, init?: RequestInit) => Promise<BackgroundTask>
1352
999
  getDownloadDirUrl: (sessionId: string, dirPath: string) => string
1353
- getReplayPreview: (sessionId: string) => Promise<ReplayPreview>
1354
1000
  getSession: (sessionId: string, init?: RequestInit) => Promise<SessionDetail>
1355
1001
  getSessionCheckpoints: (sessionId: string, init?: RequestInit) => Promise<{ nodes: CheckpointNode[]; leaf_id: string | null; }>
1356
1002
  getSessionContextStats: (sessionId: string, init?: RequestInit) => Promise<SessionContextStats>
@@ -1361,26 +1007,23 @@ getSharedSession: (token: string) => Promise<TurnProjection[]>
1361
1007
  importSession: (file: File, name?: string, solutionOverride?: string | null | ImportSessionOptions) => Promise<{ session_id: string; }>
1362
1008
  listBackgroundTasks: (sessionId: string, init?: RequestInit) => Promise<BackgroundTask[]>
1363
1009
  listDir: (sessionId: string, dirPath: string) => Promise<FileEntry[]>
1364
- listResultFeedback: (sessionId: string) => Promise<ResultFeedback[]>
1365
1010
  listSessions: (template_id_prefix?: string, solution_id?: string) => Promise<SessionInfo[]>
1366
1011
  listSessionsPaginated: (params: { limit: number; offset: number; template_id_prefix?: string; solution_id?: string; solution_registry_id?: string; q?: string; }) => Promise<PaginatedSessionsResult>
1367
1012
  listSessionsWithSkillData: () => Promise<SkillDevSession[]>
1368
1013
  pinSession: (sessionId: string, pinned: boolean) => Promise<SessionInfo>
1369
1014
  previewImport: (file: File) => Promise<ImportPreview>
1370
1015
  probeSessionUrl: (sessionId: string, url: string) => Promise<{ reachable: boolean; requires_proxy: boolean; }>
1371
- putResultFeedback: (sessionId: string, assistantEntryId: string, feedback: { helpful: boolean; reason?: ResultFeedbackReason | null; }) => Promise<ResultFeedback>
1372
1016
  renameFile: (sessionId: string, filePath: string, newName: string) => Promise<{ path: string; }>
1373
1017
  revokeShare: (sessionId: string, token: string) => Promise<{ revoked: boolean; }>
1374
1018
  rewindSession: (sessionId: string, checkpointId: string) => Promise<{ id: string; content: string; }>
1375
- searchOwnedContent: (params: { q: string; limit?: number; }) => Promise<GlobalSearchResult>
1376
1019
  setSessionEnv: (sessionId: string, env: Record<string, string>) => Promise<SessionDetail>
1377
1020
  shareFile: (sessionId: string, sourcePath: string, linkName?: string, shareFolder?: string) => Promise<{ path: string; target: string; }>
1378
- startReplaySession: (sourceSessionId: string, speed?: ReplaySpeed) => Promise<{ session_id: string; }>
1021
+ startReplaySession: (sourceSessionId: string, speed?: 1 | 2 | 5) => Promise<{ session_id: string; }>
1379
1022
  stopBackgroundTask: (sessionId: string, taskId: string) => Promise<BackgroundTaskStopResult>
1380
1023
  switchBranch: (sessionId: string, checkpointId: string) => Promise<{ id: string; leaf_id: string; }>
1381
1024
  tokenizeMessages: (messages: Array<Record<string, unknown>>, options?: { model?: string; add_generation_prompt?: boolean; enable_thinking?: boolean | null; tools?: Array<Record<string, unknown>>; }) => Promise<TokenizeResult>
1382
1025
  tokenizePrompt: (prompt: string, model?: string) => Promise<TokenizeResult>
1383
- updateReplaySession: (sessionId: string, payload: { speed?: ReplaySpeed; status?: "autonomous"; }) => Promise<{ replay_state: SessionInfo["replay_state"]; }>
1026
+ updateReplaySession: (sessionId: string, payload: { speed?: 1 | 2 | 5; status?: "autonomous"; }) => Promise<{ replay_state: SessionInfo["replay_state"]; }>
1384
1027
  updateSession: (sessionId: string, payload: { intent?: string; }) => Promise<SessionDetail>
1385
1028
  updateSessionMemory: (sessionId: string, memoryEnabled: boolean) => Promise<{ memory_enabled: boolean; }>
1386
1029
  updateSharing: (sessionId: string, shared: boolean) => Promise<{ shared: boolean; }>
@@ -1399,11 +1042,9 @@ errorMessage: string | null
1399
1042
  isStreaming: boolean
1400
1043
  messages: ChatMessage[]
1401
1044
  mode: "planning" | "executing" | null
1402
- replay: ReplaySnapshot | null
1403
1045
  sessionId: string
1404
1046
  status: "completed" | "failed" | "interrupted" | "running" | "created" | "waiting_for_input" | null
1405
1047
  turns: TurnProjection[]
1406
- viewerRole: "owner" | "viewer" | null
1407
1048
  ```
1408
1049
 
1409
1050
  ## `SessionStatus` (type)
@@ -1429,13 +1070,6 @@ files: TextFile[]
1429
1070
  name: string
1430
1071
  ```
1431
1072
 
1432
- ## `SkillMentionAvailability` (interface)
1433
-
1434
- ```ts
1435
- installed: boolean | undefined
1436
- local: boolean | undefined
1437
- ```
1438
-
1439
1073
  ## `Solution` (interface)
1440
1074
 
1441
1075
  ```ts
@@ -1585,16 +1219,10 @@ status: "done" | "error" | "cancelled" | "awaiting_answer" | "pending" | undefin
1585
1219
  export type ToolCallRenderer = (info: ToolCallInfo) => ReactNode | null
1586
1220
  ```
1587
1221
 
1588
- ## `toReplaySnapshot` (function)
1589
-
1590
- ```ts
1591
- toReplaySnapshot: (raw: ReplayState | null | undefined) => ReplaySnapshot | null
1592
- ```
1593
-
1594
1222
  ## `transformSlashCommand` (function)
1595
1223
 
1596
1224
  ```ts
1597
- transformSlashCommand: (skillName: string, rawInput: string, { local, installed }?: SkillMentionAvailability) => string
1225
+ transformSlashCommand: (skillName: string, rawInput: string) => string
1598
1226
  ```
1599
1227
 
1600
1228
  ## `TurnProjection` (interface)
@@ -1615,7 +1243,6 @@ loop_id: string
1615
1243
  memory_refs: MemoryRef[] | null | undefined
1616
1244
  model: string | null | undefined
1617
1245
  parent_fork_tool_call_id: string | null | undefined
1618
- post_chat_followup: PostChatFollowup | null | undefined
1619
1246
  role: "user" | "assistant" | "system"
1620
1247
  saved_ratio: number | null | undefined
1621
1248
  sequence: number
@@ -1684,45 +1311,6 @@ state: SessionState | null
1684
1311
  useBladeClient: () => BladeClient
1685
1312
  ```
1686
1313
 
1687
- ## `useLlmChat` (function)
1688
-
1689
- ```ts
1690
- useLlmChat: (options: LlmChatOptions) => UseLlmChatResult
1691
- ```
1692
-
1693
- ## `UseLlmChatResult` (interface)
1694
-
1695
- ```ts
1696
- error: string | null
1697
- isStreaming: boolean
1698
- messages: ChatMessage[]
1699
- reset: () => void
1700
- send: (text: string) => Promise<boolean>
1701
- stop: () => void
1702
- ```
1703
-
1704
- ## `useReplay` (function)
1705
-
1706
- ```ts
1707
- useReplay: (session: AgentSession | null) => UseReplayResult
1708
- ```
1709
-
1710
- ## `UseReplayResult` (interface)
1711
-
1712
- ```ts
1713
- canControl: boolean
1714
- canReplay: boolean
1715
- error: Error | null
1716
- exitToAutonomous: () => Promise<void>
1717
- isReplay: boolean
1718
- isStarting: boolean
1719
- mismatch: ReplayMismatch | null
1720
- setSpeed: (speed: ReplaySpeed) => Promise<void>
1721
- speed: ReplaySpeed
1722
- startReplay: (speed?: ReplaySpeed) => Promise<string>
1723
- unsupportedReason: string | null
1724
- ```
1725
-
1726
1314
  ## `UserInfo` (interface)
1727
1315
 
1728
1316
  ```ts
@@ -1,21 +0,0 @@
1
- import type { AgentSession, CreateSessionRequest } from "@blade-hq/agent-client";
2
- import { type ChatPresentationProps } from "./ChatSurface";
3
- import type { FollowupInteractionEvent } from "./PostChatFollowupBlock";
4
- export interface AgentChatProps extends ChatPresentationProps {
5
- /** follow-up、成果和评分交互;SDK 不绑定任何分析厂商。 */
6
- onFollowupInteraction?: (event: FollowupInteractionEvent) => void;
7
- /** 连接既有会话;不传则按 createOptions 自动新建。 */
8
- sessionId?: string;
9
- createOptions?: CreateSessionRequest;
10
- /** 自动创建出的 sessionId 通过此回调交还调用方持有。 */
11
- onSessionCreated?: (sessionId: string) => void;
12
- /** 会话连接完成后回调(页面协作场景拿 AgentSession 实例用)。 */
13
- onSessionReady?: (session: AgentSession) => void;
14
- /** 智能体下发给宿主页面的指令处理器(action → handler)。 */
15
- commands?: Record<string, (data: unknown) => void>;
16
- }
17
- /**
18
- * 智能体模式的聊天界面:连接(或新建)一个 Blade 会话,渲染消息流与输入框。
19
- * 状态全部来自 useAgentSession,不依赖任何全局 store。
20
- */
21
- export declare function AgentChat(props: AgentChatProps): import("react/jsx-runtime").JSX.Element;
@@ -1,68 +0,0 @@
1
- import type { AskUserAnswerData, ChatMessage, ConnectionStatus, PostChatFollowup } from "@blade-hq/agent-client";
2
- import type { ReactNode } from "react";
3
- import type { ToolCallRenderer } from "./ToolCallBlock";
4
- import type { FollowupInteractionEvent } from "./PostChatFollowupBlock";
5
- import type { ResultFeedback } from "@blade-hq/agent-client";
6
- export interface ChatViewClassNames {
7
- root?: string;
8
- banner?: string;
9
- messageList?: string;
10
- chatInput?: string;
11
- }
12
- export interface ChatViewRenderers {
13
- /** 自定义工具调用渲染;返回 null 走默认渲染。 */
14
- toolCall?: ToolCallRenderer;
15
- }
16
- export interface ChatViewSlots {
17
- /** 消息列表上方的自定义区域。 */
18
- header?: ReactNode;
19
- /** 无消息时的空状态。 */
20
- emptyState?: ReactNode;
21
- /** 输入框下方的自定义区域。 */
22
- footer?: ReactNode;
23
- }
24
- /** 两种模式共用的外观属性。 */
25
- export interface ChatPresentationProps {
26
- classNames?: ChatViewClassNames;
27
- renderers?: ChatViewRenderers;
28
- slots?: ChatViewSlots;
29
- placeholder?: string;
30
- /** 配色主题,默认浅色。宿主已经在祖先元素上写了 data-theme 时不用传。 */
31
- theme?: "light" | "dark";
32
- }
33
- /** 主题落到聊天根节点上:深色变量挂在 [data-theme="dark"] 上,由它继承给整棵子树。 */
34
- export declare function themeAttr(theme: ChatPresentationProps["theme"]): "dark" | undefined;
35
- interface ChatSurfaceProps extends ChatPresentationProps {
36
- /** follow-up、成果和评分交互;SDK 不绑定任何分析厂商。 */
37
- onFollowupInteraction?: (event: FollowupInteractionEvent) => void;
38
- connection: ConnectionStatus;
39
- errorMessage: string | null;
40
- messages: ChatMessage[];
41
- postChatFollowup?: PostChatFollowup | null;
42
- isStreaming: boolean;
43
- isStopping: boolean;
44
- inputText: string;
45
- onInputChange: (value: string) => void;
46
- onSuggestion?: (value: string) => void;
47
- onSend: (text: string) => Promise<boolean>;
48
- onStop: () => void;
49
- sessionStatus?: string;
50
- askAnswers?: Record<string, AskUserAnswerData>;
51
- onAnswer?: (answer: string, toolCallId: string, answerData: AskUserAnswerData) => void;
52
- sessionId?: string;
53
- isViewer?: boolean;
54
- resultFeedbackByEntry?: ReadonlyMap<string, ResultFeedback>;
55
- onResultFeedbackSaved?: (feedback: ResultFeedback) => void;
56
- /** 输入框上方的内部区域(纯 LLM 模式的高级设置用)。不传时不渲染任何节点。 */
57
- beforeInput?: ReactNode;
58
- /** 连接状态条下方的横幅(回放模式条用)。不传时不渲染任何节点。 */
59
- banner?: ReactNode;
60
- }
61
- /**
62
- * 消息流 + 输入框:智能体模式与纯 LLM 模式共用同一套外观,差别只在谁喂数据。
63
- *
64
- * 这里的 DOM 结构受 tests/chat-view-compat.test.tsx 的快照保护——接入方拿
65
- * .blade-chat-* 类名写了自己的样式,结构一动他们的页面就歪。
66
- */
67
- export declare function ChatSurface({ theme, classNames, renderers, slots, placeholder, connection, errorMessage, messages, postChatFollowup, isStreaming, isStopping, inputText, onInputChange, onSuggestion, onSend, onStop, sessionStatus, askAnswers, onAnswer, sessionId, isViewer, resultFeedbackByEntry, onResultFeedbackSaved, onFollowupInteraction, beforeInput, banner, }: ChatSurfaceProps): import("react/jsx-runtime").JSX.Element;
68
- export {};