replicas-engine 0.1.320 → 0.1.322

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/src/index.js +73 -16
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -287,7 +287,7 @@ var WORKSPACE_SIZES = ["small", "large"];
287
287
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
288
288
 
289
289
  // ../shared/src/e2b.ts
290
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-15-v4";
290
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-16-v1";
291
291
 
292
292
  // ../shared/src/runtime-env.ts
293
293
  function parsePosixEnvFile(content) {
@@ -3629,7 +3629,7 @@ var GitService = class {
3629
3629
  if (persistedBranch && await branchExists(persistedBranch, repo.path)) {
3630
3630
  const currentBranch = await getCurrentBranch(repo.path);
3631
3631
  if (currentBranch !== persistedBranch) {
3632
- await runGitCommand(["checkout", persistedBranch], repo.path);
3632
+ await this.checkoutWithoutHooks([persistedBranch], repo.path);
3633
3633
  }
3634
3634
  results.push({
3635
3635
  name: repo.name,
@@ -3639,7 +3639,7 @@ var GitService = class {
3639
3639
  });
3640
3640
  continue;
3641
3641
  }
3642
- await runGitCommand(["checkout", repo.defaultBranch], repo.path);
3642
+ await this.checkoutWithoutHooks([repo.defaultBranch], repo.path);
3643
3643
  if (!skipNetworkRefresh) {
3644
3644
  try {
3645
3645
  await runGitCommand(["pull", "--rebase", "--autostash"], repo.path);
@@ -3647,7 +3647,7 @@ var GitService = class {
3647
3647
  }
3648
3648
  }
3649
3649
  const branchName = await this.findAvailableBranchName(workspaceName, repo.path);
3650
- await runGitCommand(["checkout", "-b", branchName], repo.path);
3650
+ await this.checkoutWithoutHooks(["-b", branchName], repo.path);
3651
3651
  await saveRepoState(repo.name, { currentBranch: branchName }, baselineState);
3652
3652
  results.push({
3653
3653
  name: repo.name,
@@ -3923,6 +3923,9 @@ var GitService = class {
3923
3923
  }
3924
3924
  return `${sanitizedBaseName}-${Date.now()}`;
3925
3925
  }
3926
+ checkoutWithoutHooks(args, cwd) {
3927
+ return runGitCommand(["-c", "core.hooksPath=/dev/null", "checkout", ...args], cwd);
3928
+ }
3926
3929
  sanitizeBranchName(name) {
3927
3930
  const normalized = name.toLowerCase().replace(/[^a-z0-9._/-]+/g, "-").replace(/\/{2,}/g, "/").replace(/^-+|-+$/g, "");
3928
3931
  return normalized || "replicas";
@@ -6454,7 +6457,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
6454
6457
  images,
6455
6458
  permissionMode,
6456
6459
  thinkingLevel,
6457
- enableInteractiveTools
6460
+ enableInteractiveTools,
6461
+ fastMode
6458
6462
  } = request;
6459
6463
  if (!message || !message.trim()) {
6460
6464
  throw new Error("Message cannot be empty");
@@ -6501,7 +6505,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
6501
6505
  // enableInteractiveTools only matters when permissionMode is 'read'; the
6502
6506
  // session signature tracks the effective flag so a permissionMode change
6503
6507
  // can hot-swap via setPermissionMode without restarting.
6504
- enableInteractiveTools: Boolean(enableInteractiveTools)
6508
+ enableInteractiveTools: Boolean(enableInteractiveTools),
6509
+ fastMode: Boolean(fastMode)
6505
6510
  };
6506
6511
  await this.ensureSession({
6507
6512
  signature,
@@ -6567,7 +6572,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
6567
6572
  });
6568
6573
  }
6569
6574
  sessionSignaturesMatch(a, b) {
6570
- return a.combinedInstructions === b.combinedInstructions && a.thinkingLevel === b.thinkingLevel && a.enableInteractiveTools === b.enableInteractiveTools;
6575
+ return a.combinedInstructions === b.combinedInstructions && a.thinkingLevel === b.thinkingLevel && a.enableInteractiveTools === b.enableInteractiveTools && a.fastMode === b.fastMode;
6571
6576
  }
6572
6577
  async startSession(args) {
6573
6578
  const {
@@ -6624,6 +6629,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
6624
6629
  ...enableRegistrySkills ? { skills: "all" } : {},
6625
6630
  env: queryEnv,
6626
6631
  model: resolvedModel,
6632
+ settings: { fastMode: signature.fastMode },
6627
6633
  includePartialMessages: true,
6628
6634
  ...supportsClaudeThinkingDisplay(resolvedModel) ? { thinking: { type: "adaptive", display: "summarized" } } : {},
6629
6635
  ...thinkingLevel ? { effort: thinkingLevel } : {},
@@ -7143,7 +7149,7 @@ var AspClient = class {
7143
7149
  // src/managers/codex-asp/app-server-process.ts
7144
7150
  var DEFAULT_CODEX_BINARY = "codex";
7145
7151
  var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
7146
- var ENGINE_PACKAGE_VERSION = "0.1.320";
7152
+ var ENGINE_PACKAGE_VERSION = "0.1.322";
7147
7153
  var INITIALIZE_METHOD = "initialize";
7148
7154
  var INITIALIZED_NOTIFICATION = "initialized";
7149
7155
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -7393,9 +7399,11 @@ var THREAD_READ_METHOD = "thread/read";
7393
7399
  var THREAD_GOAL_SET_METHOD = "thread/goal/set";
7394
7400
  var THREAD_GOAL_GET_METHOD = "thread/goal/get";
7395
7401
  var THREAD_GOAL_CLEAR_METHOD = "thread/goal/clear";
7402
+ var THREAD_SETTINGS_UPDATE_METHOD = "thread/settings/update";
7396
7403
  var TURN_START_METHOD = "turn/start";
7397
7404
  var TURN_INTERRUPT_METHOD = "turn/interrupt";
7398
7405
  var ACCOUNT_RATE_LIMITS_READ_METHOD = "account/rateLimits/read";
7406
+ var MODEL_LIST_METHOD = "model/list";
7399
7407
  var MAX_CODEX_ASP_TRANSCRIPT_OUTPUT_CHARS = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS;
7400
7408
  function codexApprovalPolicyOverrides() {
7401
7409
  if (!ENGINE_ENV.REPLICAS_DISABLE_GH_PR_MERGE) {
@@ -7794,10 +7802,11 @@ function mergeCodexAspTranscripts(primary, supplemental) {
7794
7802
  turns: turns.sort((a, b) => Date.parse(a.startedAt) - Date.parse(b.startedAt))
7795
7803
  });
7796
7804
  }
7797
- async function buildThreadStartParams(workingDirectory, request, developerInstructions) {
7805
+ async function buildThreadStartParams(workingDirectory, request, developerInstructions, serviceTier) {
7798
7806
  const additionalDirectories = await getAgentAdditionalDirectories();
7799
7807
  return {
7800
7808
  model: request.model ?? DEFAULT_MODEL,
7809
+ ...serviceTier !== void 0 ? { serviceTier } : {},
7801
7810
  cwd: workingDirectory,
7802
7811
  runtimeWorkspaceRoots: additionalDirectories,
7803
7812
  sandbox: "danger-full-access",
@@ -7808,11 +7817,12 @@ async function buildThreadStartParams(workingDirectory, request, developerInstru
7808
7817
  persistExtendedHistory: false
7809
7818
  };
7810
7819
  }
7811
- async function buildThreadResumeParams(workingDirectory, threadId, request, developerInstructions) {
7820
+ async function buildThreadResumeParams(workingDirectory, threadId, request, developerInstructions, serviceTier) {
7812
7821
  const additionalDirectories = await getAgentAdditionalDirectories();
7813
7822
  return {
7814
7823
  threadId,
7815
7824
  model: request.model ?? DEFAULT_MODEL,
7825
+ ...serviceTier !== void 0 ? { serviceTier } : {},
7816
7826
  cwd: workingDirectory,
7817
7827
  runtimeWorkspaceRoots: additionalDirectories,
7818
7828
  sandbox: "danger-full-access",
@@ -7840,7 +7850,7 @@ async function buildTurnInput(request) {
7840
7850
  })));
7841
7851
  return { input, tempImagePaths };
7842
7852
  }
7843
- async function buildTurnStartParams(threadId, request, developerInstructions) {
7853
+ async function buildTurnStartParams(threadId, request, developerInstructions, serviceTier) {
7844
7854
  const effort = toReasoningEffort(request.thinkingLevel);
7845
7855
  const model = request.model ?? DEFAULT_MODEL;
7846
7856
  const { input, tempImagePaths } = await buildTurnInput(request);
@@ -7849,6 +7859,7 @@ async function buildTurnStartParams(threadId, request, developerInstructions) {
7849
7859
  threadId,
7850
7860
  input,
7851
7861
  model,
7862
+ ...serviceTier !== void 0 ? { serviceTier } : {},
7852
7863
  ...codexApprovalPolicyOverrides(),
7853
7864
  ...effort ? { effort } : {},
7854
7865
  ...developerInstructions ? {
@@ -7991,6 +8002,8 @@ var CodexAspManager = class extends CodingAgentManager {
7991
8002
  this.flushTranscriptUpdated(threadId);
7992
8003
  });
7993
8004
  skillRegistriesApplied = false;
8005
+ modelServiceTierCache = null;
8006
+ activeServiceTier;
7994
8007
  constructor(options) {
7995
8008
  super(options);
7996
8009
  this.historyFile = options.historyFilePath ? new CodexHistoryFile(options.historyFilePath) : null;
@@ -8156,7 +8169,9 @@ var CodexAspManager = class extends CodingAgentManager {
8156
8169
  const developerInstructions = this.buildCombinedInstructions(request.customInstructions);
8157
8170
  recordUserMessage(options.userMessagePayload);
8158
8171
  const threadId = await this.ensureThread(host, request, developerInstructions);
8159
- const runTurn = options.runTurn ?? ((aspHost, aspThreadId, aspInstructions) => this.runTurn(aspHost, aspThreadId, request, aspInstructions));
8172
+ const serviceTier = await this.resolveRequestedServiceTier(host, request);
8173
+ await this.applyThreadServiceTier(host, threadId, serviceTier);
8174
+ const runTurn = options.runTurn ?? ((aspHost, aspThreadId, aspInstructions) => this.runTurn(aspHost, aspThreadId, request, aspInstructions, serviceTier));
8160
8175
  let completedTurn;
8161
8176
  try {
8162
8177
  completedTurn = await runTurn(host, threadId, developerInstructions);
@@ -8180,27 +8195,68 @@ var CodexAspManager = class extends CodingAgentManager {
8180
8195
  const existingThreadId = this.currentThreadId;
8181
8196
  if (existingThreadId) {
8182
8197
  if (!this.threadAttached) {
8198
+ const serviceTier2 = await this.resolveRequestedServiceTier(host, request);
8183
8199
  const response = await host.client.request(
8184
8200
  THREAD_RESUME_METHOD,
8185
- await buildThreadResumeParams(this.workingDirectory, existingThreadId, request, developerInstructions)
8201
+ await buildThreadResumeParams(this.workingDirectory, existingThreadId, request, developerInstructions, serviceTier2)
8186
8202
  );
8187
8203
  this.currentThreadId = response.thread.id;
8204
+ this.activeServiceTier = response.serviceTier;
8188
8205
  this.threadAttached = true;
8189
8206
  this.seedHistoryFromThread(response.thread);
8190
8207
  await this.onSaveSessionId(this.currentThreadId);
8191
8208
  }
8192
8209
  return this.currentThreadId ?? existingThreadId;
8193
8210
  }
8211
+ const serviceTier = await this.resolveRequestedServiceTier(host, request);
8194
8212
  const threadStartResponse = await host.client.request(
8195
8213
  THREAD_START_METHOD,
8196
- await buildThreadStartParams(this.workingDirectory, request, developerInstructions)
8214
+ await buildThreadStartParams(this.workingDirectory, request, developerInstructions, serviceTier)
8197
8215
  );
8198
8216
  const threadId = threadStartResponse.thread.id;
8199
8217
  this.currentThreadId = threadId;
8218
+ this.activeServiceTier = threadStartResponse.serviceTier;
8200
8219
  this.threadAttached = true;
8201
8220
  await this.onSaveSessionId(this.currentThreadId);
8202
8221
  return threadId;
8203
8222
  }
8223
+ async resolveRequestedServiceTier(host, request) {
8224
+ if (request.fastMode === void 0) return void 0;
8225
+ if (!request.fastMode) return null;
8226
+ const model = request.model ?? DEFAULT_MODEL;
8227
+ const models = await this.listModels(host);
8228
+ const catalogModel = models.find((candidate) => candidate.model === model || candidate.id === model);
8229
+ if (!catalogModel) return void 0;
8230
+ const fastTier = catalogModel.serviceTiers.find((tier) => /fast/i.test(tier.id) || /fast/i.test(tier.name));
8231
+ if (fastTier) return fastTier.id;
8232
+ if (catalogModel.defaultServiceTier && catalogModel.serviceTiers.length === 1) {
8233
+ return catalogModel.defaultServiceTier;
8234
+ }
8235
+ return void 0;
8236
+ }
8237
+ async listModels(host) {
8238
+ if (this.modelServiceTierCache) return this.modelServiceTierCache;
8239
+ const models = [];
8240
+ let cursor = null;
8241
+ do {
8242
+ const response = await host.client.request(
8243
+ MODEL_LIST_METHOD,
8244
+ { cursor, includeHidden: true }
8245
+ );
8246
+ models.push(...response.data);
8247
+ cursor = response.nextCursor;
8248
+ } while (cursor);
8249
+ this.modelServiceTierCache = models;
8250
+ return models;
8251
+ }
8252
+ async applyThreadServiceTier(host, threadId, serviceTier) {
8253
+ if (serviceTier === void 0 || serviceTier === this.activeServiceTier) return;
8254
+ await host.client.request(
8255
+ THREAD_SETTINGS_UPDATE_METHOD,
8256
+ { threadId, serviceTier }
8257
+ );
8258
+ this.activeServiceTier = serviceTier;
8259
+ }
8204
8260
  async applySkillRegistries(host) {
8205
8261
  if (this.skillRegistriesApplied) return;
8206
8262
  try {
@@ -8213,8 +8269,8 @@ var CodexAspManager = class extends CodingAgentManager {
8213
8269
  console.warn("[CodexAspManager] Failed to apply skill registries:", error);
8214
8270
  }
8215
8271
  }
8216
- async runTurn(host, threadId, request, developerInstructions) {
8217
- const { params, tempImagePaths } = await buildTurnStartParams(threadId, request, developerInstructions);
8272
+ async runTurn(host, threadId, request, developerInstructions, serviceTier) {
8273
+ const { params, tempImagePaths } = await buildTurnStartParams(threadId, request, developerInstructions, serviceTier);
8218
8274
  return this.observeTurn(host, threadId, request, async () => {
8219
8275
  const turnStartResponse = await host.client.request(
8220
8276
  TURN_START_METHOD,
@@ -11138,6 +11194,7 @@ var sendMessageSchema = z2.object({
11138
11194
  })).optional(),
11139
11195
  thinkingLevel: z2.enum(["low", "medium", "high", "max"]).optional(),
11140
11196
  goalMode: z2.boolean().optional(),
11197
+ fastMode: z2.boolean().optional(),
11141
11198
  enableInteractiveTools: z2.boolean().optional(),
11142
11199
  type: z2.string().min(1).optional(),
11143
11200
  merge: z2.boolean().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.320",
3
+ "version": "0.1.322",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",