replicas-cli 0.3.523 → 0.3.525

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 +25 -9
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -22790,7 +22790,7 @@ function codexTurnFromEvent(event) {
22790
22790
  const { turnId, status, error: error62 } = event.payload;
22791
22791
  return typeof turnId === "string" && typeof status === "string" ? { turnId, status, ...typeof error62 === "string" ? { error: error62 } : {} } : null;
22792
22792
  }
22793
- var MERGED_MESSAGE_SEPARATOR, engineStatusSnapshotSchema, updateChatDisplayNameRequestSchema, createChatFields, createChatRequestSchema, createHarnessChatRequestSchema, spawnSubagentRequestSchema, messageSubagentRequestSchema, waitSubagentRequestSchema, subagentResponseSchema, integrationErrorNotificationTargetSchema, sendChatMessageRequestSchema, CODEX_ITEM_FIELD_CHECKS, sendChatMessageResponseSchema, interruptChatRequestSchema, respondToolInputRequestSchema;
22793
+ var MERGED_MESSAGE_SEPARATOR, engineStatusSnapshotSchema, updateChatDisplayNameRequestSchema, createChatFields, createChatRequestSchema, createHarnessChatRequestSchema, spawnSubagentRequestSchema, messageSubagentRequestSchema, waitSubagentRequestSchema, subagentResponseSchema, integrationErrorNotificationTargetSchema, sendChatMessageRequestSchema, CODEX_ITEM_FIELD_CHECKS, sendChatMessageResponseSchema, interruptChatRequestSchema, turnStoppedSchema, engineInterruptChatRequestSchema, respondToolInputRequestSchema;
22794
22794
  var init_v1 = __esm({
22795
22795
  "../shared/src/engine/v1.ts"() {
22796
22796
  "use strict";
@@ -22948,6 +22948,8 @@ var init_v1 = __esm({
22948
22948
  // The workspace's stop count once this Stop was noted: set by the monolith alone. A send that saw a lower count is older than this Stop.
22949
22949
  stopNumber: external_exports.number().int().positive().optional()
22950
22950
  });
22951
+ turnStoppedSchema = external_exports.object({ byUserId: external_exports.string().optional() });
22952
+ engineInterruptChatRequestSchema = interruptChatRequestSchema.extend({ stopped: turnStoppedSchema.optional() });
22951
22953
  respondToolInputRequestSchema = external_exports.object({
22952
22954
  requestId: external_exports.string().min(1),
22953
22955
  selectionId: external_exports.string().min(1),
@@ -28641,6 +28643,11 @@ var init_utils = __esm({
28641
28643
  });
28642
28644
 
28643
28645
  // ../shared/src/display-message/format.ts
28646
+ function userMessageText(message2) {
28647
+ return message2.cancelled ? `[Cancelled before it started]
28648
+
28649
+ ${message2.content}` : message2.content;
28650
+ }
28644
28651
  function fileContentDiff(path12, content, action) {
28645
28652
  const lines = content.replace(/\n$/, "").split("\n");
28646
28653
  return [
@@ -38291,8 +38298,10 @@ function parseReplicasEvents(events) {
38291
38298
  messages.push({
38292
38299
  id: typeof messageId === "string" ? messageId : `replicas-user-${String(payload.seq)}`,
38293
38300
  type: "user",
38294
- content: `${event.type === `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message` ? "[Cancelled before it started]\n\n" : ""}${extractToolResultText(message2.content)}`,
38301
+ content: extractToolResultText(message2.content),
38295
38302
  ...images.length ? { images } : {},
38303
+ // 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.
38304
+ ...event.type === `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message` ? { cancelled: true, ...typeof payload.userId === "string" ? { senderUserId: payload.userId } : {} } : {},
38296
38305
  timestamp: timestamp2
38297
38306
  });
38298
38307
  return;
@@ -39081,12 +39090,18 @@ function applyInterruptions(messages, events) {
39081
39090
  const result = [...messages];
39082
39091
  for (const event of events) {
39083
39092
  if (event.type !== CHAT_INTERRUPTED_EVENT_TYPE) continue;
39084
- insertDisplayMessageByTimestamp(result, {
39093
+ const interruption = {
39085
39094
  id: `interruption-${event.timestamp}`,
39086
39095
  type: "interruption",
39087
39096
  timestamp: event.timestamp,
39088
39097
  ...event.payload.steered === true ? { steered: true } : {}
39089
- });
39098
+ };
39099
+ insertDisplayMessageByTimestamp(result, interruption);
39100
+ const at = result.indexOf(interruption);
39101
+ const stoppedMs = parseTimestampMs(event.timestamp);
39102
+ let to = at;
39103
+ for (let previous = result[to - 1]; previous?.type === "user" && previous.cancelled && stoppedMs - parseTimestampMs(previous.timestamp) <= STOP_CLOCK_SKEW_MS; previous = result[to - 1]) to--;
39104
+ if (to < at) result.splice(to, 0, ...result.splice(at, 1));
39090
39105
  }
39091
39106
  let lastUserMs = null;
39092
39107
  let lastInterruption = null;
@@ -39178,12 +39193,12 @@ function filterDisplayMessages(messages, provider2) {
39178
39193
  strippedUserContents.set(msg.content, stripped);
39179
39194
  }
39180
39195
  const { content, files, walkthroughs, appshots, annotations } = stripped;
39181
- if (INTERRUPTED_MESSAGE_REGEX.test(content)) {
39196
+ if (!msg.cancelled && INTERRUPTED_MESSAGE_REGEX.test(content)) {
39182
39197
  return [{ id: msg.id, type: "interruption", timestamp: msg.timestamp }];
39183
39198
  }
39184
39199
  const cleaned = withoutAttachmentPlaceholder(content, Boolean(msg.images?.length || files.length));
39185
39200
  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);
39201
+ const origin = msg.cancelled ? null : parseMessageOrigin(msg.content);
39187
39202
  if (cleaned === msg.content && !origin && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [msg];
39188
39203
  return [{
39189
39204
  ...msg,
@@ -39197,7 +39212,7 @@ function filterDisplayMessages(messages, provider2) {
39197
39212
  });
39198
39213
  return result;
39199
39214
  }
39200
- var INTERRUPTION_DEDUP_WINDOW_MS, strippedUserContents;
39215
+ var INTERRUPTION_DEDUP_WINDOW_MS, STOP_CLOCK_SKEW_MS, strippedUserContents;
39201
39216
  var init_parsers = __esm({
39202
39217
  "../shared/src/display-message/parsers/index.ts"() {
39203
39218
  "use strict";
@@ -39226,6 +39241,7 @@ var init_parsers = __esm({
39226
39241
  init_mcp();
39227
39242
  init_utils();
39228
39243
  INTERRUPTION_DEDUP_WINDOW_MS = 15e3;
39244
+ STOP_CLOCK_SKEW_MS = 5e3;
39229
39245
  strippedUserContents = /* @__PURE__ */ new Map();
39230
39246
  }
39231
39247
  });
@@ -40276,7 +40292,7 @@ var CLI_VERSION;
40276
40292
  var init_cli_version = __esm({
40277
40293
  "../shared/src/cli-version.ts"() {
40278
40294
  "use strict";
40279
- CLI_VERSION = "0.3.523";
40295
+ CLI_VERSION = "0.3.525";
40280
40296
  }
40281
40297
  });
40282
40298
 
@@ -54605,7 +54621,7 @@ function formatDisplayMessage(message2) {
54605
54621
  case "user":
54606
54622
  console.log(import_chalk22.default.blue(`
54607
54623
  [${time3}] USER:`));
54608
- console.log(import_chalk22.default.white(` ${truncate(message2.content, 500)}`));
54624
+ console.log(import_chalk22.default.white(` ${truncate(userMessageText(message2), 500)}`));
54609
54625
  break;
54610
54626
  case "agent":
54611
54627
  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.525",
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": {