@blade-hq/agent-client 1.1.7 → 1.1.9
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 +11 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/projection/builder.d.ts +1 -0
- package/dist/shared/projection/state.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/index.d.ts +0 -8
- package/dist/types/rest.d.ts +0 -17462
package/dist/index.js
CHANGED
|
@@ -858,6 +858,7 @@ function createTurnState(turnId, loopId, opts = {}) {
|
|
|
858
858
|
blocks: [],
|
|
859
859
|
toolCalls: [],
|
|
860
860
|
usage: null,
|
|
861
|
+
responseDone: false,
|
|
861
862
|
memoryRefs: opts.memoryRefs ?? null,
|
|
862
863
|
parentForkToolCallId: null
|
|
863
864
|
};
|
|
@@ -1218,6 +1219,7 @@ var ClientProjectionBuilder = class {
|
|
|
1218
1219
|
return this.syncPatch(state);
|
|
1219
1220
|
}
|
|
1220
1221
|
onResponseDone(state, loopId, payload) {
|
|
1222
|
+
state.responseDone = true;
|
|
1221
1223
|
const model = optStr(payload.model);
|
|
1222
1224
|
if (model) state.model = model;
|
|
1223
1225
|
if (typeof payload.usage === "object" && payload.usage !== null) {
|
|
@@ -1392,6 +1394,7 @@ var ClientProjectionBuilder = class {
|
|
|
1392
1394
|
}
|
|
1393
1395
|
const finalStatus = { completed: "completed", paused: "paused", failed: "failed", interrupted: "interrupted" }[status];
|
|
1394
1396
|
if (!finalStatus) return null;
|
|
1397
|
+
if (finalStatus === "failed") this.dropIncompleteToolCalls(state);
|
|
1395
1398
|
if (!this.activeTurns.has(loopId)) {
|
|
1396
1399
|
this.pendingMemoryRefs.delete(loopId);
|
|
1397
1400
|
}
|
|
@@ -1409,6 +1412,7 @@ var ClientProjectionBuilder = class {
|
|
|
1409
1412
|
ok
|
|
1410
1413
|
};
|
|
1411
1414
|
if (state) {
|
|
1415
|
+
if (!ok) this.dropIncompleteToolCalls(state);
|
|
1412
1416
|
state.blocks.push(buildSystemNotificationBlock("agent:end", status, title, detail, metadata));
|
|
1413
1417
|
return this.finalize(loopId, ok ? "completed" : "failed");
|
|
1414
1418
|
}
|
|
@@ -1424,6 +1428,11 @@ var ClientProjectionBuilder = class {
|
|
|
1424
1428
|
);
|
|
1425
1429
|
return [{ kind: "upsert", turn }];
|
|
1426
1430
|
}
|
|
1431
|
+
dropIncompleteToolCalls(state) {
|
|
1432
|
+
if (state.responseDone) return;
|
|
1433
|
+
state.toolCalls = [];
|
|
1434
|
+
state.blocks = state.blocks.filter((block) => block.type !== "tool_use");
|
|
1435
|
+
}
|
|
1427
1436
|
onCompaction(eventType, loopId, payload) {
|
|
1428
1437
|
const compactionId = String(payload.compaction_id ?? "");
|
|
1429
1438
|
if (!compactionId) return null;
|
|
@@ -2490,6 +2499,7 @@ function normalizedToolName(name) {
|
|
|
2490
2499
|
function inferLoopStatusFromMessages(messages) {
|
|
2491
2500
|
const toolCalls = messages.flatMap((message) => message.tool_calls ?? []);
|
|
2492
2501
|
if (messages.some((message) => message.status === "streaming")) return "running";
|
|
2502
|
+
if (messages.some((message) => message.status === "failed")) return "error";
|
|
2493
2503
|
if (toolCalls.some((toolCall) => toolCall.status === "awaiting_answer")) return "awaiting_answer";
|
|
2494
2504
|
if (toolCalls.some((toolCall) => toolCall.status === "error")) return "error";
|
|
2495
2505
|
if (toolCalls.some((toolCall) => toolCall.status === "cancelled")) return "cancelled";
|
|
@@ -3811,7 +3821,7 @@ function resolveAuthToken(options) {
|
|
|
3811
3821
|
|
|
3812
3822
|
// src/version.ts
|
|
3813
3823
|
var SDK_NAME = "agent-client";
|
|
3814
|
-
var SDK_VERSION = true ? "1.1.
|
|
3824
|
+
var SDK_VERSION = true ? "1.1.9" : "1.1.1";
|
|
3815
3825
|
|
|
3816
3826
|
// src/socket.ts
|
|
3817
3827
|
function withSdkIdentity(auth) {
|