@blade-hq/agent-client 1.2.1-beta.2 → 1.2.1-beta.5

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 CHANGED
@@ -914,6 +914,7 @@ var ClientProjectionBuilder = class {
914
914
  pendingChildPauses = /* @__PURE__ */ new Map();
915
915
  pendingMemoryRefs = /* @__PURE__ */ new Map();
916
916
  activeCompactions = /* @__PURE__ */ new Map();
917
+ failedCompactions = /* @__PURE__ */ new Map();
917
918
  seq = 0;
918
919
  syntheticCounter = 0;
919
920
  displayNameResolver;
@@ -977,6 +978,12 @@ var ClientProjectionBuilder = class {
977
978
  return null;
978
979
  }
979
980
  switch (event.type) {
981
+ case "llm:stream:reset":
982
+ state.blocks = [];
983
+ state.toolCalls = [];
984
+ state.usage = null;
985
+ state.responseDone = false;
986
+ return this.syncPatch(state);
980
987
  case "llm:thinking:delta":
981
988
  return this.onDelta(state, "thinking", "", String(payload.content ?? ""));
982
989
  case "llm:content:delta":
@@ -1013,6 +1020,7 @@ var ClientProjectionBuilder = class {
1013
1020
  this.pendingChildPauses.clear();
1014
1021
  this.pendingMemoryRefs.clear();
1015
1022
  this.activeCompactions.clear();
1023
+ this.failedCompactions.clear();
1016
1024
  this.seq = 0;
1017
1025
  this.syntheticCounter = 0;
1018
1026
  }
@@ -1485,7 +1493,7 @@ var ClientProjectionBuilder = class {
1485
1493
  onCompaction(eventType, loopId, payload) {
1486
1494
  const compactionId = String(payload.compaction_id ?? "");
1487
1495
  if (!compactionId) return null;
1488
- const current = {
1496
+ let current = {
1489
1497
  ...this.activeCompactions.get(compactionId) ?? {},
1490
1498
  ...payload,
1491
1499
  loop_id: loopId
@@ -1495,6 +1503,7 @@ var ClientProjectionBuilder = class {
1495
1503
  case "compaction:start":
1496
1504
  status = "streaming";
1497
1505
  this.activeCompactions.set(compactionId, current);
1506
+ this.failedCompactions.delete(compactionId);
1498
1507
  break;
1499
1508
  case "compaction:end":
1500
1509
  status = "completed";
@@ -1507,11 +1516,17 @@ var ClientProjectionBuilder = class {
1507
1516
  case "compaction:error":
1508
1517
  status = "failed";
1509
1518
  this.activeCompactions.delete(compactionId);
1519
+ this.failedCompactions.set(compactionId, { ...current });
1510
1520
  break;
1511
1521
  default:
1512
1522
  status = "streaming";
1513
1523
  this.activeCompactions.set(compactionId, current);
1514
1524
  }
1525
+ const failed = this.failedCompactions.get(compactionId);
1526
+ if (failed && status !== "failed") {
1527
+ current = { ...failed, ...current };
1528
+ status = "failed";
1529
+ }
1515
1530
  const turn = buildCompactionTurn(this.nextSeq(), compactionId, loopId, status, current);
1516
1531
  return [{ kind: "upsert", turn }];
1517
1532
  }
@@ -4114,7 +4129,7 @@ function resolveAuthToken(options) {
4114
4129
 
4115
4130
  // src/version.ts
4116
4131
  var SDK_NAME = "agent-client";
4117
- var SDK_VERSION = true ? "1.2.1-beta.2" : "1.1.1";
4132
+ var SDK_VERSION = true ? "1.2.1-beta.5" : "1.1.1";
4118
4133
 
4119
4134
  // src/socket.ts
4120
4135
  function withSdkIdentity(auth) {