@blade-hq/agent-client 2610.0.0-beta.38 → 2610.0.0-beta.39

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
@@ -2290,10 +2290,16 @@ function projectHistory(entries) {
2290
2290
  </compaction-summary>`;
2291
2291
  }
2292
2292
  turns.push(
2293
- buildCompactionTurn(++sequence, compactionId, loopId, "completed", {
2294
- ...data,
2295
- content
2296
- })
2293
+ buildCompactionTurn(
2294
+ ++sequence,
2295
+ compactionId,
2296
+ loopId,
2297
+ data.status === "failed" ? "failed" : "completed",
2298
+ {
2299
+ ...data,
2300
+ content
2301
+ }
2302
+ )
2297
2303
  );
2298
2304
  } else if (kind === "child_pause") {
2299
2305
  const data = entry.data ?? {};
@@ -4293,7 +4299,11 @@ ${text}` } : block
4293
4299
  }
4294
4300
  /** 停止当前回复。 */
4295
4301
  stop() {
4296
- return this.runtime.emitWithAck("chat:stop", { session_id: this.sessionId }, 35e3).then((response) => response ?? {});
4302
+ return this.runtime.emitWithAck("chat:stop", { session_id: this.sessionId }, 35e3).then((response) => {
4303
+ const result = response ?? {};
4304
+ if (result.status !== "accepted") this.manualCompactionPending = false;
4305
+ return result;
4306
+ });
4297
4307
  }
4298
4308
  /** 手动触发上下文压缩。 */
4299
4309
  compact() {
@@ -4313,8 +4323,10 @@ ${text}` } : block
4313
4323
  trigger: "manual"
4314
4324
  }
4315
4325
  }));
4316
- return this.runtime.emitWithAck("chat:compact", { session_id: this.sessionId }, 3e4).then((response) => response ?? {}).finally(() => {
4326
+ return this.runtime.emitWithAck("chat:compact", { session_id: this.sessionId }, 3e4).then((response) => response ?? {}).catch((error) => {
4317
4327
  this.manualCompactionPending = false;
4328
+ throw error;
4329
+ }).finally(() => {
4318
4330
  if (this.state.activeCompaction?.compaction_id === "pending-manual-compaction") {
4319
4331
  this.update((state) => ({ ...state, activeCompaction: null }));
4320
4332
  }
@@ -4485,6 +4497,11 @@ ${text}` } : block
4485
4497
  /** @internal 历史回放通道(event_format: raw)。 */
4486
4498
  _handleTurnEvents(events, replayed = false) {
4487
4499
  if (!events.length) return;
4500
+ if (events.some(
4501
+ (event) => event.type === "compaction:end" || event.type === "compaction:error" || event.type === "compaction:abort"
4502
+ )) {
4503
+ this.manualCompactionPending = false;
4504
+ }
4488
4505
  this.dispatchRawCommands(events);
4489
4506
  const terminalChatEndStatus = extractTerminalChatEndStatus(events);
4490
4507
  if (!terminalChatEndStatus && hasChatRunEvent(events) && this.state.status !== "waiting_for_input") {
@@ -5878,7 +5895,7 @@ function resolveServiceUrl(endpoints, name, path = "") {
5878
5895
 
5879
5896
  // src/version.ts
5880
5897
  var SDK_NAME = "agent-client";
5881
- var SDK_VERSION = true ? "2610.0.0-beta.38" : "1.1.1";
5898
+ var SDK_VERSION = true ? "2610.0.0-beta.39" : "1.1.1";
5882
5899
 
5883
5900
  // src/commands/protocol.ts
5884
5901
  function isCommandEnvelope(value) {