replicas-engine 0.1.502 → 0.1.504
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 +86 -84
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -611,7 +611,7 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
611
611
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
612
612
|
|
|
613
613
|
// ../shared/src/e2b.ts
|
|
614
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-25-
|
|
614
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-25-v6";
|
|
615
615
|
|
|
616
616
|
// ../shared/src/runtime-env.ts
|
|
617
617
|
function shellQuotePosix(value) {
|
|
@@ -2587,13 +2587,21 @@ var DEFAULT_USER_PREFERENCES = {
|
|
|
2587
2587
|
default_fast_mode: false,
|
|
2588
2588
|
agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS }
|
|
2589
2589
|
};
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
)
|
|
2590
|
+
function defaultReplicasAgentAbilities() {
|
|
2591
|
+
const abilities = {};
|
|
2592
|
+
for (const key of REPLICAS_AGENT_ABILITIES) {
|
|
2593
|
+
abilities[key] = true;
|
|
2594
|
+
}
|
|
2595
|
+
if (hasAllReplicasAgentAbilities(abilities)) return abilities;
|
|
2596
|
+
throw new Error("Default Replicas agent ability flags are incomplete");
|
|
2597
|
+
}
|
|
2598
|
+
function hasAllReplicasAgentAbilities(abilities) {
|
|
2599
|
+
return REPLICAS_AGENT_ABILITIES.every((key) => typeof abilities[key] === "boolean");
|
|
2600
|
+
}
|
|
2593
2601
|
var DEFAULT_DEFAULT_SKILLS = {
|
|
2594
2602
|
replicas_agent: {
|
|
2595
2603
|
enabled: true,
|
|
2596
|
-
abilities:
|
|
2604
|
+
abilities: defaultReplicasAgentAbilities()
|
|
2597
2605
|
}
|
|
2598
2606
|
};
|
|
2599
2607
|
|
|
@@ -3195,6 +3203,12 @@ function findPrMergeSignals(request) {
|
|
|
3195
3203
|
];
|
|
3196
3204
|
return checks.flatMap(([name, pattern]) => pattern.test(combined) ? [name] : []);
|
|
3197
3205
|
}
|
|
3206
|
+
function findGitCommitSignals(request) {
|
|
3207
|
+
const command = normalizeCommandProtectionText(
|
|
3208
|
+
extractCommandProtectionCommandText(request, { stringifyFallback: true }) ?? ""
|
|
3209
|
+
);
|
|
3210
|
+
return /\bgit\s+(?:-[^\s]+\s+)*commit\b/.test(command) ? ["git-commit"] : [];
|
|
3211
|
+
}
|
|
3198
3212
|
|
|
3199
3213
|
// ../shared/src/routes/workspaces.ts
|
|
3200
3214
|
var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
|
|
@@ -4867,7 +4881,6 @@ function loadEngineEnv() {
|
|
|
4867
4881
|
ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION: readEnv("ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION"),
|
|
4868
4882
|
REPLICAS_CLAUDE_AUTH_METHOD: parseClaudeAuthMethod(readEnv("REPLICAS_CLAUDE_AUTH_METHOD")),
|
|
4869
4883
|
REPLICAS_CODEX_AUTH_METHOD: parseCodexAuthMethod(readEnv("REPLICAS_CODEX_AUTH_METHOD")),
|
|
4870
|
-
REPLICAS_DISABLE_GH_PR_MERGE: readEnv("REPLICAS_DISABLE_GH_PR_MERGE")?.toLowerCase() === "true",
|
|
4871
4884
|
REPLICAS_ENV_SYSTEM_PROMPT: readEnv("REPLICAS_ENV_SYSTEM_PROMPT"),
|
|
4872
4885
|
REPLICAS_ENV_START_HOOK: readEnv("REPLICAS_ENV_START_HOOK"),
|
|
4873
4886
|
REPLICAS_DISABLE_AUTO_START_HOOKS: readEnv("REPLICAS_DISABLE_AUTO_START_HOOKS")?.toLowerCase() === "true",
|
|
@@ -8237,7 +8250,7 @@ var LinearEventForwarder = class {
|
|
|
8237
8250
|
};
|
|
8238
8251
|
|
|
8239
8252
|
// src/services/command-protection-service.ts
|
|
8240
|
-
var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by
|
|
8253
|
+
var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
|
|
8241
8254
|
function asCommandProtectionResponse(value) {
|
|
8242
8255
|
if (typeof value !== "object" || value === null) return null;
|
|
8243
8256
|
const candidate = value;
|
|
@@ -8252,7 +8265,7 @@ function failClosed(reason, matchedSignals) {
|
|
|
8252
8265
|
};
|
|
8253
8266
|
}
|
|
8254
8267
|
async function evaluateCommandProtection(request, signal) {
|
|
8255
|
-
const matchedSignals = findPrMergeSignals(request);
|
|
8268
|
+
const matchedSignals = [...findGitCommitSignals(request), ...findPrMergeSignals(request)];
|
|
8256
8269
|
if (matchedSignals.length === 0) {
|
|
8257
8270
|
return { allowed: true, enabled: true };
|
|
8258
8271
|
}
|
|
@@ -8284,7 +8297,7 @@ function extractToolCommand(input) {
|
|
|
8284
8297
|
}
|
|
8285
8298
|
function reportCommandProtectionBlock(options) {
|
|
8286
8299
|
const message = options.result.reason || DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE;
|
|
8287
|
-
console.warn(`[${options.managerName}] blocked ${options.action} by
|
|
8300
|
+
console.warn(`[${options.managerName}] blocked ${options.action} by command protection: ${message}`);
|
|
8288
8301
|
options.recordHistoryEvent(options.eventType, {
|
|
8289
8302
|
type: "error",
|
|
8290
8303
|
message,
|
|
@@ -9023,7 +9036,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
9023
9036
|
hookSpecificOutput: {
|
|
9024
9037
|
hookEventName: "PreToolUse",
|
|
9025
9038
|
permissionDecision: "deny",
|
|
9026
|
-
permissionDecisionReason: result.reason || "Blocked by
|
|
9039
|
+
permissionDecisionReason: result.reason || "Blocked by Replicas command protection."
|
|
9027
9040
|
}
|
|
9028
9041
|
};
|
|
9029
9042
|
};
|
|
@@ -9357,15 +9370,13 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
9357
9370
|
...supportsClaudeThinkingDisplay(resolvedModel) ? { thinking: { type: "adaptive", display: "summarized" } } : {},
|
|
9358
9371
|
...effort ? { effort } : {},
|
|
9359
9372
|
canUseTool: this.buildCanUseTool(),
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
}
|
|
9368
|
-
} : {}
|
|
9373
|
+
hooks: {
|
|
9374
|
+
PreToolUse: [{
|
|
9375
|
+
matcher: "*",
|
|
9376
|
+
hooks: [this.buildCommandProtectionHook()],
|
|
9377
|
+
timeout: 30
|
|
9378
|
+
}]
|
|
9379
|
+
}
|
|
9369
9380
|
}
|
|
9370
9381
|
});
|
|
9371
9382
|
this.activeQuery = response;
|
|
@@ -9947,7 +9958,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
|
9947
9958
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
9948
9959
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
9949
9960
|
var codexCliVersionEnsured = null;
|
|
9950
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
9961
|
+
var ENGINE_PACKAGE_VERSION = "0.1.504";
|
|
9951
9962
|
var INITIALIZE_METHOD = "initialize";
|
|
9952
9963
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
9953
9964
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -10251,9 +10262,6 @@ var MODEL_LIST_METHOD = "model/list";
|
|
|
10251
10262
|
var SKILLS_LIST_METHOD = "skills/list";
|
|
10252
10263
|
var MAX_CODEX_ASP_TRANSCRIPT_OUTPUT_CHARS = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS;
|
|
10253
10264
|
function codexApprovalPolicyOverrides() {
|
|
10254
|
-
if (!ENGINE_ENV.REPLICAS_DISABLE_GH_PR_MERGE) {
|
|
10255
|
-
return { approvalPolicy: "never" };
|
|
10256
|
-
}
|
|
10257
10265
|
return {
|
|
10258
10266
|
approvalPolicy: "untrusted",
|
|
10259
10267
|
approvalsReviewer: "user"
|
|
@@ -11646,36 +11654,33 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
11646
11654
|
const method = serverRequest.method;
|
|
11647
11655
|
switch (serverRequest.method) {
|
|
11648
11656
|
case "item/commandExecution/requestApproval": {
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
toolInput: {
|
|
11655
|
-
command: serverRequest.params.command,
|
|
11656
|
-
commandActions: serverRequest.params.commandActions ?? null
|
|
11657
|
-
},
|
|
11657
|
+
const result = await evaluateCommandProtection({
|
|
11658
|
+
provider: "codex",
|
|
11659
|
+
source: "codex_approval_request",
|
|
11660
|
+
toolName: "commandExecution",
|
|
11661
|
+
toolInput: {
|
|
11658
11662
|
command: serverRequest.params.command,
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11663
|
+
commandActions: serverRequest.params.commandActions ?? null
|
|
11664
|
+
},
|
|
11665
|
+
command: serverRequest.params.command,
|
|
11666
|
+
cwd: serverRequest.params.cwd ?? null,
|
|
11667
|
+
toolUseId: serverRequest.params.itemId ?? null
|
|
11668
|
+
});
|
|
11669
|
+
if (!result.allowed) {
|
|
11670
|
+
console.warn(`[CodexAspManager] blocked command approval: ${result.reason ?? "unknown reason"}`);
|
|
11671
|
+
this.recordBlockedCommand(
|
|
11672
|
+
serverRequest.params.threadId,
|
|
11673
|
+
serverRequest.params.turnId,
|
|
11674
|
+
serverRequest.params.itemId,
|
|
11675
|
+
serverRequest.params.command ?? "",
|
|
11676
|
+
result.reason,
|
|
11677
|
+
serverRequest.params.startedAtMs,
|
|
11678
|
+
serverRequest.params.cwd,
|
|
11679
|
+
serverRequest.params.commandActions
|
|
11680
|
+
);
|
|
11681
|
+
host.client.respond(requestId, { decision: "decline" });
|
|
11682
|
+
return;
|
|
11677
11683
|
}
|
|
11678
|
-
console.warn("[CodexAspManager] approval requested while sandbox is danger-full-access");
|
|
11679
11684
|
host.client.respond(requestId, { decision: "accept" });
|
|
11680
11685
|
return;
|
|
11681
11686
|
}
|
|
@@ -11684,37 +11689,34 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
11684
11689
|
host.client.respond(requestId, { decision: "accept" });
|
|
11685
11690
|
return;
|
|
11686
11691
|
case "execCommandApproval": {
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11692
|
+
const command = serverRequest.params.command.join(" ");
|
|
11693
|
+
const result = await evaluateCommandProtection({
|
|
11694
|
+
provider: "codex",
|
|
11695
|
+
source: "codex_approval_request",
|
|
11696
|
+
toolName: "execCommand",
|
|
11697
|
+
toolInput: {
|
|
11698
|
+
command: serverRequest.params.command,
|
|
11699
|
+
parsedCmd: serverRequest.params.parsedCmd ?? null
|
|
11700
|
+
},
|
|
11701
|
+
command,
|
|
11702
|
+
cwd: serverRequest.params.cwd ?? null,
|
|
11703
|
+
toolUseId: serverRequest.params.callId ?? null
|
|
11704
|
+
});
|
|
11705
|
+
if (!result.allowed) {
|
|
11706
|
+
console.warn(`[CodexAspManager] blocked legacy command approval: ${result.reason ?? "unknown reason"}`);
|
|
11707
|
+
this.recordBlockedCommand(
|
|
11708
|
+
this.currentThreadId ?? serverRequest.params.conversationId,
|
|
11709
|
+
this.activeTurnId ?? `legacy-${requestId}`,
|
|
11710
|
+
serverRequest.params.callId,
|
|
11697
11711
|
command,
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
this.activeTurnId ?? `legacy-${requestId}`,
|
|
11706
|
-
serverRequest.params.callId,
|
|
11707
|
-
command,
|
|
11708
|
-
result.reason,
|
|
11709
|
-
Date.now(),
|
|
11710
|
-
serverRequest.params.cwd,
|
|
11711
|
-
[{ type: "unknown", command }]
|
|
11712
|
-
);
|
|
11713
|
-
host.client.respond(requestId, { decision: "denied" });
|
|
11714
|
-
return;
|
|
11715
|
-
}
|
|
11712
|
+
result.reason,
|
|
11713
|
+
Date.now(),
|
|
11714
|
+
serverRequest.params.cwd,
|
|
11715
|
+
[{ type: "unknown", command }]
|
|
11716
|
+
);
|
|
11717
|
+
host.client.respond(requestId, { decision: "denied" });
|
|
11718
|
+
return;
|
|
11716
11719
|
}
|
|
11717
|
-
console.warn("[CodexAspManager] legacy approval requested while sandbox is danger-full-access");
|
|
11718
11720
|
host.client.respond(requestId, { decision: "approved" });
|
|
11719
11721
|
return;
|
|
11720
11722
|
}
|
|
@@ -12420,7 +12422,7 @@ var CursorManager = class extends CodingAgentManager {
|
|
|
12420
12422
|
}
|
|
12421
12423
|
}
|
|
12422
12424
|
async handleCursorToolCall(toolCall) {
|
|
12423
|
-
if (!
|
|
12425
|
+
if (!toolCall) return;
|
|
12424
12426
|
if (this.blockedToolCallIds.has(toolCall.toolUseId)) return;
|
|
12425
12427
|
const result = await evaluateCommandProtection({
|
|
12426
12428
|
provider: "cursor",
|
|
@@ -13071,7 +13073,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
13071
13073
|
const callId = typeof source?.callID === "string" ? source.callID : isRecord4(payload.tool) && typeof payload.tool.callID === "string" ? payload.tool.callID : void 0;
|
|
13072
13074
|
const toolInput = callId ? this.opencodeToolInputs.get(callId) ?? payload : payload;
|
|
13073
13075
|
const command = opencodePermissionCommand(payload, toolInput);
|
|
13074
|
-
const result =
|
|
13076
|
+
const result = await evaluateCommandProtection({
|
|
13075
13077
|
provider: "opencode",
|
|
13076
13078
|
source: "opencode_permission_request",
|
|
13077
13079
|
toolName: typeof payload.action === "string" ? payload.action : typeof payload.permission === "string" ? payload.permission : "permission",
|
|
@@ -13079,7 +13081,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
13079
13081
|
command,
|
|
13080
13082
|
cwd: this.workingDirectory,
|
|
13081
13083
|
toolUseId: requestId
|
|
13082
|
-
})
|
|
13084
|
+
});
|
|
13083
13085
|
const reply = result.allowed ? "once" : "reject";
|
|
13084
13086
|
const message = result.allowed ? void 0 : reportCommandProtectionBlock({
|
|
13085
13087
|
managerName: "OpencodeManager",
|
|
@@ -13129,7 +13131,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
13129
13131
|
await this.evaluateOpencodeToolProtection(part.tool, state.input, extractToolCommand(state.input), part.id);
|
|
13130
13132
|
}
|
|
13131
13133
|
async evaluateOpencodeToolProtection(toolName, toolInput, command, toolUseId) {
|
|
13132
|
-
if (
|
|
13134
|
+
if (this.handledToolCallIds.has(toolUseId) || this.pendingToolCallIds.has(toolUseId)) return;
|
|
13133
13135
|
this.pendingToolCallIds.add(toolUseId);
|
|
13134
13136
|
try {
|
|
13135
13137
|
const result = await evaluateCommandProtection({
|