@blade-hq/agent-client 2608.0.6 → 2608.0.7-beta.0
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 +137 -5
- package/dist/blade-client.d.ts +2 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.js +327 -72
- package/dist/index.js.map +1 -1
- package/dist/resources/auth.d.ts +26 -0
- package/dist/resources/models.d.ts +22 -0
- package/dist/resources/sessions.d.ts +45 -3
- package/dist/schemas/message-utils.d.ts +11 -1
- package/dist/schemas/message.d.ts +2 -0
- package/dist/schemas/projection-utils.d.ts +3 -0
- package/dist/schemas/projection.d.ts +16 -0
- package/dist/schemas/session.d.ts +18 -1
- package/dist/session/agent-session.d.ts +23 -1
- package/dist/session/state.d.ts +15 -1
- package/dist/shared/projection/builder.d.ts +5 -0
- package/dist/shared/projection/helpers.d.ts +10 -0
- package/dist/shared/projection/index.d.ts +1 -1
- package/dist/types/socket-events.d.ts +6 -0
- package/package.json +1 -1
- package/public-api.md +187 -4
package/public-api.md
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
> 本文件由 `scripts/public-api-report.mjs` 生成,请勿手改。
|
|
4
4
|
> 公共面变更时重新生成本报告,并同步更新 README 对应章节——CI 会校验两者。
|
|
5
5
|
|
|
6
|
-
共
|
|
6
|
+
共 137 个公开声明。
|
|
7
|
+
|
|
8
|
+
## `acceptedPostChatFollowupCompletesLatestRun` (function)
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
acceptedPostChatFollowupCompletesLatestRun: (events: RawEvent[], updates: ProjectionUpdate[]) => boolean
|
|
12
|
+
```
|
|
7
13
|
|
|
8
14
|
## `ActiveCompactionState` (interface)
|
|
9
15
|
|
|
@@ -42,6 +48,7 @@ compact: () => Promise<Record<string, unknown>>
|
|
|
42
48
|
countFiles: (dirPath?: string) => Promise<number>
|
|
43
49
|
dispose: () => void
|
|
44
50
|
downloadFile: (filePath: string, downloadName?: string) => Promise<void>
|
|
51
|
+
exitReplay: () => Promise<void>
|
|
45
52
|
getState: () => SessionState
|
|
46
53
|
insertText: (text: string) => void
|
|
47
54
|
isDisposed: boolean
|
|
@@ -51,6 +58,7 @@ on: <K extends keyof AgentSessionEvents>(name: K, handler: (event: AgentSessionE
|
|
|
51
58
|
onCommand: (action: string, handler: CommandHandler) => () => void
|
|
52
59
|
send: (content: MessageContent, options?: SendOptions) => Promise<boolean>
|
|
53
60
|
sessionId: string
|
|
61
|
+
setReplaySpeed: (speed: ReplaySpeed) => Promise<void>
|
|
54
62
|
stop: () => Promise<Record<string, unknown>>
|
|
55
63
|
subscribe: (listener: () => void) => () => void
|
|
56
64
|
```
|
|
@@ -147,6 +155,7 @@ getContext: () => Record<string, unknown> | Promise<Record<string, unknown>>
|
|
|
147
155
|
## `AuthResource` (class)
|
|
148
156
|
|
|
149
157
|
```ts
|
|
158
|
+
exchangeCode: (params: ExchangeCodeParams) => Promise<ExchangeCodeResult>
|
|
150
159
|
getMe: () => Promise<UserInfo>
|
|
151
160
|
getProviders: () => Promise<ProvidersResponse>
|
|
152
161
|
login: (options?: LoginOptions) => Promise<LoginResult>
|
|
@@ -237,6 +246,7 @@ baseUrl: string
|
|
|
237
246
|
fetchImpl: { (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined
|
|
238
247
|
onRefreshSuccess: (() => void | Promise<void>) | undefined
|
|
239
248
|
socketToken: string | (() => string | null | undefined) | undefined
|
|
249
|
+
streamTokens: boolean | undefined
|
|
240
250
|
token: string | (() => string | null | undefined) | undefined
|
|
241
251
|
tokenStorage: TokenStorageMode | undefined
|
|
242
252
|
```
|
|
@@ -260,6 +270,7 @@ loop_name: string | undefined
|
|
|
260
270
|
memory_refs: MemoryRefInfo[] | undefined
|
|
261
271
|
parent_id: string | null | undefined
|
|
262
272
|
reasoning: string | undefined
|
|
273
|
+
render_id: string | undefined
|
|
263
274
|
role: "error" | "user" | "assistant" | "tool"
|
|
264
275
|
status: "streaming" | "completed" | "paused" | "failed" | "interrupted" | undefined
|
|
265
276
|
timestamp: string | undefined
|
|
@@ -376,6 +387,12 @@ path: string | undefined
|
|
|
376
387
|
token: string | (() => string | null | undefined) | undefined
|
|
377
388
|
```
|
|
378
389
|
|
|
390
|
+
## `DEFAULT_REPLAY_SPEED` (const)
|
|
391
|
+
|
|
392
|
+
```ts
|
|
393
|
+
DEFAULT_REPLAY_SPEED: ReplaySpeed
|
|
394
|
+
```
|
|
395
|
+
|
|
379
396
|
## `EmbeddedChat` (interface)
|
|
380
397
|
|
|
381
398
|
```ts
|
|
@@ -393,6 +410,22 @@ allowedOrigins: string[]
|
|
|
393
410
|
iframe: HTMLIFrameElement | undefined
|
|
394
411
|
```
|
|
395
412
|
|
|
413
|
+
## `ExchangeCodeParams` (interface)
|
|
414
|
+
|
|
415
|
+
```ts
|
|
416
|
+
clientOrigin: string
|
|
417
|
+
code: string
|
|
418
|
+
state: string
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## `ExchangeCodeResult` (interface)
|
|
422
|
+
|
|
423
|
+
```ts
|
|
424
|
+
access_token: string
|
|
425
|
+
token_type: string
|
|
426
|
+
user: { id: string; username: string; display_name: string; avatar_url: string | null; }
|
|
427
|
+
```
|
|
428
|
+
|
|
396
429
|
## `ExistingSolutionRef` (interface)
|
|
397
430
|
|
|
398
431
|
```ts
|
|
@@ -425,6 +458,14 @@ path: string
|
|
|
425
458
|
tags: string[] | undefined
|
|
426
459
|
```
|
|
427
460
|
|
|
461
|
+
## `FinalArtifact` (interface)
|
|
462
|
+
|
|
463
|
+
```ts
|
|
464
|
+
kind: "link" | "file"
|
|
465
|
+
label: string
|
|
466
|
+
target: string
|
|
467
|
+
```
|
|
468
|
+
|
|
428
469
|
## `getFileParts` (function)
|
|
429
470
|
|
|
430
471
|
```ts
|
|
@@ -443,6 +484,42 @@ getImageParts: (content: MessageContent) => ImageUrlContentPart[]
|
|
|
443
484
|
getTextContent: (content: MessageContent) => string
|
|
444
485
|
```
|
|
445
486
|
|
|
487
|
+
## `GlobalSearchConversationResult` (interface)
|
|
488
|
+
|
|
489
|
+
```ts
|
|
490
|
+
matched: "title" | "content"
|
|
491
|
+
session: SessionInfo
|
|
492
|
+
snippet: string
|
|
493
|
+
type: "conversation"
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
## `GlobalSearchFileResult` (interface)
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
matched: "name" | "path"
|
|
500
|
+
name: string
|
|
501
|
+
path: string
|
|
502
|
+
session: SessionInfo
|
|
503
|
+
snippet: string
|
|
504
|
+
type: "file"
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
## `GlobalSearchResult` (interface)
|
|
508
|
+
|
|
509
|
+
```ts
|
|
510
|
+
indexing: boolean
|
|
511
|
+
items: GlobalSearchResultItem[]
|
|
512
|
+
truncated: boolean
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## `GlobalSearchResultItem` (type)
|
|
516
|
+
|
|
517
|
+
```ts
|
|
518
|
+
export type GlobalSearchResultItem =
|
|
519
|
+
| GlobalSearchConversationResult
|
|
520
|
+
| GlobalSearchFileResult
|
|
521
|
+
```
|
|
522
|
+
|
|
446
523
|
## `groupMessagesByLoop` (function)
|
|
447
524
|
|
|
448
525
|
```ts
|
|
@@ -503,6 +580,12 @@ isHiddenInternalMessage: (message: Pick<ChatMessage, "role" | "content">) => boo
|
|
|
503
580
|
isInboundEnvelope: (value: unknown) => value is InboundEnvelope
|
|
504
581
|
```
|
|
505
582
|
|
|
583
|
+
## `latestPostChatFollowup` (function)
|
|
584
|
+
|
|
585
|
+
```ts
|
|
586
|
+
latestPostChatFollowup: (turns: TurnProjection[]) => PostChatFollowup | null
|
|
587
|
+
```
|
|
588
|
+
|
|
506
589
|
## `LayoutType` (enum)
|
|
507
590
|
|
|
508
591
|
```ts
|
|
@@ -571,7 +654,9 @@ export type ModeId = "planning" | "executing"
|
|
|
571
654
|
## `ModelCatalog` (interface)
|
|
572
655
|
|
|
573
656
|
```ts
|
|
657
|
+
baseUrl: string | undefined
|
|
574
658
|
default: string
|
|
659
|
+
defaultServiceModel: string | undefined
|
|
575
660
|
models: ModelOption[]
|
|
576
661
|
```
|
|
577
662
|
|
|
@@ -580,6 +665,7 @@ models: ModelOption[]
|
|
|
580
665
|
```ts
|
|
581
666
|
id: string
|
|
582
667
|
label: string
|
|
668
|
+
serviceModelId: string | undefined
|
|
583
669
|
```
|
|
584
670
|
|
|
585
671
|
## `ModelsResource` (class)
|
|
@@ -628,6 +714,17 @@ sequence: number
|
|
|
628
714
|
turn_id: string
|
|
629
715
|
```
|
|
630
716
|
|
|
717
|
+
## `PostChatFollowup` (interface)
|
|
718
|
+
|
|
719
|
+
```ts
|
|
720
|
+
assistant_entry_id: string
|
|
721
|
+
feedback_eligible: boolean
|
|
722
|
+
feedback_scope: "latest_result"
|
|
723
|
+
final_artifacts: FinalArtifact[] | undefined
|
|
724
|
+
recaption: string | undefined
|
|
725
|
+
suggestions: string[]
|
|
726
|
+
```
|
|
727
|
+
|
|
631
728
|
## `PreparedSolution` (interface)
|
|
632
729
|
|
|
633
730
|
```ts
|
|
@@ -689,6 +786,71 @@ payload: Record<string, unknown>
|
|
|
689
786
|
type: string
|
|
690
787
|
```
|
|
691
788
|
|
|
789
|
+
## `reconcileOptimisticUserTurns` (function)
|
|
790
|
+
|
|
791
|
+
```ts
|
|
792
|
+
reconcileOptimisticUserTurns: (currentTurns: TurnProjection[], incomingTurns: TurnProjection[]) => TurnProjection[]
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
## `ReplayPreview` (interface)
|
|
796
|
+
|
|
797
|
+
```ts
|
|
798
|
+
intent: string | null | undefined
|
|
799
|
+
reason: string | null | undefined
|
|
800
|
+
session_id: string
|
|
801
|
+
supported: boolean
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
## `ReplaySnapshot` (interface)
|
|
805
|
+
|
|
806
|
+
```ts
|
|
807
|
+
isReplay: boolean
|
|
808
|
+
sourceSessionId: string | null
|
|
809
|
+
speed: ReplaySpeed
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
## `ReplaySpeed` (type)
|
|
813
|
+
|
|
814
|
+
```ts
|
|
815
|
+
export type ReplaySpeed = 1 | 2 | 5
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
## `ReplayState` (interface)
|
|
819
|
+
|
|
820
|
+
```ts
|
|
821
|
+
autonomous_reason: string | null | undefined
|
|
822
|
+
ended_at: string | null | undefined
|
|
823
|
+
next_source_entry_id: string | null | undefined
|
|
824
|
+
source_session_id: string | undefined
|
|
825
|
+
speed: ReplaySpeed | undefined
|
|
826
|
+
status: "replay" | "autonomous" | undefined
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
## `ResultFeedback` (interface)
|
|
830
|
+
|
|
831
|
+
```ts
|
|
832
|
+
assistant_entry_id: string
|
|
833
|
+
created_at: string
|
|
834
|
+
helpful: boolean
|
|
835
|
+
project_id: string | null
|
|
836
|
+
reason: ResultFeedbackReason | null
|
|
837
|
+
session_id: string
|
|
838
|
+
surface: "unknown" | "chat" | "software_factory"
|
|
839
|
+
updated_at: string
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
## `ResultFeedbackReason` (type)
|
|
843
|
+
|
|
844
|
+
```ts
|
|
845
|
+
export type ResultFeedbackReason =
|
|
846
|
+
| "not_solved"
|
|
847
|
+
| "inaccurate"
|
|
848
|
+
| "incomplete"
|
|
849
|
+
| "needs_major_changes"
|
|
850
|
+
| "too_slow"
|
|
851
|
+
| "other"
|
|
852
|
+
```
|
|
853
|
+
|
|
692
854
|
## `RunOptions` (interface)
|
|
693
855
|
|
|
694
856
|
```ts
|
|
@@ -925,6 +1087,7 @@ downloadFile: (sessionId: string, filePath: string, downloadName?: string) => Pr
|
|
|
925
1087
|
exportSession: (sessionId: string) => Promise<void>
|
|
926
1088
|
getBackgroundTask: (sessionId: string, taskId: string, tail?: number, init?: RequestInit) => Promise<BackgroundTask>
|
|
927
1089
|
getDownloadDirUrl: (sessionId: string, dirPath: string) => string
|
|
1090
|
+
getReplayPreview: (sessionId: string) => Promise<ReplayPreview>
|
|
928
1091
|
getSession: (sessionId: string, init?: RequestInit) => Promise<SessionDetail>
|
|
929
1092
|
getSessionCheckpoints: (sessionId: string, init?: RequestInit) => Promise<{ nodes: CheckpointNode[]; leaf_id: string | null; }>
|
|
930
1093
|
getSessionContextStats: (sessionId: string, init?: RequestInit) => Promise<SessionContextStats>
|
|
@@ -935,23 +1098,26 @@ getSharedSession: (token: string) => Promise<TurnProjection[]>
|
|
|
935
1098
|
importSession: (file: File, name?: string, solutionOverride?: string | null | ImportSessionOptions) => Promise<{ session_id: string; }>
|
|
936
1099
|
listBackgroundTasks: (sessionId: string, init?: RequestInit) => Promise<BackgroundTask[]>
|
|
937
1100
|
listDir: (sessionId: string, dirPath: string) => Promise<FileEntry[]>
|
|
1101
|
+
listResultFeedback: (sessionId: string) => Promise<ResultFeedback[]>
|
|
938
1102
|
listSessions: (template_id_prefix?: string, solution_id?: string) => Promise<SessionInfo[]>
|
|
939
1103
|
listSessionsPaginated: (params: { limit: number; offset: number; template_id_prefix?: string; solution_id?: string; solution_registry_id?: string; q?: string; }) => Promise<PaginatedSessionsResult>
|
|
940
1104
|
listSessionsWithSkillData: () => Promise<SkillDevSession[]>
|
|
941
1105
|
pinSession: (sessionId: string, pinned: boolean) => Promise<SessionInfo>
|
|
942
1106
|
previewImport: (file: File) => Promise<ImportPreview>
|
|
943
1107
|
probeSessionUrl: (sessionId: string, url: string) => Promise<{ reachable: boolean; requires_proxy: boolean; }>
|
|
1108
|
+
putResultFeedback: (sessionId: string, assistantEntryId: string, feedback: { helpful: boolean; reason?: ResultFeedbackReason | null; }) => Promise<ResultFeedback>
|
|
944
1109
|
renameFile: (sessionId: string, filePath: string, newName: string) => Promise<{ path: string; }>
|
|
945
1110
|
revokeShare: (sessionId: string, token: string) => Promise<{ revoked: boolean; }>
|
|
946
1111
|
rewindSession: (sessionId: string, checkpointId: string) => Promise<{ id: string; content: string; }>
|
|
1112
|
+
searchOwnedContent: (params: { q: string; limit?: number; }) => Promise<GlobalSearchResult>
|
|
947
1113
|
setSessionEnv: (sessionId: string, env: Record<string, string>) => Promise<SessionDetail>
|
|
948
1114
|
shareFile: (sessionId: string, sourcePath: string, linkName?: string, shareFolder?: string) => Promise<{ path: string; target: string; }>
|
|
949
|
-
startReplaySession: (sourceSessionId: string, speed?:
|
|
1115
|
+
startReplaySession: (sourceSessionId: string, speed?: ReplaySpeed) => Promise<{ session_id: string; }>
|
|
950
1116
|
stopBackgroundTask: (sessionId: string, taskId: string) => Promise<BackgroundTaskStopResult>
|
|
951
1117
|
switchBranch: (sessionId: string, checkpointId: string) => Promise<{ id: string; leaf_id: string; }>
|
|
952
1118
|
tokenizeMessages: (messages: Array<Record<string, unknown>>, options?: { model?: string; add_generation_prompt?: boolean; enable_thinking?: boolean | null; tools?: Array<Record<string, unknown>>; }) => Promise<TokenizeResult>
|
|
953
1119
|
tokenizePrompt: (prompt: string, model?: string) => Promise<TokenizeResult>
|
|
954
|
-
updateReplaySession: (sessionId: string, payload: { speed?:
|
|
1120
|
+
updateReplaySession: (sessionId: string, payload: { speed?: ReplaySpeed; status?: "autonomous"; }) => Promise<{ replay_state: SessionInfo["replay_state"]; }>
|
|
955
1121
|
updateSession: (sessionId: string, payload: { intent?: string; }) => Promise<SessionDetail>
|
|
956
1122
|
updateSessionMemory: (sessionId: string, memoryEnabled: boolean) => Promise<{ memory_enabled: boolean; }>
|
|
957
1123
|
updateSharing: (sessionId: string, shared: boolean) => Promise<{ shared: boolean; }>
|
|
@@ -970,9 +1136,11 @@ errorMessage: string | null
|
|
|
970
1136
|
isStreaming: boolean
|
|
971
1137
|
messages: ChatMessage[]
|
|
972
1138
|
mode: "planning" | "executing" | null
|
|
1139
|
+
replay: ReplaySnapshot | null
|
|
973
1140
|
sessionId: string
|
|
974
1141
|
status: "completed" | "failed" | "interrupted" | "running" | "created" | "waiting_for_input" | null
|
|
975
1142
|
turns: TurnProjection[]
|
|
1143
|
+
viewerRole: "owner" | "viewer" | null
|
|
976
1144
|
```
|
|
977
1145
|
|
|
978
1146
|
## `SessionStatus` (type)
|
|
@@ -998,6 +1166,13 @@ files: TextFile[]
|
|
|
998
1166
|
name: string
|
|
999
1167
|
```
|
|
1000
1168
|
|
|
1169
|
+
## `SkillMentionAvailability` (interface)
|
|
1170
|
+
|
|
1171
|
+
```ts
|
|
1172
|
+
installed: boolean | undefined
|
|
1173
|
+
local: boolean | undefined
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1001
1176
|
## `Solution` (interface)
|
|
1002
1177
|
|
|
1003
1178
|
```ts
|
|
@@ -1141,10 +1316,16 @@ result: unknown
|
|
|
1141
1316
|
status: "done" | "error" | "cancelled" | "awaiting_answer" | "pending" | undefined
|
|
1142
1317
|
```
|
|
1143
1318
|
|
|
1319
|
+
## `toReplaySnapshot` (function)
|
|
1320
|
+
|
|
1321
|
+
```ts
|
|
1322
|
+
toReplaySnapshot: (raw: ReplayState | null | undefined) => ReplaySnapshot | null
|
|
1323
|
+
```
|
|
1324
|
+
|
|
1144
1325
|
## `transformSlashCommand` (function)
|
|
1145
1326
|
|
|
1146
1327
|
```ts
|
|
1147
|
-
transformSlashCommand: (skillName: string, rawInput: string) => string
|
|
1328
|
+
transformSlashCommand: (skillName: string, rawInput: string, { local, installed }?: SkillMentionAvailability) => string
|
|
1148
1329
|
```
|
|
1149
1330
|
|
|
1150
1331
|
## `TurnProjection` (interface)
|
|
@@ -1154,6 +1335,7 @@ archived_count: number | null | undefined
|
|
|
1154
1335
|
archived_files: ArchivedFileInfo[] | null | undefined
|
|
1155
1336
|
archived_tool_calls: ArchivedToolCallInfo[] | null | undefined
|
|
1156
1337
|
blocks: ContentBlock[]
|
|
1338
|
+
client_render_id: string | null | undefined
|
|
1157
1339
|
compaction_id: string | null | undefined
|
|
1158
1340
|
context_window: number | undefined
|
|
1159
1341
|
duration_ms: number | undefined
|
|
@@ -1165,6 +1347,7 @@ loop_id: string
|
|
|
1165
1347
|
memory_refs: MemoryRef[] | null | undefined
|
|
1166
1348
|
model: string | null | undefined
|
|
1167
1349
|
parent_fork_tool_call_id: string | null | undefined
|
|
1350
|
+
post_chat_followup: PostChatFollowup | null | undefined
|
|
1168
1351
|
role: "user" | "assistant" | "system"
|
|
1169
1352
|
saved_ratio: number | null | undefined
|
|
1170
1353
|
sequence: number
|