@codexhost/cli-darwin-x64 0.16.1 → 0.17.0

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.
@@ -19089,6 +19089,32 @@ function createAntigravityUsageStatistics(environment) {
19089
19089
  }
19090
19090
 
19091
19091
  // dist/antigravity-adapter.js
19092
+ function unstreamedReplyTail(streamed, reply) {
19093
+ const shown = streamed.replace(/\s+/gu, "");
19094
+ if (shown === "")
19095
+ return null;
19096
+ const replied = reply.replace(/\s+/gu, "");
19097
+ if (shown.endsWith(replied))
19098
+ return "";
19099
+ let at = 0;
19100
+ let matched = 0;
19101
+ while (matched < shown.length && at < reply.length) {
19102
+ const char = reply[at] ?? "";
19103
+ if (/\s/u.test(char)) {
19104
+ at += 1;
19105
+ continue;
19106
+ }
19107
+ if (char !== shown[matched])
19108
+ return null;
19109
+ at += 1;
19110
+ matched += 1;
19111
+ }
19112
+ if (matched < shown.length)
19113
+ return null;
19114
+ const tail = reply.slice(at);
19115
+ const shownTrailing = /\s*$/u.exec(streamed)?.[0] ?? "";
19116
+ return tail.startsWith(shownTrailing) ? tail.slice(shownTrailing.length) : tail;
19117
+ }
19092
19118
  var antigravityHarnessId = harnessIdSchema.parse("antigravity");
19093
19119
  var DEFAULT_INSPECT_TIMEOUT_MS = 2e4;
19094
19120
  var DEFAULT_PRINT_TIMEOUT = "30m";
@@ -19573,6 +19599,7 @@ var AntigravitySession = class {
19573
19599
  logPath,
19574
19600
  agentItem: null,
19575
19601
  agentText: "",
19602
+ turnAgentText: "",
19576
19603
  tools: /* @__PURE__ */ new Map(),
19577
19604
  completedItems: [],
19578
19605
  stderr: "",
@@ -19770,8 +19797,13 @@ ${line}`).slice(-8e3);
19770
19797
  const repliedThisTurn = Boolean(active.agentItem) || turnReply.trim() !== "";
19771
19798
  if (response)
19772
19799
  this.#lastResultResponse = response;
19773
- if (turnReply.trim() !== "")
19774
- this.#appendOrSyncAgentText(active, turnReply, false);
19800
+ if (turnReply.trim() !== "") {
19801
+ const unshown = unstreamedReplyTail(active.turnAgentText, turnReply);
19802
+ if (unshown === null)
19803
+ this.#appendOrSyncAgentText(active, turnReply, false);
19804
+ else if (unshown.trim() !== "")
19805
+ this.#appendAgentText(active, unshown);
19806
+ }
19775
19807
  const safeTurnId = event.result.num_turns !== void 0 && event.result.num_turns !== null ? `turn:${event.result.num_turns}` : `turn:${this.#history.snapshot().length + 1}`;
19776
19808
  const safeSessionId = convId || this.#nativeRef?.nativeSessionId || "unknown-session";
19777
19809
  const nativeTurnRef = nativeTurnRefSchema.parse({
@@ -19955,6 +19987,7 @@ ${line}`).slice(-8e3);
19955
19987
  this.#appendAgentText(active, text);
19956
19988
  }
19957
19989
  #appendAgentText(active, text) {
19990
+ active.turnAgentText += text;
19958
19991
  if (!active.agentItem) {
19959
19992
  active.agentItem = { type: "agentMessage", itemId: this.#newItemId(), text };
19960
19993
  active.agentText = text;
@@ -55584,6 +55584,8 @@ function conversationMessages(values, sessionId) {
55584
55584
  type: value.type,
55585
55585
  uuid: value.uuid,
55586
55586
  message: value.message,
55587
+ // Failure metadata belongs to the outer SDK/transcript record, not its Message.
55588
+ failed: value.type === "assistant" && (typeof value.error === "string" || value.isApiErrorMessage === true),
55587
55589
  nested: typeof value.parent_tool_use_id === "string" && value.parent_tool_use_id.length > 0,
55588
55590
  interrupted,
55589
55591
  startsTurn: false,
@@ -55649,7 +55651,7 @@ function turnOutcome(messages) {
55649
55651
  if (messages.some(({ interrupted }) => interrupted))
55650
55652
  return { status: "cancelled", reason: "Cancelled by user" };
55651
55653
  const assistants = messages.filter(({ type }) => type === "assistant");
55652
- const failed = assistants.some(({ message }) => typeof message.error === "string");
55654
+ const failed = assistants.some(({ failed: failed2, nested }) => failed2 && !nested);
55653
55655
  if (failed) {
55654
55656
  return {
55655
55657
  status: "failed",
@@ -55735,6 +55737,7 @@ function mapClaudeSnapshot(values, sessionId) {
55735
55737
  }
55736
55738
  if (message.type !== "assistant")
55737
55739
  return [];
55740
+ const assistantOutcome = outcome.status === "failed" && (!message.failed || message.nested) ? { status: "succeeded" } : itemOutcome(outcome);
55738
55741
  const content = message.message.content;
55739
55742
  const text2 = textParts(content).join("");
55740
55743
  const reasoning = thinkingParts(content).join("");
@@ -55746,7 +55749,7 @@ function mapClaudeSnapshot(values, sessionId) {
55746
55749
  itemId: claudeTranscriptItemId(user.uuid, "agentMessage", agentMessageOrdinal += 1),
55747
55750
  text: text2
55748
55751
  },
55749
- outcome: itemOutcome(outcome)
55752
+ outcome: assistantOutcome
55750
55753
  }
55751
55754
  ] : [];
55752
55755
  }
@@ -55763,7 +55766,7 @@ function mapClaudeSnapshot(values, sessionId) {
55763
55766
  itemId: claudeTranscriptItemId(user.uuid, "reasoning", reasoningOrdinal += 1),
55764
55767
  text: reasoning
55765
55768
  },
55766
- outcome: itemOutcome(outcome)
55769
+ outcome: assistantOutcome
55767
55770
  });
55768
55771
  projectedReasoning = true;
55769
55772
  continue;
@@ -55775,7 +55778,7 @@ function mapClaudeSnapshot(values, sessionId) {
55775
55778
  itemId: claudeTranscriptItemId(user.uuid, "agentMessage", agentMessageOrdinal += 1),
55776
55779
  text: text2
55777
55780
  },
55778
- outcome: itemOutcome(outcome)
55781
+ outcome: assistantOutcome
55779
55782
  });
55780
55783
  projectedText = true;
55781
55784
  continue;
@@ -57551,7 +57554,8 @@ var ClaudeSdkTransport = class {
57551
57554
  const activeQuery = this.#query;
57552
57555
  if (!activeQuery)
57553
57556
  throw new Error("Claude SDK transport is not running");
57554
- this.#idleAccumulator?.requestCancel();
57557
+ const idle = this.#idleAccumulator ??= new ClaudeNativeTurnAccumulator(this.#provider ? { provider: this.#provider } : {});
57558
+ idle.requestCancel();
57555
57559
  try {
57556
57560
  await this.#stopRequest(activeQuery.interrupt(), INTERRUPT_TIMEOUT_MESSAGE);
57557
57561
  } catch (error52) {
@@ -59978,7 +59982,9 @@ var ClaudeHarnessSession = class {
59978
59982
  active.cancellationRequested = true;
59979
59983
  const transport = this.#transport;
59980
59984
  const taskIds = this.#backgroundTaskIds(active);
59981
- if (transport && (taskIds.length > 0 || active.held && (active.rootSegmentActive || this.#occupancy.awaitingContinuation || active.steersAwaitingNative.size > 0))) {
59985
+ if (transport && (taskIds.length > 0 || // A written steer survives the interrupt and runs as Claude's next native turn, so the
59986
+ // Turn stays open to interrupt that turn too instead of leaking it into the next one.
59987
+ active.steersAwaitingNative.size > 0 || active.held && (active.rootSegmentActive || this.#occupancy.awaitingContinuation))) {
59982
59988
  await this.#cancelBackgroundWork(active, transport, taskIds);
59983
59989
  return { ok: true, value: { cancellationRequested: true } };
59984
59990
  }
@@ -18350,6 +18350,16 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
18350
18350
  continue;
18351
18351
  if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
18352
18352
  continue;
18353
+ if (row.type === "message" && row.role === "user" && data.startsNewUserRequest === false && !localCommand && data.agent !== "compact" && !isNativeCompactionSummary(row)) {
18354
+ const contextOnly = body.trim().length > 0 && body.replace(/<system-reminder\b[^>]*\sdata-role=(["'])user-context\1[^>]*>[\s\S]*?<\/system-reminder>/gu, "").trim().length === 0;
18355
+ if (data.isMeta === true || contextOnly)
18356
+ continue;
18357
+ if (current) {
18358
+ if (body)
18359
+ current.input.push({ type: "text", text: body });
18360
+ continue;
18361
+ }
18362
+ }
18353
18363
  if (includeCompactionHistory && isNativeCompactionSummary(row)) {
18354
18364
  if (supportsNativeCommands && current) {
18355
18365
  const outcome = data.isCompacted === true ? { status: "succeeded" } : {
@@ -17138,7 +17138,8 @@ function readCursorNativeHistory(sessionId, cwd, environment, allowMissing = fal
17138
17138
  result.push({
17139
17139
  id,
17140
17140
  text: one(user, 1).toString("utf8"),
17141
- ...rewindRoot ? { rewindRoot } : {}
17141
+ ...rewindRoot ? { rewindRoot } : {},
17142
+ ...user.get(15)?.length ? { notification: true } : {}
17142
17143
  });
17143
17144
  }
17144
17145
  }
@@ -23803,19 +23804,22 @@ var CursorSession = class {
23803
23804
  const administrative = command.input.map((part) => part.text).join("\n").trim().toLowerCase() === "/copy-request-id";
23804
23805
  if (administrative && JSON.stringify(before) === JSON.stringify(after)) {
23805
23806
  } else {
23806
- if (added.length !== 1 || after.length !== before.length + 1 || before.some((turn, index) => after[index]?.id !== turn.id) || added[0]?.text !== command.input.map((part) => part.text).join("\n"))
23807
+ const prompted = added.filter((turn) => !turn.notification);
23808
+ const own = prompted[0];
23809
+ if (!own || prompted.length !== 1 || after.length !== before.length + added.length || before.some((turn, index) => after[index]?.id !== turn.id) || own.text !== command.input.map((part) => part.text).join("\n"))
23807
23810
  throw new Error("Cursor terminal has no unique, verified native turn identity");
23808
23811
  nativeTurnRef = nativeTurnRefSchema.parse({
23809
23812
  harnessId: "cursor-cli",
23810
23813
  nativeSessionId: this.transport.sessionId,
23811
- nativeTurnKey: added[0].id,
23814
+ nativeTurnKey: own.id,
23812
23815
  formatVersion: 1
23813
23816
  });
23814
23817
  this.#fresh = false;
23815
- if (outcome.status === "succeeded" && cursorForkAvailable())
23818
+ const ownIndex = after.findIndex((turn) => turn.id === own.id);
23819
+ if (outcome.status === "succeeded" && cursorForkAvailable() && (ownIndex === after.length - 1 || after[ownIndex + 1]?.rewindRoot))
23816
23820
  outcome = {
23817
23821
  ...outcome,
23818
- checkpoint: cursorCheckpoint(this.transport.sessionId, added[0].id)
23822
+ checkpoint: cursorCheckpoint(this.transport.sessionId, own.id)
23819
23823
  };
23820
23824
  }
23821
23825
  } catch (error51) {