@tencent-ai/cloud-agent-sdk 0.3.3-next.f14a061.20260520 → 0.3.6

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/dist/index.cjs CHANGED
@@ -2244,6 +2244,18 @@ var AcpClient = class {
2244
2244
  await this._client.cancel(sessionId);
2245
2245
  }
2246
2246
  /**
2247
+ * 设置 session 使用的模型。
2248
+ *
2249
+ * @experimental 对应 ACP 协议的 `unstable_setSessionModel`,API 尚未稳定。
2250
+ */
2251
+ async setSessionModel(sessionId, modelId) {
2252
+ if (!this._client) throw new AcpProtocolError("Not connected");
2253
+ return this._client.setSessionModel({
2254
+ sessionId,
2255
+ modelId
2256
+ });
2257
+ }
2258
+ /**
2247
2259
  * 订阅指定 sessionId 的上游 notifications。
2248
2260
  *
2249
2261
  * Listener 收到的是上游 `SessionNotification` 原样(`{ sessionId, update, _meta? }`)。
@@ -2525,6 +2537,26 @@ var Session = class {
2525
2537
  loggerFor(this._runtime._connectionOpts).warn(`[session ${this.id}] cancel failed: ${err.message}`);
2526
2538
  }
2527
2539
  }
2540
+ /**
2541
+ * 设置 session 使用的模型。
2542
+ *
2543
+ * 必须在 `connect()` 之后调用。
2544
+ *
2545
+ * @param modelId 目标模型 ID,例如 `"gpt-4o"` / `"claude-3-7-sonnet"`
2546
+ *
2547
+ * @experimental 对应 ACP 协议的 `unstable_setSessionModel`,API 尚未稳定。
2548
+ *
2549
+ * @example
2550
+ * ```ts
2551
+ * await session.connect();
2552
+ * await session.setModel('claude-3-7-sonnet');
2553
+ * const r = await session.prompt('hello');
2554
+ * ```
2555
+ */
2556
+ async setModel(modelId) {
2557
+ if (!this._acpClient || this._acpClient.state !== "OPEN") throw new ValidationError("Session not connected. Call connect() first.");
2558
+ await this._acpClient.setSessionModel(this.id, modelId);
2559
+ }
2528
2560
  };
2529
2561
  /**
2530
2562
  * 合并两个 AbortSignal:任一 abort 时返回的 signal 也 abort。