@blade-hq/agent-client 2610.0.0-beta.44 → 2610.0.0-beta.46

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 CHANGED
@@ -171,6 +171,9 @@ const page = await client.sessions.getSessionTurnsPage(id) // 聊天首屏 recen
171
171
  await client.sessions.getSessionTurnsPage(id, { before: page.nextBefore! })
172
172
  ```
173
173
 
174
+ 会话插件可通过 `client.sessions.listSessionPlugins(id)` 查询,并用
175
+ `client.sessions.setSessionPluginActivation(id, name, active)` 切换当前会话;返回项类型为公开的 `SessionPlugin`。
176
+
174
177
  ### 会话回放(演示 / 彩排)
175
178
 
176
179
  拿一个已经聊完的会话当素材,重现当时的回复和工具调用,**完全不调用模型**。
@@ -604,6 +607,7 @@ transformSlashCommand(skillId, prompt, { local: false, installed: false })
604
607
  - **SDK 身份**:`SDK_NAME`、`SDK_VERSION`
605
608
  - **声明式会话**:`SessionDefinition`、`SolutionDefinition`、`SkillDefinition`、`SessionConfig`、`TextFile`、`SessionSetupError`、`SessionSetupStage`
606
609
  - **模型目录**:`ModelsResource`、`ModelCatalog`、`ModelOption`
610
+ - **聊天项目资源(REST)**:`ChatProjectsResource`、`ChatProject`
607
611
  - **会话资源(REST)**:`SessionsResource`、`CreateSessionRequest`、`ImportSessionOptions`、`AppCliDefinition`、`AppCliAttachment`、`AttachAppOptions`、`PaginatedSessionsResult`、`GlobalSearchResult`、`GlobalSearchResultItem`、`GlobalSearchConversationResult`、`GlobalSearchFileResult`、`SessionHistory`、`SessionContextStats`、`ResultFeedback`、`ResultFeedbackReason`、`ShareLinkResult`、`FileEntry`、`UploadFileEntry`、`UploadFilesOptions`、`SessionProfile`、`SessionDetail`、`SessionInfo`、`SessionStatus`、`SessionPortMapping`、`ModeId`、`TemplateId`、`PrimarySkillSnapshot`、`PrimarySkillParallelMode`
608
612
  - **会话回放**:`ReplayState`、`ReplaySpeed`、`ReplayPreview`、`ReplaySnapshot`、`toReplaySnapshot`、`DEFAULT_REPLAY_SPEED`
609
613
  - **会话状态机**:`SessionHub`、`SessionConnectOptions`、`SessionState`、`SendOptions`、`ConnectionStatus`、`AskUserAnswerData`、`AgentLoopInfo`、`ActiveCompactionState`、`createInitialSessionState`、`AgentSessionEventName`
@@ -5,6 +5,7 @@ import { HeadlessResource } from "./resources/headless";
5
5
  import { ComputersResource } from "./resources/computers";
6
6
  import { ModelsResource } from "./resources/models";
7
7
  import { SessionsResource } from "./resources/sessions";
8
+ import { ChatProjectsResource } from "./resources/chat-projects";
8
9
  import { SessionHub } from "./session/hub";
9
10
  import { type TypedSocket } from "./socket";
10
11
  export interface BladeClientOptions {
@@ -37,6 +38,7 @@ export declare class BladeClient {
37
38
  readonly computers: ComputersResource;
38
39
  readonly models: ModelsResource;
39
40
  readonly sessions: SessionsResource;
41
+ readonly chatProjects: ChatProjectsResource;
40
42
  /** 实时会话中枢:client.sessions.connect() 内部使用,一般不直接访问。 */
41
43
  readonly hub: SessionHub;
42
44
  constructor(options: BladeClientOptions);
package/dist/index.d.ts CHANGED
@@ -27,6 +27,9 @@ export type { ComputerOS, ComputerState, SessionComputer, SessionComputerList, }
27
27
  export { ModelsResource } from "./resources/models";
28
28
  export type { ModelCatalog, ModelOption } from "./resources/models";
29
29
  export type { SessionsResource } from "./resources/sessions";
30
+ export type { SessionPlugin } from "./resources/sessions";
31
+ export { ChatProjectsResource } from "./resources/chat-projects";
32
+ export type { ChatProject } from "./resources/chat-projects";
30
33
  export { hasChatRunEvent } from "./shared/projection";
31
34
  export type { CreateSessionRequest, AppCliAttachment, AppCliDefinition, FileEntry, ImportSessionOptions, PaginatedSessionsResult, GlobalSearchConversationResult, GlobalSearchFileResult, GlobalSearchResult, GlobalSearchResultItem, ResultFeedback, ResultFeedbackReason, HistoricalCommand, SessionContextStats, SessionHistory, SessionTurnsPage, ShareLinkResult, UploadFileEntry, UploadFilesOptions, } from "./resources/sessions";
32
35
  export type { ArchivedFileInfo, ArchivedToolCallInfo, ChatMessage, CompactionInfo, FileContentPart, ImageUrlContentPart, MemoryRefInfo, MessageContent, MessageContentPart, TextContentPart, ToolBridgeContent, ToolCallInfo, } from "./schemas/message";
package/dist/index.js CHANGED
@@ -538,6 +538,7 @@ var SessionInfo = type({
538
538
  "workspace_path?": "string | null",
539
539
  "ba_version?": "string | null",
540
540
  "sandbox_version?": "string | null",
541
+ "chat_project_id?": "string | null",
541
542
  "match?": "unknown"
542
543
  });
543
544
 
@@ -2510,7 +2511,8 @@ function toCreateSessionPayload(request) {
2510
2511
  compaction_ratio: request.compaction_ratio ?? null,
2511
2512
  ...request.runtime_type ? { runtime_type: request.runtime_type } : {},
2512
2513
  ...request.daemon_id ? { daemon_id: request.daemon_id } : {},
2513
- ...request.agent_runtime_id ? { agent_runtime_id: request.agent_runtime_id } : {}
2514
+ ...request.agent_runtime_id ? { agent_runtime_id: request.agent_runtime_id } : {},
2515
+ ...request.chat_project_id ? { chat_project_id: request.chat_project_id } : {}
2514
2516
  };
2515
2517
  }
2516
2518
  var builtinSolutionIds = /* @__PURE__ */ new Set([
@@ -2545,6 +2547,12 @@ var SessionsResource = class {
2545
2547
  connect(sessionId) {
2546
2548
  return this.client.hub.connect(sessionId);
2547
2549
  }
2550
+ listSessionPlugins(sessionId, init) {
2551
+ return this.client.jsonFromInit(`/api/sessions/${encodeURIComponent(sessionId)}/plugins`, init);
2552
+ }
2553
+ setSessionPluginActivation(sessionId, name, active, init) {
2554
+ return this.client.jsonFromInit(`/api/sessions/${encodeURIComponent(sessionId)}/plugins/${encodeURIComponent(name)}:activation`, { method: "POST", body: JSON.stringify({ active }), ...init });
2555
+ }
2548
2556
  /** 创建新会话并直接连接,返回可收发消息的 AgentSession。 */
2549
2557
  async create(request = {}) {
2550
2558
  if (isSessionDefinition(request)) {
@@ -2641,7 +2649,8 @@ var SessionsResource = class {
2641
2649
  template_id_prefix,
2642
2650
  solution_id,
2643
2651
  solution_registry_id,
2644
- q
2652
+ q,
2653
+ chat_project_id
2645
2654
  }) {
2646
2655
  const searchParams = new URLSearchParams();
2647
2656
  searchParams.set("limit", String(limit));
@@ -2654,6 +2663,7 @@ var SessionsResource = class {
2654
2663
  }
2655
2664
  const trimmedQuery = q?.trim();
2656
2665
  if (trimmedQuery) searchParams.set("q", trimmedQuery);
2666
+ if (chat_project_id) searchParams.set("chat_project_id", chat_project_id);
2657
2667
  return this.client.json("GET", `/api/sessions?${searchParams.toString()}`);
2658
2668
  }
2659
2669
  async listSessions(template_id_prefix, solution_id) {
@@ -3028,6 +3038,23 @@ function profileToCreateSessionRequest(profile) {
3028
3038
  };
3029
3039
  }
3030
3040
 
3041
+ // src/resources/chat-projects.ts
3042
+ var ChatProjectsResource = class {
3043
+ constructor(client) {
3044
+ this.client = client;
3045
+ }
3046
+ client;
3047
+ list() {
3048
+ return this.client.json("GET", "/api/chat-projects");
3049
+ }
3050
+ create(payload) {
3051
+ return this.client.json("POST", "/api/chat-projects", payload);
3052
+ }
3053
+ update(projectId, payload) {
3054
+ return this.client.json("PATCH", `/api/chat-projects/${encodeURIComponent(projectId)}`, payload);
3055
+ }
3056
+ };
3057
+
3031
3058
  // src/commands/registry.ts
3032
3059
  var BUFFER_LIMIT_PER_ACTION = 20;
3033
3060
  var CommandRegistry = class {
@@ -5449,6 +5476,7 @@ var BladeClient = class {
5449
5476
  computers;
5450
5477
  models;
5451
5478
  sessions;
5479
+ chatProjects;
5452
5480
  /** 实时会话中枢:client.sessions.connect() 内部使用,一般不直接访问。 */
5453
5481
  hub;
5454
5482
  constructor(options) {
@@ -5461,6 +5489,7 @@ var BladeClient = class {
5461
5489
  this.computers = new ComputersResource(this);
5462
5490
  this.models = new ModelsResource(this);
5463
5491
  this.sessions = new SessionsResource(this);
5492
+ this.chatProjects = new ChatProjectsResource(this);
5464
5493
  this.hub = new SessionHub(this);
5465
5494
  if (this.options.token === void 0) {
5466
5495
  this.runtimeToken = readStoredToken(this.options.baseUrl);
@@ -5895,7 +5924,7 @@ function resolveServiceUrl(endpoints, name, path = "") {
5895
5924
 
5896
5925
  // src/version.ts
5897
5926
  var SDK_NAME = "agent-client";
5898
- var SDK_VERSION = true ? "2610.0.0-beta.44" : "1.1.1";
5927
+ var SDK_VERSION = true ? "2610.0.0-beta.46" : "1.1.1";
5899
5928
 
5900
5929
  // src/commands/protocol.ts
5901
5930
  function isCommandEnvelope(value) {
@@ -5999,6 +6028,7 @@ export {
5999
6028
  AgentSession,
6000
6029
  BladeApiError,
6001
6030
  BladeClient,
6031
+ ChatProjectsResource,
6002
6032
  ClientProjectionBuilder,
6003
6033
  ComputersResource,
6004
6034
  DEFAULT_REPLAY_SPEED,