replicas-cli 0.3.523 → 0.3.524

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 +22 -8
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -28641,6 +28641,11 @@ var init_utils = __esm({
28641
28641
  });
28642
28642
 
28643
28643
  // ../shared/src/display-message/format.ts
28644
+ function userMessageText(message2) {
28645
+ return message2.cancelled ? `[Cancelled before it started]
28646
+
28647
+ ${message2.content}` : message2.content;
28648
+ }
28644
28649
  function fileContentDiff(path12, content, action) {
28645
28650
  const lines = content.replace(/\n$/, "").split("\n");
28646
28651
  return [
@@ -38291,8 +38296,10 @@ function parseReplicasEvents(events) {
38291
38296
  messages.push({
38292
38297
  id: typeof messageId === "string" ? messageId : `replicas-user-${String(payload.seq)}`,
38293
38298
  type: "user",
38294
- content: `${event.type === `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message` ? "[Cancelled before it started]\n\n" : ""}${extractToolResultText(message2.content)}`,
38299
+ content: extractToolResultText(message2.content),
38295
38300
  ...images.length ? { images } : {},
38301
+ // Replicas history lists no senders, and only the sender is offered Send again. Sent messages stay without one: a subagent's assignment carries its owner's id.
38302
+ ...event.type === `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message` ? { cancelled: true, ...typeof payload.userId === "string" ? { senderUserId: payload.userId } : {} } : {},
38296
38303
  timestamp: timestamp2
38297
38304
  });
38298
38305
  return;
@@ -39081,12 +39088,18 @@ function applyInterruptions(messages, events) {
39081
39088
  const result = [...messages];
39082
39089
  for (const event of events) {
39083
39090
  if (event.type !== CHAT_INTERRUPTED_EVENT_TYPE) continue;
39084
- insertDisplayMessageByTimestamp(result, {
39091
+ const interruption = {
39085
39092
  id: `interruption-${event.timestamp}`,
39086
39093
  type: "interruption",
39087
39094
  timestamp: event.timestamp,
39088
39095
  ...event.payload.steered === true ? { steered: true } : {}
39089
- });
39096
+ };
39097
+ insertDisplayMessageByTimestamp(result, interruption);
39098
+ const at = result.indexOf(interruption);
39099
+ const stoppedMs = parseTimestampMs(event.timestamp);
39100
+ let to = at;
39101
+ for (let previous = result[to - 1]; previous?.type === "user" && previous.cancelled && stoppedMs - parseTimestampMs(previous.timestamp) <= STOP_CLOCK_SKEW_MS; previous = result[to - 1]) to--;
39102
+ if (to < at) result.splice(to, 0, ...result.splice(at, 1));
39090
39103
  }
39091
39104
  let lastUserMs = null;
39092
39105
  let lastInterruption = null;
@@ -39178,12 +39191,12 @@ function filterDisplayMessages(messages, provider2) {
39178
39191
  strippedUserContents.set(msg.content, stripped);
39179
39192
  }
39180
39193
  const { content, files, walkthroughs, appshots, annotations } = stripped;
39181
- if (INTERRUPTED_MESSAGE_REGEX.test(content)) {
39194
+ if (!msg.cancelled && INTERRUPTED_MESSAGE_REGEX.test(content)) {
39182
39195
  return [{ id: msg.id, type: "interruption", timestamp: msg.timestamp }];
39183
39196
  }
39184
39197
  const cleaned = withoutAttachmentPlaceholder(content, Boolean(msg.images?.length || files.length));
39185
39198
  if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [];
39186
- const origin = parseMessageOrigin(msg.content);
39199
+ const origin = msg.cancelled ? null : parseMessageOrigin(msg.content);
39187
39200
  if (cleaned === msg.content && !origin && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [msg];
39188
39201
  return [{
39189
39202
  ...msg,
@@ -39197,7 +39210,7 @@ function filterDisplayMessages(messages, provider2) {
39197
39210
  });
39198
39211
  return result;
39199
39212
  }
39200
- var INTERRUPTION_DEDUP_WINDOW_MS, strippedUserContents;
39213
+ var INTERRUPTION_DEDUP_WINDOW_MS, STOP_CLOCK_SKEW_MS, strippedUserContents;
39201
39214
  var init_parsers = __esm({
39202
39215
  "../shared/src/display-message/parsers/index.ts"() {
39203
39216
  "use strict";
@@ -39226,6 +39239,7 @@ var init_parsers = __esm({
39226
39239
  init_mcp();
39227
39240
  init_utils();
39228
39241
  INTERRUPTION_DEDUP_WINDOW_MS = 15e3;
39242
+ STOP_CLOCK_SKEW_MS = 5e3;
39229
39243
  strippedUserContents = /* @__PURE__ */ new Map();
39230
39244
  }
39231
39245
  });
@@ -40276,7 +40290,7 @@ var CLI_VERSION;
40276
40290
  var init_cli_version = __esm({
40277
40291
  "../shared/src/cli-version.ts"() {
40278
40292
  "use strict";
40279
- CLI_VERSION = "0.3.523";
40293
+ CLI_VERSION = "0.3.524";
40280
40294
  }
40281
40295
  });
40282
40296
 
@@ -54605,7 +54619,7 @@ function formatDisplayMessage(message2) {
54605
54619
  case "user":
54606
54620
  console.log(import_chalk22.default.blue(`
54607
54621
  [${time3}] USER:`));
54608
- console.log(import_chalk22.default.white(` ${truncate(message2.content, 500)}`));
54622
+ console.log(import_chalk22.default.white(` ${truncate(userMessageText(message2), 500)}`));
54609
54623
  break;
54610
54624
  case "agent":
54611
54625
  console.log(import_chalk22.default.green(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.523",
3
+ "version": "0.3.524",
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": {