replicas-cli 0.2.403 → 0.2.405

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 +33 -10
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -24336,6 +24336,7 @@ var DEFAULT_USER_PREFERENCES = {
24336
24336
  respond_to_human_pr_reviews: false,
24337
24337
  pr_user_attribution: false,
24338
24338
  auto_draft_prs: false,
24339
+ open_prs_in_graphite: false,
24339
24340
  default_fast_mode: false,
24340
24341
  agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS }
24341
24342
  };
@@ -24394,7 +24395,7 @@ function formatTurnElapsed(ms) {
24394
24395
  }
24395
24396
 
24396
24397
  // ../shared/src/cli-version.ts
24397
- var CLI_VERSION = "0.2.403";
24398
+ var CLI_VERSION = "0.2.405";
24398
24399
 
24399
24400
  // ../shared/src/version.ts
24400
24401
  function compareVersions(v1, v2) {
@@ -24729,17 +24730,23 @@ function normalizeBackgroundTaskStatus(status) {
24729
24730
  return "in_progress";
24730
24731
  }
24731
24732
 
24733
+ // ../shared/src/display-message/constants.ts
24734
+ var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
24735
+
24732
24736
  // ../shared/src/display-message/format.ts
24733
24737
  function formatStoppedAfter(durationMs) {
24734
24738
  if (durationMs === void 0) return "You stopped";
24735
24739
  return `You stopped after ${formatTurnElapsed(durationMs)}`;
24736
24740
  }
24737
24741
 
24738
- // ../shared/src/agent-event-utils.ts
24742
+ // ../shared/src/user-message-matching.ts
24739
24743
  function parseTimestampMs(timestamp) {
24740
24744
  const value = Date.parse(timestamp);
24741
24745
  return Number.isFinite(value) ? value : 0;
24742
24746
  }
24747
+ function areUserMessagesWithinMatchWindow(a, b) {
24748
+ return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
24749
+ }
24743
24750
 
24744
24751
  // ../shared/src/display-message/parsers/utils.ts
24745
24752
  var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
@@ -25565,6 +25572,13 @@ function parseClaudeEvents(events, parentToolUseId) {
25565
25572
  const assistantThinking = /* @__PURE__ */ new Map();
25566
25573
  const assistantTextCounts = /* @__PURE__ */ new Map();
25567
25574
  const acceptedUserMessageIndexes = /* @__PURE__ */ new Set();
25575
+ const canonicalUserMessageIndexes = /* @__PURE__ */ new Set();
25576
+ const findMatchingUserMessageIndex = (indexes, content, timestamp) => {
25577
+ return [...indexes].find((index) => {
25578
+ const message = messages[index];
25579
+ return message?.type === "user" && areUserMessagesWithinMatchWindow(message, { content, timestamp });
25580
+ });
25581
+ };
25568
25582
  let turnWasInterrupted = false;
25569
25583
  const taskAccumulator = new TaskAccumulator();
25570
25584
  const taskSnapshot = () => taskAccumulator.getTasks().map((task) => ({
@@ -25578,13 +25592,21 @@ function parseClaudeEvents(events, parentToolUseId) {
25578
25592
  const images = userMessageImages(event.payload.images);
25579
25593
  if (content || images) {
25580
25594
  const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
25581
- acceptedUserMessageIndexes.add(messages.push({
25595
+ const canonicalIndex = findMatchingUserMessageIndex(canonicalUserMessageIndexes, content, event.timestamp);
25596
+ const canonical = canonicalIndex === void 0 ? void 0 : messages[canonicalIndex];
25597
+ const message = {
25582
25598
  id: typeof messageId === "string" ? messageId : `user-${event.timestamp}`,
25583
25599
  type: "user",
25584
25600
  content,
25585
- images,
25601
+ images: images?.length ? images : canonical?.type === "user" ? canonical.images : void 0,
25586
25602
  timestamp: event.timestamp
25587
- }) - 1);
25603
+ };
25604
+ if (canonicalIndex === void 0) {
25605
+ acceptedUserMessageIndexes.add(messages.push(message) - 1);
25606
+ } else {
25607
+ messages[canonicalIndex] = message;
25608
+ canonicalUserMessageIndexes.delete(canonicalIndex);
25609
+ }
25588
25610
  }
25589
25611
  return;
25590
25612
  }
@@ -25646,10 +25668,11 @@ function parseClaudeEvents(events, parentToolUseId) {
25646
25668
  };
25647
25669
  }).filter((img) => img.data);
25648
25670
  if (textContent || images.length > 0) {
25649
- const acceptedIndex = [...acceptedUserMessageIndexes].find((index) => {
25650
- const accepted2 = messages[index];
25651
- return accepted2?.type === "user" && accepted2.content === textContent;
25652
- });
25671
+ const acceptedIndex = findMatchingUserMessageIndex(
25672
+ acceptedUserMessageIndexes,
25673
+ textContent,
25674
+ event.timestamp
25675
+ );
25653
25676
  const accepted = acceptedIndex === void 0 ? void 0 : messages[acceptedIndex];
25654
25677
  const message = {
25655
25678
  id: accepted?.id ?? `user-${event.timestamp}`,
@@ -25659,7 +25682,7 @@ function parseClaudeEvents(events, parentToolUseId) {
25659
25682
  timestamp: event.timestamp
25660
25683
  };
25661
25684
  if (acceptedIndex === void 0) {
25662
- messages.push(message);
25685
+ canonicalUserMessageIndexes.add(messages.push(message) - 1);
25663
25686
  } else {
25664
25687
  messages[acceptedIndex] = message;
25665
25688
  acceptedUserMessageIndexes.delete(acceptedIndex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.403",
3
+ "version": "0.2.405",
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": {