@blade-hq/agent-client 2612.0.0-beta.64 → 2612.0.0-beta.66
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 +9 -0
- package/dist/{chunk-MVTJORKS.js → chunk-TFY4NAL2.js} +15 -4
- package/dist/chunk-TFY4NAL2.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/resources/connectors.d.ts +15 -4
- package/dist/tool-provider.d.ts +5 -0
- package/package.json +1 -1
- package/public-api.md +8 -4
- package/dist/chunk-MVTJORKS.js.map +0 -1
package/README.md
CHANGED
|
@@ -1009,3 +1009,12 @@ BA 桌面使用同源 `/api/auth/sdk/desktop-session` 建立自身 cookie 会话
|
|
|
1009
1009
|
`auth.login()` 仍是普通浏览器的弹窗登录,不负责本机监听。
|
|
1010
1010
|
|
|
1011
1011
|
飞书初始授权的 `permission_template` 标明官方推荐清单来源;`permissions` 可包含尚无 SW 操作的推荐权限。`ConnectorPermission.template/category_name` 用于展示清单,`app_status` 与 `user_status` 分别表示应用开通和本人同意;未知不等于拒绝,也不能据此断言企业免审。授权范围不等于工具实现范围。
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
`client.llm`(`LlmResource`)提供单次 `chat.completions.create` 调用,输入 `ChatCompletionRequest`、返回 `ChatCompletion`;返回的工具调用只作为数据交给调用方处理。
|
|
1015
|
+
|
|
1016
|
+
## 托管连接契约
|
|
1017
|
+
|
|
1018
|
+
`client.connectors` 的连接声明支持 `browser`、`device`、`managed`。`browser` 仍在用户沙盒打开登录页;`managed` 表示由部署绑定的 SW 管理认证,包内 url 为空,不要调用 `startBrowserAuthorization`。通过 `authorize(name, "authorize")` 与 `authorization(name)` 获取 SW 公共连接状态;管理页面在后续交付中消费 `authorization_url`,不会将 PAT 传入页面。
|
|
1019
|
+
|
|
1020
|
+
`push_identity` 是 SW 提供的公开事件身份,`reference_scope` 用于保留查询或文件来源,均不含凭据。飞书继续携带 app_id,邮箱只有 connection_id;不要替旧引用补当前来源,也不要为邮箱虚构应用编号。文件仍用鉴权的 `uploadFile` / `downloadFile`,不能直接请求 SW 或采信任意下载 URL。邮箱当前只交付通道与类型,品牌包、授权页面、共享连接 UI 及 PA 推送随后续任务切换。
|
|
@@ -146,7 +146,7 @@ var ToolProvider = class {
|
|
|
146
146
|
}, 15e3);
|
|
147
147
|
socket.addEventListener("open", () => {
|
|
148
148
|
if (this.socket !== socket) return;
|
|
149
|
-
socket.send(JSON.stringify({ jsonrpc: "2.0", id: "register", method: "provider/register", params: { providerId: this.options.providerId, capability: this.options.capability } }));
|
|
149
|
+
socket.send(JSON.stringify({ jsonrpc: "2.0", id: "register", method: "provider/register", params: { providerId: this.options.providerId, capability: this.options.capability, tools: this.definitions() } }));
|
|
150
150
|
});
|
|
151
151
|
socket.addEventListener("message", (event) => {
|
|
152
152
|
if (this.socket !== socket || typeof event.data !== "string") return;
|
|
@@ -169,6 +169,9 @@ var ToolProvider = class {
|
|
|
169
169
|
if (this.disposed) return;
|
|
170
170
|
this.timer = setTimeout(() => this.open(), Math.min(1e4, 500 * 2 ** Math.min(this.attempts++, 5)));
|
|
171
171
|
}
|
|
172
|
+
definitions() {
|
|
173
|
+
return this.options.tools.map(({ name, description, inputSchema, outputSchema, annotations }) => ({ name, description, inputSchema, ...outputSchema ? { outputSchema } : {}, ...annotations ? { annotations } : {} }));
|
|
174
|
+
}
|
|
172
175
|
async receive(socket, text) {
|
|
173
176
|
const message = JSON.parse(text);
|
|
174
177
|
if (message.jsonrpc !== "2.0") throw new Error("Invalid JSON-RPC envelope");
|
|
@@ -196,7 +199,7 @@ var ToolProvider = class {
|
|
|
196
199
|
let response = { jsonrpc: "2.0", id: message.id };
|
|
197
200
|
try {
|
|
198
201
|
if (message.method === "tools/list") {
|
|
199
|
-
response.result = { tools: this.
|
|
202
|
+
response.result = { tools: this.definitions() };
|
|
200
203
|
} else if (message.method === "tools/call") {
|
|
201
204
|
const params = message.params;
|
|
202
205
|
const tool = this.options.tools.find((t) => t.name === params?.name);
|
|
@@ -224,7 +227,7 @@ var ToolProvider = class {
|
|
|
224
227
|
|
|
225
228
|
// src/version.ts
|
|
226
229
|
var SDK_NAME = "agent-client";
|
|
227
|
-
var SDK_VERSION = true ? "2612.0.0-beta.
|
|
230
|
+
var SDK_VERSION = true ? "2612.0.0-beta.66" : "1.1.1";
|
|
228
231
|
|
|
229
232
|
// src/auth-login.ts
|
|
230
233
|
function isAuthCallbackMessage(value) {
|
|
@@ -1502,6 +1505,11 @@ var ClientProjectionBuilder = class {
|
|
|
1502
1505
|
/** A durable snapshot supersedes only this turn's temporary overlay. */
|
|
1503
1506
|
acceptDurableTurn(turn) {
|
|
1504
1507
|
this.seedSequence(turn.sequence);
|
|
1508
|
+
if (turn.kind === "compaction") {
|
|
1509
|
+
this.turnsById.set(turn.turn_id, turn);
|
|
1510
|
+
if (turn.status !== "streaming") this.activeCompactions.delete(turn.compaction_id ?? "");
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1505
1513
|
if (!isConversationTurn(turn)) return;
|
|
1506
1514
|
const active = this.activeTurns.get(turn.loop_id);
|
|
1507
1515
|
if (active?.turnId === turn.turn_id) this.activeTurns.delete(turn.loop_id);
|
|
@@ -1522,6 +1530,7 @@ var ClientProjectionBuilder = class {
|
|
|
1522
1530
|
const turnsById = /* @__PURE__ */ new Map();
|
|
1523
1531
|
for (const turn of turns) {
|
|
1524
1532
|
this.seedSequence(turn.sequence);
|
|
1533
|
+
if (turn.kind === "compaction") turnsById.set(turn.turn_id, turn);
|
|
1525
1534
|
if (!isConversationTurn(turn)) continue;
|
|
1526
1535
|
turnsById.set(turn.turn_id, turn);
|
|
1527
1536
|
const current = latestTurns.get(turn.loop_id);
|
|
@@ -2137,6 +2146,8 @@ var ClientProjectionBuilder = class {
|
|
|
2137
2146
|
onCompaction(eventType, loopId, payload) {
|
|
2138
2147
|
const compactionId = String(payload.compaction_id ?? "");
|
|
2139
2148
|
if (!compactionId) return null;
|
|
2149
|
+
const previous = this.turnsById.get(`compaction:${compactionId}`);
|
|
2150
|
+
if (eventType === "compaction:start" && previous && previous.status !== "streaming") return null;
|
|
2140
2151
|
let current = {
|
|
2141
2152
|
...this.activeCompactions.get(compactionId) ?? {},
|
|
2142
2153
|
...payload,
|
|
@@ -9348,4 +9359,4 @@ export {
|
|
|
9348
9359
|
parseAskUserQuestion,
|
|
9349
9360
|
formatAskUserAnswer
|
|
9350
9361
|
};
|
|
9351
|
-
//# sourceMappingURL=chunk-
|
|
9362
|
+
//# sourceMappingURL=chunk-TFY4NAL2.js.map
|