replicas-cli 0.2.467 → 0.2.470

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.mjs +74 -27
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -10004,8 +10004,11 @@ var DEFAULT_RELAY_SUBAGENT_PROVIDERS = [...VALID_RELAY_SUBAGENT_PROVIDERS];
10004
10004
  var DEFAULT_USER_PREFERENCES = {
10005
10005
  default_agent: "codex",
10006
10006
  default_model: null,
10007
+ claude_models: null,
10008
+ codex_models: null,
10007
10009
  cursor_models: null,
10008
10010
  openrouter_models: null,
10011
+ relay_models: null,
10009
10012
  close_workspace_on_pr_close: true,
10010
10013
  close_workspace_on_pr_merge: true,
10011
10014
  default_environment_id: null,
@@ -10081,7 +10084,7 @@ function formatTurnElapsed(ms) {
10081
10084
  }
10082
10085
 
10083
10086
  // ../shared/src/cli-version.ts
10084
- var CLI_VERSION = "0.2.467";
10087
+ var CLI_VERSION = "0.2.470";
10085
10088
 
10086
10089
  // ../shared/src/version.ts
10087
10090
  function compareVersions(v1, v2) {
@@ -25680,8 +25683,9 @@ function parseOpencodeEvents(events) {
25680
25683
  if (event.type === "event_msg" && event.payload.type === "user_message") {
25681
25684
  const message = event.payload.message;
25682
25685
  if (typeof message === "string" && message.trim()) {
25686
+ const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
25683
25687
  messages.push({
25684
- id: `opencode-user-${event.timestamp}-${messages.length}`,
25688
+ id: typeof messageId === "string" ? messageId : `opencode-user-${event.timestamp}`,
25685
25689
  type: "user",
25686
25690
  content: message,
25687
25691
  timestamp: event.timestamp
@@ -25693,7 +25697,7 @@ function parseOpencodeEvents(events) {
25693
25697
  const error51 = assistantError(event.payload.info);
25694
25698
  if (error51) {
25695
25699
  messages.push({
25696
- id: `opencode-error-${event.timestamp}-${messages.length}`,
25700
+ id: `opencode-${event.type}-${event.timestamp}`,
25697
25701
  type: "error",
25698
25702
  message: error51,
25699
25703
  timestamp: event.timestamp
@@ -25704,7 +25708,7 @@ function parseOpencodeEvents(events) {
25704
25708
  if (event.type === "opencode-error") {
25705
25709
  const message = typeof event.payload.message === "string" ? event.payload.message : "Opencode run failed";
25706
25710
  messages.push({
25707
- id: `opencode-error-${event.timestamp}-${messages.length}`,
25711
+ id: `opencode-${event.type}-${event.timestamp}`,
25708
25712
  type: "error",
25709
25713
  message,
25710
25714
  timestamp: event.timestamp
@@ -25715,7 +25719,7 @@ function parseOpencodeEvents(events) {
25715
25719
  const tool = typeof event.payload.tool === "string" ? event.payload.tool : "tool";
25716
25720
  const input = event.payload.input ?? event.payload.arguments;
25717
25721
  const callId = typeof event.payload.callID === "string" ? event.payload.callID : null;
25718
- const id2 = callId ? `opencode-${callId}` : `opencode-${event.timestamp}-${messages.length}`;
25722
+ const id2 = callId ? `opencode-${callId}` : `opencode-${event.type}-${event.timestamp}`;
25719
25723
  upsertDisplayMessage(messages, createCallDisplayMessage({
25720
25724
  id: id2,
25721
25725
  server: "opencode",
@@ -25728,7 +25732,7 @@ function parseOpencodeEvents(events) {
25728
25732
  }
25729
25733
  const part = partFromEvent(event);
25730
25734
  if (!part) continue;
25731
- let id = `opencode-${event.timestamp}-${messages.length}`;
25735
+ let id = `opencode-${event.type}-${event.timestamp}`;
25732
25736
  if (typeof part.callID === "string") id = `opencode-${part.callID}`;
25733
25737
  else if (typeof part.id === "string") id = `opencode-${part.id}`;
25734
25738
  const time3 = isRecord(part.time) ? part.time : null;
@@ -26670,38 +26674,81 @@ function stableString(value) {
26670
26674
  return String(value);
26671
26675
  }
26672
26676
  }
26673
- function duplicateMessage(a, b) {
26674
- if (a.id === b.id) return true;
26675
- if (a.type !== b.type || !nearTimestamp(a.timestamp, b.timestamp)) {
26676
- return false;
26677
+ function duplicateKey(message) {
26678
+ if (message.type === "user" || message.type === "agent" || message.type === "reasoning") {
26679
+ return JSON.stringify([message.type, message.content]);
26677
26680
  }
26678
- if (a.type === "user" && b.type === "user") return a.content === b.content;
26679
- if (a.type === "agent" && b.type === "agent") return a.content === b.content;
26680
- if (a.type === "reasoning" && b.type === "reasoning") return a.content === b.content;
26681
- if (a.type === "command" && b.type === "command") return a.command === b.command;
26682
- if (a.type === "web_search" && b.type === "web_search") return a.query === b.query;
26683
- if (a.type === "subagent" && b.type === "subagent") {
26684
- return a.description === b.description && a.prompt === b.prompt && a.subagentType === b.subagentType && a.model === b.model;
26681
+ if (message.type === "command") return JSON.stringify([message.type, message.command]);
26682
+ if (message.type === "web_search") return JSON.stringify([message.type, message.query]);
26683
+ if (message.type === "subagent") {
26684
+ return JSON.stringify([
26685
+ message.type,
26686
+ message.description,
26687
+ message.prompt,
26688
+ message.subagentType,
26689
+ message.model
26690
+ ]);
26685
26691
  }
26686
- if (a.type === "todo_list" && b.type === "todo_list") {
26687
- return stableString(a.items) === stableString(b.items);
26692
+ if (message.type === "todo_list") {
26693
+ return JSON.stringify([message.type, stableString(message.items)]);
26688
26694
  }
26689
- if (a.type === "patch" && b.type === "patch") {
26690
- return stableString(a.operations) === stableString(b.operations);
26695
+ if (message.type === "patch") {
26696
+ return JSON.stringify([message.type, stableString(message.operations)]);
26691
26697
  }
26692
- if (a.type === "tool_call" && b.type === "tool_call") {
26693
- return a.server === b.server && a.tool === b.tool && stableString(a.input) === stableString(b.input);
26698
+ if (message.type === "tool_call") {
26699
+ return JSON.stringify([
26700
+ message.type,
26701
+ message.server,
26702
+ message.tool,
26703
+ stableString(message.input)
26704
+ ]);
26694
26705
  }
26695
- return false;
26706
+ return null;
26707
+ }
26708
+ function duplicateBucketKey(message, bucketOffset = 0) {
26709
+ const key = duplicateKey(message);
26710
+ if (key === null) return null;
26711
+ const bucket = Math.floor(parseTimestampMs(message.timestamp) / DUPLICATE_WINDOW_MS) + bucketOffset;
26712
+ return JSON.stringify([bucket, key]);
26696
26713
  }
26697
26714
  function mergeCodexAspDisplayMessages(primary, supplemental) {
26698
26715
  const merged = [...primary];
26716
+ const firstIndexById = /* @__PURE__ */ new Map();
26717
+ const indexesByDuplicateBucket = /* @__PURE__ */ new Map();
26718
+ const indexMessage = (message, index) => {
26719
+ if (!firstIndexById.has(message.id)) firstIndexById.set(message.id, index);
26720
+ const key = duplicateBucketKey(message);
26721
+ if (key === null) return;
26722
+ const indexes = indexesByDuplicateBucket.get(key) ?? /* @__PURE__ */ new Set();
26723
+ indexes.add(index);
26724
+ indexesByDuplicateBucket.set(key, indexes);
26725
+ };
26726
+ const unindexMessage = (message, index) => {
26727
+ const key = duplicateBucketKey(message);
26728
+ if (key === null) return;
26729
+ const indexes = indexesByDuplicateBucket.get(key);
26730
+ indexes?.delete(index);
26731
+ if (indexes?.size === 0) indexesByDuplicateBucket.delete(key);
26732
+ };
26733
+ merged.forEach(indexMessage);
26699
26734
  for (const message of supplemental) {
26700
- const duplicateIndex = merged.findIndex((existing) => duplicateMessage(existing, message));
26701
- if (duplicateIndex === -1) {
26702
- merged.push(message);
26735
+ let duplicateIndex = firstIndexById.get(message.id);
26736
+ if (duplicateIndex === void 0) {
26737
+ for (let bucketOffset = -1; bucketOffset <= 1; bucketOffset += 1) {
26738
+ const key = duplicateBucketKey(message, bucketOffset);
26739
+ for (const index of (key === null ? void 0 : indexesByDuplicateBucket.get(key)) ?? []) {
26740
+ if (nearTimestamp(merged[index].timestamp, message.timestamp) && (duplicateIndex === void 0 || index < duplicateIndex)) {
26741
+ duplicateIndex = index;
26742
+ }
26743
+ }
26744
+ }
26745
+ }
26746
+ if (duplicateIndex === void 0) {
26747
+ indexMessage(message, merged.push(message) - 1);
26703
26748
  } else if (message.type === "user") {
26749
+ unindexMessage(merged[duplicateIndex], duplicateIndex);
26704
26750
  merged[duplicateIndex] = { ...merged[duplicateIndex], timestamp: message.timestamp };
26751
+ indexMessage(merged[duplicateIndex], duplicateIndex);
26705
26752
  }
26706
26753
  }
26707
26754
  return merged.map((message, index) => ({ message, index })).sort((a, b) => parseTimestampMs(a.message.timestamp) - parseTimestampMs(b.message.timestamp) || a.index - b.index).map(({ message }) => message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.467",
3
+ "version": "0.2.470",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {