replicas-engine 0.1.1315 → 0.1.1318

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.
@@ -8,12 +8,12 @@ import {
8
8
  listRunningCodexModels,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-NLBGKIXF.js";
12
- import "./chunk-KJL7WKAT.js";
13
- import "./chunk-6ZNT2UKY.js";
14
- import "./chunk-YPGEGHAO.js";
11
+ } from "./chunk-ORM5QECI.js";
12
+ import "./chunk-56WDCAN2.js";
13
+ import "./chunk-QLDS5LTC.js";
14
+ import "./chunk-2MCGQBB5.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-WS3GVLJ2.js";
16
+ import "./chunk-LLSE2EKJ.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-WS3GVLJ2.js";
6
+ } from "./chunk-LLSE2EKJ.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-YPGEGHAO.js";
7
+ } from "./chunk-2MCGQBB5.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -21,7 +21,7 @@ import {
21
21
  provisionedDeviceSchema,
22
22
  readReplicasRuntimeEnv,
23
23
  serializePosixEnvFile
24
- } from "./chunk-WS3GVLJ2.js";
24
+ } from "./chunk-LLSE2EKJ.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -89,7 +89,7 @@ function requireValidURL(value, name) {
89
89
  }
90
90
  }
91
91
  function parseClaudeAuthMethod(value) {
92
- if (value === "ollama" || value === "oauth" || value === "api_key" || value === "bedrock" || value === "foundry") {
92
+ if (value === "ollama" || value === "oauth" || value === "api_key" || value === "anthropic-compatible" || value === "bedrock" || value === "foundry") {
93
93
  return value;
94
94
  }
95
95
  return void 0;
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-6ZNT2UKY.js";
6
+ } from "./chunk-QLDS5LTC.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -15,7 +15,7 @@ import {
15
15
  isRecord,
16
16
  readOllamaAuthEnv,
17
17
  readOpenAICompatibleAuthEnv
18
- } from "./chunk-WS3GVLJ2.js";
18
+ } from "./chunk-LLSE2EKJ.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -1139,6 +1139,7 @@ var CREDENTIAL_SCOPE_PRIORITY = [CREDENTIAL_SCOPE.USER, CREDENTIAL_SCOPE.ORG];
1139
1139
  var CREDENTIAL_METHOD = {
1140
1140
  OAUTH: "oauth",
1141
1141
  API_KEY: "api_key",
1142
+ ANTHROPIC_COMPATIBLE: "anthropic-compatible",
1142
1143
  OPENAI_COMPATIBLE: "openai-compatible",
1143
1144
  OLLAMA: "ollama",
1144
1145
  FOUNDRY: "foundry",
@@ -1151,6 +1152,7 @@ var CREDENTIAL_METHOD = {
1151
1152
  var CREDENTIAL_TYPE = {
1152
1153
  CLAUDE_OAUTH: "claude",
1153
1154
  ANTHROPIC_API_KEY: "claude_anthropic_api_key",
1155
+ ANTHROPIC_COMPATIBLE: "anthropic_compatible",
1154
1156
  CLAUDE_FOUNDRY: "claude_foundry",
1155
1157
  CLAUDE_BEDROCK: "claude_bedrock",
1156
1158
  CODEX_OAUTH: "codex",
@@ -1183,12 +1185,14 @@ var INFERENCE_PROVIDER_LABELS = {
1183
1185
  [CREDENTIAL_METHOD.OPENCODE_GO]: "OpenCode Go",
1184
1186
  [CREDENTIAL_METHOD.ASTER]: "Aster",
1185
1187
  [CREDENTIAL_METHOD.OPENROUTER]: "OpenRouter",
1186
- [CREDENTIAL_METHOD.OPENAI_COMPATIBLE]: "OpenAI-compatible endpoint"
1188
+ [CREDENTIAL_METHOD.OPENAI_COMPATIBLE]: "OpenAI-compatible endpoint",
1189
+ [CREDENTIAL_METHOD.ANTHROPIC_COMPATIBLE]: "Anthropic-compatible endpoint"
1187
1190
  };
1188
1191
  var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
1189
1192
  [AGENT.CLAUDE]: [
1190
1193
  { method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CLAUDE_OAUTH },
1191
1194
  { method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.ANTHROPIC_API_KEY },
1195
+ { method: CREDENTIAL_METHOD.ANTHROPIC_COMPATIBLE, credentialType: CREDENTIAL_TYPE.ANTHROPIC_COMPATIBLE },
1192
1196
  { method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CLAUDE_FOUNDRY },
1193
1197
  { method: CREDENTIAL_METHOD.BEDROCK, credentialType: CREDENTIAL_TYPE.CLAUDE_BEDROCK },
1194
1198
  { method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
@@ -1244,6 +1248,7 @@ function getCredentialMethodLabel(agent, method) {
1244
1248
  case CREDENTIAL_METHOD.ASTER:
1245
1249
  case CREDENTIAL_METHOD.OPENROUTER:
1246
1250
  case CREDENTIAL_METHOD.OPENAI_COMPATIBLE:
1251
+ case CREDENTIAL_METHOD.ANTHROPIC_COMPATIBLE:
1247
1252
  return INFERENCE_PROVIDER_LABELS[method];
1248
1253
  case CREDENTIAL_METHOD.MUSE_OAUTH:
1249
1254
  return "Muse account";
@@ -1638,7 +1643,8 @@ var sendChatMessageRequestSchema = z4.object({
1638
1643
  senderAvatarUrl: z4.string().optional(),
1639
1644
  errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
1640
1645
  errorNotificationTargets: z4.array(integrationErrorNotificationTargetSchema).optional(),
1641
- replacesMessageId: z4.string().min(1).max(256).optional()
1646
+ replacesMessageId: z4.string().min(1).max(256).optional(),
1647
+ steer: z4.union([z4.boolean(), z4.literal("alone")]).optional()
1642
1648
  }).passthrough();
1643
1649
  function isChatMessageSender(value) {
1644
1650
  return isRecord(value) && (value.messageId === void 0 || typeof value.messageId === "string") && typeof value.senderUserId === "string" && typeof value.senderEmail === "string" && typeof value.recordedAt === "string";
@@ -1821,11 +1827,20 @@ function applyCodexAspTranscriptDelta(current, delta) {
1821
1827
  turns
1822
1828
  };
1823
1829
  }
1830
+ async function steerQueuedInOrder(queue, messageId, steer) {
1831
+ const ids = queue.slice(0, queue.findIndex(({ id }) => id === messageId) + 1).filter(({ steeredAt }) => !steeredAt).map(({ id }) => id);
1832
+ if (ids.at(-1) !== messageId) return false;
1833
+ for (const id of ids) {
1834
+ if (!await steer(id)) return false;
1835
+ }
1836
+ return true;
1837
+ }
1824
1838
  var sendChatMessageResponseSchema = z4.object({
1825
1839
  messageId: z4.string(),
1826
1840
  queued: z4.boolean(),
1827
1841
  position: z4.number(),
1828
- chatId: z4.string().optional()
1842
+ chatId: z4.string().optional(),
1843
+ steered: z4.boolean().optional()
1829
1844
  });
1830
1845
  function isLatestChatHistoryPage(params) {
1831
1846
  return params.beforeCursor === void 0 && params.beforeEvent === void 0 && params.beforeTurn === void 0;
@@ -5931,25 +5946,18 @@ function fileContentDiff(path, content, action) {
5931
5946
  ].join("\n");
5932
5947
  }
5933
5948
  var SEARCH_COMMANDS = /* @__PURE__ */ new Set(["grep", "rg"]);
5934
- var OPTION_VALUE_FLAGS = /* @__PURE__ */ new Set([
5935
- "-A",
5936
- "-B",
5937
- "-C",
5938
- "-e",
5939
- "-f",
5940
- "-m",
5941
- "--after-context",
5942
- "--before-context",
5943
- "--context",
5944
- "--glob",
5945
- "--max-count",
5946
- "--regexp"
5947
- ]);
5948
- var LINE_COUNT_VALUE_FLAGS = /* @__PURE__ */ new Set([
5949
- "-c",
5950
- "-n",
5951
- "--lines"
5952
- ]);
5949
+ var LINE_COUNT_VALUE_FLAGS = /* @__PURE__ */ new Set(["-c", "-n", "--bytes", "--lines"]);
5950
+ var SEARCH_VALUE_FLAGS = ["-A", "-B", "-C", "-d", "-e", "-f", "-m", "--after-context", "--before-context", "--context", "--file", "--max-count", "--regexp"];
5951
+ var VALUE_FLAGS = {
5952
+ grep: /* @__PURE__ */ new Set([...SEARCH_VALUE_FLAGS, "-D", "--devices", "--directories", "--exclude", "--exclude-dir", "--include"]),
5953
+ rg: /* @__PURE__ */ new Set([...SEARCH_VALUE_FLAGS, "-E", "-M", "-T", "-g", "-j", "-t", "--encoding", "--glob", "--iglob", "--max-columns", "--max-depth", "--sort", "--sortr", "--threads", "--type", "--type-add", "--type-not"]),
5954
+ head: LINE_COUNT_VALUE_FLAGS,
5955
+ tail: LINE_COUNT_VALUE_FLAGS,
5956
+ ls: /* @__PURE__ */ new Set(["-I", "-T", "-w", "--hide", "--ignore", "--tabsize", "--width"]),
5957
+ nl: /* @__PURE__ */ new Set(["-b", "-d", "-f", "-h", "-i", "-l", "-n", "-s", "-v", "-w"]),
5958
+ tree: /* @__PURE__ */ new Set(["-I", "-L", "-P", "--filelimit"])
5959
+ };
5960
+ var PATTERN_FLAGS = /* @__PURE__ */ new Set(["-e", "-f", "--file", "--regexp"]);
5953
5961
  var SCRIPT_ROOT = "/";
5954
5962
  var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
5955
5963
  var fileWrites = ({ writes }) => writes.filter(({ path }) => path !== "/dev/null");
@@ -5971,15 +5979,15 @@ function skillNamesFromCommand(command) {
5971
5979
  });
5972
5980
  })));
5973
5981
  }
5974
- function pathArgs(words, extraValueFlags) {
5982
+ function pathArgs(command, words) {
5975
5983
  const paths = [];
5976
5984
  for (let i = 0; i < words.length; i++) {
5977
5985
  const word = words[i];
5978
- if (OPTION_VALUE_FLAGS.has(word) || extraValueFlags?.has(word)) {
5986
+ const valueAt = /^-[A-Za-z]{2,}$/.test(word) ? [...word.slice(1)].findIndex((letter) => VALUE_FLAGS[command]?.has(`-${letter}`)) : -1;
5987
+ if (VALUE_FLAGS[command]?.has(word) || valueAt >= 0 && valueAt === word.length - 2) {
5979
5988
  i++;
5980
5989
  continue;
5981
5990
  }
5982
- if (word.startsWith("--glob=") || word.startsWith("--regexp=")) continue;
5983
5991
  if (word.startsWith("-")) continue;
5984
5992
  paths.push(word);
5985
5993
  }
@@ -5987,8 +5995,13 @@ function pathArgs(words, extraValueFlags) {
5987
5995
  }
5988
5996
  function readCommandPaths(command, words) {
5989
5997
  if (SEARCH_COMMANDS.has(command)) {
5990
- const args = pathArgs(words.slice(1));
5991
- return args.slice(1);
5998
+ const args = pathArgs(command, words.slice(1));
5999
+ return words.some((word) => PATTERN_FLAGS.has(word) || /^-[A-Za-z]+[ef]$/.test(word) || /^--(file|regexp)=/.test(word)) ? args : args.slice(1);
6000
+ }
6001
+ if (command === "find") {
6002
+ const paths = words.slice(1).filter((word) => !/^(-[HLP]|-O\d|--)$/.test(word));
6003
+ const expression = paths.findIndex((word) => word.startsWith("-") || word === "(" || word === "!");
6004
+ return expression === -1 ? paths : paths.slice(0, expression);
5992
6005
  }
5993
6006
  if (command === "sed") {
5994
6007
  const paths = [];
@@ -6014,7 +6027,7 @@ function readCommandPaths(command, words) {
6014
6027
  }
6015
6028
  return Array.from(new Set(paths));
6016
6029
  }
6017
- return pathArgs(words.slice(1), command === "head" || command === "tail" ? LINE_COUNT_VALUE_FLAGS : void 0);
6030
+ return pathArgs(command, words.slice(1));
6018
6031
  }
6019
6032
  function writesFiles(name, argv) {
6020
6033
  if (name === "sed") return argv.some((word) => /^(-[a-zA-Z]*i|--in-place)/.test(word));
@@ -9170,6 +9183,9 @@ function parseGoalCommand(message2) {
9170
9183
  if (!value) return null;
9171
9184
  return classifyGoalValue(value);
9172
9185
  }
9186
+ function isCompactCommand(message2) {
9187
+ return /^\/compact$/i.test(message2.trim());
9188
+ }
9173
9189
  function getGoalCommand(message2, goalMode) {
9174
9190
  if (!goalMode) return parseGoalCommand(message2);
9175
9191
  const value = message2.trim();
@@ -9443,6 +9459,7 @@ var CODEX_AUTH_ENV_KEYS_BY_METHOD = {
9443
9459
  "REPLICAS_CODEX_AUTH_METHOD"
9444
9460
  ],
9445
9461
  ollama: ["OPENAI_API_KEY", "CODEX_OPENAI_BASE_URL", "REPLICAS_CODEX_AUTH_METHOD", "REPLICAS_CODEX_OLLAMA_API_KEY", "REPLICAS_CODEX_OLLAMA_BASE_URL"],
9462
+ "anthropic-compatible": [],
9446
9463
  bedrock: [],
9447
9464
  foundry: ["AZURE_OPENAI_API_KEY", "CODEX_FOUNDRY_BASE_URL", "CODEX_FOUNDRY_MODEL", "REPLICAS_CODEX_AUTH_METHOD"]
9448
9465
  };
@@ -9469,11 +9486,12 @@ var CLAUDE_AUTH_ENV_KEYS = [
9469
9486
  function claudeAuthEnvFromResponse(response) {
9470
9487
  switch (response.type) {
9471
9488
  case "ollama":
9489
+ case "anthropic-compatible":
9472
9490
  return {
9473
9491
  ANTHROPIC_API_KEY: "",
9474
9492
  ANTHROPIC_AUTH_TOKEN: response.apiKey,
9475
9493
  ANTHROPIC_BASE_URL: response.baseUrl,
9476
- REPLICAS_CLAUDE_AUTH_METHOD: "ollama"
9494
+ REPLICAS_CLAUDE_AUTH_METHOD: response.type
9477
9495
  };
9478
9496
  case "oauth":
9479
9497
  return response.refreshToken ? { REPLICAS_CLAUDE_AUTH_METHOD: "oauth" } : { CLAUDE_CODE_OAUTH_TOKEN: response.accessToken, REPLICAS_CLAUDE_AUTH_METHOD: "oauth" };
@@ -9506,6 +9524,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
9506
9524
  api_key: ["ANTHROPIC_API_KEY", "REPLICAS_CLAUDE_AUTH_METHOD"],
9507
9525
  "openai-compatible": [],
9508
9526
  ollama: ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL", "REPLICAS_CLAUDE_AUTH_METHOD"],
9527
+ "anthropic-compatible": ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL", "REPLICAS_CLAUDE_AUTH_METHOD"],
9509
9528
  bedrock: [
9510
9529
  "CLAUDE_CODE_USE_BEDROCK",
9511
9530
  "AWS_ACCESS_KEY_ID",
@@ -10830,6 +10849,7 @@ export {
10830
10849
  codexItemFromEvent,
10831
10850
  codexTurnFromEvent,
10832
10851
  codexTranscriptToEvents,
10852
+ steerQueuedInOrder,
10833
10853
  isLatestChatHistoryPage,
10834
10854
  getChatHistoryPageSenders,
10835
10855
  parseChatHistoryCursor,
@@ -10931,6 +10951,7 @@ export {
10931
10951
  mergeSlashCommands,
10932
10952
  getSlashCommandsForProvider,
10933
10953
  MAX_CODEX_GOAL_OBJECTIVE_CHARS,
10954
+ isCompactCommand,
10934
10955
  getGoalCommand,
10935
10956
  getGoalCommandObjectiveValidationError,
10936
10957
  DEFAULT_START_HOOK_TIMEOUT_MS,
@@ -10,15 +10,15 @@ import {
10
10
  resolveDiffBase,
11
11
  runGitCommand,
12
12
  setAgentCredentialSnapshot
13
- } from "./chunk-KJL7WKAT.js";
13
+ } from "./chunk-56WDCAN2.js";
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-6ZNT2UKY.js";
17
+ } from "./chunk-QLDS5LTC.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
21
- } from "./chunk-YPGEGHAO.js";
21
+ } from "./chunk-2MCGQBB5.js";
22
22
  import {
23
23
  isRecord
24
24
  } from "./chunk-UZSNFLDQ.js";
@@ -56,7 +56,7 @@ import {
56
56
  resolveOpenAICompatibleModelsUrl,
57
57
  splitMothershipInstructions,
58
58
  withTimeout
59
- } from "./chunk-WS3GVLJ2.js";
59
+ } from "./chunk-LLSE2EKJ.js";
60
60
 
61
61
  // src/managers/codex-token-manager.ts
62
62
  import { promises as fs } from "fs";
@@ -306,7 +306,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
306
306
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
307
307
  await this.applyCredentialsResponse(data);
308
308
  setAgentCredentialSnapshot("codex", data);
309
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-N7BKUV3E.js");
309
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ANSPVIFL.js");
310
310
  await restartCodexAspHostIfRunning2();
311
311
  });
312
312
  await this.start(true);
@@ -328,7 +328,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
328
328
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
329
329
  await this.applyCredentialsResponse(data);
330
330
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
331
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-N7BKUV3E.js");
331
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ANSPVIFL.js");
332
332
  await restartCodexAspHostIfRunning2();
333
333
  }
334
334
  setAgentCredentialSnapshot("codex", data);
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-YPGEGHAO.js";
6
+ } from "./chunk-2MCGQBB5.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-WS3GVLJ2.js";
9
+ } from "./chunk-LLSE2EKJ.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1313";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1318";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-WS3GVLJ2.js";
8
+ } from "./chunk-LLSE2EKJ.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -6,7 +6,7 @@ import {
6
6
  getOriginDefaultBranch,
7
7
  monolithRequest,
8
8
  runGitCommand
9
- } from "./chunk-KJL7WKAT.js";
9
+ } from "./chunk-56WDCAN2.js";
10
10
  import {
11
11
  extractCommandProtectionCommandText,
12
12
  findCommandProtectionGitLookups,
@@ -14,7 +14,7 @@ import {
14
14
  findPrMergeSignals,
15
15
  findScoutRepoWriteSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-WS3GVLJ2.js";
17
+ } from "./chunk-LLSE2EKJ.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-W3WYNT2B.js";
7
- import "./chunk-KJL7WKAT.js";
8
- import "./chunk-YPGEGHAO.js";
6
+ } from "./chunk-VY3L43BO.js";
7
+ import "./chunk-56WDCAN2.js";
8
+ import "./chunk-2MCGQBB5.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-WS3GVLJ2.js";
12
+ import "./chunk-LLSE2EKJ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -14,12 +14,12 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-6XZJIOBX.js";
17
+ } from "./chunk-I2O6UQT6.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-6ZNT2UKY.js";
22
- import "./chunk-YPGEGHAO.js";
21
+ } from "./chunk-QLDS5LTC.js";
22
+ import "./chunk-2MCGQBB5.js";
23
23
  import {
24
24
  AGENT,
25
25
  OPENCODE_GO_PROVIDER,
@@ -29,7 +29,7 @@ import {
29
29
  headlessAgentUsagePath,
30
30
  isRecord,
31
31
  withTimeout
32
- } from "./chunk-WS3GVLJ2.js";
32
+ } from "./chunk-LLSE2EKJ.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  evaluateCommandProtection,
28
28
  extractToolCommand,
29
29
  reportCommandProtectionBlock
30
- } from "./chunk-W3WYNT2B.js";
30
+ } from "./chunk-VY3L43BO.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -65,10 +65,10 @@ import {
65
65
  spawnMuseMsp,
66
66
  startMuseSession,
67
67
  uuidV7
68
- } from "./chunk-6XZJIOBX.js";
68
+ } from "./chunk-I2O6UQT6.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
- } from "./chunk-5MSEDYGZ.js";
71
+ } from "./chunk-RG6ZUUTP.js";
72
72
  import {
73
73
  ACCOUNT_RATE_LIMITS_READ_METHOD,
74
74
  AsyncLock,
@@ -143,7 +143,7 @@ import {
143
143
  timestampFromSeconds,
144
144
  upsertCredentialFileLines,
145
145
  writeSecureCredentialFile
146
- } from "./chunk-NLBGKIXF.js";
146
+ } from "./chunk-ORM5QECI.js";
147
147
  import {
148
148
  ENGINE_ENV,
149
149
  monolithRequest,
@@ -153,15 +153,15 @@ import {
153
153
  resolveDiffBase,
154
154
  setAgentCredentialSnapshot,
155
155
  setLinearSessionId
156
- } from "./chunk-KJL7WKAT.js";
156
+ } from "./chunk-56WDCAN2.js";
157
157
  import {
158
158
  getCodexModelProvider
159
- } from "./chunk-6ZNT2UKY.js";
159
+ } from "./chunk-QLDS5LTC.js";
160
160
  import {
161
161
  SUBPROCESS_MAX_BUFFER,
162
162
  execAsync,
163
163
  execFileAsync
164
- } from "./chunk-YPGEGHAO.js";
164
+ } from "./chunk-2MCGQBB5.js";
165
165
  import {
166
166
  isRecord as isRecord2
167
167
  } from "./chunk-UZSNFLDQ.js";
@@ -343,6 +343,7 @@ import {
343
343
  isClaudeResultError,
344
344
  isClientMessageSource,
345
345
  isCodexAuthError,
346
+ isCompactCommand,
346
347
  isDefaultChat,
347
348
  isExcludedRepoFilePath,
348
349
  isLatestChatHistoryPage,
@@ -403,6 +404,7 @@ import {
403
404
  skillNamesFromCommand,
404
405
  spawnSubagentRequestSchema,
405
406
  splitMothershipInstructions,
407
+ steerQueuedInOrder,
406
408
  stripAgentDiagnosticErrors,
407
409
  threadHandoffText,
408
410
  toClaudeCodeModel,
@@ -415,7 +417,7 @@ import {
415
417
  workspaceTokenRequestSchema,
416
418
  workspaceTokenResponseSchema,
417
419
  wrapInTag
418
- } from "./chunk-WS3GVLJ2.js";
420
+ } from "./chunk-LLSE2EKJ.js";
419
421
  import {
420
422
  cloneMcpConfig,
421
423
  ensureCompatibilityImports,
@@ -8836,7 +8838,7 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
8836
8838
  }
8837
8839
  getSkipReason() {
8838
8840
  const method = ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD;
8839
- if ((method === "ollama" || method === "api_key" || method === "bedrock" || method === "foundry") && !this.fellBack) {
8841
+ if ((method === "ollama" || method === "api_key" || method === "anthropic-compatible" || method === "bedrock" || method === "foundry") && !this.fellBack) {
8840
8842
  return `auth method is ${method}`;
8841
8843
  }
8842
8844
  return null;
@@ -8867,7 +8869,7 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
8867
8869
  }
8868
8870
  async fetchFreshCredentials(failureReason, failureKind = "rejected", failedCredential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.claude, allowedMethods, resetsAt) {
8869
8871
  const configuredMethod = ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD;
8870
- const failedMethod = failedCredential?.method === "ollama" || failedCredential?.method === "oauth" || failedCredential?.method === "api_key" || failedCredential?.method === "bedrock" || failedCredential?.method === "foundry" ? failedCredential.method : configuredMethod === "ollama" || configuredMethod === "oauth" || configuredMethod === "api_key" || configuredMethod === "bedrock" || configuredMethod === "foundry" ? configuredMethod : void 0;
8872
+ const failedMethod = failedCredential?.method === "ollama" || failedCredential?.method === "oauth" || failedCredential?.method === "api_key" || failedCredential?.method === "anthropic-compatible" || failedCredential?.method === "bedrock" || failedCredential?.method === "foundry" ? failedCredential.method : configuredMethod === "ollama" || configuredMethod === "oauth" || configuredMethod === "api_key" || configuredMethod === "anthropic-compatible" || configuredMethod === "bedrock" || configuredMethod === "foundry" ? configuredMethod : void 0;
8871
8873
  this.fellBack = true;
8872
8874
  return this.swapCredentials({
8873
8875
  provider: "claude",
@@ -9509,7 +9511,9 @@ function detectCodexAuthMethod() {
9509
9511
  // src/managers/agent-auth-detection.ts
9510
9512
  var CLAUDE_CREDENTIALS_PATH = join2(homedir2(), ".claude", ".credentials.json");
9511
9513
  function detectClaudeAuthMethod() {
9512
- if (ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD === "ollama") return "ollama";
9514
+ if (ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD === "ollama" || ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD === "anthropic-compatible") {
9515
+ return ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD;
9516
+ }
9513
9517
  if (existsSync(CLAUDE_CREDENTIALS_PATH) || process.env.CLAUDE_CODE_OAUTH_TOKEN) {
9514
9518
  return "oauth";
9515
9519
  }
@@ -10623,7 +10627,7 @@ import { join as join29 } from "path";
10623
10627
  import { randomUUID as randomUUID10 } from "crypto";
10624
10628
 
10625
10629
  // ../shared/src/workspace-chat.ts
10626
- var WORKSPACE_CHATS_QUERY_SCHEMA_VERSION = 16;
10630
+ var WORKSPACE_CHATS_QUERY_SCHEMA_VERSION = 17;
10627
10631
  var WORKSPACE_CHATS_QUERY_ROOT = `workspace-chats:v${WORKSPACE_CHATS_QUERY_SCHEMA_VERSION}`;
10628
10632
  function isAcceptedUserMessage(event) {
10629
10633
  return getUserMessage(event) !== null && event.payload.source === ACCEPTED_USER_MESSAGE_SOURCE;
@@ -10810,6 +10814,11 @@ function insertChronologically(existing, additions) {
10810
10814
  result.push(...sorted.slice(next));
10811
10815
  return result;
10812
10816
  }
10817
+ function canSteerMessage(provider, request) {
10818
+ if (provider === "cursor") return !request.images?.length;
10819
+ if (provider !== "claude" && provider !== "codex") return false;
10820
+ return !getGoalCommand(request.message, request.goalMode) && !(provider === "codex" && isCompactCommand(request.message));
10821
+ }
10813
10822
 
10814
10823
  // src/managers/claude-manager.ts
10815
10824
  import {
@@ -11315,7 +11324,7 @@ function describeLoginFailure(provider, login, configuredMethod, revoked) {
11315
11324
  const fixer = orgLogin ? "an organization admin" : login?.account?.ownerName ?? "you";
11316
11325
  return `${agent} could not sign in with ${name}. The login expired or was revoked. Replicas recently switched to one-year Claude logins, so ${fixer} should update the Replicas CLI (\`npm install -g replicas-cli@latest\`) and reconnect with \`replicas claude-auth${orgLogin ? " --org" : ""}\`. Claude logins are listed in ${agentsPage}`;
11317
11326
  }
11318
- const why = revoked ? "It was signed out, revoked, or expired." : method === "api_key" ? "The key may be invalid, revoked, out of credits, or missing access to the selected model." : method === "bedrock" ? "Check its credentials, region, IAM permissions, and Claude model access." : method === "foundry" ? `Check its API key, resource, and ${agent} deployment names.` : "It was rejected even after a refresh.";
11327
+ const why = revoked ? "It was signed out, revoked, or expired." : method === "api_key" ? "The key may be invalid, revoked, out of credits, or missing access to the selected model." : method === "bedrock" ? "Check its credentials, region, IAM permissions, and Claude model access." : method === "foundry" ? `Check its API key, resource, and ${agent} deployment names.` : method === "anthropic-compatible" ? "Check its endpoint URL, API key, and that it serves the selected model." : "It was rejected even after a refresh.";
11319
11328
  const reconnect = orgLogin ? `An organization admin can reconnect it in ${agentsPage}` : `Reconnect it in ${agentsPage}`;
11320
11329
  return `${agent} could not sign in with ${name}. ${why} ${reconnect}`;
11321
11330
  }
@@ -12202,7 +12211,7 @@ function buildClaudeAgentEnv(overrides) {
12202
12211
  env.ANTHROPIC_API_KEY = void 0;
12203
12212
  }
12204
12213
  if (method && method !== "none" && method !== "oauth") env.CLAUDE_CODE_OAUTH_TOKEN = void 0;
12205
- if (method === "ollama") env.ANTHROPIC_API_KEY = "";
12214
+ if (method === "ollama" || method === "anthropic-compatible") env.ANTHROPIC_API_KEY = "";
12206
12215
  if (isBedrock) {
12207
12216
  env.CLAUDE_CODE_USE_BEDROCK = "1";
12208
12217
  env.CLAUDE_CODE_USE_MANTLE = "1";
@@ -14668,9 +14677,6 @@ function skillsListToSlashCommands(response) {
14668
14677
  }))
14669
14678
  );
14670
14679
  }
14671
- function isCompactCommand(message) {
14672
- return /^\/compact$/i.test(message.trim());
14673
- }
14674
14680
  var CodexAspManager = class extends CodingAgentManager {
14675
14681
  currentThreadId = null;
14676
14682
  pendingFork = null;
@@ -14747,7 +14753,7 @@ var CodexAspManager = class extends CodingAgentManager {
14747
14753
  return super.interrupt(persistRemoval);
14748
14754
  }
14749
14755
  async keepStoppedRequest(request) {
14750
- if (isCompactCommand(request.message) || getGoalCommand(request.message, request.goalMode)) return false;
14756
+ if (!canSteerMessage("codex", request)) return false;
14751
14757
  this.unreadRequests.push({ ...request, message: `${request.message}
14752
14758
 
14753
14759
  ` });
@@ -14813,7 +14819,7 @@ var CodexAspManager = class extends CodingAgentManager {
14813
14819
  const expectedTurnId = this.activeTurnId;
14814
14820
  if (!threadId || !expectedTurnId || !this.messageQueue.isProcessing()) return false;
14815
14821
  if (this.compacting) return false;
14816
- if (getGoalCommand(request.message, request.goalMode) || isCompactCommand(request.message)) return false;
14822
+ if (!canSteerMessage("codex", request)) return false;
14817
14823
  const { input, tempImagePaths } = await buildTurnInput(request);
14818
14824
  const result = await this.requestActiveTurnWithReconciliation(
14819
14825
  "steer",
@@ -60549,12 +60555,12 @@ var ChatService = class {
60549
60555
  const typedMessage = request.message;
60550
60556
  const idempotencyKey = request.idempotencyKey ?? request.messageId;
60551
60557
  if (idempotencyKey) {
60558
+ const accepting2 = chat.acceptingSendResponses.get(idempotencyKey);
60559
+ if (accepting2) return accepting2;
60552
60560
  const accepted = chat.acceptedSendResponses.get(idempotencyKey);
60553
60561
  if (accepted) {
60554
60562
  return accepted;
60555
60563
  }
60556
- const accepting2 = chat.acceptingSendResponses.get(idempotencyKey);
60557
- if (accepting2) return accepting2;
60558
60564
  }
60559
60565
  if (chat.switching) await chat.switching.catch(() => {
60560
60566
  });
@@ -60600,17 +60606,29 @@ ${decisions}` };
60600
60606
  model: request.model ?? savedModel ?? void 0,
60601
60607
  thinkingLevel: request.thinkingLevel ?? (request.inheritThinkingLevel ? chat.persisted.thinkingLevel : void 0)
60602
60608
  };
60603
- return await chat.provider.enqueueMessage(
60604
- request,
60605
- (result, acceptedMessage) => this.withUnpublishedHistory(chat, () => this.handleMessageAccepted(
60606
- chatId,
60607
- chat,
60608
- request,
60609
- acceptedMessage,
60610
- result,
60611
- typedMessage
60612
- ))
60613
- );
60609
+ const { steer, ...queued } = request;
60610
+ const enqueued = steer ? { ...queued, messageId: queued.messageId ?? `msg_${randomUUID10()}` } : queued;
60611
+ if (enqueued.messageId && steer && chat.provider.isProcessing() && (steer === "alone" || chat.provider.getQueue().every(({ steeredAt }) => steeredAt)) && canSteerMessage(chat.persisted.provider, enqueued)) {
60612
+ chat.steeringOnArrival.add(enqueued.messageId);
60613
+ }
60614
+ try {
60615
+ const response = await chat.provider.enqueueMessage(
60616
+ enqueued,
60617
+ (result, acceptedMessage) => this.withUnpublishedHistory(chat, () => this.handleMessageAccepted(
60618
+ chatId,
60619
+ chat,
60620
+ request,
60621
+ acceptedMessage,
60622
+ result,
60623
+ typedMessage
60624
+ ))
60625
+ );
60626
+ if (!steer || !response.queued) return response;
60627
+ const steered = await steerQueuedInOrder(steer === "alone" ? [{ id: response.messageId }] : chat.provider.getQueue(), response.messageId, async (id) => (await this.steerFromQueue(chatId, id)).success);
60628
+ return { ...response, steered };
60629
+ } finally {
60630
+ if (enqueued.messageId && chat.steeringOnArrival.delete(enqueued.messageId)) this.publishQueueIfChanged(chatId);
60631
+ }
60614
60632
  } catch (error) {
60615
60633
  if (seenBeforeSend) this.forkSourceSeenBlocks.set(chatId, seenBeforeSend);
60616
60634
  else this.forkSourceSeenBlocks.delete(chatId);
@@ -60831,7 +60849,7 @@ ${decisions}` };
60831
60849
  return {
60832
60850
  chatId,
60833
60851
  processing: hasActiveChatTurn(chat),
60834
- queue: chat.provider.getQueue()
60852
+ queue: chat.provider.getQueue().map((message) => chat.steeringOnArrival.has(message.id) && !message.steeredAt ? { ...message, steeredAt: message.queuedAt } : message)
60835
60853
  };
60836
60854
  }
60837
60855
  async withUnpublishedHistory(chat, run) {
@@ -61561,6 +61579,7 @@ ${note}`;
61561
61579
  historyVersion: randomUUID10(),
61562
61580
  provider,
61563
61581
  pendingMessageIds: [],
61582
+ steeringOnArrival: /* @__PURE__ */ new Set(),
61564
61583
  acceptedUserEvents: /* @__PURE__ */ new Map(),
61565
61584
  acceptedSendResponses: new Map(Object.entries(persisted.acceptedSendResponses ?? {})),
61566
61585
  acceptingSendResponses: /* @__PURE__ */ new Map(),
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-5MSEDYGZ.js";
6
+ } from "./chunk-RG6ZUUTP.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-WS3GVLJ2.js";
12
+ } from "./chunk-LLSE2EKJ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -11,7 +11,7 @@ import {
11
11
  spawnSubagentRequestSchema,
12
12
  subagentResponseSchema,
13
13
  waitSubagentRequestSchema
14
- } from "./chunk-WS3GVLJ2.js";
14
+ } from "./chunk-LLSE2EKJ.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1315",
3
+ "version": "0.1.1318",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",