@karlorz/codexhost-cli-win32-x64 0.16.1-3 → 0.17.0-1

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.
@@ -19262,6 +19262,32 @@ function createAntigravityUsageStatistics(environment) {
19262
19262
  }
19263
19263
 
19264
19264
  // dist/antigravity-adapter.js
19265
+ function unstreamedReplyTail(streamed, reply) {
19266
+ const shown = streamed.replace(/\s+/gu, "");
19267
+ if (shown === "")
19268
+ return null;
19269
+ const replied = reply.replace(/\s+/gu, "");
19270
+ if (shown.endsWith(replied))
19271
+ return "";
19272
+ let at = 0;
19273
+ let matched = 0;
19274
+ while (matched < shown.length && at < reply.length) {
19275
+ const char = reply[at] ?? "";
19276
+ if (/\s/u.test(char)) {
19277
+ at += 1;
19278
+ continue;
19279
+ }
19280
+ if (char !== shown[matched])
19281
+ return null;
19282
+ at += 1;
19283
+ matched += 1;
19284
+ }
19285
+ if (matched < shown.length)
19286
+ return null;
19287
+ const tail = reply.slice(at);
19288
+ const shownTrailing = /\s*$/u.exec(streamed)?.[0] ?? "";
19289
+ return tail.startsWith(shownTrailing) ? tail.slice(shownTrailing.length) : tail;
19290
+ }
19265
19291
  var antigravityHarnessId = harnessIdSchema.parse("antigravity");
19266
19292
  var DEFAULT_INSPECT_TIMEOUT_MS = 2e4;
19267
19293
  var DEFAULT_PRINT_TIMEOUT = "30m";
@@ -19746,6 +19772,7 @@ var AntigravitySession = class {
19746
19772
  logPath,
19747
19773
  agentItem: null,
19748
19774
  agentText: "",
19775
+ turnAgentText: "",
19749
19776
  tools: /* @__PURE__ */ new Map(),
19750
19777
  completedItems: [],
19751
19778
  stderr: "",
@@ -19943,8 +19970,13 @@ ${line}`).slice(-8e3);
19943
19970
  const repliedThisTurn = Boolean(active.agentItem) || turnReply.trim() !== "";
19944
19971
  if (response)
19945
19972
  this.#lastResultResponse = response;
19946
- if (turnReply.trim() !== "")
19947
- this.#appendOrSyncAgentText(active, turnReply, false);
19973
+ if (turnReply.trim() !== "") {
19974
+ const unshown = unstreamedReplyTail(active.turnAgentText, turnReply);
19975
+ if (unshown === null)
19976
+ this.#appendOrSyncAgentText(active, turnReply, false);
19977
+ else if (unshown.trim() !== "")
19978
+ this.#appendAgentText(active, unshown);
19979
+ }
19948
19980
  const safeTurnId = event.result.num_turns !== void 0 && event.result.num_turns !== null ? `turn:${event.result.num_turns}` : `turn:${this.#history.snapshot().length + 1}`;
19949
19981
  const safeSessionId = convId || this.#nativeRef?.nativeSessionId || "unknown-session";
19950
19982
  const nativeTurnRef = nativeTurnRefSchema.parse({
@@ -20128,6 +20160,7 @@ ${line}`).slice(-8e3);
20128
20160
  this.#appendAgentText(active, text);
20129
20161
  }
20130
20162
  #appendAgentText(active, text) {
20163
+ active.turnAgentText += text;
20131
20164
  if (!active.agentItem) {
20132
20165
  active.agentItem = { type: "agentMessage", itemId: this.#newItemId(), text };
20133
20166
  active.agentText = text;
@@ -55783,6 +55783,8 @@ function conversationMessages(values, sessionId) {
55783
55783
  type: value.type,
55784
55784
  uuid: value.uuid,
55785
55785
  message: value.message,
55786
+ // Failure metadata belongs to the outer SDK/transcript record, not its Message.
55787
+ failed: value.type === "assistant" && (typeof value.error === "string" || value.isApiErrorMessage === true),
55786
55788
  nested: typeof value.parent_tool_use_id === "string" && value.parent_tool_use_id.length > 0,
55787
55789
  interrupted,
55788
55790
  startsTurn: false,
@@ -55848,7 +55850,7 @@ function turnOutcome(messages) {
55848
55850
  if (messages.some(({ interrupted }) => interrupted))
55849
55851
  return { status: "cancelled", reason: "Cancelled by user" };
55850
55852
  const assistants = messages.filter(({ type }) => type === "assistant");
55851
- const failed = assistants.some(({ message }) => typeof message.error === "string");
55853
+ const failed = assistants.some(({ failed: failed2, nested }) => failed2 && !nested);
55852
55854
  if (failed) {
55853
55855
  return {
55854
55856
  status: "failed",
@@ -55934,6 +55936,7 @@ function mapClaudeSnapshot(values, sessionId) {
55934
55936
  }
55935
55937
  if (message.type !== "assistant")
55936
55938
  return [];
55939
+ const assistantOutcome = outcome.status === "failed" && (!message.failed || message.nested) ? { status: "succeeded" } : itemOutcome(outcome);
55937
55940
  const content = message.message.content;
55938
55941
  const text2 = textParts(content).join("");
55939
55942
  const reasoning = thinkingParts(content).join("");
@@ -55945,7 +55948,7 @@ function mapClaudeSnapshot(values, sessionId) {
55945
55948
  itemId: claudeTranscriptItemId(user.uuid, "agentMessage", agentMessageOrdinal += 1),
55946
55949
  text: text2
55947
55950
  },
55948
- outcome: itemOutcome(outcome)
55951
+ outcome: assistantOutcome
55949
55952
  }
55950
55953
  ] : [];
55951
55954
  }
@@ -55962,7 +55965,7 @@ function mapClaudeSnapshot(values, sessionId) {
55962
55965
  itemId: claudeTranscriptItemId(user.uuid, "reasoning", reasoningOrdinal += 1),
55963
55966
  text: reasoning
55964
55967
  },
55965
- outcome: itemOutcome(outcome)
55968
+ outcome: assistantOutcome
55966
55969
  });
55967
55970
  projectedReasoning = true;
55968
55971
  continue;
@@ -55974,7 +55977,7 @@ function mapClaudeSnapshot(values, sessionId) {
55974
55977
  itemId: claudeTranscriptItemId(user.uuid, "agentMessage", agentMessageOrdinal += 1),
55975
55978
  text: text2
55976
55979
  },
55977
- outcome: itemOutcome(outcome)
55980
+ outcome: assistantOutcome
55978
55981
  });
55979
55982
  projectedText = true;
55980
55983
  continue;
@@ -57750,7 +57753,8 @@ var ClaudeSdkTransport = class {
57750
57753
  const activeQuery = this.#query;
57751
57754
  if (!activeQuery)
57752
57755
  throw new Error("Claude SDK transport is not running");
57753
- this.#idleAccumulator?.requestCancel();
57756
+ const idle = this.#idleAccumulator ??= new ClaudeNativeTurnAccumulator(this.#provider ? { provider: this.#provider } : {});
57757
+ idle.requestCancel();
57754
57758
  try {
57755
57759
  await this.#stopRequest(activeQuery.interrupt(), INTERRUPT_TIMEOUT_MESSAGE);
57756
57760
  } catch (error52) {
@@ -60179,7 +60183,9 @@ var ClaudeHarnessSession = class {
60179
60183
  active.cancellationRequested = true;
60180
60184
  const transport = this.#transport;
60181
60185
  const taskIds = this.#backgroundTaskIds(active);
60182
- if (transport && (taskIds.length > 0 || active.held && (active.rootSegmentActive || this.#occupancy.awaitingContinuation || active.steersAwaitingNative.size > 0))) {
60186
+ if (transport && (taskIds.length > 0 || // A written steer survives the interrupt and runs as Claude's next native turn, so the
60187
+ // Turn stays open to interrupt that turn too instead of leaking it into the next one.
60188
+ active.steersAwaitingNative.size > 0 || active.held && (active.rootSegmentActive || this.#occupancy.awaitingContinuation))) {
60183
60189
  await this.#cancelBackgroundWork(active, transport, taskIds);
60184
60190
  return { ok: true, value: { cancellationRequested: true } };
60185
60191
  }
@@ -18523,6 +18523,16 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
18523
18523
  continue;
18524
18524
  if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
18525
18525
  continue;
18526
+ if (row.type === "message" && row.role === "user" && data.startsNewUserRequest === false && !localCommand && data.agent !== "compact" && !isNativeCompactionSummary(row)) {
18527
+ const contextOnly = body.trim().length > 0 && body.replace(/<system-reminder\b[^>]*\sdata-role=(["'])user-context\1[^>]*>[\s\S]*?<\/system-reminder>/gu, "").trim().length === 0;
18528
+ if (data.isMeta === true || contextOnly)
18529
+ continue;
18530
+ if (current) {
18531
+ if (body)
18532
+ current.input.push({ type: "text", text: body });
18533
+ continue;
18534
+ }
18535
+ }
18526
18536
  if (includeCompactionHistory && isNativeCompactionSummary(row)) {
18527
18537
  if (supportsNativeCommands && current) {
18528
18538
  const outcome = data.isCompacted === true ? { status: "succeeded" } : {
@@ -17311,7 +17311,8 @@ function readCursorNativeHistory(sessionId, cwd, environment, allowMissing = fal
17311
17311
  result.push({
17312
17312
  id,
17313
17313
  text: one(user, 1).toString("utf8"),
17314
- ...rewindRoot ? { rewindRoot } : {}
17314
+ ...rewindRoot ? { rewindRoot } : {},
17315
+ ...user.get(15)?.length ? { notification: true } : {}
17315
17316
  });
17316
17317
  }
17317
17318
  }
@@ -23986,19 +23987,22 @@ var CursorSession = class {
23986
23987
  const administrative = command.input.map((part) => part.text).join("\n").trim().toLowerCase() === "/copy-request-id";
23987
23988
  if (administrative && JSON.stringify(before) === JSON.stringify(after)) {
23988
23989
  } else {
23989
- 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"))
23990
+ const prompted = added.filter((turn) => !turn.notification);
23991
+ const own = prompted[0];
23992
+ 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"))
23990
23993
  throw new Error("Cursor terminal has no unique, verified native turn identity");
23991
23994
  nativeTurnRef = nativeTurnRefSchema.parse({
23992
23995
  harnessId: "cursor-cli",
23993
23996
  nativeSessionId: this.transport.sessionId,
23994
- nativeTurnKey: added[0].id,
23997
+ nativeTurnKey: own.id,
23995
23998
  formatVersion: 1
23996
23999
  });
23997
24000
  this.#fresh = false;
23998
- if (outcome.status === "succeeded" && cursorForkAvailable())
24001
+ const ownIndex = after.findIndex((turn) => turn.id === own.id);
24002
+ if (outcome.status === "succeeded" && cursorForkAvailable() && (ownIndex === after.length - 1 || after[ownIndex + 1]?.rewindRoot))
23999
24003
  outcome = {
24000
24004
  ...outcome,
24001
- checkpoint: cursorCheckpoint(this.transport.sessionId, added[0].id)
24005
+ checkpoint: cursorCheckpoint(this.transport.sessionId, own.id)
24002
24006
  };
24003
24007
  }
24004
24008
  } catch (error51) {