@blade-hq/agent-react 1.1.1 → 1.1.3

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.
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import {
3
+ Nt
4
+ } from "./chunk-ZXXLY4RM.js";
5
+ export {
6
+ Nt as Mermaid
7
+ };
8
+ //# sourceMappingURL=mermaid-3ZIDBTTL-N7YKJ3SM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@blade-hq/agent-react",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Blade Agent React 绑定:BladeProvider、useAgentSession、开箱即用的 ChatView 聊天界面。",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/blade-hq/blade-agent.git"
8
+ },
5
9
  "type": "module",
6
10
  "main": "./dist/index.js",
7
11
  "types": "./dist/index.d.ts",
@@ -24,12 +28,9 @@
24
28
  "access": "public"
25
29
  },
26
30
  "dependencies": {
27
- "@blade-hq/agent-client": "1.1.1",
28
- "clsx": "^2.1.0",
29
- "lucide-react": "^0.468.0",
30
- "streamdown": "^2.0.0",
31
- "use-stick-to-bottom": "^1.1.3"
31
+ "@blade-hq/agent-client": "1.1.3"
32
32
  },
33
+ "bundledDependencies": [],
33
34
  "peerDependencies": {
34
35
  "react": "^18.0.0 || ^19.0.0",
35
36
  "react-dom": "^18.0.0 || ^19.0.0"
package/public-api.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > 本文件由 `scripts/public-api-report.mjs` 生成,请勿手改。
4
4
  > 公共面变更时重新生成本报告,并同步更新 README 对应章节——CI 会校验两者。
5
5
 
6
- 共 118 个公开声明。
6
+ 共 125 个公开声明。
7
7
 
8
8
  ## `ActiveCompactionState` (interface)
9
9
 
@@ -38,10 +38,13 @@ toolCallId: string
38
38
  append: (text: string) => void
39
39
  attach: (label: string, data: unknown) => void
40
40
  compact: () => Promise<Record<string, unknown>>
41
+ countFiles: (dirPath?: string) => Promise<number>
41
42
  dispose: () => void
43
+ downloadFile: (filePath: string, downloadName?: string) => Promise<void>
42
44
  getState: () => SessionState
43
45
  insertText: (text: string) => void
44
46
  isDisposed: boolean
47
+ listDir: (dirPath?: string) => Promise<FileEntry[]>
45
48
  off: <K extends keyof AgentSessionEvents>(name: K, handler: (event: AgentSessionEvents[K]) => void) => void
46
49
  on: <K extends keyof AgentSessionEvents>(name: K, handler: (event: AgentSessionEvents[K]) => void) => () => void
47
50
  onCommand: (action: string, handler: CommandHandler) => () => void
@@ -172,7 +175,6 @@ statusText: string
172
175
  auth: AuthResource
173
176
  blob: (method: HttpMethod, path: string) => Promise<Blob>
174
177
  buildAuthedUrl: (path: string) => string
175
- ensureVersionCompatible: () => Promise<void>
176
178
  fetch: (method: HttpMethod, path: string, init?: BladeFetchInit, isRetry?: boolean) => Promise<Response>
177
179
  formData: (method: HttpMethod, path: string, form: FormData, options?: { expectOk?: boolean; onUploadProgress?: (progress: UploadProgress) => void; }) => Promise<Response>
178
180
  hasToken: () => boolean
@@ -182,6 +184,7 @@ json: <T>(method: HttpMethod, path: string, body?: unknown) => Promise<T>
182
184
  jsonFromInit: <T>(path: string, init?: RequestInit) => Promise<T>
183
185
  login: (options?: LoginOptions) => Promise<LoginResult>
184
186
  logoutToken: () => void
187
+ models: ModelsResource
185
188
  onSocketReplaced: (listener: () => void) => () => void
186
189
  options: BladeClientOptions
187
190
  responseFromInit: (path: string, init?: RequestInit) => Promise<Response>
@@ -587,16 +590,30 @@ export type MessageContent = string | MessageContentPart[]
587
590
  export type MessageContentPart = TextContentPart | ImageUrlContentPart | FileContentPart
588
591
  ```
589
592
 
590
- ## `MIN_SERVER_VERSION` (const)
593
+ ## `ModeId` (type)
591
594
 
592
595
  ```ts
593
- MIN_SERVER_VERSION: "1.1.1"
596
+ export type ModeId = "planning" | "executing"
594
597
  ```
595
598
 
596
- ## `ModeId` (type)
599
+ ## `ModelCatalog` (interface)
597
600
 
598
601
  ```ts
599
- export type ModeId = "planning" | "executing"
602
+ default: string
603
+ models: ModelOption[]
604
+ ```
605
+
606
+ ## `ModelOption` (interface)
607
+
608
+ ```ts
609
+ id: string
610
+ label: string
611
+ ```
612
+
613
+ ## `ModelsResource` (class)
614
+
615
+ ```ts
616
+ list: () => Promise<ModelCatalog>
600
617
  ```
601
618
 
602
619
  ## `normalizeMessageContent` (function)
@@ -731,7 +748,7 @@ SDK_NAME: "agent-client"
731
748
  ## `SDK_VERSION` (const)
732
749
 
733
750
  ```ts
734
- SDK_VERSION: "2.0.0"
751
+ SDK_VERSION: string
735
752
  ```
736
753
 
737
754
  ## `SendOptions` (interface)
@@ -745,11 +762,15 @@ thinkingOverride: boolean | undefined
745
762
  whatif: { from_step: number; quotes: Array<Record<string, unknown>>; deprecate_entry_ids: string[]; } | undefined
746
763
  ```
747
764
 
748
- ## `ServerVersionInfo` (interface)
765
+ ## `SessionConfig` (interface)
749
766
 
750
767
  ```ts
751
- min_sdk: string | undefined
752
- version: string
768
+ compactionRatio: number | undefined
769
+ disableTools: string[] | undefined
770
+ enableThinking: boolean | undefined
771
+ env: Record<string, string> | undefined
772
+ memoryEnabled: boolean | undefined
773
+ model: string | undefined
753
774
  ```
754
775
 
755
776
  ## `SessionContextStats` (interface)
@@ -760,6 +781,15 @@ context_window: number
760
781
  tokens_used: number
761
782
  ```
762
783
 
784
+ ## `SessionDefinition` (interface)
785
+
786
+ ```ts
787
+ config: SessionConfig | undefined
788
+ intent: string | undefined
789
+ skills: SkillDefinition[] | undefined
790
+ solution: SolutionDefinition | undefined
791
+ ```
792
+
763
793
  ## `SessionDetail` (interface)
764
794
 
765
795
  ```ts
@@ -875,19 +905,38 @@ model: string | undefined
875
905
  solution: SolutionRef | undefined
876
906
  ```
877
907
 
908
+ ## `SessionSetupError` (class)
909
+
910
+ ```ts
911
+ cause: unknown
912
+ message: string
913
+ name: "SessionSetupError"
914
+ sessionId: string | undefined
915
+ stack: string | undefined
916
+ stage: SessionSetupStage
917
+ ```
918
+
919
+ ## `SessionSetupStage` (type)
920
+
921
+ ```ts
922
+ export type SessionSetupStage = "solution" | "session" | "skill" | "connection"
923
+ ```
924
+
878
925
  ## `SessionsResource` (class)
879
926
 
880
927
  ```ts
881
928
  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
929
  connect: (sessionId: string) => Promise<AgentSession>
883
930
  copyFile: (sessionId: string, filePath: string) => Promise<{ path: string; }>
884
- create: (request?: CreateSessionRequest) => Promise<AgentSession>
931
+ countFiles: (sessionId: string, dirPath?: string) => Promise<number>
932
+ create: (request?: CreateSessionRequest | SessionDefinition) => Promise<AgentSession>
885
933
  createSession: (intent?: string, template_id?: TemplateId, primary_skill_id?: string | null) => Promise<{ session_id: string; }>
886
934
  createSessionWithRequest: (request: CreateSessionRequest) => Promise<{ session_id: string; }>
887
935
  createShare: (sessionId: string) => Promise<ShareLinkResult>
888
936
  createWithProfile: (params: { intent: string; profile: SessionProfile; }) => Promise<{ session_id: string; }>
889
937
  deleteFile: (sessionId: string, filePath: string) => Promise<void>
890
938
  deleteSession: (sessionId: string) => Promise<{ deleted: boolean; }>
939
+ downloadFile: (sessionId: string, filePath: string, downloadName?: string) => Promise<void>
891
940
  exportSession: (sessionId: string) => Promise<void>
892
941
  getBackgroundTask: (sessionId: string, taskId: string, tail?: number, init?: RequestInit) => Promise<BackgroundTask>
893
942
  getDownloadDirUrl: (sessionId: string, dirPath: string) => string
@@ -957,6 +1006,13 @@ token: string
957
1006
  url: string
958
1007
  ```
959
1008
 
1009
+ ## `SkillDefinition` (interface)
1010
+
1011
+ ```ts
1012
+ files: TextFile[]
1013
+ name: string
1014
+ ```
1015
+
960
1016
  ## `Solution` (interface)
961
1017
 
962
1018
  ```ts
@@ -1012,6 +1068,15 @@ create: { title: string; description?: string; submit_button: string; sections:
1012
1068
  list: { title: string; create_button: string; card?: { subtitle?: string; stats?: Array<{ label: string; value: string; color?: string; }>; }; }
1013
1069
  ```
1014
1070
 
1071
+ ## `SolutionDefinition` (type)
1072
+
1073
+ ```ts
1074
+ export type SolutionDefinition =
1075
+ | { id: string; role?: string }
1076
+ /** 自定义 Solution:文本文件路径均相对于 Solution 根目录。 */
1077
+ | { files: TextFile[]; role?: string }
1078
+ ```
1079
+
1015
1080
  ## `SolutionRef` (type)
1016
1081
 
1017
1082
  ```ts
@@ -1056,6 +1121,15 @@ text: string
1056
1121
  type: "text"
1057
1122
  ```
1058
1123
 
1124
+ ## `TextFile` (type)
1125
+
1126
+ ```ts
1127
+ export type TextFile = {
1128
+ path: string
1129
+ content: string
1130
+ }
1131
+ ```
1132
+
1059
1133
  ## `TokenStorageMode` (type)
1060
1134
 
1061
1135
  ```ts
@@ -1192,15 +1266,3 @@ token: string
1192
1266
  username: string
1193
1267
  ```
1194
1268
 
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
-