replicas-engine 0.1.119 → 0.1.121
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.
- package/dist/src/index.js +63 -10
- package/package.json +2 -2
package/dist/src/index.js
CHANGED
|
@@ -42,6 +42,18 @@ function requireValidURL(value, name) {
|
|
|
42
42
|
throw new Error(`Invalid engine environment: ${name} must be a valid URL`);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
function parseClaudeAuthMethod(value) {
|
|
46
|
+
if (value === "oauth" || value === "api_key" || value === "bedrock") {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
function parseCodexAuthMethod(value) {
|
|
52
|
+
if (value === "oauth" || value === "api_key") {
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
45
57
|
var IS_WARMING_MODE = process.argv.includes("--warming");
|
|
46
58
|
function loadEngineEnv() {
|
|
47
59
|
const HOME_DIR = homedir();
|
|
@@ -66,7 +78,9 @@ function loadEngineEnv() {
|
|
|
66
78
|
CLAUDE_CODE_USE_BEDROCK: readEnv("CLAUDE_CODE_USE_BEDROCK"),
|
|
67
79
|
AWS_ACCESS_KEY_ID: readEnv("AWS_ACCESS_KEY_ID"),
|
|
68
80
|
AWS_SECRET_ACCESS_KEY: readEnv("AWS_SECRET_ACCESS_KEY"),
|
|
69
|
-
AWS_REGION: readEnv("AWS_REGION")
|
|
81
|
+
AWS_REGION: readEnv("AWS_REGION"),
|
|
82
|
+
REPLICAS_CLAUDE_AUTH_METHOD: parseClaudeAuthMethod(readEnv("REPLICAS_CLAUDE_AUTH_METHOD")),
|
|
83
|
+
REPLICAS_CODEX_AUTH_METHOD: parseCodexAuthMethod(readEnv("REPLICAS_CODEX_AUTH_METHOD"))
|
|
70
84
|
};
|
|
71
85
|
if (!IS_WARMING_MODE && !env.WORKSPACE_ID) {
|
|
72
86
|
console.error("WORKSPACE_ID is not set \u2014 this is required in normal (non-warming) mode");
|
|
@@ -1137,7 +1151,7 @@ function parseReplicasConfigString(content, filename) {
|
|
|
1137
1151
|
}
|
|
1138
1152
|
|
|
1139
1153
|
// ../shared/src/engine/environment.ts
|
|
1140
|
-
var DAYTONA_SNAPSHOT_ID = "
|
|
1154
|
+
var DAYTONA_SNAPSHOT_ID = "23-04-2026-islington-v2";
|
|
1141
1155
|
|
|
1142
1156
|
// ../shared/src/engine/types.ts
|
|
1143
1157
|
var DEFAULT_CHAT_TITLES = {
|
|
@@ -2447,6 +2461,43 @@ var CodingAgentManager = class {
|
|
|
2447
2461
|
}
|
|
2448
2462
|
};
|
|
2449
2463
|
|
|
2464
|
+
// src/utils/agent-env.ts
|
|
2465
|
+
function buildClaudeAgentEnv(overrides) {
|
|
2466
|
+
const env = { ...process.env };
|
|
2467
|
+
if (overrides) {
|
|
2468
|
+
Object.assign(env, overrides);
|
|
2469
|
+
}
|
|
2470
|
+
if (shouldStripAnthropicApiKey()) {
|
|
2471
|
+
env.ANTHROPIC_API_KEY = void 0;
|
|
2472
|
+
}
|
|
2473
|
+
return env;
|
|
2474
|
+
}
|
|
2475
|
+
function buildCodexAgentEnv() {
|
|
2476
|
+
const env = {};
|
|
2477
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
2478
|
+
if (typeof value === "string") {
|
|
2479
|
+
env[key] = value;
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
if (shouldStripOpenAIApiKey()) {
|
|
2483
|
+
delete env.OPENAI_API_KEY;
|
|
2484
|
+
}
|
|
2485
|
+
return env;
|
|
2486
|
+
}
|
|
2487
|
+
function resolveCodexApiKey() {
|
|
2488
|
+
if (shouldStripOpenAIApiKey()) {
|
|
2489
|
+
return void 0;
|
|
2490
|
+
}
|
|
2491
|
+
return ENGINE_ENV.OPENAI_API_KEY;
|
|
2492
|
+
}
|
|
2493
|
+
function shouldStripAnthropicApiKey() {
|
|
2494
|
+
const method = ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD;
|
|
2495
|
+
return method === "oauth" || method === "bedrock";
|
|
2496
|
+
}
|
|
2497
|
+
function shouldStripOpenAIApiKey() {
|
|
2498
|
+
return ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD === "oauth";
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2450
2501
|
// src/managers/claude-manager.ts
|
|
2451
2502
|
var PromptStream = class {
|
|
2452
2503
|
queue = [];
|
|
@@ -2592,7 +2643,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
2592
2643
|
preset: "claude_code",
|
|
2593
2644
|
append: combinedInstructions
|
|
2594
2645
|
};
|
|
2595
|
-
const queryEnv = this.envOverrides
|
|
2646
|
+
const queryEnv = buildClaudeAgentEnv(this.envOverrides);
|
|
2596
2647
|
const response = query({
|
|
2597
2648
|
prompt: promptStream,
|
|
2598
2649
|
options: {
|
|
@@ -2742,7 +2793,7 @@ import { existsSync as existsSync6 } from "fs";
|
|
|
2742
2793
|
import { join as join11 } from "path";
|
|
2743
2794
|
import { homedir as homedir8 } from "os";
|
|
2744
2795
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
2745
|
-
var DEFAULT_MODEL = "gpt-5.
|
|
2796
|
+
var DEFAULT_MODEL = "gpt-5.5";
|
|
2746
2797
|
var CODEX_CONFIG_PATH = join11(homedir8(), ".codex", "config.toml");
|
|
2747
2798
|
function isLinearThoughtEvent2(event) {
|
|
2748
2799
|
return event.content.type === "thought";
|
|
@@ -2764,9 +2815,11 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
2764
2815
|
activeAbortController = null;
|
|
2765
2816
|
constructor(options) {
|
|
2766
2817
|
super(options);
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2818
|
+
const codexApiKey = resolveCodexApiKey();
|
|
2819
|
+
this.codex = new Codex({
|
|
2820
|
+
env: buildCodexAgentEnv(),
|
|
2821
|
+
...codexApiKey ? { apiKey: codexApiKey } : {}
|
|
2822
|
+
});
|
|
2770
2823
|
this.tempImageDir = join11(homedir8(), ".replicas", "codex", "temp-images");
|
|
2771
2824
|
this.initializeManager(this.processMessageInternal.bind(this));
|
|
2772
2825
|
}
|
|
@@ -3182,7 +3235,7 @@ You will also receive the chatId so you can send follow-up messages or clean up
|
|
|
3182
3235
|
{
|
|
3183
3236
|
provider: providerEnum.describe(providerDesc),
|
|
3184
3237
|
prompt: z.string().describe("The full prompt/instructions for the subagent. Be detailed - it has no context from your conversation."),
|
|
3185
|
-
model: z.string().optional().describe(codexAvailable ? "Model override. Claude: opus, sonnet, haiku. Codex: gpt-5.4, gpt-5.3-codex, etc." : "Model override. Claude: opus, sonnet, haiku."),
|
|
3238
|
+
model: z.string().optional().describe(codexAvailable ? "Model override. Claude: opus, sonnet, haiku. Codex: gpt-5.5, gpt-5.4, gpt-5.3-codex, etc." : "Model override. Claude: opus, sonnet, haiku."),
|
|
3186
3239
|
thinking_level: z.enum(["low", "medium", "high", "max"]).optional().describe(
|
|
3187
3240
|
"Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, max = maximum effort. Defaults: Claude = high, Codex = medium."
|
|
3188
3241
|
),
|
|
@@ -3419,7 +3472,7 @@ function getUsingToolsSection() {
|
|
|
3419
3472
|
function getDelegationSection(codexAvailable) {
|
|
3420
3473
|
const providerList = codexAvailable ? "claude, codex, or relay" : "claude or relay";
|
|
3421
3474
|
const spawnDesc = `Create a new subagent with a specific provider (${providerList}), send it a prompt, and wait for its response. Returns the chatId and the agent's final response. You can set a custom timeout via the timeout_minutes parameter (default: 10 minutes).`;
|
|
3422
|
-
const agentSelectionLines = codexAvailable ? `Use provider 'codex' for heavy code writing, implementation, and large refactors. Suggested models: gpt-5.
|
|
3475
|
+
const agentSelectionLines = codexAvailable ? `Use provider 'codex' for heavy code writing, implementation, and large refactors. Suggested models: gpt-5.5 (default), gpt-5.4, gpt-5.3-codex.
|
|
3423
3476
|
|
|
3424
3477
|
Use provider 'claude' for codebase exploration, code review, planning, complex debugging, and tasks requiring nuanced architectural understanding. Suggested models: opus (default), sonnet (faster).` : `Use provider 'claude' for all tasks including code writing, codebase exploration, code review, planning, complex debugging, and tasks requiring nuanced architectural understanding. Suggested models: opus (default), sonnet (faster).`;
|
|
3425
3478
|
return `# Delegation
|
|
@@ -3530,7 +3583,7 @@ function getEnvironmentSection() {
|
|
|
3530
3583
|
`Platform: ${process.platform}`,
|
|
3531
3584
|
getShellInfoLine(),
|
|
3532
3585
|
`OS Version: ${unameSR}`,
|
|
3533
|
-
`The most recent Claude model family is Claude 4.5/4.6. Model IDs \u2014 Opus 4.
|
|
3586
|
+
`The most recent Claude model family is Claude 4.5/4.6/4.7. Model IDs \u2014 Opus 4.7: 'claude-opus-4-7', Sonnet 4.6: 'claude-sonnet-4-6', Haiku 4.5: 'claude-haiku-4-5-20251001'. When building AI applications, default to the latest and most capable Claude models.`
|
|
3534
3587
|
];
|
|
3535
3588
|
return [
|
|
3536
3589
|
`# Environment`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replicas-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.121",
|
|
4
4
|
"description": "Lightweight API server for Replicas workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@anthropic-ai/claude-agent-sdk": "0.2.112",
|
|
31
31
|
"@hono/node-server": "^1.19.5",
|
|
32
|
-
"@openai/codex-sdk": "^0.
|
|
32
|
+
"@openai/codex-sdk": "^0.124.0",
|
|
33
33
|
"hono": "^4.10.3",
|
|
34
34
|
"smol-toml": "^1.6.0",
|
|
35
35
|
"yaml": "^2.8.2",
|