replicas-cli 0.3.179 → 0.3.180

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 +47 -24
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -16640,7 +16640,7 @@ function parseCodexTurnRetryPayload(payload) {
16640
16640
  const { attempt, maxAttempts, [CODEX_ASP_ITEM_ID_PAYLOAD_KEY]: turnId } = payload;
16641
16641
  return typeof attempt === "number" && typeof maxAttempts === "number" && typeof turnId === "string" ? { attempt, maxAttempts, [CODEX_ASP_ITEM_ID_PAYLOAD_KEY]: turnId } : void 0;
16642
16642
  }
16643
- var CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE, ACCEPTED_USER_MESSAGE_SOURCE, QUEUED_MESSAGE_REMOVED_EVENT_TYPE, REMOVED_MESSAGE_IDS_PAYLOAD_KEY, USER_MESSAGE_ID_PAYLOAD_KEY, CODEX_ASP_ITEM_ID_PAYLOAD_KEY, CODEX_ITEM_EVENT_TYPE, CODEX_ITEM_PARTIAL_EVENT_TYPE, CODEX_TURN_EVENT_TYPE, CODEX_TURN_RETRY_EVENT_TYPE, CODEX_QUOTA_STATUS_EVENT_TYPE, CHAT_INTERRUPTED_EVENT_TYPE, CHAT_MESSAGE_REJECTED_EVENT_TYPE, CHAT_TURN_LOST_EVENT_TYPE, AUTH_FALLBACK_EVENT_TYPE;
16643
+ var CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE, ACCEPTED_USER_MESSAGE_SOURCE, QUEUED_MESSAGE_REMOVED_EVENT_TYPE, REMOVED_MESSAGE_IDS_PAYLOAD_KEY, USER_MESSAGE_ID_PAYLOAD_KEY, REPLACED_MESSAGE_ID_PAYLOAD_KEY, CODEX_ASP_ITEM_ID_PAYLOAD_KEY, CODEX_ITEM_EVENT_TYPE, CODEX_ITEM_PARTIAL_EVENT_TYPE, CODEX_TURN_EVENT_TYPE, CODEX_TURN_RETRY_EVENT_TYPE, CODEX_QUOTA_STATUS_EVENT_TYPE, CHAT_INTERRUPTED_EVENT_TYPE, CHAT_MESSAGE_REJECTED_EVENT_TYPE, CHAT_TURN_LOST_EVENT_TYPE, AUTH_FALLBACK_EVENT_TYPE;
16644
16644
  var init_event = __esm({
16645
16645
  "../shared/src/event.ts"() {
16646
16646
  "use strict";
@@ -16653,6 +16653,7 @@ var init_event = __esm({
16653
16653
  QUEUED_MESSAGE_REMOVED_EVENT_TYPE = "replicas-queued-message-removed";
16654
16654
  REMOVED_MESSAGE_IDS_PAYLOAD_KEY = "removedMessageIds";
16655
16655
  USER_MESSAGE_ID_PAYLOAD_KEY = "replicasMessageId";
16656
+ REPLACED_MESSAGE_ID_PAYLOAD_KEY = "replicasReplacedMessageId";
16656
16657
  CODEX_ASP_ITEM_ID_PAYLOAD_KEY = "codexAspItemId";
16657
16658
  CODEX_ITEM_EVENT_TYPE = "codex-item";
16658
16659
  CODEX_ITEM_PARTIAL_EVENT_TYPE = "codex-item-partial";
@@ -16806,7 +16807,8 @@ var init_v1 = __esm({
16806
16807
  senderDisplayName: external_exports.string().optional(),
16807
16808
  senderAvatarUrl: external_exports.string().optional(),
16808
16809
  errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
16809
- errorNotificationTargets: external_exports.array(integrationErrorNotificationTargetSchema).optional()
16810
+ errorNotificationTargets: external_exports.array(integrationErrorNotificationTargetSchema).optional(),
16811
+ replacesMessageId: external_exports.string().min(1).max(256).optional()
16810
16812
  }).passthrough();
16811
16813
  CODEX_ITEM_FIELD_CHECKS = {
16812
16814
  userMessage: (item) => typeof item.content === "string",
@@ -28841,6 +28843,7 @@ function parseCodexEvents(events) {
28841
28843
  const turn = turns.get(turnId);
28842
28844
  if (!turn) continue;
28843
28845
  const kept = [];
28846
+ let opened = false;
28844
28847
  for (const message2 of messagesForCodexTurn(turn)) {
28845
28848
  if (retriedTurnIds.has(turnId)) {
28846
28849
  if (message2.type === "error") continue;
@@ -28855,17 +28858,17 @@ function parseCodexEvents(events) {
28855
28858
  }
28856
28859
  const prompts3 = recordedPrompts.get(stripReplicasInstructionBlock(message2.content));
28857
28860
  const recorded = prompts3 && takeRecordedPrompt(prompts3, message2, index);
28858
- if (!recorded) {
28859
- kept.push(message2);
28860
- continue;
28861
- }
28862
- claimedPrompts.add(recorded);
28863
- kept.push({ ...recorded, images: recorded.images ?? message2.images });
28861
+ if (recorded) claimedPrompts.add(recorded);
28862
+ const prompt = recorded ? { ...recorded, images: recorded.images ?? message2.images } : message2;
28863
+ if (!opened) promptTurnIds.set(prompt, turnId);
28864
+ opened = true;
28865
+ kept.push(prompt);
28864
28866
  }
28865
28867
  messages.splice(index, 0, ...kept);
28866
28868
  }
28867
28869
  return messages.filter((message2) => !claimedPrompts.has(message2));
28868
28870
  }
28871
+ var promptTurnIds;
28869
28872
  var init_codex_parser = __esm({
28870
28873
  "../shared/src/display-message/parsers/codex-parser.ts"() {
28871
28874
  "use strict";
@@ -28877,6 +28880,7 @@ var init_codex_parser = __esm({
28877
28880
  init_utils();
28878
28881
  init_format2();
28879
28882
  init_codex_asp_parser();
28883
+ promptTurnIds = /* @__PURE__ */ new WeakMap();
28880
28884
  }
28881
28885
  });
28882
28886
 
@@ -30234,8 +30238,7 @@ var init_claude_parser = __esm({
30234
30238
  });
30235
30239
 
30236
30240
  // ../shared/src/display-message/parsers/index.ts
30237
- function parseAgentEvents(events, agentType) {
30238
- events = excludeQueuedAcceptedEvents(events, []);
30241
+ function parseProviderEvents(events, agentType, parentToolUseId) {
30239
30242
  if (agentType === "codex") {
30240
30243
  return parseCodexEvents(events);
30241
30244
  }
@@ -30251,21 +30254,37 @@ function parseAgentEvents(events, agentType) {
30251
30254
  if (agentType === "pi") {
30252
30255
  return parsePiEvents(events);
30253
30256
  }
30254
- return parseClaudeEvents(events);
30257
+ return parseClaudeEvents(events, parentToolUseId);
30255
30258
  }
30256
30259
  function parseDisplayMessages(events, agentType, options = {}) {
30257
- events = excludeQueuedAcceptedEvents(events, []);
30258
- const parsedEvents = agentType === "claude" ? parseClaudeEvents(events, options.parentToolUseId) : parseAgentEvents(events, agentType);
30259
- const reconciledEvents = [];
30260
- for (const message2 of parsedEvents) {
30261
- if (message2.type === "user") upsertDisplayMessage(reconciledEvents, message2);
30262
- else reconciledEvents.push(message2);
30263
- }
30264
- if (options.filter === false) return reconciledEvents;
30265
- return applyEngineNotices(
30266
- applyInterruptions(filterDisplayMessages(reconciledEvents, agentType), events),
30267
- events
30268
- );
30260
+ return withoutReplacedMessages(excludeQueuedAcceptedEvents(events, []), (segment) => {
30261
+ const parsedEvents = parseProviderEvents(segment, agentType, options.parentToolUseId);
30262
+ const reconciledEvents = [];
30263
+ for (const message2 of parsedEvents) {
30264
+ if (message2.type === "user") upsertDisplayMessage(reconciledEvents, message2);
30265
+ else reconciledEvents.push(message2);
30266
+ }
30267
+ if (options.filter === false) return reconciledEvents;
30268
+ return applyEngineNotices(
30269
+ applyInterruptions(filterDisplayMessages(reconciledEvents, agentType), segment),
30270
+ segment
30271
+ );
30272
+ });
30273
+ }
30274
+ function withoutReplacedMessages(events, parse3) {
30275
+ let kept = [];
30276
+ let start = 0;
30277
+ const handled = /* @__PURE__ */ new Set();
30278
+ events.forEach((event, index) => {
30279
+ const replaced = getReplacedMessageId(event);
30280
+ if (replaced === null || handled.has(replaced)) return;
30281
+ handled.add(replaced);
30282
+ if (index === 0) return;
30283
+ kept.push(...parse3(events.slice(start, index)));
30284
+ kept = kept.slice(0, Math.max(0, kept.findIndex(({ id }) => id === replaced)));
30285
+ start = index;
30286
+ });
30287
+ return start === 0 ? parse3(events) : [...kept, ...parse3(events.slice(start))];
30269
30288
  }
30270
30289
  function applyInterruptions(messages, events) {
30271
30290
  const result = [...messages];
@@ -30435,6 +30454,10 @@ function getUserMessageId(event) {
30435
30454
  const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
30436
30455
  return typeof messageId === "string" ? messageId : null;
30437
30456
  }
30457
+ function getReplacedMessageId(event) {
30458
+ const messageId = event.payload[REPLACED_MESSAGE_ID_PAYLOAD_KEY];
30459
+ return typeof messageId === "string" ? messageId : null;
30460
+ }
30438
30461
  function getRemovedMessageIds(event) {
30439
30462
  if (event.type !== QUEUED_MESSAGE_REMOVED_EVENT_TYPE) return [];
30440
30463
  const messageIds = event.payload[REMOVED_MESSAGE_IDS_PAYLOAD_KEY];
@@ -31088,7 +31111,7 @@ var CLI_VERSION;
31088
31111
  var init_cli_version = __esm({
31089
31112
  "../shared/src/cli-version.ts"() {
31090
31113
  "use strict";
31091
- CLI_VERSION = "0.3.179";
31114
+ CLI_VERSION = "0.3.180";
31092
31115
  }
31093
31116
  });
31094
31117
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.179",
3
+ "version": "0.3.180",
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": {