replicas-cli 0.2.596 → 0.2.597

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.
Files changed (2) hide show
  1. package/dist/index.cjs +12 -5
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -24552,7 +24552,7 @@ function isTransientErrorText(text, options = {}) {
24552
24552
  }
24553
24553
 
24554
24554
  // ../shared/src/cli-version.ts
24555
- var CLI_VERSION = "0.2.596";
24555
+ var CLI_VERSION = "0.2.597";
24556
24556
 
24557
24557
  // ../shared/src/version.ts
24558
24558
  function compareVersions(v1, v2) {
@@ -25189,6 +25189,7 @@ function coerceBackgroundTaskPayload(payload) {
25189
25189
  prompt: optionalString(payload.prompt),
25190
25190
  lastToolName: optionalString(payload.last_tool_name),
25191
25191
  usage,
25192
+ ambient: optionalBoolean(payload.ambient),
25192
25193
  patch
25193
25194
  };
25194
25195
  }
@@ -26522,6 +26523,7 @@ function parseClaudeEvents(events, parentToolUseId) {
26522
26523
  });
26523
26524
  const toolCallMap = /* @__PURE__ */ new Map();
26524
26525
  const taskMessageMap = /* @__PURE__ */ new Map();
26526
+ const ambientTaskIds = /* @__PURE__ */ new Set();
26525
26527
  const partialIndexes = /* @__PURE__ */ new Map();
26526
26528
  const completedStreamIds = /* @__PURE__ */ new Set();
26527
26529
  const supersededStreamIds = /* @__PURE__ */ new Set();
@@ -26530,9 +26532,10 @@ function parseClaudeEvents(events, parentToolUseId) {
26530
26532
  const assistantTextCounts = /* @__PURE__ */ new Map();
26531
26533
  const acceptedUserMessageIndexes = /* @__PURE__ */ new Set();
26532
26534
  const canonicalUserMessageIndexes = /* @__PURE__ */ new Set();
26535
+ const supersededUserMessageIndexes = /* @__PURE__ */ new Set();
26533
26536
  const findMatchingUserMessageIndex = (indexes, content, timestamp, messageId) => {
26534
26537
  if (typeof messageId === "string") {
26535
- const byId = messages.findIndex((message) => message.type === "user" && message.id === messageId);
26538
+ const byId = messages.findIndex((message, index) => message.type === "user" && message.id === messageId && !supersededUserMessageIndexes.has(index));
26536
26539
  if (byId !== -1) return byId;
26537
26540
  }
26538
26541
  return [...indexes].find((index) => {
@@ -26644,9 +26647,12 @@ function parseClaudeEvents(events, parentToolUseId) {
26644
26647
  };
26645
26648
  if (acceptedIndex === void 0) {
26646
26649
  canonicalUserMessageIndexes.add(messages.push(message) - 1);
26650
+ } else if (acceptedUserMessageIndexes.has(acceptedIndex)) {
26651
+ supersededUserMessageIndexes.add(acceptedIndex);
26652
+ acceptedUserMessageIndexes.delete(acceptedIndex);
26653
+ canonicalUserMessageIndexes.add(messages.push(message) - 1);
26647
26654
  } else {
26648
26655
  messages[acceptedIndex] = message;
26649
- acceptedUserMessageIndexes.delete(acceptedIndex);
26650
26656
  }
26651
26657
  }
26652
26658
  }
@@ -26882,7 +26888,8 @@ function parseClaudeEvents(events, parentToolUseId) {
26882
26888
  }
26883
26889
  if (event.type === "claude-system") {
26884
26890
  const payload = coerceBackgroundTaskPayload(event.payload);
26885
- if (payload) {
26891
+ if (payload?.ambient) ambientTaskIds.add(payload.taskId);
26892
+ if (payload && !ambientTaskIds.has(payload.taskId)) {
26886
26893
  const existing = taskMessageMap.get(payload.taskId);
26887
26894
  const nextStatus = payload.subtype === "task_notification" ? normalizeBackgroundTaskStatus(payload.status) : payload.subtype === "task_updated" ? normalizeBackgroundTaskStatus(payload.patch?.status) : existing?.status ?? "in_progress";
26888
26895
  const nextMessage = {
@@ -26999,7 +27006,7 @@ function parseClaudeEvents(events, parentToolUseId) {
26999
27006
  message.targetProvider = target.subagentType;
27000
27007
  }
27001
27008
  }
27002
- const staleIndexes = /* @__PURE__ */ new Set();
27009
+ const staleIndexes = new Set(supersededUserMessageIndexes);
27003
27010
  for (const streamId of [...completedStreamIds, ...supersededStreamIds]) {
27004
27011
  const refs = partialIndexes.get(streamId);
27005
27012
  if (refs?.reasoning !== void 0) staleIndexes.add(refs.reasoning);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.596",
3
+ "version": "0.2.597",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {