replicas-cli 0.2.704 → 0.2.706

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 +50 -17
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -22556,6 +22556,11 @@ function isCredentialScope(value) {
22556
22556
  var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
22557
22557
  var workspaceCredentialProviderSchema = external_exports.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
22558
22558
  var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true });
22559
+ var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
22560
+ provider: external_exports.enum(VALID_CODING_AGENT_PROVIDERS)
22561
+ }).refine(({ provider, method }) => agentCredentialMethods(provider).includes(method), {
22562
+ message: "This inference provider is not supported by this agent"
22563
+ });
22559
22564
  var switchWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
22560
22565
  provider: workspaceCredentialProviderSchema
22561
22566
  }).refine(({ provider, method }) => agentCredentialMethods(provider).includes(method), {
@@ -25068,6 +25073,15 @@ function removeReplicasInstructions(text) {
25068
25073
  return removeTag(text, REPLICAS_INSTRUCTIONS_TAG);
25069
25074
  }
25070
25075
 
25076
+ // ../shared/src/user-message-matching.ts
25077
+ function parseTimestampMs(timestamp) {
25078
+ const value = typeof timestamp === "number" ? timestamp : Date.parse(timestamp);
25079
+ return Number.isFinite(value) ? value : 0;
25080
+ }
25081
+ function areUserMessagesWithinMatchWindow(a, b) {
25082
+ return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
25083
+ }
25084
+
25071
25085
  // ../shared/src/display-message/parsers/codex-asp-parser.ts
25072
25086
  function collectCodexTurns(events) {
25073
25087
  const turns = /* @__PURE__ */ new Map();
@@ -25335,6 +25349,25 @@ function parsePatch(input) {
25335
25349
  }
25336
25350
  return operations;
25337
25351
  }
25352
+ function takeRecordedPrompt(prompts7, echo, turnIndex) {
25353
+ const timestampMs = parseTimestampMs(echo.timestamp);
25354
+ let closestIndex = -1;
25355
+ let closestDistance = Infinity;
25356
+ for (let i = prompts7.length - 1; i >= 0; i--) {
25357
+ const candidate = prompts7[i];
25358
+ const distance = Math.abs(candidate.timestampMs - timestampMs);
25359
+ if (distance > closestDistance) continue;
25360
+ if (candidate.index >= turnIndex && !areUserMessagesWithinMatchWindow(
25361
+ { content: candidate.message.content, timestamp: candidate.timestampMs },
25362
+ { content: echo.content, timestamp: timestampMs }
25363
+ )) continue;
25364
+ const images = candidate.message.images;
25365
+ if (images && echo.images && (images.length !== echo.images.length || images.some((image, index) => image.mediaType !== echo.images?.[index].mediaType || image.data !== echo.images?.[index].data))) continue;
25366
+ closestIndex = i;
25367
+ closestDistance = distance;
25368
+ }
25369
+ return closestIndex === -1 ? void 0 : prompts7.splice(closestIndex, 1)[0].message;
25370
+ }
25338
25371
  function parseCodexEvents(events) {
25339
25372
  const messages = [];
25340
25373
  const turns = collectCodexTurns(events);
@@ -25518,26 +25551,35 @@ function parseCodexEvents(events) {
25518
25551
  }
25519
25552
  }
25520
25553
  });
25554
+ const recordedPrompts = /* @__PURE__ */ new Map();
25555
+ messages.forEach((message, index) => {
25556
+ if (message.type !== "user") return;
25557
+ const prompts7 = recordedPrompts.get(message.content) ?? [];
25558
+ prompts7.push({ message, index, timestampMs: parseTimestampMs(message.timestamp) });
25559
+ recordedPrompts.set(message.content, prompts7);
25560
+ });
25521
25561
  const claimedPrompts = /* @__PURE__ */ new Set();
25522
25562
  for (const { index, turnId } of turnInsertions.reverse()) {
25523
25563
  const turn = turns.get(turnId);
25524
25564
  if (!turn) continue;
25525
25565
  const kept = [];
25526
25566
  for (const message of messagesForCodexTurn(turn)) {
25527
- const recordedIndex = message.type === "user" ? messages.findLastIndex((candidate, candidateIndex) => candidateIndex < index && candidate.type === "user" && candidate.content === message.content && !claimedPrompts.has(candidateIndex)) : -1;
25528
- if (recordedIndex === -1) {
25567
+ if (message.type !== "user") {
25529
25568
  kept.push(message);
25530
25569
  continue;
25531
25570
  }
25532
- claimedPrompts.add(recordedIndex);
25533
- const recorded = messages[recordedIndex];
25534
- if (recorded.type === "user" && message.type === "user" && !recorded.images && message.images) {
25535
- messages[recordedIndex] = { ...recorded, images: message.images };
25571
+ const prompts7 = recordedPrompts.get(message.content);
25572
+ const recorded = prompts7 && takeRecordedPrompt(prompts7, message, index);
25573
+ if (!recorded) {
25574
+ kept.push(message);
25575
+ continue;
25536
25576
  }
25577
+ claimedPrompts.add(recorded);
25578
+ kept.push({ ...recorded, images: recorded.images ?? message.images });
25537
25579
  }
25538
25580
  messages.splice(index, 0, ...kept);
25539
25581
  }
25540
- return messages;
25582
+ return messages.filter((message) => !claimedPrompts.has(message));
25541
25583
  }
25542
25584
 
25543
25585
  // ../shared/src/display-message/parsers/cursor-parser.ts
@@ -26525,15 +26567,6 @@ function parseMcpToolName(name) {
26525
26567
  return { server, tool };
26526
26568
  }
26527
26569
 
26528
- // ../shared/src/user-message-matching.ts
26529
- function parseTimestampMs(timestamp) {
26530
- const value = Date.parse(timestamp);
26531
- return Number.isFinite(value) ? value : 0;
26532
- }
26533
- function areUserMessagesWithinMatchWindow(a, b) {
26534
- return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
26535
- }
26536
-
26537
26570
  // ../shared/src/display-message/parsers/claude-parser.ts
26538
26571
  var ABORTED_TERMINAL_REASONS = /* @__PURE__ */ new Set(["aborted_streaming", "aborted_tools"]);
26539
26572
  function createSubagentMessage(messageIndex, timestamp, fields) {
@@ -27375,7 +27408,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
27375
27408
  });
27376
27409
 
27377
27410
  // ../shared/src/cli-version.ts
27378
- var CLI_VERSION = "0.2.704";
27411
+ var CLI_VERSION = "0.2.706";
27379
27412
 
27380
27413
  // ../shared/src/version.ts
27381
27414
  function compareVersions(v1, v2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.704",
3
+ "version": "0.2.706",
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": {