replicas-cli 0.2.703 → 0.2.705

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 +60 -23
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -7856,6 +7856,7 @@ var CREDENTIAL_METHOD = {
7856
7856
  OAUTH: "oauth",
7857
7857
  API_KEY: "api_key",
7858
7858
  OPENAI_COMPATIBLE: "openai-compatible",
7859
+ OLLAMA: "ollama",
7859
7860
  FOUNDRY: "foundry",
7860
7861
  BEDROCK: "bedrock",
7861
7862
  OPENCODE_GO: "opencode-go",
@@ -7872,6 +7873,7 @@ var CREDENTIAL_TYPE = {
7872
7873
  CODEX_OAUTH: "codex",
7873
7874
  OPENAI_API_KEY: "openai_api_key",
7874
7875
  OPENAI_COMPATIBLE: "openai_compatible",
7876
+ OLLAMA: "ollama",
7875
7877
  CODEX_FOUNDRY: "codex_foundry",
7876
7878
  CURSOR_API_KEY: "cursor_api_key",
7877
7879
  OPENCODE_GO_API_KEY: "opencode_go_api_key",
@@ -7883,6 +7885,7 @@ var CREDENTIAL_TYPE = {
7883
7885
  MUSE_API_KEY: "muse_api_key"
7884
7886
  };
7885
7887
  var INFERENCE_PROVIDER_LABELS = {
7888
+ [CREDENTIAL_METHOD.OLLAMA]: "Ollama",
7886
7889
  [CREDENTIAL_METHOD.OPENCODE_GO]: "OpenCode Go",
7887
7890
  [CREDENTIAL_METHOD.ASTER]: "Aster",
7888
7891
  [CREDENTIAL_METHOD.OPENROUTER]: "OpenRouter"
@@ -7892,19 +7895,22 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
7892
7895
  { method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CLAUDE_OAUTH },
7893
7896
  { method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.ANTHROPIC_API_KEY },
7894
7897
  { method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CLAUDE_FOUNDRY },
7895
- { method: CREDENTIAL_METHOD.BEDROCK, credentialType: CREDENTIAL_TYPE.CLAUDE_BEDROCK }
7898
+ { method: CREDENTIAL_METHOD.BEDROCK, credentialType: CREDENTIAL_TYPE.CLAUDE_BEDROCK },
7899
+ { method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
7896
7900
  ],
7897
7901
  [AGENT.CODEX]: [
7898
7902
  { method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CODEX_OAUTH },
7899
7903
  { method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.OPENAI_API_KEY },
7900
7904
  { method: CREDENTIAL_METHOD.OPENAI_COMPATIBLE, credentialType: CREDENTIAL_TYPE.OPENAI_COMPATIBLE },
7901
- { method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CODEX_FOUNDRY }
7905
+ { method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CODEX_FOUNDRY },
7906
+ { method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
7902
7907
  ],
7903
7908
  [AGENT.CURSOR]: [
7904
7909
  { method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.CURSOR_API_KEY }
7905
7910
  ],
7906
7911
  [AGENT.DEEPSEEK]: [
7907
- { method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY }
7912
+ { method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY },
7913
+ { method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
7908
7914
  ],
7909
7915
  [AGENT.FX]: [
7910
7916
  { method: CREDENTIAL_METHOD.AI_GATEWAY, credentialType: CREDENTIAL_TYPE.AI_GATEWAY_API_KEY }
@@ -7913,7 +7919,8 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
7913
7919
  { method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.GEMINI_API_KEY }
7914
7920
  ],
7915
7921
  [AGENT.KIMI]: [
7916
- { method: CREDENTIAL_METHOD.AI_GATEWAY, credentialType: CREDENTIAL_TYPE.AI_GATEWAY_API_KEY }
7922
+ { method: CREDENTIAL_METHOD.AI_GATEWAY, credentialType: CREDENTIAL_TYPE.AI_GATEWAY_API_KEY },
7923
+ { method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
7917
7924
  ],
7918
7925
  [AGENT.MUSE]: [
7919
7926
  { method: CREDENTIAL_METHOD.MUSE_OAUTH, credentialType: CREDENTIAL_TYPE.MUSE_OAUTH },
@@ -7922,12 +7929,14 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
7922
7929
  [AGENT.OPENCODE]: [
7923
7930
  { method: CREDENTIAL_METHOD.OPENCODE_GO, credentialType: CREDENTIAL_TYPE.OPENCODE_GO_API_KEY },
7924
7931
  { method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
7925
- { method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY }
7932
+ { method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY },
7933
+ { method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
7926
7934
  ],
7927
7935
  [AGENT.PI]: [
7928
7936
  { method: CREDENTIAL_METHOD.OPENCODE_GO, credentialType: CREDENTIAL_TYPE.OPENCODE_GO_API_KEY },
7929
7937
  { method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
7930
- { method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY }
7938
+ { method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY },
7939
+ { method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
7931
7940
  ]
7932
7941
  };
7933
7942
  function agentCredentialMethods(agent) {
@@ -25059,6 +25068,15 @@ function removeReplicasInstructions(text) {
25059
25068
  return removeTag(text, REPLICAS_INSTRUCTIONS_TAG);
25060
25069
  }
25061
25070
 
25071
+ // ../shared/src/user-message-matching.ts
25072
+ function parseTimestampMs(timestamp) {
25073
+ const value = typeof timestamp === "number" ? timestamp : Date.parse(timestamp);
25074
+ return Number.isFinite(value) ? value : 0;
25075
+ }
25076
+ function areUserMessagesWithinMatchWindow(a, b) {
25077
+ return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
25078
+ }
25079
+
25062
25080
  // ../shared/src/display-message/parsers/codex-asp-parser.ts
25063
25081
  function collectCodexTurns(events) {
25064
25082
  const turns = /* @__PURE__ */ new Map();
@@ -25326,6 +25344,25 @@ function parsePatch(input) {
25326
25344
  }
25327
25345
  return operations;
25328
25346
  }
25347
+ function takeRecordedPrompt(prompts7, echo, turnIndex) {
25348
+ const timestampMs = parseTimestampMs(echo.timestamp);
25349
+ let closestIndex = -1;
25350
+ let closestDistance = Infinity;
25351
+ for (let i = prompts7.length - 1; i >= 0; i--) {
25352
+ const candidate = prompts7[i];
25353
+ const distance = Math.abs(candidate.timestampMs - timestampMs);
25354
+ if (distance > closestDistance) continue;
25355
+ if (candidate.index >= turnIndex && !areUserMessagesWithinMatchWindow(
25356
+ { content: candidate.message.content, timestamp: candidate.timestampMs },
25357
+ { content: echo.content, timestamp: timestampMs }
25358
+ )) continue;
25359
+ const images = candidate.message.images;
25360
+ 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;
25361
+ closestIndex = i;
25362
+ closestDistance = distance;
25363
+ }
25364
+ return closestIndex === -1 ? void 0 : prompts7.splice(closestIndex, 1)[0].message;
25365
+ }
25329
25366
  function parseCodexEvents(events) {
25330
25367
  const messages = [];
25331
25368
  const turns = collectCodexTurns(events);
@@ -25509,26 +25546,35 @@ function parseCodexEvents(events) {
25509
25546
  }
25510
25547
  }
25511
25548
  });
25549
+ const recordedPrompts = /* @__PURE__ */ new Map();
25550
+ messages.forEach((message, index) => {
25551
+ if (message.type !== "user") return;
25552
+ const prompts7 = recordedPrompts.get(message.content) ?? [];
25553
+ prompts7.push({ message, index, timestampMs: parseTimestampMs(message.timestamp) });
25554
+ recordedPrompts.set(message.content, prompts7);
25555
+ });
25512
25556
  const claimedPrompts = /* @__PURE__ */ new Set();
25513
25557
  for (const { index, turnId } of turnInsertions.reverse()) {
25514
25558
  const turn = turns.get(turnId);
25515
25559
  if (!turn) continue;
25516
25560
  const kept = [];
25517
25561
  for (const message of messagesForCodexTurn(turn)) {
25518
- const recordedIndex = message.type === "user" ? messages.findLastIndex((candidate, candidateIndex) => candidateIndex < index && candidate.type === "user" && candidate.content === message.content && !claimedPrompts.has(candidateIndex)) : -1;
25519
- if (recordedIndex === -1) {
25562
+ if (message.type !== "user") {
25520
25563
  kept.push(message);
25521
25564
  continue;
25522
25565
  }
25523
- claimedPrompts.add(recordedIndex);
25524
- const recorded = messages[recordedIndex];
25525
- if (recorded.type === "user" && message.type === "user" && !recorded.images && message.images) {
25526
- messages[recordedIndex] = { ...recorded, images: message.images };
25566
+ const prompts7 = recordedPrompts.get(message.content);
25567
+ const recorded = prompts7 && takeRecordedPrompt(prompts7, message, index);
25568
+ if (!recorded) {
25569
+ kept.push(message);
25570
+ continue;
25527
25571
  }
25572
+ claimedPrompts.add(recorded);
25573
+ kept.push({ ...recorded, images: recorded.images ?? message.images });
25528
25574
  }
25529
25575
  messages.splice(index, 0, ...kept);
25530
25576
  }
25531
- return messages;
25577
+ return messages.filter((message) => !claimedPrompts.has(message));
25532
25578
  }
25533
25579
 
25534
25580
  // ../shared/src/display-message/parsers/cursor-parser.ts
@@ -26516,15 +26562,6 @@ function parseMcpToolName(name) {
26516
26562
  return { server, tool };
26517
26563
  }
26518
26564
 
26519
- // ../shared/src/user-message-matching.ts
26520
- function parseTimestampMs(timestamp) {
26521
- const value = Date.parse(timestamp);
26522
- return Number.isFinite(value) ? value : 0;
26523
- }
26524
- function areUserMessagesWithinMatchWindow(a, b) {
26525
- return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
26526
- }
26527
-
26528
26565
  // ../shared/src/display-message/parsers/claude-parser.ts
26529
26566
  var ABORTED_TERMINAL_REASONS = /* @__PURE__ */ new Set(["aborted_streaming", "aborted_tools"]);
26530
26567
  function createSubagentMessage(messageIndex, timestamp, fields) {
@@ -27366,7 +27403,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
27366
27403
  });
27367
27404
 
27368
27405
  // ../shared/src/cli-version.ts
27369
- var CLI_VERSION = "0.2.703";
27406
+ var CLI_VERSION = "0.2.705";
27370
27407
 
27371
27408
  // ../shared/src/version.ts
27372
27409
  function compareVersions(v1, v2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.703",
3
+ "version": "0.2.705",
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": {