replicas-engine 0.1.958 → 0.1.960
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/{asp-host-QI7MAWDJ.js → asp-host-F7IOQ6EZ.js} +5 -5
- package/dist/src/{chunk-LI5QEJBB.js → chunk-3TPGWE3O.js} +6 -6
- package/dist/src/{chunk-YNVHVJQR.js → chunk-E4WKHWCM.js} +1 -1
- package/dist/src/{chunk-YEIV5OYO.js → chunk-F47TKGB5.js} +3 -3
- package/dist/src/{chunk-NHEZTD3X.js → chunk-QSVTOKZY.js} +4 -5
- package/dist/src/{chunk-FHP2MB2M.js → chunk-SYJMIBRY.js} +3 -3
- package/dist/src/{chunk-7GWXM2H5.js → chunk-T2TXUSX7.js} +69 -90
- package/dist/src/{chunk-UQ3N4FNZ.js → chunk-VY7WH777.js} +1 -1
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +3 -3
- package/dist/src/index.js +388 -385
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/{relay-mcp.js → subagent-mcp.js} +38 -39
- package/package.json +2 -2
- package/dist/src/chunk-SJ6BDSN3.js +0 -45
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-3TPGWE3O.js";
|
|
9
|
+
import "./chunk-QSVTOKZY.js";
|
|
10
|
+
import "./chunk-SYJMIBRY.js";
|
|
11
|
+
import "./chunk-E4WKHWCM.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-T2TXUSX7.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
export {
|
|
16
16
|
getCodexAspHost,
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QSVTOKZY.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
buildCodexAgentEnv
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SYJMIBRY.js";
|
|
13
13
|
import {
|
|
14
14
|
SUBPROCESS_MAX_BUFFER,
|
|
15
15
|
execFileAsync
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-E4WKHWCM.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
19
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
listOpenAICompatibleModels,
|
|
28
28
|
readOllamaAuthEnv,
|
|
29
29
|
resolveOpenAICompatibleModelsUrl
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-T2TXUSX7.js";
|
|
31
31
|
|
|
32
32
|
// src/managers/codex-token-manager.ts
|
|
33
33
|
import { promises as fs } from "fs";
|
|
@@ -260,7 +260,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
260
260
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
261
261
|
await this.applyCredentialsResponse(data);
|
|
262
262
|
setAgentCredentialSnapshot("codex", data);
|
|
263
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
263
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-F7IOQ6EZ.js");
|
|
264
264
|
await restartCodexAspHostIfRunning2();
|
|
265
265
|
});
|
|
266
266
|
await this.start(true);
|
|
@@ -280,7 +280,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
280
280
|
await this.applyCredentialUpdate(generation, async () => {
|
|
281
281
|
await this.applyCredentialsResponse(data);
|
|
282
282
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
283
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
283
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-F7IOQ6EZ.js");
|
|
284
284
|
await restartCodexAspHostIfRunning2();
|
|
285
285
|
}
|
|
286
286
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-T2TXUSX7.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -3,18 +3,18 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
monolithRequest
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QSVTOKZY.js";
|
|
7
7
|
import {
|
|
8
8
|
SUBPROCESS_MAX_BUFFER,
|
|
9
9
|
execFileAsync
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-E4WKHWCM.js";
|
|
11
11
|
import {
|
|
12
12
|
extractCommandProtectionCommandText,
|
|
13
13
|
findCommandProtectionGitLookups,
|
|
14
14
|
findGitCommitSignals,
|
|
15
15
|
findPrMergeSignals,
|
|
16
16
|
parseCommandProtectionRequest
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-T2TXUSX7.js";
|
|
18
18
|
|
|
19
19
|
// src/services/command-protection-service.ts
|
|
20
20
|
import { readFile, stat } from "fs/promises";
|
|
@@ -12,10 +12,9 @@ import {
|
|
|
12
12
|
fallbackPlanResponseSchema,
|
|
13
13
|
isRecord,
|
|
14
14
|
isValidAgentProvider,
|
|
15
|
-
isValidRelayBaseProvider,
|
|
16
15
|
parsePosixEnvFile,
|
|
17
16
|
readReplicasRuntimeEnv
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-T2TXUSX7.js";
|
|
19
18
|
|
|
20
19
|
// src/runtime-env-loader.ts
|
|
21
20
|
import { readFileSync } from "fs";
|
|
@@ -189,14 +188,14 @@ async function monolithRequest(path, init = {}) {
|
|
|
189
188
|
});
|
|
190
189
|
}
|
|
191
190
|
var MonolithService = class {
|
|
192
|
-
async
|
|
191
|
+
async getSubagentMcpConfig() {
|
|
193
192
|
try {
|
|
194
|
-
const response = await monolithRequest("/v1/engine/
|
|
193
|
+
const response = await monolithRequest("/v1/engine/subagent-mcp", { method: "GET", signal: AbortSignal.timeout(1e4) });
|
|
195
194
|
if (!response.ok) {
|
|
196
195
|
return null;
|
|
197
196
|
}
|
|
198
197
|
const body = await response.json();
|
|
199
|
-
return isRecord(body) && Array.isArray(body.providers) && body.providers.every((provider) => typeof provider === "string" && isValidAgentProvider(provider))
|
|
198
|
+
return isRecord(body) && typeof body.enabled === "boolean" && Array.isArray(body.providers) && body.providers.every((provider) => typeof provider === "string" && isValidAgentProvider(provider)) ? { enabled: body.enabled, providers: body.providers } : null;
|
|
200
199
|
} catch {
|
|
201
200
|
return null;
|
|
202
201
|
}
|
|
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
execFileAsync
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-E4WKHWCM.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T2TXUSX7.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
|
|
|
240
240
|
if (method === "foundry") return "azure";
|
|
241
241
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
242
242
|
}
|
|
243
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
243
|
+
var ENGINE_PACKAGE_VERSION = "0.1.960";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -32,29 +32,19 @@ var AGENT = {
|
|
|
32
32
|
CURSOR: "cursor",
|
|
33
33
|
MUSE: "muse",
|
|
34
34
|
OPENCODE: "opencode",
|
|
35
|
-
PI: "pi"
|
|
36
|
-
RELAY: "relay"
|
|
35
|
+
PI: "pi"
|
|
37
36
|
};
|
|
38
37
|
var VALID_AGENT_PROVIDERS = Object.values(AGENT);
|
|
39
|
-
var
|
|
40
|
-
var VALID_RELAY_BASE_PROVIDERS = [
|
|
41
|
-
AGENT.CLAUDE,
|
|
42
|
-
AGENT.CODEX,
|
|
43
|
-
AGENT.OPENCODE,
|
|
44
|
-
AGENT.PI
|
|
45
|
-
];
|
|
46
|
-
var DEFAULT_RELAY_BASE_PROVIDER = AGENT.CLAUDE;
|
|
47
|
-
var VALID_CODING_AGENT_PROVIDERS = VALID_AGENT_PROVIDERS.filter(
|
|
48
|
-
(provider) => provider !== AGENT.RELAY
|
|
49
|
-
);
|
|
38
|
+
var SUBAGENT_MCP_HARNESSES = [AGENT.CLAUDE, AGENT.CODEX];
|
|
50
39
|
function isValidAgentProvider(value) {
|
|
51
40
|
return VALID_AGENT_PROVIDERS.some((p) => p === value);
|
|
52
41
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
var LEGACY_RELAY_BASE_PROVIDERS = [AGENT.CLAUDE, AGENT.CODEX, AGENT.OPENCODE, AGENT.PI];
|
|
43
|
+
function normalizeLegacyChatProvider(provider, relayBaseProvider) {
|
|
44
|
+
if (provider === "relay") {
|
|
45
|
+
return LEGACY_RELAY_BASE_PROVIDERS.find((base) => base === relayBaseProvider) ?? AGENT.CLAUDE;
|
|
46
|
+
}
|
|
47
|
+
return isValidAgentProvider(provider) ? provider : null;
|
|
58
48
|
}
|
|
59
49
|
var VALID_THINKING_LEVELS = ["low", "medium", "high", "xhigh", "max", "ultra", "ultracode"];
|
|
60
50
|
var STANDARD_THINKING_LEVELS = ["low", "medium", "high", "xhigh", "max"];
|
|
@@ -64,8 +54,7 @@ var THINKING_LEVELS_BY_AGENT = {
|
|
|
64
54
|
cursor: STANDARD_THINKING_LEVELS,
|
|
65
55
|
muse: VALID_THINKING_LEVELS.filter((level) => level !== "max" && level !== "ultracode"),
|
|
66
56
|
opencode: STANDARD_THINKING_LEVELS,
|
|
67
|
-
pi: STANDARD_THINKING_LEVELS
|
|
68
|
-
relay: [...STANDARD_THINKING_LEVELS, "ultracode"]
|
|
57
|
+
pi: STANDARD_THINKING_LEVELS
|
|
69
58
|
};
|
|
70
59
|
function isValidThinkingLevel(value) {
|
|
71
60
|
return VALID_THINKING_LEVELS.some((l) => l === value);
|
|
@@ -94,8 +83,6 @@ function getProviderDisplayName(provider, variant = "short") {
|
|
|
94
83
|
return "Opencode";
|
|
95
84
|
case "pi":
|
|
96
85
|
return "Pi";
|
|
97
|
-
case "relay":
|
|
98
|
-
return "Relay";
|
|
99
86
|
case "claude":
|
|
100
87
|
return variant === "long" ? "Claude Code" : "Claude";
|
|
101
88
|
}
|
|
@@ -195,8 +182,7 @@ var DEFAULT_CHAT_TITLES = {
|
|
|
195
182
|
cursor: "Cursor",
|
|
196
183
|
muse: "Muse Code",
|
|
197
184
|
opencode: "Opencode",
|
|
198
|
-
pi: "Pi"
|
|
199
|
-
relay: "Relay"
|
|
185
|
+
pi: "Pi"
|
|
200
186
|
};
|
|
201
187
|
function isDefaultChat(chat) {
|
|
202
188
|
return chat.title === DEFAULT_CHAT_TITLES[chat.provider];
|
|
@@ -254,8 +240,7 @@ var FALLBACK_AGENT_MODEL = {
|
|
|
254
240
|
cursor: DEFAULT_CURSOR_MODEL,
|
|
255
241
|
muse: DEFAULT_MUSE_MODEL,
|
|
256
242
|
opencode: DEFAULT_OPENCODE_MODEL,
|
|
257
|
-
pi: DEFAULT_PI_MODEL
|
|
258
|
-
relay: DEFAULT_CLAUDE_MODEL
|
|
243
|
+
pi: DEFAULT_PI_MODEL
|
|
259
244
|
};
|
|
260
245
|
function getDefaultAgentModel(provider, overrides) {
|
|
261
246
|
const catalogDefault = overrides?.defaultModels?.[provider];
|
|
@@ -360,8 +345,7 @@ var AGENT_MODELS = {
|
|
|
360
345
|
],
|
|
361
346
|
muse: [MUSE_SPARK_1_3_MODEL, DEFAULT_MUSE_MODEL],
|
|
362
347
|
opencode: [...DEFAULT_OPENROUTER_MODELS, ...ASTER_MODELS],
|
|
363
|
-
pi: [...DEFAULT_OPENROUTER_MODELS, ...ASTER_MODELS]
|
|
364
|
-
relay: [CLAUDE_FABLE_5_1_MODEL, CLAUDE_FABLE_5_MODEL, CLAUDE_OPUS_5_5_MODEL, CLAUDE_OPUS_5_MODEL, CLAUDE_OPUS_4_8_MODEL, CLAUDE_SONNET_5_5_MODEL, CLAUDE_SONNET_5_MODEL]
|
|
348
|
+
pi: [...DEFAULT_OPENROUTER_MODELS, ...ASTER_MODELS]
|
|
365
349
|
};
|
|
366
350
|
var HIDDEN_BY_DEFAULT_MODELS = /* @__PURE__ */ new Set([
|
|
367
351
|
CLAUDE_FABLE_5_MODEL,
|
|
@@ -396,13 +380,12 @@ var DEFAULT_STATIC_AGENT_MODELS = {
|
|
|
396
380
|
codex: withoutHiddenByDefault(AGENT_MODELS.codex)
|
|
397
381
|
};
|
|
398
382
|
var DEFAULT_CURSOR_MODELS = withoutHiddenByDefault(AGENT_MODELS.cursor);
|
|
399
|
-
var DEFAULT_RELAY_MODELS = withoutHiddenByDefault(AGENT_MODELS.relay);
|
|
400
383
|
function getAgentModelOptions(provider, overrides) {
|
|
401
384
|
const override = overrides?.[provider];
|
|
402
385
|
if (override?.length) return override;
|
|
403
386
|
if (provider === "claude" || provider === "codex") return DEFAULT_STATIC_AGENT_MODELS[provider];
|
|
404
387
|
if (provider === "cursor") return DEFAULT_CURSOR_MODELS;
|
|
405
|
-
return
|
|
388
|
+
return AGENT_MODELS[provider];
|
|
406
389
|
}
|
|
407
390
|
var CLAUDE_MODEL_MIN_SANDBOX_IMAGE = {
|
|
408
391
|
[CLAUDE_FABLE_5_1_MODEL]: "replicas-sandbox-2026-09-01-v6",
|
|
@@ -1072,7 +1055,7 @@ function coerceAuthFallbackPayload(payload) {
|
|
|
1072
1055
|
const { provider, reason, exhaustedMethod, exhaustedScope, candidateMethod, candidateScope, status, detail } = payload;
|
|
1073
1056
|
const exhaustedAccount = credentialAccountSchema.safeParse(payload.exhaustedAccount).data;
|
|
1074
1057
|
const candidateAccount = credentialAccountSchema.safeParse(payload.candidateAccount).data;
|
|
1075
|
-
if (typeof provider !== "string" || !
|
|
1058
|
+
if (typeof provider !== "string" || !isValidAgentProvider(provider) || reason !== "rate_limit" && reason !== "out_of_credits" || !isAuthMethod(exhaustedMethod) || !isAuthMethod(candidateMethod) || !isCredentialScope(candidateScope) || status !== "switched" && status !== "failed") {
|
|
1076
1059
|
return null;
|
|
1077
1060
|
}
|
|
1078
1061
|
return {
|
|
@@ -1139,25 +1122,19 @@ var ENGINE_SLEEP_PATH = "/lifecycle/sleep";
|
|
|
1139
1122
|
var updateChatDisplayNameRequestSchema = z3.object({
|
|
1140
1123
|
displayName: z3.string().trim().min(1).max(100)
|
|
1141
1124
|
});
|
|
1142
|
-
function getChatExecutionProvider(chat) {
|
|
1143
|
-
return chat.provider === "relay" ? chat.relayBaseProvider ?? DEFAULT_RELAY_BASE_PROVIDER : chat.provider;
|
|
1144
|
-
}
|
|
1145
1125
|
var createChatRequestSchema = z3.object({
|
|
1146
1126
|
id: z3.string().uuid().optional(),
|
|
1147
1127
|
createdAt: z3.string().datetime().optional(),
|
|
1148
1128
|
provider: z3.enum(VALID_AGENT_PROVIDERS),
|
|
1149
|
-
relayBaseProvider: z3.enum(VALID_CODING_AGENT_PROVIDERS).optional(),
|
|
1150
1129
|
title: z3.string().min(1).optional(),
|
|
1151
1130
|
parentChatId: z3.string().uuid().optional(),
|
|
1152
1131
|
forkSourceChatId: z3.string().uuid().optional(),
|
|
1153
1132
|
sideChat: z3.boolean().optional(),
|
|
1154
1133
|
clientRequestId: z3.string().min(1).max(128).optional()
|
|
1155
|
-
}).refine((request) => request.provider === "relay" || request.relayBaseProvider === void 0, {
|
|
1156
|
-
message: "relayBaseProvider is only valid for Relay chats"
|
|
1157
1134
|
}).refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
|
|
1158
1135
|
message: "A side chat must fork its parent chat"
|
|
1159
1136
|
});
|
|
1160
|
-
var
|
|
1137
|
+
var spawnSubagentRequestSchema = z3.object({
|
|
1161
1138
|
provider: z3.enum(VALID_AGENT_PROVIDERS),
|
|
1162
1139
|
prompt: z3.string().min(1),
|
|
1163
1140
|
forkTurns: z3.string().regex(/^(all|none|[1-9]\d*)$/).refine(
|
|
@@ -1168,15 +1145,15 @@ var spawnRelaySubagentRequestSchema = z3.object({
|
|
|
1168
1145
|
thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional(),
|
|
1169
1146
|
title: z3.string().min(1).optional()
|
|
1170
1147
|
});
|
|
1171
|
-
var
|
|
1148
|
+
var messageSubagentRequestSchema = z3.object({
|
|
1172
1149
|
message: z3.string().min(1),
|
|
1173
1150
|
model: z3.string().min(1).optional(),
|
|
1174
1151
|
thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional()
|
|
1175
1152
|
});
|
|
1176
|
-
var
|
|
1153
|
+
var waitSubagentRequestSchema = z3.object({
|
|
1177
1154
|
timeoutMinutes: z3.coerce.number().positive().max(1440).optional()
|
|
1178
1155
|
});
|
|
1179
|
-
var
|
|
1156
|
+
var subagentResponseSchema = z3.object({
|
|
1180
1157
|
chatId: z3.string().uuid(),
|
|
1181
1158
|
status: z3.enum(["working", "completed"]),
|
|
1182
1159
|
response: z3.string().optional(),
|
|
@@ -1667,9 +1644,9 @@ function gitIdentityConfigCommands(identity, scope = "global") {
|
|
|
1667
1644
|
];
|
|
1668
1645
|
}
|
|
1669
1646
|
|
|
1670
|
-
// ../shared/src/
|
|
1671
|
-
var
|
|
1672
|
-
var
|
|
1647
|
+
// ../shared/src/subagent-mcp.ts
|
|
1648
|
+
var SUBAGENT_MCP_SERVER_NAME = "subagents";
|
|
1649
|
+
var SUBAGENT_MCP_TOOLS = {
|
|
1673
1650
|
getProviders: "get_providers",
|
|
1674
1651
|
spawnAgent: "spawn_agent",
|
|
1675
1652
|
getAgent: "get_agent",
|
|
@@ -1677,14 +1654,14 @@ var RELAY_MCP_TOOLS = {
|
|
|
1677
1654
|
messageAgent: "message_agent",
|
|
1678
1655
|
deleteAgent: "delete_agent"
|
|
1679
1656
|
};
|
|
1680
|
-
var
|
|
1657
|
+
var SUBAGENT_MCP_TOOL_NAMES = Object.values(SUBAGENT_MCP_TOOLS);
|
|
1681
1658
|
|
|
1682
1659
|
// ../shared/src/headless-agent.ts
|
|
1683
1660
|
import { z as z4 } from "zod";
|
|
1684
1661
|
var headlessAgentRequestSchema = z4.object({
|
|
1685
1662
|
mode: z4.literal("structured"),
|
|
1686
1663
|
agent: z4.custom(
|
|
1687
|
-
(value) => typeof value === "string" &&
|
|
1664
|
+
(value) => typeof value === "string" && isValidAgentProvider(value)
|
|
1688
1665
|
),
|
|
1689
1666
|
model: z4.string().min(1),
|
|
1690
1667
|
prompt: z4.string(),
|
|
@@ -1866,7 +1843,7 @@ var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
|
|
|
1866
1843
|
var workspaceCredentialProviderSchema = z6.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
|
|
1867
1844
|
var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true });
|
|
1868
1845
|
var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
|
|
1869
|
-
provider: z6.enum(
|
|
1846
|
+
provider: z6.enum(VALID_AGENT_PROVIDERS)
|
|
1870
1847
|
}).refine(({ provider, method }) => agentCredentialMethods(provider).includes(method), {
|
|
1871
1848
|
message: "This inference provider is not supported by this agent"
|
|
1872
1849
|
});
|
|
@@ -1884,7 +1861,6 @@ import { z as z7 } from "zod";
|
|
|
1884
1861
|
var fallbackHarnessStepSchema = z7.object({
|
|
1885
1862
|
kind: z7.literal("harness"),
|
|
1886
1863
|
provider: z7.enum(VALID_AGENT_PROVIDERS),
|
|
1887
|
-
relayBaseProvider: z7.enum(VALID_RELAY_BASE_PROVIDERS).optional(),
|
|
1888
1864
|
model: z7.string().min(1),
|
|
1889
1865
|
thinkingLevel: z7.enum(VALID_THINKING_LEVELS).optional()
|
|
1890
1866
|
});
|
|
@@ -1903,7 +1879,7 @@ var quotaLimitKindSchema = z8.enum(["rate_limit", "out_of_credits"]);
|
|
|
1903
1879
|
var chatForkInfoSchema = z8.object({
|
|
1904
1880
|
source: z8.object({
|
|
1905
1881
|
chatId: z8.string().min(1),
|
|
1906
|
-
provider: z8.
|
|
1882
|
+
provider: z8.string().transform((provider, ctx) => normalizeLegacyChatProvider(provider) ?? (ctx.addIssue({ code: "custom" }), z8.NEVER)),
|
|
1907
1883
|
title: z8.string()
|
|
1908
1884
|
}),
|
|
1909
1885
|
trigger: z8.enum(["manual", "auto", "side"]),
|
|
@@ -1919,7 +1895,6 @@ function coerceChatForkInfo(value) {
|
|
|
1919
1895
|
}
|
|
1920
1896
|
var forkChatRequestSchema = z8.object({
|
|
1921
1897
|
provider: z8.enum(VALID_AGENT_PROVIDERS),
|
|
1922
|
-
relayBaseProvider: z8.enum(VALID_RELAY_BASE_PROVIDERS).optional(),
|
|
1923
1898
|
model: z8.string().min(1).optional(),
|
|
1924
1899
|
thinkingLevel: z8.enum(VALID_THINKING_LEVELS).optional(),
|
|
1925
1900
|
title: z8.string().min(1).max(200).optional(),
|
|
@@ -1941,7 +1916,7 @@ function describeChatForkReason(reason, provider) {
|
|
|
1941
1916
|
}
|
|
1942
1917
|
var AGENT_QUOTA_EXHAUSTED_EVENT_TYPE = "agent-quota-exhausted";
|
|
1943
1918
|
var agentQuotaExhaustedPayloadSchema = z8.object({
|
|
1944
|
-
provider: z8.enum(
|
|
1919
|
+
provider: z8.enum(VALID_AGENT_PROVIDERS),
|
|
1945
1920
|
reason: quotaLimitKindSchema,
|
|
1946
1921
|
detail: z8.string().optional(),
|
|
1947
1922
|
forkTo: fallbackHarnessStepSchema.optional()
|
|
@@ -2049,7 +2024,7 @@ var WRAPPER_VALUE_OPTIONS = {
|
|
|
2049
2024
|
};
|
|
2050
2025
|
var ANSI_C_ESCAPES = { n: "\n", t: " ", r: "\r", a: "\x07", b: "\b", e: "\x1B", E: "\x1B", f: "\f", v: "\v" };
|
|
2051
2026
|
function parseShellScript(script, cwd) {
|
|
2052
|
-
const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0 };
|
|
2027
|
+
const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0, subshell: false };
|
|
2053
2028
|
parseUntil(scope, 0, false);
|
|
2054
2029
|
return scope.commands;
|
|
2055
2030
|
}
|
|
@@ -2149,16 +2124,18 @@ function emit(scope, raw) {
|
|
|
2149
2124
|
stdin,
|
|
2150
2125
|
afterAnd: raw.afterAnd,
|
|
2151
2126
|
stdinFile: stdinFile ? resolveShellPath(scope.dir, stdinFile.target) : null,
|
|
2152
|
-
writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), content: output, append: op.endsWith(">>") }] : []),
|
|
2127
|
+
writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), target, content: output, append: op.endsWith(">>") }] : []),
|
|
2153
2128
|
wrapper: script !== void 0,
|
|
2154
|
-
truncated
|
|
2129
|
+
truncated,
|
|
2130
|
+
piped: raw.pipeFrom !== void 0,
|
|
2131
|
+
subshell: scope.subshell || raw.subshell
|
|
2155
2132
|
});
|
|
2156
2133
|
if (name === "cd" || name === "pushd" || name === "popd") {
|
|
2157
2134
|
scope.dir = name !== "popd" && argv[1] && argv[1] !== "-" ? resolveShellPath(scope.dir, argv[1]) : null;
|
|
2158
2135
|
} else if (["export", "declare", "local", "readonly"].includes(name)) {
|
|
2159
2136
|
assign(scope, argv.slice(1).filter((arg) => /^[A-Za-z_]\w*=/.test(arg)));
|
|
2160
2137
|
}
|
|
2161
|
-
if (script && !truncated) parseUntil({ src: script, vars: name === "eval" ? scope.vars : /* @__PURE__ */ new Map(), dir: scope.dir, commands: scope.commands, depth: scope.depth + 1 }, 0, false);
|
|
2138
|
+
if (script && !truncated) parseUntil({ src: script, vars: name === "eval" ? scope.vars : /* @__PURE__ */ new Map(), dir: scope.dir, commands: scope.commands, depth: scope.depth + 1, subshell: scope.subshell || raw.subshell }, 0, false);
|
|
2162
2139
|
}
|
|
2163
2140
|
function readHeredocBodies(scope, heredocs, start) {
|
|
2164
2141
|
const { src } = scope;
|
|
@@ -2206,7 +2183,7 @@ function readDoubleQuoted(scope, start, terminator) {
|
|
|
2206
2183
|
return { value, end: i };
|
|
2207
2184
|
}
|
|
2208
2185
|
function substitute(scope, src, start, closeParen) {
|
|
2209
|
-
const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1 };
|
|
2186
|
+
const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1, subshell: true };
|
|
2210
2187
|
const end = parseUntil(child, start, closeParen);
|
|
2211
2188
|
scope.commands.push(...child.commands);
|
|
2212
2189
|
const [only] = child.commands;
|
|
@@ -2251,7 +2228,7 @@ function parseUntil(scope, start, closeParen) {
|
|
|
2251
2228
|
const { src } = scope;
|
|
2252
2229
|
let i = start;
|
|
2253
2230
|
let line = [];
|
|
2254
|
-
let current = { words: [], redirects: [], heredocs: [], afterAnd: false };
|
|
2231
|
+
let current = { words: [], redirects: [], heredocs: [], afterAnd: false, subshell: false };
|
|
2255
2232
|
let pendingHeredocs = [];
|
|
2256
2233
|
let word = null;
|
|
2257
2234
|
let quoted = false;
|
|
@@ -2279,7 +2256,8 @@ function parseUntil(scope, start, closeParen) {
|
|
|
2279
2256
|
const endCommand = (op) => {
|
|
2280
2257
|
endWord();
|
|
2281
2258
|
const done = current;
|
|
2282
|
-
|
|
2259
|
+
if (op === "&") done.subshell = true;
|
|
2260
|
+
current = { words: [], redirects: [], heredocs: [], pipeFrom: op === "|" || op === "|&" ? done : void 0, afterAnd: op === "&&", subshell: parens > 0 };
|
|
2283
2261
|
if (done.words.length > 0 || done.redirects.length > 0 || done.heredocs.length > 0) line.push(done);
|
|
2284
2262
|
};
|
|
2285
2263
|
const flush = () => {
|
|
@@ -2486,16 +2464,25 @@ ${operation.diff}` : ""}`).join("\n\n");
|
|
|
2486
2464
|
if (message.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
|
|
2487
2465
|
return { kind: "error", title: "Agent error", summary: "", content: message.message };
|
|
2488
2466
|
}
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
return
|
|
2467
|
+
var SCRIPT_ROOT = "/";
|
|
2468
|
+
var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
|
|
2469
|
+
var fileWrites = ({ writes }) => writes.filter(({ path }) => path !== "/dev/null");
|
|
2470
|
+
function shellCommands(command) {
|
|
2471
|
+
return parseShellScript(command, SCRIPT_ROOT).filter(({ wrapper }) => !wrapper);
|
|
2472
|
+
}
|
|
2473
|
+
function simpleCommands(command) {
|
|
2474
|
+
const commands = shellCommands(command);
|
|
2475
|
+
const hasRedirectOrSubshell = commands.some((shellCommand) => shellCommand.subshell || shellCommand.stdinFile !== null || !shellCommand.piped && shellCommand.stdin !== void 0 || fileWrites(shellCommand).length > 0);
|
|
2476
|
+
if (commands.length === 0 || hasRedirectOrSubshell) return null;
|
|
2477
|
+
return commands.map((shellCommand) => {
|
|
2478
|
+
const argv = shellCommand.argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026"));
|
|
2479
|
+
return { ...shellCommand, argv, name: commandName(argv) };
|
|
2480
|
+
});
|
|
2494
2481
|
}
|
|
2495
2482
|
function skillNamesFromCommand(command) {
|
|
2496
|
-
const
|
|
2497
|
-
if (!
|
|
2498
|
-
return Array.from(new Set(
|
|
2483
|
+
const commands = simpleCommands(command);
|
|
2484
|
+
if (!commands) return [];
|
|
2485
|
+
return Array.from(new Set(commands.flatMap(({ argv }) => argv).flatMap((word) => {
|
|
2499
2486
|
const skillName = skillNameFromSkillRootPath(word);
|
|
2500
2487
|
return skillName ? [skillName] : [];
|
|
2501
2488
|
})));
|
|
@@ -4706,13 +4693,12 @@ var REPLICAS_AGENT_ABILITIES = Object.keys(
|
|
|
4706
4693
|
// ../shared/src/routes/preferences.ts
|
|
4707
4694
|
var EMPTY_AGENT_DEFAULT_SETTINGS = {
|
|
4708
4695
|
agent_provider: null,
|
|
4709
|
-
relay_base_provider: null,
|
|
4710
4696
|
model: null,
|
|
4711
4697
|
thinking_level: null,
|
|
4712
4698
|
goal_mode: null,
|
|
4713
4699
|
fast_mode: null
|
|
4714
4700
|
};
|
|
4715
|
-
var
|
|
4701
|
+
var DEFAULT_SUBAGENT_MCP_PROVIDERS = [...VALID_AGENT_PROVIDERS];
|
|
4716
4702
|
var DEFAULT_USER_PREFERENCES = {
|
|
4717
4703
|
default_agent: "codex",
|
|
4718
4704
|
default_model: null,
|
|
@@ -4736,6 +4722,7 @@ var DEFAULT_USER_PREFERENCES = {
|
|
|
4736
4722
|
open_links_in_desktop_app: false,
|
|
4737
4723
|
mothership_in_dms: false,
|
|
4738
4724
|
memory_enabled: null,
|
|
4725
|
+
subagent_mcp_enabled: null,
|
|
4739
4726
|
default_fast_mode: false,
|
|
4740
4727
|
agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS },
|
|
4741
4728
|
fallback_chains: null
|
|
@@ -6607,7 +6594,7 @@ function parseAgentEvents(events, agentType) {
|
|
|
6607
6594
|
}
|
|
6608
6595
|
function parseDisplayMessages(events, agentType, options = {}) {
|
|
6609
6596
|
events = excludeQueuedAcceptedEvents(events, []);
|
|
6610
|
-
const parsedEvents = agentType === "claude"
|
|
6597
|
+
const parsedEvents = agentType === "claude" ? parseClaudeEvents(events, options.parentToolUseId) : parseAgentEvents(events, agentType);
|
|
6611
6598
|
const reconciledEvents = [];
|
|
6612
6599
|
for (const message of parsedEvents) {
|
|
6613
6600
|
if (message.type === "user") upsertDisplayMessage(reconciledEvents, message);
|
|
@@ -7092,11 +7079,8 @@ function buildCodexTokenUsageContextUsagePayload(usage) {
|
|
|
7092
7079
|
updatedAt: usage.updatedAt
|
|
7093
7080
|
};
|
|
7094
7081
|
}
|
|
7095
|
-
function normalizeProvider(provider) {
|
|
7096
|
-
return provider === "relay" ? "relay" : provider;
|
|
7097
|
-
}
|
|
7098
7082
|
function resolveClaudeContextWindow(provider, model, reportedMaxTokens) {
|
|
7099
|
-
if (provider !== "claude"
|
|
7083
|
+
if (provider !== "claude") {
|
|
7100
7084
|
return { maxTokens: reportedMaxTokens, usedKnownWindow: false };
|
|
7101
7085
|
}
|
|
7102
7086
|
const knownWindow = getClaudeModelContextWindow(model);
|
|
@@ -7194,7 +7178,7 @@ function extractLatestContextUsage(events, provider) {
|
|
|
7194
7178
|
for (const event of events) {
|
|
7195
7179
|
if (event.type === CONTEXT_USAGE_EVENT_TYPE) {
|
|
7196
7180
|
const usage = coerceContextUsagePayload(event.payload, event.timestamp);
|
|
7197
|
-
if (usage && usage.provider ===
|
|
7181
|
+
if (usage && usage.provider === provider) {
|
|
7198
7182
|
latest = usage;
|
|
7199
7183
|
}
|
|
7200
7184
|
continue;
|
|
@@ -7330,7 +7314,7 @@ var SLASH_COMMANDS = [
|
|
|
7330
7314
|
command: "/plan",
|
|
7331
7315
|
description: "Switch to plan mode and optionally send a prompt.",
|
|
7332
7316
|
argumentHint: "[prompt]",
|
|
7333
|
-
providers: ["claude", "codex", "cursor", "muse", "opencode", "pi"
|
|
7317
|
+
providers: ["claude", "codex", "cursor", "muse", "opencode", "pi"]
|
|
7334
7318
|
},
|
|
7335
7319
|
{
|
|
7336
7320
|
command: "/fast",
|
|
@@ -8729,10 +8713,8 @@ function normalizeChatTranscriptMetadata(value) {
|
|
|
8729
8713
|
sha256,
|
|
8730
8714
|
fork
|
|
8731
8715
|
} = value;
|
|
8732
|
-
|
|
8733
|
-
if (
|
|
8734
|
-
metadata.relayBaseProvider = relayBaseProvider;
|
|
8735
|
-
}
|
|
8716
|
+
const normalizedProvider = typeof provider === "string" ? normalizeLegacyChatProvider(provider, relayBaseProvider) : null;
|
|
8717
|
+
if (normalizedProvider) metadata.provider = normalizedProvider;
|
|
8736
8718
|
const parsedCredential = agentCredentialSnapshotSchema.safeParse(credential);
|
|
8737
8719
|
if (parsedCredential.success) metadata.credential = parsedCredential.data;
|
|
8738
8720
|
if (typeof title === "string") metadata.title = title;
|
|
@@ -8810,10 +8792,8 @@ export {
|
|
|
8810
8792
|
createErrorResult,
|
|
8811
8793
|
AGENT,
|
|
8812
8794
|
VALID_AGENT_PROVIDERS,
|
|
8813
|
-
|
|
8795
|
+
SUBAGENT_MCP_HARNESSES,
|
|
8814
8796
|
isValidAgentProvider,
|
|
8815
|
-
isValidCodingAgentProvider,
|
|
8816
|
-
isValidRelayBaseProvider,
|
|
8817
8797
|
codexReasoningEffortForThinkingLevel,
|
|
8818
8798
|
getProviderDisplayName,
|
|
8819
8799
|
detectAgentQuotaLimit,
|
|
@@ -8913,12 +8893,11 @@ export {
|
|
|
8913
8893
|
ENGINE_ACTIVATE_PATH,
|
|
8914
8894
|
ENGINE_SLEEP_PATH,
|
|
8915
8895
|
updateChatDisplayNameRequestSchema,
|
|
8916
|
-
getChatExecutionProvider,
|
|
8917
8896
|
createChatRequestSchema,
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8897
|
+
spawnSubagentRequestSchema,
|
|
8898
|
+
messageSubagentRequestSchema,
|
|
8899
|
+
waitSubagentRequestSchema,
|
|
8900
|
+
subagentResponseSchema,
|
|
8922
8901
|
sendChatMessageRequestSchema,
|
|
8923
8902
|
isChatMessageSender,
|
|
8924
8903
|
normalizeCodexAspTranscriptStatus,
|
|
@@ -9001,9 +8980,9 @@ export {
|
|
|
9001
8980
|
resolveWarmHookConfig,
|
|
9002
8981
|
REPLICAS_CONFIG_FILENAMES,
|
|
9003
8982
|
parseReplicasConfigString,
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
8983
|
+
SUBAGENT_MCP_SERVER_NAME,
|
|
8984
|
+
SUBAGENT_MCP_TOOLS,
|
|
8985
|
+
SUBAGENT_MCP_TOOL_NAMES,
|
|
9007
8986
|
headlessAgentRequestSchema,
|
|
9008
8987
|
isAuthenticationErrorText,
|
|
9009
8988
|
isClaudeAuthErrorText,
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-F47TKGB5.js";
|
|
7
|
+
import "./chunk-QSVTOKZY.js";
|
|
8
|
+
import "./chunk-E4WKHWCM.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-T2TXUSX7.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AppServerProcess,
|
|
9
9
|
buildCodexAgentEnv
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-SYJMIBRY.js";
|
|
11
|
+
import "./chunk-E4WKHWCM.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
headlessAgentRequestSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-T2TXUSX7.js";
|
|
16
16
|
import "./chunk-VEQXQN22.js";
|
|
17
17
|
|
|
18
18
|
// src/headless-agent.ts
|