replicas-engine 0.1.1601 → 0.1.1604
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-OTRP5WWS.js → asp-host-SREXP5OS.js} +5 -5
- package/dist/src/{chunk-6DGCGNRD.js → chunk-6D5SMRMT.js} +1 -1
- package/dist/src/{chunk-E5U45B5E.js → chunk-CLNFEQTV.js} +3 -3
- package/dist/src/{chunk-PUN65MPP.js → chunk-G4JGVKBD.js} +2 -2
- package/dist/src/{chunk-O76HWQZW.js → chunk-GUT6QWKE.js} +11 -20
- package/dist/src/{chunk-4XXV6XF7.js → chunk-L4G45OOU.js} +1 -1
- package/dist/src/{chunk-LAVIBP35.js → chunk-YMTLOKKY.js} +2 -2
- package/dist/src/{chunk-LM3GPSH5.js → chunk-YSWTDVQS.js} +6 -6
- package/dist/src/{chunk-Z744SRUU.js → chunk-ZKSPRQIP.js} +391 -230
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +34 -15
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
listCodexModelsForDetails,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-YSWTDVQS.js";
|
|
12
|
+
import "./chunk-YMTLOKKY.js";
|
|
13
|
+
import "./chunk-CLNFEQTV.js";
|
|
14
|
+
import "./chunk-6D5SMRMT.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-ZKSPRQIP.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
export {
|
|
19
19
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -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-ZKSPRQIP.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -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-6D5SMRMT.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZKSPRQIP.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.1604";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
AspClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CLNFEQTV.js";
|
|
7
7
|
import {
|
|
8
8
|
ASTER_BASE_URL,
|
|
9
9
|
ASTER_PROVIDER,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isRecord,
|
|
16
16
|
readOllamaAuthEnv,
|
|
17
17
|
readOpenAICompatibleAuthEnv
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZKSPRQIP.js";
|
|
19
19
|
|
|
20
20
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
21
21
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -3,24 +3,26 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
ENGINE_ENV,
|
|
6
|
-
getOriginDefaultBranch,
|
|
7
6
|
monolithRequest,
|
|
8
7
|
runGitCommand
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YMTLOKKY.js";
|
|
10
9
|
import {
|
|
10
|
+
COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
|
|
11
|
+
COMMAND_PROTECTION_REPO_GIT_ARGS,
|
|
12
|
+
commandProtectionEvaluateResponseSchema,
|
|
11
13
|
extractCommandProtectionCommandText,
|
|
12
14
|
findCommandProtectionGitLookups,
|
|
13
15
|
findGitCommitSignals,
|
|
14
16
|
findPrMergeSignals,
|
|
15
17
|
findScoutRepoWriteSignals,
|
|
16
18
|
parseCommandProtectionRequest,
|
|
19
|
+
toCommandProtectionRepoState,
|
|
17
20
|
withE2BRetry
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ZKSPRQIP.js";
|
|
19
22
|
|
|
20
23
|
// src/services/command-protection-service.ts
|
|
21
24
|
import { readFile, stat } from "fs/promises";
|
|
22
25
|
var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
|
|
23
|
-
var MAX_COMMIT_MESSAGE_FILE_BYTES = 64 * 1024;
|
|
24
26
|
var GATEWAY_ERROR_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
25
27
|
var SCOUT_REPO_WRITE_BLOCK_MESSAGE = "Scout never clones, commits, pushes, or opens pull requests. Spawn a workspace on an environment that has the repository, or relay this to the thread's workspace.";
|
|
26
28
|
async function resolveGitContext({ repoDirs, messageFiles }) {
|
|
@@ -28,29 +30,17 @@ async function resolveGitContext({ repoDirs, messageFiles }) {
|
|
|
28
30
|
const git = (dir, args) => runGitCommand(args, dir).then((output) => output || null, () => null);
|
|
29
31
|
const [repos, files] = await Promise.all([
|
|
30
32
|
Promise.all(repoDirs.map(async (dir) => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
getOriginDefaultBranch(dir),
|
|
34
|
-
git(dir, ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{push}"]),
|
|
35
|
-
git(dir, ["config", "--get-regexp", "^(push\\.default|push\\.pushoption|remote\\..+\\.push)$"]),
|
|
36
|
-
git(dir, ["log", "-1", "--format=%B"]),
|
|
37
|
-
git(dir, ["rev-parse", "--quiet", "--verify", "MERGE_HEAD"])
|
|
38
|
-
]);
|
|
39
|
-
return [dir, { branch, defaultBranch, pushBranch: pushBranch?.replace(/^[^/]+\//, "") ?? null, pushConfig, headMessage, mergeInProgress: mergeHead !== null }];
|
|
33
|
+
const outputs = await Promise.all(COMMAND_PROTECTION_REPO_GIT_ARGS.map((args) => git(dir, [...args])));
|
|
34
|
+
return [dir, toCommandProtectionRepoState(outputs)];
|
|
40
35
|
})),
|
|
41
36
|
Promise.all(messageFiles.map(async (path) => {
|
|
42
37
|
const info = await stat(path).catch(() => null);
|
|
43
|
-
const content = info?.isFile() && info.size <=
|
|
38
|
+
const content = info?.isFile() && info.size <= COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES ? await readFile(path, "utf8").catch(() => null) : null;
|
|
44
39
|
return content === null ? [] : [[path, content]];
|
|
45
40
|
}))
|
|
46
41
|
]);
|
|
47
42
|
return { repos: Object.fromEntries(repos), messageFiles: Object.fromEntries(files.flat()) };
|
|
48
43
|
}
|
|
49
|
-
function asCommandProtectionResponse(value) {
|
|
50
|
-
if (typeof value !== "object" || value === null) return null;
|
|
51
|
-
const candidate = value;
|
|
52
|
-
return typeof candidate.allowed === "boolean" && typeof candidate.enabled === "boolean" ? candidate : null;
|
|
53
|
-
}
|
|
54
44
|
function failClosed(reason, matchedSignals) {
|
|
55
45
|
return {
|
|
56
46
|
allowed: false,
|
|
@@ -99,7 +89,8 @@ async function evaluateCommandProtection(request, signal) {
|
|
|
99
89
|
const detail = error instanceof Error ? error.message : String(error);
|
|
100
90
|
return failClosed(`Command protection failed closed: ${detail}`, matchedSignals);
|
|
101
91
|
}
|
|
102
|
-
|
|
92
|
+
const verdict = commandProtectionEvaluateResponseSchema.safeParse(payload);
|
|
93
|
+
return verdict.success ? verdict.data : failClosed("Command protection failed closed: invalid response from policy service", matchedSignals);
|
|
103
94
|
}
|
|
104
95
|
function extractToolCommand(input) {
|
|
105
96
|
return extractCommandProtectionCommandText({ toolInput: input }, { stringifyFallback: false });
|
|
@@ -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-6D5SMRMT.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord as isRecord2
|
|
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-ZKSPRQIP.js";
|
|
25
25
|
|
|
26
26
|
// src/runtime-env-loader.ts
|
|
27
27
|
import { readFileSync } from "fs";
|
|
@@ -12,15 +12,15 @@ import {
|
|
|
12
12
|
resolveDiffBase,
|
|
13
13
|
runGitCommand,
|
|
14
14
|
setAgentCredentialSnapshot
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YMTLOKKY.js";
|
|
16
16
|
import {
|
|
17
17
|
AppServerProcess,
|
|
18
18
|
buildCodexAgentEnv
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CLNFEQTV.js";
|
|
20
20
|
import {
|
|
21
21
|
SUBPROCESS_MAX_BUFFER,
|
|
22
22
|
execFileAsync
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-6D5SMRMT.js";
|
|
24
24
|
import {
|
|
25
25
|
isRecord
|
|
26
26
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
shrunkImageSize,
|
|
62
62
|
splitMothershipInstructions,
|
|
63
63
|
withTimeout
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-ZKSPRQIP.js";
|
|
65
65
|
|
|
66
66
|
// src/managers/codex-token-manager.ts
|
|
67
67
|
import { promises as fs } from "fs";
|
|
@@ -461,7 +461,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
461
461
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
462
462
|
await this.applyCredentialsResponse(data);
|
|
463
463
|
setAgentCredentialSnapshot("codex", data);
|
|
464
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
464
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-SREXP5OS.js");
|
|
465
465
|
await restartCodexAspHostIfRunning2();
|
|
466
466
|
});
|
|
467
467
|
await this.start(true);
|
|
@@ -483,7 +483,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
483
483
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
484
484
|
await this.applyCredentialsResponse(data);
|
|
485
485
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
486
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
486
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-SREXP5OS.js");
|
|
487
487
|
await restartCodexAspHostIfRunning2();
|
|
488
488
|
}
|
|
489
489
|
setAgentCredentialSnapshot("codex", data);
|