replicas-engine 0.1.1733 → 0.1.1735
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-KU77QZVW.js → asp-host-2LPNE5G7.js} +6 -6
- package/dist/src/{chunk-CRB6P7I4.js → chunk-55G3NLLN.js} +1 -1
- package/dist/src/{chunk-MFXSL5G4.js → chunk-6ZQJ2FCZ.js} +3 -3
- package/dist/src/{chunk-CSKRIU7K.js → chunk-7MXDYU6B.js} +3 -2
- package/dist/src/{chunk-WD3L6FWJ.js → chunk-7PPJSJPG.js} +1 -1
- package/dist/src/{chunk-F2WVJOWL.js → chunk-BFNB3T2B.js} +2 -2
- package/dist/src/{chunk-IZGVOH2B.js → chunk-ECEMAFOD.js} +1 -1
- package/dist/src/{chunk-K4NYGHUQ.js → chunk-F6YSMVNR.js} +8 -8
- package/dist/src/{chunk-DWVNAWGI.js → chunk-ONX4IOKS.js} +1 -1
- package/dist/src/{chunk-CF6XLMV2.js → chunk-UVNMAG7F.js} +2 -2
- package/dist/src/{chunk-JLCSSPG3.js → chunk-VBNDEBIY.js} +42 -32
- package/dist/src/codemode-mcp.js +3 -3
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +113 -75
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
listCodexModelsForDetails,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-F6YSMVNR.js";
|
|
12
|
+
import "./chunk-ONX4IOKS.js";
|
|
13
|
+
import "./chunk-7MXDYU6B.js";
|
|
14
|
+
import "./chunk-6ZQJ2FCZ.js";
|
|
15
|
+
import "./chunk-7PPJSJPG.js";
|
|
16
16
|
import "./chunk-UZSNFLDQ.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-VBNDEBIY.js";
|
|
18
18
|
import "./chunk-VEQXQN22.js";
|
|
19
19
|
export {
|
|
20
20
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -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-7PPJSJPG.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VBNDEBIY.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -244,7 +244,7 @@ function getCodexModelProvider(method) {
|
|
|
244
244
|
if (method === "foundry") return "azure";
|
|
245
245
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
246
246
|
}
|
|
247
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
247
|
+
var ENGINE_PACKAGE_VERSION = "0.1.1735";
|
|
248
248
|
var INITIALIZE_METHOD = "initialize";
|
|
249
249
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
250
250
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
SUBPROCESS_MAX_BUFFER,
|
|
6
6
|
execFileAsync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7PPJSJPG.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
provisionedDeviceSchema,
|
|
22
22
|
readReplicasRuntimeEnv,
|
|
23
23
|
serializePosixEnvFile
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VBNDEBIY.js";
|
|
25
25
|
|
|
26
26
|
// src/runtime-env-loader.ts
|
|
27
27
|
import { readFileSync } from "fs";
|
|
@@ -168,6 +168,7 @@ function loadEngineEnv(runtimeEnvFile) {
|
|
|
168
168
|
REPLICAS_AGENT_CREDENTIALS: parseAgentCredentialSnapshots(readEnv("REPLICAS_AGENT_CREDENTIALS")),
|
|
169
169
|
REPLICAS_ENV_SYSTEM_PROMPT: readEnv("REPLICAS_ENV_SYSTEM_PROMPT"),
|
|
170
170
|
REPLICAS_ENV_START_HOOK: readEnv("REPLICAS_ENV_START_HOOK"),
|
|
171
|
+
REPLICAS_REPOSITORY_HOOKS_DISABLED: readEnv("REPLICAS_REPOSITORY_HOOKS_DISABLED") === "1",
|
|
171
172
|
REPLICAS_ENV_DEVICES: parseDevices(readEnv("REPLICAS_ENV_DEVICES")),
|
|
172
173
|
TS_AUTHKEY: readEnv("TS_AUTHKEY"),
|
|
173
174
|
REPLICAS_DISABLE_AUTO_START_HOOKS: readEnv("REPLICAS_DISABLE_AUTO_START_HOOKS")?.toLowerCase() === "true",
|
|
@@ -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-VBNDEBIY.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
runGitCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7MXDYU6B.js";
|
|
9
9
|
import {
|
|
10
10
|
COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
|
|
11
11
|
COMMAND_PROTECTION_REPO_GIT_ARGS,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
parseCommandProtectionRequest,
|
|
19
19
|
toCommandProtectionRepoState,
|
|
20
20
|
withRetry
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-VBNDEBIY.js";
|
|
22
22
|
|
|
23
23
|
// src/services/command-protection-service.ts
|
|
24
24
|
import { readFile, stat } from "fs/promises";
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
subagentCodexMcpConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ONX4IOKS.js";
|
|
7
7
|
import {
|
|
8
8
|
ENGINE_ENV,
|
|
9
9
|
UNQUOTED_PATHS_CONFIG,
|
|
@@ -15,15 +15,15 @@ import {
|
|
|
15
15
|
resolveDiffBase,
|
|
16
16
|
runGitCommand,
|
|
17
17
|
setAgentCredentialSnapshot
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-7MXDYU6B.js";
|
|
19
19
|
import {
|
|
20
20
|
AppServerProcess,
|
|
21
21
|
buildCodexAgentEnv
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6ZQJ2FCZ.js";
|
|
23
23
|
import {
|
|
24
24
|
SUBPROCESS_MAX_BUFFER,
|
|
25
25
|
execFileAsync
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-7PPJSJPG.js";
|
|
27
27
|
import {
|
|
28
28
|
isRecord
|
|
29
29
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
shrunkImageSize,
|
|
69
69
|
splitManagerInstructions,
|
|
70
70
|
withTimeout
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-VBNDEBIY.js";
|
|
72
72
|
|
|
73
73
|
// src/managers/codex-token-manager.ts
|
|
74
74
|
import { promises as fs } from "fs";
|
|
@@ -340,7 +340,7 @@ async function withdrawAgentLogin(provider, { envKeys, files }) {
|
|
|
340
340
|
{ ...persisted.values, REPLICAS_AGENT_CREDENTIALS: JSON.stringify(remaining) },
|
|
341
341
|
/* @__PURE__ */ new Set([...persisted.unsetKeys, ...envKeys])
|
|
342
342
|
));
|
|
343
|
-
if (provider === "codex") await (await import("./asp-host-
|
|
343
|
+
if (provider === "codex") await (await import("./asp-host-2LPNE5G7.js")).restartCodexAspHostIfRunning();
|
|
344
344
|
return true;
|
|
345
345
|
}
|
|
346
346
|
|
|
@@ -498,7 +498,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
498
498
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
499
499
|
await this.applyCredentialsResponse(data);
|
|
500
500
|
setAgentCredentialSnapshot("codex", data);
|
|
501
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
501
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2LPNE5G7.js");
|
|
502
502
|
await restartCodexAspHostIfRunning2();
|
|
503
503
|
});
|
|
504
504
|
await this.start(true);
|
|
@@ -524,7 +524,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
524
524
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
525
525
|
await this.applyCredentialsResponse(data);
|
|
526
526
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
527
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
527
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2LPNE5G7.js");
|
|
528
528
|
await restartCodexAspHostIfRunning2();
|
|
529
529
|
}
|
|
530
530
|
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
|
SUBAGENT_MCP_TOOL_NAMES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VBNDEBIY.js";
|
|
7
7
|
|
|
8
8
|
// src/managers/subagent-mcp-config.ts
|
|
9
9
|
import { existsSync } from "fs";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-XCFPXSY4.js";
|
|
7
7
|
import {
|
|
8
8
|
AspClient
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6ZQJ2FCZ.js";
|
|
10
10
|
import {
|
|
11
11
|
ASTER_BASE_URL,
|
|
12
12
|
ASTER_PROVIDER,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isRecord,
|
|
19
19
|
readOllamaAuthEnv,
|
|
20
20
|
readOpenAICompatibleAuthEnv
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-VBNDEBIY.js";
|
|
22
22
|
|
|
23
23
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
24
24
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -1116,17 +1116,17 @@ var require_luxon = __commonJS({
|
|
|
1116
1116
|
constructor(dt, intl, opts) {
|
|
1117
1117
|
this.opts = opts;
|
|
1118
1118
|
this.originalZone = void 0;
|
|
1119
|
-
let
|
|
1119
|
+
let z50 = void 0;
|
|
1120
1120
|
if (this.opts.timeZone) {
|
|
1121
1121
|
this.dt = dt;
|
|
1122
1122
|
} else if (dt.zone.type === "fixed") {
|
|
1123
1123
|
const gmtOffset = -1 * (dt.offset / 60);
|
|
1124
1124
|
const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
|
|
1125
1125
|
if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
|
|
1126
|
-
|
|
1126
|
+
z50 = offsetZ;
|
|
1127
1127
|
this.dt = dt;
|
|
1128
1128
|
} else {
|
|
1129
|
-
|
|
1129
|
+
z50 = "UTC";
|
|
1130
1130
|
this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
|
|
1131
1131
|
minutes: dt.offset
|
|
1132
1132
|
});
|
|
@@ -1136,9 +1136,9 @@ var require_luxon = __commonJS({
|
|
|
1136
1136
|
this.dt = dt;
|
|
1137
1137
|
} else if (dt.zone.type === "iana") {
|
|
1138
1138
|
this.dt = dt;
|
|
1139
|
-
|
|
1139
|
+
z50 = dt.zone.name;
|
|
1140
1140
|
} else {
|
|
1141
|
-
|
|
1141
|
+
z50 = "UTC";
|
|
1142
1142
|
this.dt = dt.setZone("UTC").plus({
|
|
1143
1143
|
minutes: dt.offset
|
|
1144
1144
|
});
|
|
@@ -1147,7 +1147,7 @@ var require_luxon = __commonJS({
|
|
|
1147
1147
|
const intlOpts = {
|
|
1148
1148
|
...this.opts
|
|
1149
1149
|
};
|
|
1150
|
-
intlOpts.timeZone = intlOpts.timeZone ||
|
|
1150
|
+
intlOpts.timeZone = intlOpts.timeZone || z50;
|
|
1151
1151
|
this.dtf = getCachedDTF(intl, intlOpts);
|
|
1152
1152
|
}
|
|
1153
1153
|
format() {
|
|
@@ -11736,6 +11736,9 @@ var automationTriggerSchema = z11.discriminatedUnion("type", [
|
|
|
11736
11736
|
z11.object({ type: z11.literal("custom"), config: z11.object({}) })
|
|
11737
11737
|
]);
|
|
11738
11738
|
|
|
11739
|
+
// ../shared/src/format.ts
|
|
11740
|
+
var USD = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" });
|
|
11741
|
+
|
|
11739
11742
|
// ../shared/src/routes/environment-setups.ts
|
|
11740
11743
|
var ENVIRONMENT_SETUP_STEPS = [
|
|
11741
11744
|
{ key: "understand", label: "Understand the codebase" },
|
|
@@ -11886,6 +11889,7 @@ var applyEnvironmentSetupRequestSchema = z12.object({
|
|
|
11886
11889
|
});
|
|
11887
11890
|
|
|
11888
11891
|
// ../shared/src/routes/environment.ts
|
|
11892
|
+
var ENVIRONMENT_SETUP_SOURCE_MODES = ["app_and_repo", "repo_only", "app_only"];
|
|
11889
11893
|
var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
|
|
11890
11894
|
var MCP_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
11891
11895
|
var environmentMcpVariableReferenceSchema = z13.strictObject({
|
|
@@ -16180,6 +16184,7 @@ var replicasEnvironmentConfigSchema = z26.strictObject({
|
|
|
16180
16184
|
memory: z26.strictObject({ read: z26.boolean().optional(), write: z26.boolean().optional() }).nullable().optional(),
|
|
16181
16185
|
gpu: z26.boolean().nullable().optional(),
|
|
16182
16186
|
mobileTesting: z26.boolean().nullable().optional(),
|
|
16187
|
+
setupSourceMode: z26.enum(ENVIRONMENT_SETUP_SOURCE_MODES).nullable().optional(),
|
|
16183
16188
|
defaultSkills: defaultSkillsOverridesSchema.superRefine((skills, context) => {
|
|
16184
16189
|
for (const ability of REPLICAS_AGENT_ABILITIES) if (skills.replicas_agent?.abilities?.[ability] === false && REPLICAS_AGENT_ABILITY_REGISTRY[ability].locked) context.addIssue({ code: "custom", path: ["replicas_agent", "abilities", ability], message: "This built-in ability cannot be disabled" });
|
|
16185
16190
|
}).nullable().optional(),
|
|
@@ -16217,7 +16222,7 @@ var replicasEnvironmentConfigSchema = z26.strictObject({
|
|
|
16217
16222
|
});
|
|
16218
16223
|
|
|
16219
16224
|
// ../shared/src/routes/environment-config-source.ts
|
|
16220
|
-
var ENVIRONMENT_CONFIG_PREFERENCES = [["memory", "memory"], ["gpu", "gpu"], ["mobileTesting", "mobile_testing"], ["defaultSkills", "default_skills"]];
|
|
16225
|
+
var ENVIRONMENT_CONFIG_PREFERENCES = [["memory", "memory"], ["gpu", "gpu"], ["mobileTesting", "mobile_testing"], ["defaultSkills", "default_skills"], ["setupSourceMode", "setup_source_mode"]];
|
|
16221
16226
|
var ENVIRONMENT_CONFIG_SETTING_FIELDS = ["repositories", "workspaceSize", "inheritRepositories", ...ENVIRONMENT_CONFIG_PREFERENCES.map(([field]) => field)];
|
|
16222
16227
|
var environmentConfigLocationSchema = z27.union([
|
|
16223
16228
|
z27.object({
|
|
@@ -21208,7 +21213,7 @@ function filterDisplayMessages(messages, provider2) {
|
|
|
21208
21213
|
}
|
|
21209
21214
|
const cleaned = withoutAttachmentPlaceholder(content, Boolean(msg.images?.length || files.length));
|
|
21210
21215
|
if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [];
|
|
21211
|
-
const origin = msg.cancelled ? null : parseMessageOrigin(msg.content);
|
|
21216
|
+
const origin = msg.cancelled ? null : parseMessageOrigin(threadHandoffText(msg.content) || msg.content);
|
|
21212
21217
|
if (cleaned === msg.content && !origin && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [msg];
|
|
21213
21218
|
return [{
|
|
21214
21219
|
...msg,
|
|
@@ -21994,7 +21999,7 @@ async function withRetry(label, fn, options) {
|
|
|
21994
21999
|
}
|
|
21995
22000
|
|
|
21996
22001
|
// ../shared/src/tensorlake.ts
|
|
21997
|
-
var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-22-
|
|
22002
|
+
var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-22-v8547";
|
|
21998
22003
|
var TENSORLAKE_DISK_MB = 100 * 1024;
|
|
21999
22004
|
|
|
22000
22005
|
// ../shared/src/egress.ts
|
|
@@ -24140,8 +24145,13 @@ var WEBHOOK_PROVIDERS = ["linear", "github", "gitlab", "slack", "stripe", "sentr
|
|
|
24140
24145
|
var WEBHOOK_PROVIDER_SET = new Set(WEBHOOK_PROVIDERS);
|
|
24141
24146
|
|
|
24142
24147
|
// ../shared/src/routes/environment-hook-runs.ts
|
|
24148
|
+
import { z as z47 } from "zod";
|
|
24143
24149
|
var ENVIRONMENT_HOOK_RUN_LOG_LIMIT = 5 * 1024 * 1024;
|
|
24144
24150
|
var ENVIRONMENT_HOOK_RUN_TAIL_LIMIT = 8 * 1024;
|
|
24151
|
+
var environmentHookRunStepsSchema = z47.array(z47.object({
|
|
24152
|
+
repository: z47.string().max(255).nullable(),
|
|
24153
|
+
status: z47.enum(["succeeded", "failed", "skipped"])
|
|
24154
|
+
})).max(1024);
|
|
24145
24155
|
|
|
24146
24156
|
// ../shared/src/workspace-alerts.ts
|
|
24147
24157
|
var MANAGER_RELAY_WINDOW_MS = 5 * 6e4;
|
|
@@ -24358,40 +24368,40 @@ function isSkillRegistryManifest(value) {
|
|
|
24358
24368
|
}
|
|
24359
24369
|
|
|
24360
24370
|
// ../shared/src/routes/variable-requests.ts
|
|
24361
|
-
import { z as
|
|
24371
|
+
import { z as z48 } from "zod";
|
|
24362
24372
|
var VARIABLE_REQUEST_WAIT = { defaultMs: 10 * 6e4, maxMs: 30 * 6e4, pollMs: 3e3, waiterStaleMs: 15e3 };
|
|
24363
24373
|
var VARIABLE_REQUEST_DESTINATIONS = ["environment", "workspace"];
|
|
24364
|
-
var requestedVariableSchema =
|
|
24365
|
-
key:
|
|
24366
|
-
required:
|
|
24367
|
-
replace:
|
|
24374
|
+
var requestedVariableSchema = z48.object({
|
|
24375
|
+
key: z48.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
|
|
24376
|
+
required: z48.boolean(),
|
|
24377
|
+
replace: z48.boolean().optional()
|
|
24368
24378
|
});
|
|
24369
|
-
var requestedVariablesSchema =
|
|
24370
|
-
var createVariableRequestSchema =
|
|
24379
|
+
var requestedVariablesSchema = z48.array(requestedVariableSchema).min(1, "must not be empty").max(ENVIRONMENT_SETUP_LIMITS.variables).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys");
|
|
24380
|
+
var createVariableRequestSchema = z48.object({
|
|
24371
24381
|
variables: requestedVariablesSchema,
|
|
24372
|
-
reason:
|
|
24373
|
-
wait:
|
|
24382
|
+
reason: z48.string().trim().max(500).nullish().transform((value) => value || null),
|
|
24383
|
+
wait: z48.boolean().default(true)
|
|
24374
24384
|
});
|
|
24375
|
-
var respondVariableRequestSchema =
|
|
24376
|
-
|
|
24377
|
-
action:
|
|
24378
|
-
destination:
|
|
24385
|
+
var respondVariableRequestSchema = z48.discriminatedUnion("action", [
|
|
24386
|
+
z48.object({
|
|
24387
|
+
action: z48.literal("provide"),
|
|
24388
|
+
destination: z48.enum(VARIABLE_REQUEST_DESTINATIONS),
|
|
24379
24389
|
/** Defaults to the workspace's environment, so older clients keep saving there. */
|
|
24380
|
-
environment_ids:
|
|
24381
|
-
overwrite:
|
|
24382
|
-
values:
|
|
24390
|
+
environment_ids: z48.array(z48.string().uuid()).optional(),
|
|
24391
|
+
overwrite: z48.boolean().optional(),
|
|
24392
|
+
values: z48.record(z48.string().regex(VARIABLE_KEY_RE), z48.string())
|
|
24383
24393
|
}),
|
|
24384
|
-
|
|
24394
|
+
z48.object({ action: z48.literal("skip") })
|
|
24385
24395
|
]);
|
|
24386
24396
|
|
|
24387
24397
|
// ../shared/src/routes/local-control-requests.ts
|
|
24388
|
-
import { z as
|
|
24389
|
-
var createLocalControlRequestSchema =
|
|
24390
|
-
reason:
|
|
24391
|
-
wait:
|
|
24398
|
+
import { z as z49 } from "zod";
|
|
24399
|
+
var createLocalControlRequestSchema = z49.object({
|
|
24400
|
+
reason: z49.string().trim().max(500).optional().transform((value) => value || null),
|
|
24401
|
+
wait: z49.boolean().default(true)
|
|
24392
24402
|
});
|
|
24393
|
-
var respondLocalControlRequestSchema =
|
|
24394
|
-
var setLocalControlSchema =
|
|
24403
|
+
var respondLocalControlRequestSchema = z49.object({ action: z49.enum(["allow", "dismiss"]) });
|
|
24404
|
+
var setLocalControlSchema = z49.object({ enabled: z49.boolean() });
|
|
24395
24405
|
|
|
24396
24406
|
export {
|
|
24397
24407
|
ENGINE_SEND_MESSAGE_FAILED_ERROR,
|
package/dist/src/codemode-mcp.js
CHANGED
|
@@ -4,15 +4,15 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
getManagedPiMcpServers,
|
|
6
6
|
managedMcpServerProcess
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-55G3NLLN.js";
|
|
8
8
|
import "./chunk-XCFPXSY4.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ONX4IOKS.js";
|
|
10
10
|
import {
|
|
11
11
|
isRecord
|
|
12
12
|
} from "./chunk-UZSNFLDQ.js";
|
|
13
13
|
import {
|
|
14
14
|
rankToolsByQuery
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-VBNDEBIY.js";
|
|
16
16
|
import "./chunk-VEQXQN22.js";
|
|
17
17
|
|
|
18
18
|
// src/codemode-mcp.ts
|
|
@@ -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-BFNB3T2B.js";
|
|
7
|
+
import "./chunk-7MXDYU6B.js";
|
|
8
|
+
import "./chunk-7PPJSJPG.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-VBNDEBIY.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
spawnMuseMsp,
|
|
19
19
|
startGeminiSession,
|
|
20
20
|
startMuseSession
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UVNMAG7F.js";
|
|
22
22
|
import "./chunk-XCFPXSY4.js";
|
|
23
23
|
import {
|
|
24
24
|
AppServerProcess,
|
|
25
25
|
buildCodexAgentEnv
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-6ZQJ2FCZ.js";
|
|
27
|
+
import "./chunk-7PPJSJPG.js";
|
|
28
28
|
import {
|
|
29
29
|
AGENT,
|
|
30
30
|
OPENCODE_GO_PROVIDER,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
headlessAgentUsagePath,
|
|
35
35
|
isRecord,
|
|
36
36
|
withTimeout
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-VBNDEBIY.js";
|
|
38
38
|
import "./chunk-VEQXQN22.js";
|
|
39
39
|
|
|
40
40
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -90,12 +90,12 @@ import {
|
|
|
90
90
|
import {
|
|
91
91
|
getManagedPiMcpServers,
|
|
92
92
|
managedMcpServerProcess
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-55G3NLLN.js";
|
|
94
94
|
import {
|
|
95
95
|
evaluateCommandProtection,
|
|
96
96
|
extractToolCommand,
|
|
97
97
|
reportCommandProtectionBlock
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-BFNB3T2B.js";
|
|
99
99
|
import {
|
|
100
100
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
101
101
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
startMuseSession,
|
|
136
136
|
thinkingVariant,
|
|
137
137
|
uuidV7
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-UVNMAG7F.js";
|
|
139
139
|
import {
|
|
140
140
|
GEMINI_AUTH_PATH,
|
|
141
141
|
GEMINI_CLI_PATH,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
} from "./chunk-XCFPXSY4.js";
|
|
146
146
|
import {
|
|
147
147
|
publishedPullRequestUrls
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-ECEMAFOD.js";
|
|
149
149
|
import {
|
|
150
150
|
ACCOUNT_RATE_LIMITS_READ_METHOD,
|
|
151
151
|
AsyncLock,
|
|
@@ -225,12 +225,12 @@ import {
|
|
|
225
225
|
upsertCredentialFileLines,
|
|
226
226
|
withdrawAgentLogin,
|
|
227
227
|
writeSecureCredentialFile
|
|
228
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-F6YSMVNR.js";
|
|
229
229
|
import {
|
|
230
230
|
SUBAGENT_MCP_TOOL_TIMEOUT_MS,
|
|
231
231
|
engineScriptProcess,
|
|
232
232
|
subagentMcpProcessConfig
|
|
233
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-ONX4IOKS.js";
|
|
234
234
|
import {
|
|
235
235
|
ENGINE_ENV,
|
|
236
236
|
UNQUOTED_PATHS_CONFIG,
|
|
@@ -241,18 +241,18 @@ import {
|
|
|
241
241
|
resolveDiffBase,
|
|
242
242
|
setAgentCredentialSnapshot,
|
|
243
243
|
setLinearSessionId
|
|
244
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-7MXDYU6B.js";
|
|
245
245
|
import {
|
|
246
246
|
AspRequestTimeoutError,
|
|
247
247
|
AspResponseError,
|
|
248
248
|
buildCodexAgentEnv,
|
|
249
249
|
getCodexModelProvider
|
|
250
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-6ZQJ2FCZ.js";
|
|
251
251
|
import {
|
|
252
252
|
SUBPROCESS_MAX_BUFFER,
|
|
253
253
|
execAsync,
|
|
254
254
|
execFileAsync
|
|
255
|
-
} from "./chunk-
|
|
255
|
+
} from "./chunk-7PPJSJPG.js";
|
|
256
256
|
import {
|
|
257
257
|
isRecord
|
|
258
258
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -556,7 +556,7 @@ import {
|
|
|
556
556
|
workspaceTokenRequestSchema,
|
|
557
557
|
workspaceTokenResponseSchema,
|
|
558
558
|
wrapInTag
|
|
559
|
-
} from "./chunk-
|
|
559
|
+
} from "./chunk-VBNDEBIY.js";
|
|
560
560
|
import {
|
|
561
561
|
__commonJS,
|
|
562
562
|
__export,
|
|
@@ -693,7 +693,7 @@ var require_lib = __commonJS({
|
|
|
693
693
|
"../node_modules/.bun/which@5.0.0/node_modules/which/lib/index.js"(exports, module) {
|
|
694
694
|
"use strict";
|
|
695
695
|
var { isexe, sync: isexeSync } = require_index_min();
|
|
696
|
-
var { join:
|
|
696
|
+
var { join: join38, delimiter: delimiter3, sep: sep2, posix } = __require("path");
|
|
697
697
|
var isWindows = process.platform === "win32";
|
|
698
698
|
var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
|
|
699
699
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
@@ -722,7 +722,7 @@ var require_lib = __commonJS({
|
|
|
722
722
|
var getPathPart = (raw, cmd) => {
|
|
723
723
|
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
724
724
|
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
725
|
-
return prefix +
|
|
725
|
+
return prefix + join38(pathPart, cmd);
|
|
726
726
|
};
|
|
727
727
|
var which = async (cmd, opt = {}) => {
|
|
728
728
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
@@ -10357,13 +10357,17 @@ async function readReplicasConfigFromDir(dirPath) {
|
|
|
10357
10357
|
continue;
|
|
10358
10358
|
}
|
|
10359
10359
|
const data = await readFile4(configPath, "utf-8");
|
|
10360
|
-
|
|
10361
|
-
|
|
10360
|
+
try {
|
|
10361
|
+
return createSuccessResult({ config: parseReplicasConfigString(data, filename), filename });
|
|
10362
|
+
} catch (error) {
|
|
10363
|
+
return createErrorResult({ message: `Could not parse ${filename}: ${error instanceof Error ? error.message : String(error)}` });
|
|
10364
|
+
}
|
|
10362
10365
|
}
|
|
10363
|
-
return null;
|
|
10366
|
+
return createSuccessResult(null);
|
|
10364
10367
|
}
|
|
10365
10368
|
var ReplicasConfigService = class {
|
|
10366
10369
|
configs = [];
|
|
10370
|
+
configErrors = [];
|
|
10367
10371
|
hooksRunning = false;
|
|
10368
10372
|
hooksCompleted = false;
|
|
10369
10373
|
hooksFailed = false;
|
|
@@ -10395,7 +10399,8 @@ var ReplicasConfigService = class {
|
|
|
10395
10399
|
timedOut: result.timedOut,
|
|
10396
10400
|
output: result.output.slice(-ENVIRONMENT_HOOK_RUN_LOG_LIMIT),
|
|
10397
10401
|
outputChars: result.output.length,
|
|
10398
|
-
network: await checkProxyRoute()
|
|
10402
|
+
network: await checkProxyRoute(),
|
|
10403
|
+
steps: result.steps
|
|
10399
10404
|
}, START_HOOK_REPORT_ATTEMPTS), (error) => {
|
|
10400
10405
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
10401
10406
|
this.hooksFailed = true;
|
|
@@ -10428,27 +10433,30 @@ var ReplicasConfigService = class {
|
|
|
10428
10433
|
async loadConfigs() {
|
|
10429
10434
|
const repos = await gitService.listRepositories();
|
|
10430
10435
|
const configs = [];
|
|
10436
|
+
const configErrors = [];
|
|
10431
10437
|
for (const repo of repos) {
|
|
10432
10438
|
try {
|
|
10433
10439
|
const result = await readReplicasConfigFromDir(repo.path);
|
|
10434
|
-
if (!result) {
|
|
10440
|
+
if (!result.ok) {
|
|
10441
|
+
console.error(`[ReplicasConfig] ${repo.name}: ${result.error.message}`);
|
|
10442
|
+
configErrors.push({ repoName: repo.name, error: result.error.message });
|
|
10443
|
+
continue;
|
|
10444
|
+
}
|
|
10445
|
+
if (!result.data) {
|
|
10435
10446
|
continue;
|
|
10436
10447
|
}
|
|
10437
10448
|
configs.push({
|
|
10438
10449
|
repoName: repo.name,
|
|
10439
10450
|
workingDirectory: repo.path,
|
|
10440
10451
|
defaultBranch: repo.defaultBranch,
|
|
10441
|
-
config: result.config
|
|
10452
|
+
config: result.data.config
|
|
10442
10453
|
});
|
|
10443
10454
|
} catch (error) {
|
|
10444
|
-
|
|
10445
|
-
console.error(`[ReplicasConfig] Failed to parse ${repo.name} config:`, error.message);
|
|
10446
|
-
} else if (error instanceof Error) {
|
|
10447
|
-
console.error(`[ReplicasConfig] Error loading ${repo.name} config:`, error.message);
|
|
10448
|
-
}
|
|
10455
|
+
console.error(`[ReplicasConfig] Error loading ${repo.name} config:`, error instanceof Error ? error.message : error);
|
|
10449
10456
|
}
|
|
10450
10457
|
}
|
|
10451
|
-
this.configs = configs;
|
|
10458
|
+
this.configs = configs.sort((a, b) => a.repoName.localeCompare(b.repoName));
|
|
10459
|
+
this.configErrors = configErrors;
|
|
10452
10460
|
}
|
|
10453
10461
|
/**
|
|
10454
10462
|
* Write a message to the start hooks log file.
|
|
@@ -10561,8 +10569,12 @@ var ReplicasConfigService = class {
|
|
|
10561
10569
|
const onEvent = params.onEvent ?? (() => {
|
|
10562
10570
|
});
|
|
10563
10571
|
const envHookContent = (params.environmentStartHook ?? ENGINE_ENV.REPLICAS_ENV_START_HOOK)?.trim() ?? "";
|
|
10564
|
-
const
|
|
10572
|
+
const repoEntries = [
|
|
10573
|
+
...this.repositoryStartHookEntries(),
|
|
10574
|
+
...ENGINE_ENV.REPLICAS_REPOSITORY_HOOKS_DISABLED ? [] : this.configErrors
|
|
10575
|
+
].sort((a, b) => a.repoName.localeCompare(b.repoName));
|
|
10565
10576
|
const outputBlocks = [];
|
|
10577
|
+
const steps = [];
|
|
10566
10578
|
let overallExitCode = 0;
|
|
10567
10579
|
let overallTimedOut = false;
|
|
10568
10580
|
const recordResult = (result) => {
|
|
@@ -10577,7 +10589,7 @@ var ReplicasConfigService = class {
|
|
|
10577
10589
|
overallTimedOut = true;
|
|
10578
10590
|
}
|
|
10579
10591
|
};
|
|
10580
|
-
if (!envHookContent &&
|
|
10592
|
+
if (!envHookContent && repoEntries.length === 0) {
|
|
10581
10593
|
this.hooksRunning = false;
|
|
10582
10594
|
this.hooksCompleted = true;
|
|
10583
10595
|
this.hooksFailed = false;
|
|
@@ -10586,10 +10598,10 @@ var ReplicasConfigService = class {
|
|
|
10586
10598
|
for (const repo of repos) {
|
|
10587
10599
|
await environmentDetailsService.setRepositoryStartHook(repo.name, "n/a");
|
|
10588
10600
|
}
|
|
10589
|
-
const result = { exitCode: 0, output: "No start hooks configured.", timedOut: false };
|
|
10601
|
+
const result = { exitCode: 0, output: "No start hooks configured.", timedOut: false, steps };
|
|
10590
10602
|
onEvent({ type: "output", data: `${result.output}
|
|
10591
10603
|
`, label: "start-hooks" });
|
|
10592
|
-
onEvent({ type: "complete", exitCode: result.exitCode, timedOut: result.timedOut });
|
|
10604
|
+
onEvent({ type: "complete", exitCode: result.exitCode, timedOut: result.timedOut, steps });
|
|
10593
10605
|
return result;
|
|
10594
10606
|
}
|
|
10595
10607
|
this.hooksRunning = true;
|
|
@@ -10603,7 +10615,7 @@ var ReplicasConfigService = class {
|
|
|
10603
10615
|
`=== Start Hooks Execution Log ===
|
|
10604
10616
|
Started: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
10605
10617
|
Environment hook: ${envHookContent ? "yes" : "no"}
|
|
10606
|
-
Repositories: ${
|
|
10618
|
+
Repositories: ${repoEntries.length}
|
|
10607
10619
|
|
|
10608
10620
|
`,
|
|
10609
10621
|
"utf-8"
|
|
@@ -10615,6 +10627,7 @@ Repositories: ${hookEntries.length}
|
|
|
10615
10627
|
onOutputChunk: (chunk) => onEvent({ type: "output", data: chunk, label: "environment" })
|
|
10616
10628
|
});
|
|
10617
10629
|
recordResult(envResult);
|
|
10630
|
+
steps.push({ repository: null, status: envResult.exitCode === 0 ? "succeeded" : "failed" });
|
|
10618
10631
|
await startHookLogsService.saveEnvironmentLog({
|
|
10619
10632
|
hookCommands: [envHookContent],
|
|
10620
10633
|
output: envResult.output.join(""),
|
|
@@ -10626,13 +10639,30 @@ Repositories: ${hookEntries.length}
|
|
|
10626
10639
|
await environmentDetailsService.setEnvironmentStartHook("n/a");
|
|
10627
10640
|
}
|
|
10628
10641
|
const repos = await gitService.listRepositories();
|
|
10629
|
-
const reposWithHooks = new Set(
|
|
10642
|
+
const reposWithHooks = new Set(repoEntries.map((entry) => entry.repoName));
|
|
10630
10643
|
for (const repo of repos) {
|
|
10631
10644
|
if (!reposWithHooks.has(repo.name)) {
|
|
10632
10645
|
await environmentDetailsService.setRepositoryStartHook(repo.name, "n/a");
|
|
10633
10646
|
}
|
|
10634
10647
|
}
|
|
10635
|
-
for (const entry of
|
|
10648
|
+
for (const entry of repoEntries) {
|
|
10649
|
+
if ("error" in entry) {
|
|
10650
|
+
const output = `[ERROR] ${entry.repoName}: ${entry.error}
|
|
10651
|
+
`;
|
|
10652
|
+
onEvent({ type: "output", data: output, label: `repo:${entry.repoName}` });
|
|
10653
|
+
await this.logToFile(`[${entry.repoName}] ${output.trim()}`);
|
|
10654
|
+
recordResult({ exitCode: 1, timedOut: false, output: [output] });
|
|
10655
|
+
await startHookLogsService.saveRepoLog(entry.repoName, {
|
|
10656
|
+
hookCommands: [],
|
|
10657
|
+
output,
|
|
10658
|
+
exitCode: 1,
|
|
10659
|
+
timedOut: false,
|
|
10660
|
+
executedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
10661
|
+
});
|
|
10662
|
+
await environmentDetailsService.setRepositoryStartHook(entry.repoName, "no");
|
|
10663
|
+
steps.push({ repository: entry.repoName, status: "failed" });
|
|
10664
|
+
continue;
|
|
10665
|
+
}
|
|
10636
10666
|
const startHookConfig = entry.config.startHook;
|
|
10637
10667
|
if (!startHookConfig) {
|
|
10638
10668
|
continue;
|
|
@@ -10641,6 +10671,7 @@ Repositories: ${hookEntries.length}
|
|
|
10641
10671
|
if (!params.ignorePersistedState && persistedRepoState?.startHooksCompleted) {
|
|
10642
10672
|
await this.logToFile(`[${entry.repoName}] Start hooks already completed in this workspace lifecycle, skipping`);
|
|
10643
10673
|
await environmentDetailsService.setRepositoryStartHook(entry.repoName, "yes");
|
|
10674
|
+
steps.push({ repository: entry.repoName, status: "skipped" });
|
|
10644
10675
|
continue;
|
|
10645
10676
|
}
|
|
10646
10677
|
await this.stopStartHookProcesses(entry.repoName);
|
|
@@ -10713,15 +10744,17 @@ ${startHookConfig.commands.join("\n")}`;
|
|
|
10713
10744
|
await saveRepoState(entry.repoName, { startHooksCompleted: true }, fallbackRepoState);
|
|
10714
10745
|
}
|
|
10715
10746
|
await environmentDetailsService.setRepositoryStartHook(entry.repoName, repoFailed ? "no" : "yes");
|
|
10747
|
+
steps.push({ repository: entry.repoName, status: repoFailed ? "failed" : "succeeded" });
|
|
10716
10748
|
}
|
|
10717
10749
|
this.hooksCompleted = true;
|
|
10718
10750
|
this.hooksFailed = overallExitCode !== 0;
|
|
10719
10751
|
const result = {
|
|
10720
10752
|
exitCode: overallExitCode,
|
|
10721
10753
|
output: outputBlocks.join("\n\n"),
|
|
10722
|
-
timedOut: overallTimedOut
|
|
10754
|
+
timedOut: overallTimedOut,
|
|
10755
|
+
steps
|
|
10723
10756
|
};
|
|
10724
|
-
onEvent({ type: "complete", exitCode: result.exitCode, timedOut: result.timedOut });
|
|
10757
|
+
onEvent({ type: "complete", exitCode: result.exitCode, timedOut: result.timedOut, steps });
|
|
10725
10758
|
return result;
|
|
10726
10759
|
} catch (error) {
|
|
10727
10760
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -10763,7 +10796,7 @@ ${startHookConfig.commands.join("\n")}`;
|
|
|
10763
10796
|
if (envHookContent) {
|
|
10764
10797
|
commands.push(`[environment] ${envHookContent}`);
|
|
10765
10798
|
}
|
|
10766
|
-
for (const entry of this.
|
|
10799
|
+
for (const entry of this.repositoryStartHookEntries()) {
|
|
10767
10800
|
const repoCommands = entry.config.startHook?.commands ?? [];
|
|
10768
10801
|
for (const command of repoCommands) {
|
|
10769
10802
|
commands.push(`[${entry.repoName}] ${command}`);
|
|
@@ -10774,6 +10807,10 @@ ${startHookConfig.commands.join("\n")}`;
|
|
|
10774
10807
|
}
|
|
10775
10808
|
return { commands };
|
|
10776
10809
|
}
|
|
10810
|
+
repositoryStartHookEntries() {
|
|
10811
|
+
if (ENGINE_ENV.REPLICAS_REPOSITORY_HOOKS_DISABLED) return [];
|
|
10812
|
+
return this.configs.filter((entry) => entry.config.startHook && entry.config.startHook.commands.length > 0);
|
|
10813
|
+
}
|
|
10777
10814
|
getSystemPrompts() {
|
|
10778
10815
|
return repositorySystemPrompts(this.configs);
|
|
10779
10816
|
}
|
|
@@ -64973,15 +65010,12 @@ var RepoFileService = class {
|
|
|
64973
65010
|
// src/v1-routes.ts
|
|
64974
65011
|
import { Hono } from "hono";
|
|
64975
65012
|
import { z as z6 } from "zod";
|
|
64976
|
-
import { readdir as readdir12, stat as stat6, readFile as
|
|
65013
|
+
import { readdir as readdir12, stat as stat6, readFile as readFile21 } from "fs/promises";
|
|
64977
65014
|
import { openAsBlob } from "fs";
|
|
64978
|
-
import { join as
|
|
65015
|
+
import { join as join35, resolve as resolve6 } from "path";
|
|
64979
65016
|
|
|
64980
65017
|
// src/services/warm-hooks-service.ts
|
|
64981
65018
|
import { spawn as spawn5 } from "child_process";
|
|
64982
|
-
import { readFile as readFile21 } from "fs/promises";
|
|
64983
|
-
import { existsSync as existsSync16 } from "fs";
|
|
64984
|
-
import { join as join35 } from "path";
|
|
64985
65019
|
|
|
64986
65020
|
// src/services/warm-hook-logs-service.ts
|
|
64987
65021
|
import { mkdir as mkdir16, readFile as readFile20, writeFile as writeFile9, readdir as readdir11, appendFile as appendFile5, unlink as unlink2 } from "fs/promises";
|
|
@@ -65086,34 +65120,16 @@ var WarmHookLogsService = class {
|
|
|
65086
65120
|
var warmHookLogsService = new WarmHookLogsService();
|
|
65087
65121
|
|
|
65088
65122
|
// src/services/warm-hooks-service.ts
|
|
65089
|
-
async function readRepoWarmHook(repoPath) {
|
|
65090
|
-
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
65091
|
-
const configPath = join35(repoPath, filename);
|
|
65092
|
-
if (!existsSync16(configPath)) {
|
|
65093
|
-
continue;
|
|
65094
|
-
}
|
|
65095
|
-
try {
|
|
65096
|
-
const raw = await readFile21(configPath, "utf-8");
|
|
65097
|
-
const config = parseReplicasConfigString(raw, filename);
|
|
65098
|
-
if (!config.warmHook) {
|
|
65099
|
-
return null;
|
|
65100
|
-
}
|
|
65101
|
-
return resolveWarmHookConfig(config.warmHook);
|
|
65102
|
-
} catch (error) {
|
|
65103
|
-
const nodeError = error;
|
|
65104
|
-
if (nodeError?.code === "ENOENT") {
|
|
65105
|
-
continue;
|
|
65106
|
-
}
|
|
65107
|
-
throw error;
|
|
65108
|
-
}
|
|
65109
|
-
}
|
|
65110
|
-
return null;
|
|
65111
|
-
}
|
|
65112
65123
|
async function collectRepoWarmHooks() {
|
|
65113
65124
|
const repos = await gitService.listRepositories();
|
|
65114
65125
|
const collected = [];
|
|
65115
65126
|
for (const repo of repos) {
|
|
65116
|
-
const
|
|
65127
|
+
const result = await readReplicasConfigFromDir(repo.path);
|
|
65128
|
+
if (!result.ok) {
|
|
65129
|
+
collected.push({ repoName: repo.name, repoPath: repo.path, configError: result.error.message });
|
|
65130
|
+
continue;
|
|
65131
|
+
}
|
|
65132
|
+
const warmHook = result.data?.config.warmHook ? resolveWarmHookConfig(result.data.config.warmHook) : null;
|
|
65117
65133
|
if (!warmHook) {
|
|
65118
65134
|
continue;
|
|
65119
65135
|
}
|
|
@@ -65194,12 +65210,13 @@ async function executeHookScriptStreaming(params) {
|
|
|
65194
65210
|
async function runWarmHooksStreaming(params) {
|
|
65195
65211
|
await warmHookLogsService.resetCurrentRunLog();
|
|
65196
65212
|
const originalOnEvent = params.onEvent;
|
|
65213
|
+
const steps = [];
|
|
65197
65214
|
const onEvent = (event) => {
|
|
65198
65215
|
if (event.type === "output" && event.data) {
|
|
65199
65216
|
void warmHookLogsService.appendCurrentRunLog(event.data).catch(() => {
|
|
65200
65217
|
});
|
|
65201
65218
|
}
|
|
65202
|
-
originalOnEvent(event);
|
|
65219
|
+
originalOnEvent(event.type === "complete" ? { ...event, steps } : event);
|
|
65203
65220
|
};
|
|
65204
65221
|
params = { ...params, onEvent };
|
|
65205
65222
|
const outputBlocks = [];
|
|
@@ -65213,6 +65230,7 @@ async function runWarmHooksStreaming(params) {
|
|
|
65213
65230
|
onChunk: (chunk) => params.onEvent({ type: "output", data: chunk, label: "environment-warm-hook" })
|
|
65214
65231
|
});
|
|
65215
65232
|
outputBlocks.push(envResult.output);
|
|
65233
|
+
steps.push({ repository: null, status: envResult.exitCode === 0 ? "succeeded" : "failed" });
|
|
65216
65234
|
await environmentDetailsService.setEnvironmentWarmHook(envResult.exitCode === 0 ? "yes" : "no", envResult.output);
|
|
65217
65235
|
await warmHookLogsService.saveEnvironmentHookLog({
|
|
65218
65236
|
hookScript: environmentHook,
|
|
@@ -65233,7 +65251,7 @@ async function runWarmHooksStreaming(params) {
|
|
|
65233
65251
|
} else {
|
|
65234
65252
|
await environmentDetailsService.setEnvironmentWarmHook("n/a");
|
|
65235
65253
|
}
|
|
65236
|
-
const repoHooks = await collectRepoWarmHooks();
|
|
65254
|
+
const repoHooks = ENGINE_ENV.REPLICAS_REPOSITORY_HOOKS_DISABLED ? [] : await collectRepoWarmHooks();
|
|
65237
65255
|
const repoHookNames = new Set(repoHooks.map((repoHook) => repoHook.repoName));
|
|
65238
65256
|
const discoveredRepos = await gitService.listRepositories();
|
|
65239
65257
|
for (const repo of discoveredRepos) {
|
|
@@ -65242,6 +65260,25 @@ async function runWarmHooksStreaming(params) {
|
|
|
65242
65260
|
}
|
|
65243
65261
|
}
|
|
65244
65262
|
for (const repoHook of repoHooks) {
|
|
65263
|
+
if ("configError" in repoHook) {
|
|
65264
|
+
const output = `$ repo-warm-hook:${repoHook.repoName}
|
|
65265
|
+
[ERROR] ${repoHook.configError}
|
|
65266
|
+
`;
|
|
65267
|
+
params.onEvent({ type: "output", data: output, label: `repo:${repoHook.repoName}` });
|
|
65268
|
+
outputBlocks.push(output);
|
|
65269
|
+
steps.push({ repository: repoHook.repoName, status: "failed" });
|
|
65270
|
+
await environmentDetailsService.setRepositoryWarmHook(repoHook.repoName, "no");
|
|
65271
|
+
await warmHookLogsService.saveRepoHookLog(repoHook.repoName, {
|
|
65272
|
+
hookScript: "",
|
|
65273
|
+
output,
|
|
65274
|
+
exitCode: 1,
|
|
65275
|
+
timedOut: false,
|
|
65276
|
+
executedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
65277
|
+
});
|
|
65278
|
+
const result2 = { exitCode: 1, output: outputBlocks.join("\n\n"), timedOut: false };
|
|
65279
|
+
params.onEvent({ type: "complete", exitCode: result2.exitCode, timedOut: result2.timedOut });
|
|
65280
|
+
return result2;
|
|
65281
|
+
}
|
|
65245
65282
|
const combinedScript = repoHook.commands.join("\n");
|
|
65246
65283
|
const repoOutputBlocks = [];
|
|
65247
65284
|
let repoFailed = false;
|
|
@@ -65283,6 +65320,7 @@ ${combinedScript}`;
|
|
|
65283
65320
|
}
|
|
65284
65321
|
}
|
|
65285
65322
|
}
|
|
65323
|
+
steps.push({ repository: repoHook.repoName, status: repoFailed ? "failed" : "succeeded" });
|
|
65286
65324
|
await environmentDetailsService.setRepositoryWarmHook(
|
|
65287
65325
|
repoHook.repoName,
|
|
65288
65326
|
repoFailed ? "no" : "yes"
|
|
@@ -65318,7 +65356,7 @@ ${combinedScript}` : combinedScript;
|
|
|
65318
65356
|
|
|
65319
65357
|
// src/services/terminal-service.ts
|
|
65320
65358
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
65321
|
-
import { existsSync as
|
|
65359
|
+
import { existsSync as existsSync16 } from "fs";
|
|
65322
65360
|
import { spawn as spawn6 } from "node-pty";
|
|
65323
65361
|
import { z as z5 } from "zod";
|
|
65324
65362
|
var MAX_REPLAY_CHARS2 = 1024 * 1024;
|
|
@@ -65346,7 +65384,7 @@ var TerminalService = class {
|
|
|
65346
65384
|
});
|
|
65347
65385
|
}
|
|
65348
65386
|
const id = randomUUID10();
|
|
65349
|
-
const shell = process.env.SHELL &&
|
|
65387
|
+
const shell = process.env.SHELL && existsSync16(process.env.SHELL) ? process.env.SHELL : "/bin/bash";
|
|
65350
65388
|
const pty = spawn6(shell, ["-l"], {
|
|
65351
65389
|
name: "xterm-256color",
|
|
65352
65390
|
cols,
|
|
@@ -66471,7 +66509,7 @@ data: ${JSON.stringify("Terminal session not found")}
|
|
|
66471
66509
|
const logFiles = files.filter((f) => f.endsWith(".log"));
|
|
66472
66510
|
const sessions = await Promise.all(
|
|
66473
66511
|
logFiles.map(async (filename) => {
|
|
66474
|
-
const filePath =
|
|
66512
|
+
const filePath = join35(LOG_DIR, filename);
|
|
66475
66513
|
const fileStat = await stat6(filePath);
|
|
66476
66514
|
const sessionId = filename.replace(/\.log$/, "");
|
|
66477
66515
|
return {
|
|
@@ -66506,7 +66544,7 @@ data: ${JSON.stringify("Terminal session not found")}
|
|
|
66506
66544
|
}
|
|
66507
66545
|
let content;
|
|
66508
66546
|
try {
|
|
66509
|
-
content = await
|
|
66547
|
+
content = await readFile21(filePath, "utf-8");
|
|
66510
66548
|
} catch {
|
|
66511
66549
|
return c.json(jsonError("Log session not found"), 404);
|
|
66512
66550
|
}
|
|
@@ -66530,7 +66568,7 @@ data: ${JSON.stringify("Terminal session not found")}
|
|
|
66530
66568
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
66531
66569
|
import { mkdir as mkdir17, open as open3, stat as stat7, writeFile as writeFile10 } from "fs/promises";
|
|
66532
66570
|
import { arch as arch2, platform as platform3 } from "os";
|
|
66533
|
-
import { dirname as dirname14, join as
|
|
66571
|
+
import { dirname as dirname14, join as join36, resolve as resolve7 } from "path";
|
|
66534
66572
|
import { z as z7 } from "zod";
|
|
66535
66573
|
|
|
66536
66574
|
// src/services/exec/process-registry.ts
|
|
@@ -66726,7 +66764,7 @@ function parse(schema, json) {
|
|
|
66726
66764
|
return parsed.data;
|
|
66727
66765
|
}
|
|
66728
66766
|
function resolvePath(target) {
|
|
66729
|
-
if (target === "~" || target.startsWith("~/")) return
|
|
66767
|
+
if (target === "~" || target.startsWith("~/")) return join36(ENGINE_ENV.HOME_DIR, target.slice(1));
|
|
66730
66768
|
return resolve7(ENGINE_ENV.WORKSPACE_ROOT, target);
|
|
66731
66769
|
}
|
|
66732
66770
|
async function mcpServerProcess(name) {
|
|
@@ -67002,13 +67040,13 @@ function attachTerminalSocket(id, socket) {
|
|
|
67002
67040
|
}
|
|
67003
67041
|
|
|
67004
67042
|
// src/services/resource-monitor.ts
|
|
67005
|
-
import { readFile as
|
|
67043
|
+
import { readFile as readFile22 } from "fs/promises";
|
|
67006
67044
|
var SAMPLE_INTERVAL_MS = 5e3;
|
|
67007
67045
|
var READ_TIMEOUT_MS = 2e3;
|
|
67008
67046
|
var pendingReads = new InFlightMap();
|
|
67009
67047
|
var boundedReads = /* @__PURE__ */ new WeakMap();
|
|
67010
67048
|
function readWithin(path8) {
|
|
67011
|
-
const read = pendingReads.run(path8, () =>
|
|
67049
|
+
const read = pendingReads.run(path8, () => readFile22(path8, "utf8"));
|
|
67012
67050
|
const bounded = boundedReads.get(read) ?? withTimeout(read, READ_TIMEOUT_MS, `Timed out reading ${path8}`);
|
|
67013
67051
|
boundedReads.set(read, bounded);
|
|
67014
67052
|
return bounded;
|
|
@@ -67267,8 +67305,8 @@ async function installWorkspaceSdk() {
|
|
|
67267
67305
|
// src/services/git-push-tracker.ts
|
|
67268
67306
|
import { mkdir as mkdir19, rm as rm8 } from "fs/promises";
|
|
67269
67307
|
import { createServer as createServer3 } from "net";
|
|
67270
|
-
import { join as
|
|
67271
|
-
var SOCKET_PATH =
|
|
67308
|
+
import { join as join37 } from "path";
|
|
67309
|
+
var SOCKET_PATH = join37(ENGINE_DIR, "git-trace2.sock");
|
|
67272
67310
|
var MAX_LINE_LENGTH = 1024 * 1024;
|
|
67273
67311
|
var listening = null;
|
|
67274
67312
|
function startGitPushTracker() {
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
publishedPullRequestUrls
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ECEMAFOD.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
10
|
import {
|
|
11
11
|
shouldRefreshPullRequests
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VBNDEBIY.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/services/post-tool-pr-notifier.ts
|
package/dist/src/subagent-mcp.js
CHANGED