@blade-hq/agent-client 2612.0.0-beta.41 → 2612.0.0-beta.44
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 +4 -2
- package/dist/{chunk-X4LEN2SS.js → chunk-WSXAKVX6.js} +19 -4
- package/dist/chunk-WSXAKVX6.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/session/agent-session.d.ts +5 -1
- package/dist/types/socket-events.d.ts +25 -0
- package/package.json +1 -1
- package/public-api.md +2 -0
- package/dist/chunk-X4LEN2SS.js.map +0 -1
package/README.md
CHANGED
|
@@ -739,6 +739,8 @@ chat.renderers = {
|
|
|
739
739
|
|
|
740
740
|
## 附录:公开类型索引
|
|
741
741
|
|
|
742
|
+
已有会话可调用 `await session.selectModel("模型标识")` 立即切换模型,无须额外发送消息。父子任务后续模型调用沿用会话当前选择;正在调用的旧模型会取消,正在执行的业务工具保留。返回 `false` 表示选择失败,并通过会话的错误事件反馈原因。因模型调用失败停止的任务会接续执行;主动停止或等待用户回答的任务保持原状态。
|
|
743
|
+
|
|
742
744
|
完整签名见 [public-api.md](./public-api.md)(由 `scripts/public-api-report.mjs` 生成并在 CI 校验)。
|
|
743
745
|
|
|
744
746
|
- **客户端与登录**:`BladeClient`、`BladeClientOptions`、`UploadProgress`、`BladeApiError`、`LoginOptions`、`LoginResult`、`TokenStorageMode`、`AuthResource`、`ExchangeCodeParams`、`ExchangeCodeResult`、`ProvidersResponse`、`UserInfo`
|
|
@@ -841,7 +843,7 @@ const delivery = await session.getDelivery(request.requestId)
|
|
|
841
843
|
|
|
842
844
|
同一保存请求可重试,BA 不重复入队;同 ID 改变正文或参数会拒绝。接收结果 `accepted` 表示输入已持久化,不表示任务完成。`unknown` 表示无法确认,`not_found` 是查询未找到;不得因此生成新 ID。查询可返回队列项、队列状态和执行 ID;记录保留至会话删除。
|
|
843
845
|
|
|
844
|
-
|
|
846
|
+
此接口复用后端持久化投递:空闲时自动开始,默认在运行中等待,暂停时保留。设置 `queueWhenRunning: false` 时补充当前运行,PA 使用此模式。可靠请求不能编辑,但可以立即补充、取消、重排和继续。支持普通文本、模式、模型、思考与推理强度;AskUser 作答、多模态、whatif 和 replay 继续使用 `send()`。需要支持 `prepared_options` 及 `chat:queue:request` 的 BA;旧服务的普通队列确认不算可靠请求回执。
|
|
845
847
|
|
|
846
848
|
公开类型:`PreparedSend` 是可持久化的请求快照,`PreparedSendOptions` 是普通输入的执行参数,`DeliveryReceipt` 是接受或查询结果。
|
|
847
849
|
|
|
@@ -867,7 +869,7 @@ await persist(request)
|
|
|
867
869
|
await session.sendPrepared(request)
|
|
868
870
|
```
|
|
869
871
|
|
|
870
|
-
每条消息最多 20 份资料,ID 不重复,每份正文最多 64000 个 Unicode 字符,整个资料 JSON 最多 256 KiB,超限拒绝。文件沿用指定会话的鉴权与路径解析,不接受外部 URL;仅有 `name`
|
|
872
|
+
每条消息最多 20 份资料,ID 不重复,每份正文最多 64000 个 Unicode 字符,整个资料 JSON 最多 256 KiB,超限拒绝。文件沿用指定会话的鉴权与路径解析,不接受外部 URL;仅有 `name` 的文件显示不可用。带资料的可靠消息支持 `queueWhenRunning: false` 或「立即补充」;正文和资料一起交给当前运行,资料仍通过标准 Context 注入。原生智能体目前不支持此通道。
|
|
871
873
|
|
|
872
874
|
## 连接器管理
|
|
873
875
|
|
|
@@ -224,7 +224,7 @@ var ToolProvider = class {
|
|
|
224
224
|
|
|
225
225
|
// src/version.ts
|
|
226
226
|
var SDK_NAME = "agent-client";
|
|
227
|
-
var SDK_VERSION = true ? "2612.0.0-beta.
|
|
227
|
+
var SDK_VERSION = true ? "2612.0.0-beta.44" : "1.1.1";
|
|
228
228
|
|
|
229
229
|
// src/auth-login.ts
|
|
230
230
|
function isAuthCallbackMessage(value) {
|
|
@@ -6010,17 +6010,31 @@ var AgentSession = class _AgentSession {
|
|
|
6010
6010
|
this.getAppContext = options.getContext;
|
|
6011
6011
|
return attachment;
|
|
6012
6012
|
}
|
|
6013
|
+
/** 立即为整个会话切换模型,并接续因模型故障停下的任务。 */
|
|
6014
|
+
async selectModel(model) {
|
|
6015
|
+
try {
|
|
6016
|
+
await this.ensureJoined();
|
|
6017
|
+
const response = await this.runtime.emitWithAck("chat:model", { session_id: this.sessionId, model }, 3e4);
|
|
6018
|
+
if (response?.status !== "ok") throw new Error(typeof response?.message === "string" ? response.message : "\u6A21\u578B\u5207\u6362\u5931\u8D25");
|
|
6019
|
+
return true;
|
|
6020
|
+
} catch (error) {
|
|
6021
|
+
const failure = describeSessionError(error, "\u6A21\u578B\u5207\u6362\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
|
|
6022
|
+
this.update((state) => addErrorMessage(state, failure.message));
|
|
6023
|
+
this.emitter.emit("error", { message: failure.message });
|
|
6024
|
+
return false;
|
|
6025
|
+
}
|
|
6026
|
+
}
|
|
6013
6027
|
/** Prepare a durable text input without sending any network request. */
|
|
6014
6028
|
prepareSend(content, options = {}) {
|
|
6015
6029
|
if (!content.trim()) throw new Error("\u6D88\u606F\u4E0D\u80FD\u4E3A\u7A7A");
|
|
6016
|
-
if (Object.keys(options).some((key) => !["mode", "model", "thinkingOverride", "reasoningLevel", "contextAttachments"].includes(key))) {
|
|
6030
|
+
if (Object.keys(options).some((key) => !["mode", "model", "thinkingOverride", "reasoningLevel", "contextAttachments", "queueWhenRunning"].includes(key))) {
|
|
6017
6031
|
throw new Error("\u53EF\u9760\u6587\u672C\u53D1\u9001\u4E0D\u652F\u6301\u8FD9\u4E9B\u53C2\u6570\uFF0C\u8BF7\u4F7F\u7528 send()");
|
|
6018
6032
|
}
|
|
6019
6033
|
const snapshot2 = JSON.parse(JSON.stringify(options));
|
|
6020
6034
|
if (snapshot2.contextAttachments) snapshot2.contextAttachments = snapshotContextAttachments(snapshot2.contextAttachments);
|
|
6021
6035
|
return { sessionId: this.sessionId, requestId: createClientRequestId(), content, options: snapshot2 };
|
|
6022
6036
|
}
|
|
6023
|
-
/** Durably
|
|
6037
|
+
/** Durably send a text input with its saved delivery intent. Retries must reuse the saved request. */
|
|
6024
6038
|
async sendPrepared(request) {
|
|
6025
6039
|
if (request.sessionId !== this.sessionId) throw new Error("\u53D1\u9001\u8BF7\u6C42\u4E0D\u5C5E\u4E8E\u5F53\u524D\u4F1A\u8BDD");
|
|
6026
6040
|
try {
|
|
@@ -6032,6 +6046,7 @@ var AgentSession = class _AgentSession {
|
|
|
6032
6046
|
prepared_options: {
|
|
6033
6047
|
mode: request.options.mode,
|
|
6034
6048
|
model: request.options.model,
|
|
6049
|
+
...request.options.queueWhenRunning !== void 0 ? { queue_when_running: request.options.queueWhenRunning } : {},
|
|
6035
6050
|
thinking_override: request.options.thinkingOverride,
|
|
6036
6051
|
reasoning_level: request.options.reasoningLevel,
|
|
6037
6052
|
...request.options.contextAttachments ? { context_attachments: request.options.contextAttachments } : {}
|
|
@@ -9117,4 +9132,4 @@ export {
|
|
|
9117
9132
|
BladeClient,
|
|
9118
9133
|
BladeApplicationClient
|
|
9119
9134
|
};
|
|
9120
|
-
//# sourceMappingURL=chunk-
|
|
9135
|
+
//# sourceMappingURL=chunk-WSXAKVX6.js.map
|