replicas-engine 0.1.464 → 0.1.466

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 +70 -17
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -44,13 +44,23 @@ function createErrorResult(error) {
44
44
 
45
45
  // ../shared/src/agent.ts
46
46
  var VALID_AGENT_PROVIDERS = ["claude", "codex", "cursor", "opencode", "pi", "relay"];
47
+ var VALID_RELAY_SUBAGENT_PROVIDERS = VALID_AGENT_PROVIDERS;
47
48
  var VALID_CODING_AGENT_PROVIDERS = VALID_AGENT_PROVIDERS.filter(
48
49
  (provider) => provider !== "relay"
49
50
  );
50
51
  function isValidAgentProvider(value) {
51
52
  return VALID_AGENT_PROVIDERS.some((p) => p === value);
52
53
  }
53
- var VALID_THINKING_LEVELS = ["low", "medium", "high", "xhigh", "max"];
54
+ var VALID_THINKING_LEVELS = ["low", "medium", "high", "xhigh", "max", "ultra", "ultracode"];
55
+ var STANDARD_THINKING_LEVELS = ["low", "medium", "high", "xhigh", "max"];
56
+ var THINKING_LEVELS_BY_AGENT = {
57
+ claude: [...STANDARD_THINKING_LEVELS, "ultracode"],
58
+ codex: [...STANDARD_THINKING_LEVELS, "ultra"],
59
+ cursor: STANDARD_THINKING_LEVELS,
60
+ opencode: STANDARD_THINKING_LEVELS,
61
+ pi: STANDARD_THINKING_LEVELS,
62
+ relay: [...STANDARD_THINKING_LEVELS, "ultracode"]
63
+ };
54
64
  function isValidThinkingLevel(value) {
55
65
  return VALID_THINKING_LEVELS.some((l) => l === value);
56
66
  }
@@ -59,7 +69,9 @@ var CODEX_REASONING_EFFORT_BY_THINKING_LEVEL = {
59
69
  medium: "medium",
60
70
  high: "high",
61
71
  xhigh: "xhigh",
62
- max: "xhigh"
72
+ max: "xhigh",
73
+ ultra: "ultra",
74
+ ultracode: "xhigh"
63
75
  };
64
76
  function codexReasoningEffortForThinkingLevel(thinkingLevel) {
65
77
  return thinkingLevel ? CODEX_REASONING_EFFORT_BY_THINKING_LEVEL[thinkingLevel] : void 0;
@@ -561,7 +573,7 @@ var WORKSPACE_SIZES = ["small", "large"];
561
573
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
562
574
 
563
575
  // ../shared/src/e2b.ts
564
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-19-v16";
576
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-19-v18";
565
577
 
566
578
  // ../shared/src/runtime-env.ts
567
579
  function shellQuotePosix(value) {
@@ -2506,6 +2518,7 @@ var EMPTY_AGENT_DEFAULT_SETTINGS = {
2506
2518
  goal_mode: null,
2507
2519
  fast_mode: null
2508
2520
  };
2521
+ var DEFAULT_RELAY_SUBAGENT_PROVIDERS = [...VALID_RELAY_SUBAGENT_PROVIDERS];
2509
2522
  var DEFAULT_USER_PREFERENCES = {
2510
2523
  default_agent: "codex",
2511
2524
  default_model: null,
@@ -4762,6 +4775,18 @@ async function monolithRequest(path6, init = {}) {
4762
4775
  });
4763
4776
  }
4764
4777
  var MonolithService = class {
4778
+ async getRelaySubagentProviders() {
4779
+ try {
4780
+ const response = await monolithRequest("/v1/engine/relay-subagent-providers", { method: "GET" });
4781
+ if (!response.ok) {
4782
+ return null;
4783
+ }
4784
+ const body = await response.json();
4785
+ return isRecord(body) && Array.isArray(body.providers) && body.providers.every((provider) => typeof provider === "string" && isValidAgentProvider(provider)) ? body.providers : null;
4786
+ } catch {
4787
+ return null;
4788
+ }
4789
+ }
4765
4790
  async sendEvent(event) {
4766
4791
  if (!ENGINE_ENV.WORKSPACE_ID) {
4767
4792
  return;
@@ -9114,6 +9139,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
9114
9139
  thinkingLevel,
9115
9140
  signature
9116
9141
  } = args;
9142
+ const ultracode = thinkingLevel === "ultracode";
9143
+ const effort = thinkingLevel === "ultra" || ultracode ? "xhigh" : thinkingLevel;
9117
9144
  const systemPrompt = this.systemPromptOverride ? this.systemPromptOverride(combinedInstructions) : {
9118
9145
  type: "preset",
9119
9146
  preset: "claude_code",
@@ -9150,10 +9177,13 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
9150
9177
  ...shared.enableAllSkills ? { skills: "all" } : {},
9151
9178
  env: shared.env,
9152
9179
  model: claudeCodeModel,
9153
- settings: { fastMode: signature.fastMode },
9180
+ settings: {
9181
+ fastMode: signature.fastMode,
9182
+ ...ultracode ? { enableWorkflows: true, ultracode: true } : {}
9183
+ },
9154
9184
  includePartialMessages: true,
9155
9185
  ...supportsClaudeThinkingDisplay(resolvedModel) ? { thinking: { type: "adaptive", display: "summarized" } } : {},
9156
- ...thinkingLevel ? { effort: thinkingLevel } : {},
9186
+ ...effort ? { effort } : {},
9157
9187
  canUseTool: this.buildCanUseTool(),
9158
9188
  ...ENGINE_ENV.REPLICAS_DISABLE_GH_PR_MERGE ? {
9159
9189
  hooks: {
@@ -9742,10 +9772,10 @@ var AspClient = class {
9742
9772
  // src/managers/codex-asp/app-server-process.ts
9743
9773
  var DEFAULT_CODEX_BINARY = "codex";
9744
9774
  var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
9745
- var MIN_CODEX_CLI_VERSION = "0.144.0";
9775
+ var MIN_CODEX_CLI_VERSION = "0.144.6";
9746
9776
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
9747
9777
  var codexCliVersionEnsured = null;
9748
- var ENGINE_PACKAGE_VERSION = "0.1.464";
9778
+ var ENGINE_PACKAGE_VERSION = "0.1.466";
9749
9779
  var INITIALIZE_METHOD = "initialize";
9750
9780
  var INITIALIZED_NOTIFICATION = "initialized";
9751
9781
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -12303,7 +12333,9 @@ var OPENCODE_VARIANT_CANDIDATES_BY_THINKING_LEVEL = {
12303
12333
  medium: ["medium"],
12304
12334
  high: ["high"],
12305
12335
  xhigh: ["xhigh", "high"],
12306
- max: ["max", "xhigh", "high"]
12336
+ max: ["max", "xhigh", "high"],
12337
+ ultra: ["max", "xhigh", "high"],
12338
+ ultracode: ["max", "xhigh", "high"]
12307
12339
  };
12308
12340
  var opencodeAuthSchema = z2.record(z2.string(), z2.object({
12309
12341
  type: z2.string().optional(),
@@ -13068,7 +13100,9 @@ var PiManager = class extends CodingAgentManager {
13068
13100
  const model2 = this.session.modelRegistry.find("openrouter", request.model);
13069
13101
  if (model2) await this.session.setModel(model2);
13070
13102
  }
13071
- if (request.thinkingLevel) this.session.setThinkingLevel(request.thinkingLevel);
13103
+ if (request.thinkingLevel) {
13104
+ this.session.setThinkingLevel(request.thinkingLevel === "ultra" || request.thinkingLevel === "ultracode" ? "xhigh" : request.thinkingLevel);
13105
+ }
13072
13106
  return this.session;
13073
13107
  }
13074
13108
  const apiKey = ENGINE_ENV.OPENROUTER_API_KEY;
@@ -13117,7 +13151,9 @@ var PiManager = class extends CodingAgentManager {
13117
13151
  resourceLoader
13118
13152
  });
13119
13153
  this.session = result.session;
13120
- if (request.thinkingLevel) this.session.setThinkingLevel(request.thinkingLevel);
13154
+ if (request.thinkingLevel) {
13155
+ this.session.setThinkingLevel(request.thinkingLevel === "ultra" || request.thinkingLevel === "ultracode" ? "xhigh" : request.thinkingLevel);
13156
+ }
13121
13157
  this.activeSessionFile = sessionManager.getSessionFile() ?? null;
13122
13158
  await this.onSaveSessionId(this.activeSessionFile);
13123
13159
  this.unsubscribe = this.session.subscribe((event) => this.handleEvent(event));
@@ -13151,6 +13187,9 @@ import { createSdkMcpServer, tool } from "@anthropic-ai/claude-agent-sdk";
13151
13187
  import { z as z3 } from "zod";
13152
13188
 
13153
13189
  // src/managers/relay-providers.ts
13190
+ function isRelaySubagentProviderAllowed(provider, allowedProviders) {
13191
+ return allowedProviders.includes(provider);
13192
+ }
13154
13193
  function getAvailableRelayProviders(availability) {
13155
13194
  const codexAvailable = availability.codexAvailable ?? false;
13156
13195
  const cursorAvailable = availability.cursorAvailable ?? false;
@@ -13255,7 +13294,7 @@ async function getChatFinalResponse(chatId) {
13255
13294
  }
13256
13295
  return "[No response from subagent]";
13257
13296
  }
13258
- function buildSpawnAgentTool(parentChatId, availability = {}) {
13297
+ function buildSpawnAgentTool(parentChatId, availability = {}, getAllowedProviders = () => monolithService.getRelaySubagentProviders()) {
13259
13298
  const codexAvailable = availability.codexAvailable ?? false;
13260
13299
  const cursorAvailable = availability.cursorAvailable ?? false;
13261
13300
  const opencodeAvailable = availability.opencodeAvailable ?? false;
@@ -13287,16 +13326,30 @@ You will also receive the chatId so you can send follow-up messages or clean up
13287
13326
  opencodeAvailable ? `Opencode: ${AGENT_MODELS.opencode.join(", ")}.` : null
13288
13327
  ].filter(Boolean).join(" ")),
13289
13328
  thinking_level: z3.enum(VALID_THINKING_LEVELS).optional().describe(
13290
- "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, xhigh = extended effort, max = maximum effort. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
13329
+ "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, xhigh = extended effort, max = maximum effort, ultra = Codex ultra, ultracode = Claude Code dynamic workflows. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
13291
13330
  ),
13292
13331
  title: z3.string().optional().describe("Optional title for the subagent chat (for identification)."),
13293
13332
  timeout_minutes: z3.number().positive().optional().describe("Timeout in minutes for the subagent to complete (default: 10). Set higher for large tasks to avoid losing work.")
13294
13333
  },
13295
13334
  async (args) => {
13296
13335
  try {
13336
+ const provider = args.provider;
13337
+ const allowedProviders = await getAllowedProviders();
13338
+ if (!allowedProviders) {
13339
+ return {
13340
+ content: [{ type: "text", text: "Unable to verify Relay subagent settings. Please try again." }],
13341
+ isError: true
13342
+ };
13343
+ }
13344
+ if (!isRelaySubagentProviderAllowed(provider, allowedProviders)) {
13345
+ return {
13346
+ content: [{ type: "text", text: `Relay is not allowed to use ${provider} as a subagent.` }],
13347
+ isError: true
13348
+ };
13349
+ }
13297
13350
  const createBody = {
13298
- provider: args.provider,
13299
- title: args.title || `Subagent (${args.provider})`
13351
+ provider,
13352
+ title: args.title || `Subagent (${provider})`
13300
13353
  };
13301
13354
  if (parentChatId) {
13302
13355
  createBody.parentChatId = parentChatId;
@@ -13355,7 +13408,7 @@ The tool blocks until the subagent completes and returns its response.`,
13355
13408
  message: z3.string().describe("The follow-up message to send."),
13356
13409
  model: z3.string().optional().describe("Optional model override for this message."),
13357
13410
  thinking_level: z3.enum(VALID_THINKING_LEVELS).optional().describe(
13358
- "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, xhigh = extended effort, max = maximum effort. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
13411
+ "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, xhigh = extended effort, max = maximum effort, ultra = Codex ultra, ultracode = Claude Code dynamic workflows. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
13359
13412
  ),
13360
13413
  timeout_minutes: z3.number().positive().optional().describe("Timeout in minutes for the subagent to complete (default: 10). Set higher for large tasks to avoid losing work.")
13361
13414
  },
@@ -13413,11 +13466,11 @@ var deleteAgentTool = tool(
13413
13466
  }
13414
13467
  }
13415
13468
  );
13416
- function createRelayMcpServer(parentChatId, availability = {}) {
13469
+ function createRelayMcpServer(parentChatId, availability = {}, getAllowedProviders) {
13417
13470
  return createSdkMcpServer({
13418
13471
  name: "relay-subagent-tools",
13419
13472
  version: "1.0.0",
13420
- tools: [buildSpawnAgentTool(parentChatId, availability), messageAgentTool, deleteAgentTool]
13473
+ tools: [buildSpawnAgentTool(parentChatId, availability, getAllowedProviders), messageAgentTool, deleteAgentTool]
13421
13474
  });
13422
13475
  }
13423
13476
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.464",
3
+ "version": "0.1.466",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",