@blade-hq/agent-client 1.2.1-alpha.2 → 1.2.1-alpha.4

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.
@@ -1,6 +1,6 @@
1
1
  import type { BackgroundTask } from "../schemas/background";
2
2
  import type { TurnProjection } from "../schemas/projection";
3
- import type { SessionDetail, SessionInfo, TemplateId } from "../schemas/session";
3
+ import type { PublishedSolutionRef, SessionDetail, SessionInfo, TemplateId } from "../schemas/session";
4
4
  import type { Task } from "../schemas/task";
5
5
  import type { BladeClient, UploadProgress } from "../blade-client";
6
6
  import type { AgentSession } from "../session/agent-session";
@@ -9,7 +9,12 @@ import type { SessionProfile } from "../types/sdk-profile";
9
9
  export interface CreateSessionRequest {
10
10
  intent?: string;
11
11
  template_id?: TemplateId;
12
+ /** 正式 Solution 来源。Hub 使用 { source: "hub", org, name }。 */
13
+ solution_ref?: PublishedSolutionRef;
14
+ /** @deprecated 请使用结构化的 solution_ref;继续支持以保证现有 SDK 调用无感升级。 */
12
15
  solution_id?: string;
16
+ /** 从已有会话复制其不可变 Solution 与 Skill 运行快照。 */
17
+ solution_snapshot_session_id?: string;
13
18
  biz_role_id?: string | null;
14
19
  primary_skill_id?: string | null;
15
20
  model?: string | null;
@@ -150,6 +155,12 @@ export interface ImportPreview {
150
155
  skills: ImportPreviewSkill[];
151
156
  scenario: ImportPreviewScenario | null;
152
157
  }
158
+ export interface ImportSessionOptions {
159
+ /** 导入后改用这个正式 Solution 的最新版。 */
160
+ solution_ref?: PublishedSolutionRef;
161
+ /** 导入后改用已有会话的完整运行快照。 */
162
+ solution_snapshot_session_id?: string;
163
+ }
153
164
  export declare class SessionsResource {
154
165
  private client;
155
166
  constructor(client: BladeClient);
@@ -170,6 +181,7 @@ export declare class SessionsResource {
170
181
  offset: number;
171
182
  template_id_prefix?: string;
172
183
  solution_id?: string;
184
+ solution_registry_id?: string;
173
185
  q?: string;
174
186
  }): Promise<PaginatedSessionsResult>;
175
187
  listSessionsWithSkillData(): Promise<SkillDevSession[]>;
@@ -285,7 +297,7 @@ export declare class SessionsResource {
285
297
  getDownloadDirUrl(sessionId: string, dirPath: string): string;
286
298
  exportSession(sessionId: string): Promise<void>;
287
299
  previewImport(file: File): Promise<ImportPreview>;
288
- importSession(file: File, name?: string, solutionId?: string | null): Promise<{
300
+ importSession(file: File, name?: string, solutionOverride?: string | null | ImportSessionOptions): Promise<{
289
301
  session_id: string;
290
302
  }>;
291
303
  }
@@ -4,6 +4,14 @@ export type SessionStatus = typeof SessionStatus.infer;
4
4
  export type TemplateId = "default" | "skill_editor" | "ship_attack";
5
5
  export type SkillEditorTemplateId = "skill_editor";
6
6
  export type ModeId = "planning" | "executing";
7
+ export type PublishedSolutionRef = {
8
+ source: "builtin";
9
+ name: string;
10
+ } | {
11
+ source: "hub";
12
+ org: string;
13
+ name: string;
14
+ };
7
15
  export interface ReplayState {
8
16
  source_session_id?: string;
9
17
  status?: "replay" | "autonomous";
@@ -43,6 +51,7 @@ export declare const SessionInfo: import("arktype/internal/variants/object.ts").
43
51
  model?: string | null | undefined;
44
52
  enable_thinking?: boolean | null | undefined;
45
53
  solution_id?: string | null | undefined;
54
+ solution_ref?: unknown;
46
55
  biz_role_id?: string | null | undefined;
47
56
  solution?: unknown;
48
57
  plan_summary?: string | null | undefined;
@@ -69,6 +78,7 @@ export type SessionInfo = Omit<typeof SessionInfo.infer, "template_id" | "soluti
69
78
  model?: string | null;
70
79
  enable_thinking?: boolean | null;
71
80
  solution_id?: string | null;
81
+ solution_ref?: PublishedSolutionRef | null;
72
82
  biz_role_id?: string | null;
73
83
  solution?: Solution | null;
74
84
  primary_skill_id?: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blade-hq/agent-client",
3
- "version": "1.2.1-alpha.2",
3
+ "version": "1.2.1-alpha.4",
4
4
  "description": "Blade Agent 框架无关客户端:会话实时状态机、REST 通道、弹窗登录、页面协作。浏览器与 Node.js 通用。",
5
5
  "repository": {
6
6
  "type": "git",
package/public-api.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > 本文件由 `scripts/public-api-report.mjs` 生成,请勿手改。
4
4
  > 公共面变更时重新生成本报告,并同步更新 README 对应章节——CI 会校验两者。
5
5
 
6
- 共 114 个公开声明。
6
+ 共 116 个公开声明。
7
7
 
8
8
  ## `ActiveCompactionState` (interface)
9
9
 
@@ -349,6 +349,8 @@ primary_skill_id: string | null | undefined
349
349
  runtime_type: "sandbox" | "daemon" | null | undefined
350
350
  session_solution_asset_id: string | null | undefined
351
351
  solution_id: string | undefined
352
+ solution_ref: PublishedSolutionRef | undefined
353
+ solution_snapshot_session_id: string | undefined
352
354
  template_id: TemplateId | undefined
353
355
  ```
354
356
 
@@ -454,6 +456,13 @@ image_url: { url: string; }
454
456
  type: "image_url"
455
457
  ```
456
458
 
459
+ ## `ImportSessionOptions` (interface)
460
+
461
+ ```ts
462
+ solution_ref: PublishedSolutionRef | undefined
463
+ solution_snapshot_session_id: string | undefined
464
+ ```
465
+
457
466
  ## `InboundAction` (type)
458
467
 
459
468
  ```ts
@@ -657,6 +666,14 @@ password_enabled: boolean
657
666
  providers: { name: string; authorize_url: string; }[]
658
667
  ```
659
668
 
669
+ ## `PublishedSolutionRef` (type)
670
+
671
+ ```ts
672
+ export type PublishedSolutionRef =
673
+ | { source: "builtin"; name: string }
674
+ | { source: "hub"; org: string; name: string }
675
+ ```
676
+
660
677
  ## `RawEvent` (interface)
661
678
 
662
679
  ```ts
@@ -775,6 +792,7 @@ runtime_type: string | null | undefined
775
792
  shared: boolean | undefined
776
793
  solution: Solution | null | undefined
777
794
  solution_id: string | null | undefined
795
+ solution_ref: PublishedSolutionRef | null | undefined
778
796
  status: "completed" | "failed" | "interrupted" | "running" | "created" | "waiting_for_input"
779
797
  template_id: TemplateId | null | undefined
780
798
  updated_at: string
@@ -823,6 +841,7 @@ SessionInfo = type({
823
841
  "model?": "string | null",
824
842
  "enable_thinking?": "boolean | null",
825
843
  "solution_id?": "string | null",
844
+ "solution_ref?": "unknown",
826
845
  "biz_role_id?": "string | null",
827
846
  "solution?": "unknown",
828
847
  "plan_summary?": "string | null",
@@ -905,11 +924,11 @@ getSessionHistory: (sessionId: string, init?: RequestInit) => Promise<SessionHis
905
924
  getSessionTasks: (sessionId: string) => Promise<Task[]>
906
925
  getSessionTurns: (sessionId: string) => Promise<TurnProjection[]>
907
926
  getSharedSession: (token: string) => Promise<TurnProjection[]>
908
- importSession: (file: File, name?: string, solutionId?: string | null) => Promise<{ session_id: string; }>
927
+ importSession: (file: File, name?: string, solutionOverride?: string | null | ImportSessionOptions) => Promise<{ session_id: string; }>
909
928
  listBackgroundTasks: (sessionId: string, init?: RequestInit) => Promise<BackgroundTask[]>
910
929
  listDir: (sessionId: string, dirPath: string) => Promise<FileEntry[]>
911
930
  listSessions: (template_id_prefix?: string, solution_id?: string) => Promise<SessionInfo[]>
912
- listSessionsPaginated: (params: { limit: number; offset: number; template_id_prefix?: string; solution_id?: string; q?: string; }) => Promise<PaginatedSessionsResult>
931
+ listSessionsPaginated: (params: { limit: number; offset: number; template_id_prefix?: string; solution_id?: string; solution_registry_id?: string; q?: string; }) => Promise<PaginatedSessionsResult>
913
932
  listSessionsWithSkillData: () => Promise<SkillDevSession[]>
914
933
  pinSession: (sessionId: string, pinned: boolean) => Promise<SessionInfo>
915
934
  previewImport: (file: File) => Promise<ImportPreview>