replicas-engine 0.1.321 → 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 +67 -13
  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-v5";
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) {
@@ -6457,7 +6457,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
6457
6457
  images,
6458
6458
  permissionMode,
6459
6459
  thinkingLevel,
6460
- enableInteractiveTools
6460
+ enableInteractiveTools,
6461
+ fastMode
6461
6462
  } = request;
6462
6463
  if (!message || !message.trim()) {
6463
6464
  throw new Error("Message cannot be empty");
@@ -6504,7 +6505,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
6504
6505
  // enableInteractiveTools only matters when permissionMode is 'read'; the
6505
6506
  // session signature tracks the effective flag so a permissionMode change
6506
6507
  // can hot-swap via setPermissionMode without restarting.
6507
- enableInteractiveTools: Boolean(enableInteractiveTools)
6508
+ enableInteractiveTools: Boolean(enableInteractiveTools),
6509
+ fastMode: Boolean(fastMode)
6508
6510
  };
6509
6511
  await this.ensureSession({
6510
6512
  signature,
@@ -6570,7 +6572,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
6570
6572
  });
6571
6573
  }
6572
6574
  sessionSignaturesMatch(a, b) {
6573
- 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;
6574
6576
  }
6575
6577
  async startSession(args) {
6576
6578
  const {
@@ -6627,6 +6629,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
6627
6629
  ...enableRegistrySkills ? { skills: "all" } : {},
6628
6630
  env: queryEnv,
6629
6631
  model: resolvedModel,
6632
+ settings: { fastMode: signature.fastMode },
6630
6633
  includePartialMessages: true,
6631
6634
  ...supportsClaudeThinkingDisplay(resolvedModel) ? { thinking: { type: "adaptive", display: "summarized" } } : {},
6632
6635
  ...thinkingLevel ? { effort: thinkingLevel } : {},
@@ -7146,7 +7149,7 @@ var AspClient = class {
7146
7149
  // src/managers/codex-asp/app-server-process.ts
7147
7150
  var DEFAULT_CODEX_BINARY = "codex";
7148
7151
  var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
7149
- var ENGINE_PACKAGE_VERSION = "0.1.321";
7152
+ var ENGINE_PACKAGE_VERSION = "0.1.322";
7150
7153
  var INITIALIZE_METHOD = "initialize";
7151
7154
  var INITIALIZED_NOTIFICATION = "initialized";
7152
7155
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -7396,9 +7399,11 @@ var THREAD_READ_METHOD = "thread/read";
7396
7399
  var THREAD_GOAL_SET_METHOD = "thread/goal/set";
7397
7400
  var THREAD_GOAL_GET_METHOD = "thread/goal/get";
7398
7401
  var THREAD_GOAL_CLEAR_METHOD = "thread/goal/clear";
7402
+ var THREAD_SETTINGS_UPDATE_METHOD = "thread/settings/update";
7399
7403
  var TURN_START_METHOD = "turn/start";
7400
7404
  var TURN_INTERRUPT_METHOD = "turn/interrupt";
7401
7405
  var ACCOUNT_RATE_LIMITS_READ_METHOD = "account/rateLimits/read";
7406
+ var MODEL_LIST_METHOD = "model/list";
7402
7407
  var MAX_CODEX_ASP_TRANSCRIPT_OUTPUT_CHARS = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS;
7403
7408
  function codexApprovalPolicyOverrides() {
7404
7409
  if (!ENGINE_ENV.REPLICAS_DISABLE_GH_PR_MERGE) {
@@ -7797,10 +7802,11 @@ function mergeCodexAspTranscripts(primary, supplemental) {
7797
7802
  turns: turns.sort((a, b) => Date.parse(a.startedAt) - Date.parse(b.startedAt))
7798
7803
  });
7799
7804
  }
7800
- async function buildThreadStartParams(workingDirectory, request, developerInstructions) {
7805
+ async function buildThreadStartParams(workingDirectory, request, developerInstructions, serviceTier) {
7801
7806
  const additionalDirectories = await getAgentAdditionalDirectories();
7802
7807
  return {
7803
7808
  model: request.model ?? DEFAULT_MODEL,
7809
+ ...serviceTier !== void 0 ? { serviceTier } : {},
7804
7810
  cwd: workingDirectory,
7805
7811
  runtimeWorkspaceRoots: additionalDirectories,
7806
7812
  sandbox: "danger-full-access",
@@ -7811,11 +7817,12 @@ async function buildThreadStartParams(workingDirectory, request, developerInstru
7811
7817
  persistExtendedHistory: false
7812
7818
  };
7813
7819
  }
7814
- async function buildThreadResumeParams(workingDirectory, threadId, request, developerInstructions) {
7820
+ async function buildThreadResumeParams(workingDirectory, threadId, request, developerInstructions, serviceTier) {
7815
7821
  const additionalDirectories = await getAgentAdditionalDirectories();
7816
7822
  return {
7817
7823
  threadId,
7818
7824
  model: request.model ?? DEFAULT_MODEL,
7825
+ ...serviceTier !== void 0 ? { serviceTier } : {},
7819
7826
  cwd: workingDirectory,
7820
7827
  runtimeWorkspaceRoots: additionalDirectories,
7821
7828
  sandbox: "danger-full-access",
@@ -7843,7 +7850,7 @@ async function buildTurnInput(request) {
7843
7850
  })));
7844
7851
  return { input, tempImagePaths };
7845
7852
  }
7846
- async function buildTurnStartParams(threadId, request, developerInstructions) {
7853
+ async function buildTurnStartParams(threadId, request, developerInstructions, serviceTier) {
7847
7854
  const effort = toReasoningEffort(request.thinkingLevel);
7848
7855
  const model = request.model ?? DEFAULT_MODEL;
7849
7856
  const { input, tempImagePaths } = await buildTurnInput(request);
@@ -7852,6 +7859,7 @@ async function buildTurnStartParams(threadId, request, developerInstructions) {
7852
7859
  threadId,
7853
7860
  input,
7854
7861
  model,
7862
+ ...serviceTier !== void 0 ? { serviceTier } : {},
7855
7863
  ...codexApprovalPolicyOverrides(),
7856
7864
  ...effort ? { effort } : {},
7857
7865
  ...developerInstructions ? {
@@ -7994,6 +8002,8 @@ var CodexAspManager = class extends CodingAgentManager {
7994
8002
  this.flushTranscriptUpdated(threadId);
7995
8003
  });
7996
8004
  skillRegistriesApplied = false;
8005
+ modelServiceTierCache = null;
8006
+ activeServiceTier;
7997
8007
  constructor(options) {
7998
8008
  super(options);
7999
8009
  this.historyFile = options.historyFilePath ? new CodexHistoryFile(options.historyFilePath) : null;
@@ -8159,7 +8169,9 @@ var CodexAspManager = class extends CodingAgentManager {
8159
8169
  const developerInstructions = this.buildCombinedInstructions(request.customInstructions);
8160
8170
  recordUserMessage(options.userMessagePayload);
8161
8171
  const threadId = await this.ensureThread(host, request, developerInstructions);
8162
- 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));
8163
8175
  let completedTurn;
8164
8176
  try {
8165
8177
  completedTurn = await runTurn(host, threadId, developerInstructions);
@@ -8183,27 +8195,68 @@ var CodexAspManager = class extends CodingAgentManager {
8183
8195
  const existingThreadId = this.currentThreadId;
8184
8196
  if (existingThreadId) {
8185
8197
  if (!this.threadAttached) {
8198
+ const serviceTier2 = await this.resolveRequestedServiceTier(host, request);
8186
8199
  const response = await host.client.request(
8187
8200
  THREAD_RESUME_METHOD,
8188
- await buildThreadResumeParams(this.workingDirectory, existingThreadId, request, developerInstructions)
8201
+ await buildThreadResumeParams(this.workingDirectory, existingThreadId, request, developerInstructions, serviceTier2)
8189
8202
  );
8190
8203
  this.currentThreadId = response.thread.id;
8204
+ this.activeServiceTier = response.serviceTier;
8191
8205
  this.threadAttached = true;
8192
8206
  this.seedHistoryFromThread(response.thread);
8193
8207
  await this.onSaveSessionId(this.currentThreadId);
8194
8208
  }
8195
8209
  return this.currentThreadId ?? existingThreadId;
8196
8210
  }
8211
+ const serviceTier = await this.resolveRequestedServiceTier(host, request);
8197
8212
  const threadStartResponse = await host.client.request(
8198
8213
  THREAD_START_METHOD,
8199
- await buildThreadStartParams(this.workingDirectory, request, developerInstructions)
8214
+ await buildThreadStartParams(this.workingDirectory, request, developerInstructions, serviceTier)
8200
8215
  );
8201
8216
  const threadId = threadStartResponse.thread.id;
8202
8217
  this.currentThreadId = threadId;
8218
+ this.activeServiceTier = threadStartResponse.serviceTier;
8203
8219
  this.threadAttached = true;
8204
8220
  await this.onSaveSessionId(this.currentThreadId);
8205
8221
  return threadId;
8206
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
+ }
8207
8260
  async applySkillRegistries(host) {
8208
8261
  if (this.skillRegistriesApplied) return;
8209
8262
  try {
@@ -8216,8 +8269,8 @@ var CodexAspManager = class extends CodingAgentManager {
8216
8269
  console.warn("[CodexAspManager] Failed to apply skill registries:", error);
8217
8270
  }
8218
8271
  }
8219
- async runTurn(host, threadId, request, developerInstructions) {
8220
- 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);
8221
8274
  return this.observeTurn(host, threadId, request, async () => {
8222
8275
  const turnStartResponse = await host.client.request(
8223
8276
  TURN_START_METHOD,
@@ -11141,6 +11194,7 @@ var sendMessageSchema = z2.object({
11141
11194
  })).optional(),
11142
11195
  thinkingLevel: z2.enum(["low", "medium", "high", "max"]).optional(),
11143
11196
  goalMode: z2.boolean().optional(),
11197
+ fastMode: z2.boolean().optional(),
11144
11198
  enableInteractiveTools: z2.boolean().optional(),
11145
11199
  type: z2.string().min(1).optional(),
11146
11200
  merge: z2.boolean().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.321",
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",