@blade-hq/agent-react 2608.0.8 → 2608.0.9

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,7 +3,7 @@
3
3
  > 本文件由 `scripts/public-api-report.mjs` 生成,请勿手改。
4
4
  > 公共面变更时重新生成本报告,并同步更新 README 对应章节——CI 会校验两者。
5
5
 
6
- 共 137 个公开声明。
6
+ 共 159 个公开声明。
7
7
 
8
8
  ## `ActiveCompactionState` (interface)
9
9
 
@@ -24,6 +24,27 @@ trigger: "auto" | "manual" | "forced_retry" | null | undefined
24
24
  turn_id: string
25
25
  ```
26
26
 
27
+ ## `AgentChat` (function)
28
+
29
+ ```ts
30
+ AgentChat: (props: AgentChatProps) => JSX.Element
31
+ ```
32
+
33
+ ## `AgentChatProps` (interface)
34
+
35
+ ```ts
36
+ classNames: ChatViewClassNames | undefined
37
+ commands: Record<string, (data: unknown) => void> | undefined
38
+ createOptions: CreateSessionRequest | undefined
39
+ onSessionCreated: ((sessionId: string) => void) | undefined
40
+ onSessionReady: ((session: AgentSession) => void) | undefined
41
+ placeholder: string | undefined
42
+ renderers: ChatViewRenderers | undefined
43
+ sessionId: string | undefined
44
+ slots: ChatViewSlots | undefined
45
+ theme: "light" | "dark" | undefined
46
+ ```
47
+
27
48
  ## `AgentLoopInfo` (interface)
28
49
 
29
50
  ```ts
@@ -42,6 +63,7 @@ compact: () => Promise<Record<string, unknown>>
42
63
  countFiles: (dirPath?: string) => Promise<number>
43
64
  dispose: () => void
44
65
  downloadFile: (filePath: string, downloadName?: string) => Promise<void>
66
+ exitReplay: () => Promise<void>
45
67
  getState: () => SessionState
46
68
  insertText: (text: string) => void
47
69
  isDisposed: boolean
@@ -51,6 +73,7 @@ on: <K extends keyof AgentSessionEvents>(name: K, handler: (event: AgentSessionE
51
73
  onCommand: (action: string, handler: CommandHandler) => () => void
52
74
  send: (content: MessageContent, options?: SendOptions) => Promise<boolean>
53
75
  sessionId: string
76
+ setReplaySpeed: (speed: ReplaySpeed) => Promise<void>
54
77
  stop: () => Promise<Record<string, unknown>>
55
78
  subscribe: (listener: () => void) => () => void
56
79
  ```
@@ -147,6 +170,7 @@ getContext: () => Record<string, unknown> | Promise<Record<string, unknown>>
147
170
  ## `AuthResource` (class)
148
171
 
149
172
  ```ts
173
+ exchangeCode: (params: ExchangeCodeParams) => Promise<ExchangeCodeResult>
150
174
  getMe: () => Promise<UserInfo>
151
175
  getProviders: () => Promise<ProvidersResponse>
152
176
  login: (options?: LoginOptions) => Promise<LoginResult>
@@ -260,6 +284,13 @@ client: BladeClient
260
284
  buildMessageContent: (text: string, attachments: Array<{ kind: "file"; name: string; uploadedPath?: string; textContent?: string | null; mimeType?: string; }>) => MessageContent
261
285
  ```
262
286
 
287
+ ## `ChatCompletionTool` (interface)
288
+
289
+ ```ts
290
+ function: { name: string; description?: string; parameters?: Record<string, unknown>; }
291
+ type: "function"
292
+ ```
293
+
263
294
  ## `ChatMessage` (interface)
264
295
 
265
296
  ```ts
@@ -300,6 +331,9 @@ root: string | undefined
300
331
  classNames: ChatViewClassNames | undefined
301
332
  commands: Record<string, (data: unknown) => void> | undefined
302
333
  createOptions: CreateSessionRequest | undefined
334
+ llm: (LlmChatOptions & { advanced?: boolean | LlmAdvancedSettings; onOverrideChange?: (override: LlmOverride) => void; }) | undefined
335
+ mode: "agent" | "llm" | undefined
336
+ onLlmReady: ((handle: LlmChatHandle) => void) | undefined
303
337
  onSessionCreated: ((sessionId: string) => void) | undefined
304
338
  onSessionReady: ((session: AgentSession) => void) | undefined
305
339
  placeholder: string | undefined
@@ -433,6 +467,12 @@ path: string | undefined
433
467
  token: string | (() => string | null | undefined) | undefined
434
468
  ```
435
469
 
470
+ ## `DEFAULT_REPLAY_SPEED` (const)
471
+
472
+ ```ts
473
+ DEFAULT_REPLAY_SPEED: ReplaySpeed
474
+ ```
475
+
436
476
  ## `EmbeddedChat` (interface)
437
477
 
438
478
  ```ts
@@ -450,10 +490,20 @@ allowedOrigins: string[]
450
490
  iframe: HTMLIFrameElement | undefined
451
491
  ```
452
492
 
453
- ## `EMPTY_PLATFORM_ENDPOINTS` (const)
493
+ ## `ExchangeCodeParams` (interface)
454
494
 
455
495
  ```ts
456
- EMPTY_PLATFORM_ENDPOINTS: PlatformEndpoints
496
+ clientOrigin: string
497
+ code: string
498
+ state: string
499
+ ```
500
+
501
+ ## `ExchangeCodeResult` (interface)
502
+
503
+ ```ts
504
+ access_token: string
505
+ token_type: string
506
+ user: { id: string; username: string; display_name: string; avatar_url: string | null; }
457
507
  ```
458
508
 
459
509
  ## `ExistingSolutionRef` (interface)
@@ -582,18 +632,86 @@ export enum LayoutType {
582
632
  }
583
633
  ```
584
634
 
585
- ## `loadPlatformEndpoints` (function)
635
+ ## `LlmAdvancedSettings` (interface)
586
636
 
587
637
  ```ts
588
- loadPlatformEndpoints: (options?: LoadPlatformEndpointsOptions) => Promise<PlatformEndpoints>
638
+ apiKey: boolean | undefined
639
+ baseURL: boolean | undefined
640
+ model: boolean | undefined
641
+ storage: "local" | "memory" | undefined
642
+ storageKey: string | undefined
589
643
  ```
590
644
 
591
- ## `LoadPlatformEndpointsOptions` (interface)
645
+ ## `LlmChat` (function)
592
646
 
593
647
  ```ts
594
- baseUrl: string | undefined
648
+ LlmChat: ({ classNames, renderers, slots, placeholder, theme, onReady, advanced, onOverrideChange, ...options }: LlmChatProps) => JSX.Element
649
+ ```
650
+
651
+ ## `LlmChatHandle` (interface)
652
+
653
+ ```ts
654
+ insertText: (text: string) => void
655
+ reset: () => void
656
+ send: (text: string) => Promise<boolean>
657
+ ```
658
+
659
+ ## `LlmChatOptions` (interface)
660
+
661
+ ```ts
662
+ apiKey: string | undefined
663
+ baseURL: string
664
+ extraBody: Record<string, unknown> | undefined
595
665
  fetchImpl: { (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined
596
- timeoutMs: number | undefined
666
+ headers: Record<string, string> | undefined
667
+ historyTurns: number | undefined
668
+ maxToolRounds: number | undefined
669
+ model: string
670
+ onToolCall: ((call: LlmToolCall) => Promise<unknown>) | undefined
671
+ system: string | undefined
672
+ temperature: number | undefined
673
+ tools: ChatCompletionTool[] | undefined
674
+ ```
675
+
676
+ ## `LlmChatProps` (interface)
677
+
678
+ ```ts
679
+ advanced: boolean | LlmAdvancedSettings | undefined
680
+ apiKey: string | undefined
681
+ baseURL: string
682
+ classNames: ChatViewClassNames | undefined
683
+ extraBody: Record<string, unknown> | undefined
684
+ fetchImpl: { (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined
685
+ headers: Record<string, string> | undefined
686
+ historyTurns: number | undefined
687
+ maxToolRounds: number | undefined
688
+ model: string
689
+ onOverrideChange: ((override: LlmOverride) => void) | undefined
690
+ onReady: ((handle: LlmChatHandle) => void) | undefined
691
+ onToolCall: ((call: LlmToolCall) => Promise<unknown>) | undefined
692
+ placeholder: string | undefined
693
+ renderers: ChatViewRenderers | undefined
694
+ slots: ChatViewSlots | undefined
695
+ system: string | undefined
696
+ temperature: number | undefined
697
+ theme: "light" | "dark" | undefined
698
+ tools: ChatCompletionTool[] | undefined
699
+ ```
700
+
701
+ ## `LlmOverride` (interface)
702
+
703
+ ```ts
704
+ apiKey: string | undefined
705
+ baseURL: string | undefined
706
+ model: string | undefined
707
+ ```
708
+
709
+ ## `LlmToolCall` (interface)
710
+
711
+ ```ts
712
+ arguments: string
713
+ id: string
714
+ name: string
597
715
  ```
598
716
 
599
717
  ## `LoginOptions` (interface)
@@ -663,7 +781,9 @@ export type ModeId = "planning" | "executing"
663
781
  ## `ModelCatalog` (interface)
664
782
 
665
783
  ```ts
784
+ baseUrl: string | undefined
666
785
  default: string
786
+ defaultServiceModel: string | undefined
667
787
  models: ModelOption[]
668
788
  ```
669
789
 
@@ -672,6 +792,7 @@ models: ModelOption[]
672
792
  ```ts
673
793
  id: string
674
794
  label: string
795
+ serviceModelId: string | undefined
675
796
  ```
676
797
 
677
798
  ## `ModelsResource` (class)
@@ -720,18 +841,6 @@ sequence: number
720
841
  turn_id: string
721
842
  ```
722
843
 
723
- ## `PlatformEndpoints` (interface)
724
-
725
- ```ts
726
- services: Partial<Record<"os" | "hub" | "agent" | "oauth" | "llmGateway" | "gitea", string>>
727
- ```
728
-
729
- ## `PlatformServiceName` (type)
730
-
731
- ```ts
732
- export type PlatformServiceName = (typeof PLATFORM_SERVICE_NAMES)[number]
733
- ```
734
-
735
844
  ## `PreparedSolution` (interface)
736
845
 
737
846
  ```ts
@@ -793,10 +902,76 @@ payload: Record<string, unknown>
793
902
  type: string
794
903
  ```
795
904
 
796
- ## `resolveServiceUrl` (function)
905
+ ## `ReplayBar` (function)
906
+
907
+ ```ts
908
+ ReplayBar: ({ isReplay, speed, onSpeedChange, onExit, canControl, className, }: ReplayBarProps) => JSX.Element | null
909
+ ```
910
+
911
+ ## `ReplayBarProps` (interface)
912
+
913
+ ```ts
914
+ canControl: boolean | undefined
915
+ className: string | undefined
916
+ isReplay: boolean
917
+ onExit: () => void
918
+ onSpeedChange: (speed: ReplaySpeed) => void
919
+ speed: ReplaySpeed
920
+ ```
921
+
922
+ ## `ReplayMismatch` (interface)
923
+
924
+ ```ts
925
+ actualMessage: string
926
+ expectedMessage: string
927
+ resolve: (decision: "keep_replay" | "continue_replay") => void
928
+ ```
929
+
930
+ ## `ReplayMismatchPrompt` (function)
931
+
932
+ ```ts
933
+ ReplayMismatchPrompt: ({ mismatch, className }: ReplayMismatchPromptProps) => JSX.Element | null
934
+ ```
935
+
936
+ ## `ReplayMismatchPromptProps` (interface)
937
+
938
+ ```ts
939
+ className: string | undefined
940
+ mismatch: ReplayMismatch | null
941
+ ```
942
+
943
+ ## `ReplayPreview` (interface)
944
+
945
+ ```ts
946
+ intent: string | null | undefined
947
+ reason: string | null | undefined
948
+ session_id: string
949
+ supported: boolean
950
+ ```
951
+
952
+ ## `ReplaySnapshot` (interface)
953
+
954
+ ```ts
955
+ isReplay: boolean
956
+ sourceSessionId: string | null
957
+ speed: ReplaySpeed
958
+ ```
959
+
960
+ ## `ReplaySpeed` (type)
797
961
 
798
962
  ```ts
799
- resolveServiceUrl: (endpoints: PlatformEndpoints, name: PlatformServiceName, path?: string) => string | null
963
+ export type ReplaySpeed = 1 | 2 | 5
964
+ ```
965
+
966
+ ## `ReplayState` (interface)
967
+
968
+ ```ts
969
+ autonomous_reason: string | null | undefined
970
+ ended_at: string | null | undefined
971
+ next_source_entry_id: string | null | undefined
972
+ source_session_id: string | undefined
973
+ speed: ReplaySpeed | undefined
974
+ status: "replay" | "autonomous" | undefined
800
975
  ```
801
976
 
802
977
  ## `RunOptions` (interface)
@@ -1035,6 +1210,7 @@ downloadFile: (sessionId: string, filePath: string, downloadName?: string) => Pr
1035
1210
  exportSession: (sessionId: string) => Promise<void>
1036
1211
  getBackgroundTask: (sessionId: string, taskId: string, tail?: number, init?: RequestInit) => Promise<BackgroundTask>
1037
1212
  getDownloadDirUrl: (sessionId: string, dirPath: string) => string
1213
+ getReplayPreview: (sessionId: string) => Promise<ReplayPreview>
1038
1214
  getSession: (sessionId: string, init?: RequestInit) => Promise<SessionDetail>
1039
1215
  getSessionCheckpoints: (sessionId: string, init?: RequestInit) => Promise<{ nodes: CheckpointNode[]; leaf_id: string | null; }>
1040
1216
  getSessionContextStats: (sessionId: string, init?: RequestInit) => Promise<SessionContextStats>
@@ -1056,12 +1232,12 @@ revokeShare: (sessionId: string, token: string) => Promise<{ revoked: boolean; }
1056
1232
  rewindSession: (sessionId: string, checkpointId: string) => Promise<{ id: string; content: string; }>
1057
1233
  setSessionEnv: (sessionId: string, env: Record<string, string>) => Promise<SessionDetail>
1058
1234
  shareFile: (sessionId: string, sourcePath: string, linkName?: string, shareFolder?: string) => Promise<{ path: string; target: string; }>
1059
- startReplaySession: (sourceSessionId: string, speed?: 1 | 2 | 5) => Promise<{ session_id: string; }>
1235
+ startReplaySession: (sourceSessionId: string, speed?: ReplaySpeed) => Promise<{ session_id: string; }>
1060
1236
  stopBackgroundTask: (sessionId: string, taskId: string) => Promise<BackgroundTaskStopResult>
1061
1237
  switchBranch: (sessionId: string, checkpointId: string) => Promise<{ id: string; leaf_id: string; }>
1062
1238
  tokenizeMessages: (messages: Array<Record<string, unknown>>, options?: { model?: string; add_generation_prompt?: boolean; enable_thinking?: boolean | null; tools?: Array<Record<string, unknown>>; }) => Promise<TokenizeResult>
1063
1239
  tokenizePrompt: (prompt: string, model?: string) => Promise<TokenizeResult>
1064
- updateReplaySession: (sessionId: string, payload: { speed?: 1 | 2 | 5; status?: "autonomous"; }) => Promise<{ replay_state: SessionInfo["replay_state"]; }>
1240
+ updateReplaySession: (sessionId: string, payload: { speed?: ReplaySpeed; status?: "autonomous"; }) => Promise<{ replay_state: SessionInfo["replay_state"]; }>
1065
1241
  updateSession: (sessionId: string, payload: { intent?: string; }) => Promise<SessionDetail>
1066
1242
  updateSessionMemory: (sessionId: string, memoryEnabled: boolean) => Promise<{ memory_enabled: boolean; }>
1067
1243
  updateSharing: (sessionId: string, shared: boolean) => Promise<{ shared: boolean; }>
@@ -1080,9 +1256,11 @@ errorMessage: string | null
1080
1256
  isStreaming: boolean
1081
1257
  messages: ChatMessage[]
1082
1258
  mode: "planning" | "executing" | null
1259
+ replay: ReplaySnapshot | null
1083
1260
  sessionId: string
1084
1261
  status: "completed" | "failed" | "interrupted" | "running" | "created" | "waiting_for_input" | null
1085
1262
  turns: TurnProjection[]
1263
+ viewerRole: "owner" | "viewer" | null
1086
1264
  ```
1087
1265
 
1088
1266
  ## `SessionStatus` (type)
@@ -1108,6 +1286,13 @@ files: TextFile[]
1108
1286
  name: string
1109
1287
  ```
1110
1288
 
1289
+ ## `SkillMentionAvailability` (interface)
1290
+
1291
+ ```ts
1292
+ installed: boolean | undefined
1293
+ local: boolean | undefined
1294
+ ```
1295
+
1111
1296
  ## `Solution` (interface)
1112
1297
 
1113
1298
  ```ts
@@ -1257,10 +1442,16 @@ status: "done" | "error" | "cancelled" | "awaiting_answer" | "pending" | undefin
1257
1442
  export type ToolCallRenderer = (info: ToolCallInfo) => ReactNode | null
1258
1443
  ```
1259
1444
 
1445
+ ## `toReplaySnapshot` (function)
1446
+
1447
+ ```ts
1448
+ toReplaySnapshot: (raw: ReplayState | null | undefined) => ReplaySnapshot | null
1449
+ ```
1450
+
1260
1451
  ## `transformSlashCommand` (function)
1261
1452
 
1262
1453
  ```ts
1263
- transformSlashCommand: (skillName: string, rawInput: string) => string
1454
+ transformSlashCommand: (skillName: string, rawInput: string, { local, installed }?: SkillMentionAvailability) => string
1264
1455
  ```
1265
1456
 
1266
1457
  ## `TurnProjection` (interface)
@@ -1349,6 +1540,45 @@ state: SessionState | null
1349
1540
  useBladeClient: () => BladeClient
1350
1541
  ```
1351
1542
 
1543
+ ## `useLlmChat` (function)
1544
+
1545
+ ```ts
1546
+ useLlmChat: (options: LlmChatOptions) => UseLlmChatResult
1547
+ ```
1548
+
1549
+ ## `UseLlmChatResult` (interface)
1550
+
1551
+ ```ts
1552
+ error: string | null
1553
+ isStreaming: boolean
1554
+ messages: ChatMessage[]
1555
+ reset: () => void
1556
+ send: (text: string) => Promise<boolean>
1557
+ stop: () => void
1558
+ ```
1559
+
1560
+ ## `useReplay` (function)
1561
+
1562
+ ```ts
1563
+ useReplay: (session: AgentSession | null) => UseReplayResult
1564
+ ```
1565
+
1566
+ ## `UseReplayResult` (interface)
1567
+
1568
+ ```ts
1569
+ canControl: boolean
1570
+ canReplay: boolean
1571
+ error: Error | null
1572
+ exitToAutonomous: () => Promise<void>
1573
+ isReplay: boolean
1574
+ isStarting: boolean
1575
+ mismatch: ReplayMismatch | null
1576
+ setSpeed: (speed: ReplaySpeed) => Promise<void>
1577
+ speed: ReplaySpeed
1578
+ startReplay: (speed?: ReplaySpeed) => Promise<string>
1579
+ unsupportedReason: string | null
1580
+ ```
1581
+
1352
1582
  ## `UserInfo` (interface)
1353
1583
 
1354
1584
  ```ts