@blade-hq/agent-client 2610.0.0-beta.57 → 2610.0.0-beta.59
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.js +30 -4
- package/dist/index.js.map +1 -1
- package/dist/session/agent-session.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4698,13 +4698,39 @@ var AgentSession = class _AgentSession {
|
|
|
4698
4698
|
/**
|
|
4699
4699
|
* 重排等待消息。`orderedIds` 必须是当前 pending 条目 id 的**完整集合**(顺序任意),
|
|
4700
4700
|
* 服务端按 `expectedRevision` 校验后整体替换顺序。
|
|
4701
|
+
*
|
|
4702
|
+
* 拖动排序就该像本地操作一样落地:版本冲突(运行中的任务刚领走一条 / 另一个端也在
|
|
4703
|
+
* 动队列)不甩给用户「刷新后重试」,而是拿冲突响应里那份**最新快照**重算一次再提交
|
|
4704
|
+
* ——掉队的条目(已经被领取执行的)从顺序里剔除,剩下的保持用户拖出来的相对次序。
|
|
4705
|
+
* 最多补两次;仍旧冲突才把结果交回调用方。
|
|
4701
4706
|
*/
|
|
4702
4707
|
async reorderQueuedMessages(expectedRevision, orderedIds) {
|
|
4703
|
-
|
|
4708
|
+
let revision = expectedRevision;
|
|
4709
|
+
let ids = orderedIds;
|
|
4710
|
+
let result = await this.runQueueCommand("chat:queue:reorder", {
|
|
4704
4711
|
session_id: this.sessionId,
|
|
4705
|
-
expected_revision:
|
|
4706
|
-
ordered_ids:
|
|
4712
|
+
expected_revision: revision,
|
|
4713
|
+
ordered_ids: ids
|
|
4707
4714
|
});
|
|
4715
|
+
for (let attempt = 0; attempt < 2 && !result.ok && result.conflict; attempt++) {
|
|
4716
|
+
const snapshot2 = result.snapshot;
|
|
4717
|
+
if (!snapshot2) break;
|
|
4718
|
+
const pending = snapshot2.items.filter(canEditQueuedMessage);
|
|
4719
|
+
const live = new Set(pending.map((item) => item.id));
|
|
4720
|
+
const next = ids.filter((id) => live.has(id));
|
|
4721
|
+
for (const item of pending) if (!next.includes(item.id)) next.push(item.id);
|
|
4722
|
+
if (next.length === 0) {
|
|
4723
|
+
return { ok: true, conflict: false, snapshot: snapshot2, message: null };
|
|
4724
|
+
}
|
|
4725
|
+
revision = snapshot2.revision;
|
|
4726
|
+
ids = next;
|
|
4727
|
+
result = await this.runQueueCommand("chat:queue:reorder", {
|
|
4728
|
+
session_id: this.sessionId,
|
|
4729
|
+
expected_revision: revision,
|
|
4730
|
+
ordered_ids: ids
|
|
4731
|
+
});
|
|
4732
|
+
}
|
|
4733
|
+
return result;
|
|
4708
4734
|
}
|
|
4709
4735
|
/** 删除一条等待消息;不传版本时由服务端自行判定。 */
|
|
4710
4736
|
async cancelQueuedMessage(itemId, expectedVersion) {
|
|
@@ -6588,7 +6614,7 @@ function resolveServiceUrl(endpoints, name, path = "") {
|
|
|
6588
6614
|
|
|
6589
6615
|
// src/version.ts
|
|
6590
6616
|
var SDK_NAME = "agent-client";
|
|
6591
|
-
var SDK_VERSION = true ? "2610.0.0-beta.
|
|
6617
|
+
var SDK_VERSION = true ? "2610.0.0-beta.59" : "1.1.1";
|
|
6592
6618
|
|
|
6593
6619
|
// src/commands/protocol.ts
|
|
6594
6620
|
function isCommandEnvelope(value) {
|