replicas-engine 0.1.267 → 0.1.269
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 +9 -9
- package/package.json +1 -1
- package/scripts/engine-watchdog.sh +6 -1
- package/scripts/lockmem.c +61 -1
package/dist/src/index.js
CHANGED
|
@@ -286,7 +286,7 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
286
286
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
287
287
|
|
|
288
288
|
// ../shared/src/e2b.ts
|
|
289
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-05-
|
|
289
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-05-v6";
|
|
290
290
|
|
|
291
291
|
// ../shared/src/runtime-env.ts
|
|
292
292
|
function parsePosixEnvFile(content) {
|
|
@@ -1967,6 +1967,13 @@ function isClaudeAuthErrorText(text) {
|
|
|
1967
1967
|
return lower.includes("failed to authenticate") || lower.includes("authentication_error") || lower.includes("authentication_failed") || lower.includes("authentication failed") || lower.includes("invalid authentication credentials") || lower.includes("not logged in") || lower.includes("please run /login") || lower.includes("credit balance is too low") || lower.includes("401") && lower.includes("authentic");
|
|
1968
1968
|
}
|
|
1969
1969
|
|
|
1970
|
+
// ../shared/src/codex-auth.ts
|
|
1971
|
+
function isCodexAuthError(error) {
|
|
1972
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
1973
|
+
const lower = msg.toLowerCase();
|
|
1974
|
+
return lower.includes("unauthorized") || lower.includes("authentication") || lower.includes("invalid api key") || lower.includes("incorrect api key") || lower.includes("api key") && lower.includes("invalid") || lower.includes("401") || lower.includes('codexerrorinfo="unauthorized"') || lower.includes("codexerrorinfo=unauthorized") || lower.includes("failed to refresh token") || lower.includes("your session has ended");
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1970
1977
|
// ../shared/src/engine/environment.ts
|
|
1971
1978
|
var DESKTOP_NOVNC_PORT = 6080;
|
|
1972
1979
|
|
|
@@ -6575,7 +6582,7 @@ var AspClient = class {
|
|
|
6575
6582
|
// src/managers/codex-asp/app-server-process.ts
|
|
6576
6583
|
var DEFAULT_CODEX_BINARY = "codex";
|
|
6577
6584
|
var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
6578
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6585
|
+
var ENGINE_PACKAGE_VERSION = "0.1.269";
|
|
6579
6586
|
var INITIALIZE_METHOD = "initialize";
|
|
6580
6587
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6581
6588
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -6834,13 +6841,6 @@ var CodexQuotaStatusTracker = class {
|
|
|
6834
6841
|
}
|
|
6835
6842
|
};
|
|
6836
6843
|
|
|
6837
|
-
// src/utils/codex-auth.ts
|
|
6838
|
-
function isCodexAuthError(error) {
|
|
6839
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
6840
|
-
const lower = msg.toLowerCase();
|
|
6841
|
-
return lower.includes("unauthorized") || lower.includes("authentication") || lower.includes("invalid api key") || lower.includes("incorrect api key") || lower.includes("api key") && lower.includes("invalid") || lower.includes("401") || lower.includes('codexerrorinfo="unauthorized"') || lower.includes("codexerrorinfo=unauthorized");
|
|
6842
|
-
}
|
|
6843
|
-
|
|
6844
6844
|
// src/managers/codex-asp/mappers.ts
|
|
6845
6845
|
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
|
|
6846
6846
|
var localImageCache = /* @__PURE__ */ new Map();
|
package/package.json
CHANGED
|
@@ -39,7 +39,12 @@ sudo prlimit --memlock=536870912:536870912 --pid $$ 2>/dev/null || true
|
|
|
39
39
|
LOCKMEM_SO=/usr/local/lib/replicas-lockmem.so
|
|
40
40
|
if [ -r "$LOCKMEM_SO" ]; then
|
|
41
41
|
# Prepend (don't replace) so any inherited LD_PRELOAD still loads.
|
|
42
|
-
if [
|
|
42
|
+
if [ "${LD_PRELOAD:-}" = "$LOCKMEM_SO" ] \
|
|
43
|
+
|| [[ "${LD_PRELOAD:-}" == "$LOCKMEM_SO:"* ]] \
|
|
44
|
+
|| [[ "${LD_PRELOAD:-}" == *":$LOCKMEM_SO" ]] \
|
|
45
|
+
|| [[ "${LD_PRELOAD:-}" == *":$LOCKMEM_SO:"* ]]; then
|
|
46
|
+
ENGINE_LD_PRELOAD="$LD_PRELOAD"
|
|
47
|
+
elif [ -n "${LD_PRELOAD:-}" ]; then
|
|
43
48
|
ENGINE_LD_PRELOAD="$LOCKMEM_SO:$LD_PRELOAD"
|
|
44
49
|
else
|
|
45
50
|
ENGINE_LD_PRELOAD="$LOCKMEM_SO"
|
package/scripts/lockmem.c
CHANGED
|
@@ -5,15 +5,75 @@
|
|
|
5
5
|
#include <sys/mman.h>
|
|
6
6
|
#include <stdio.h>
|
|
7
7
|
#include <errno.h>
|
|
8
|
+
#include <stdlib.h>
|
|
8
9
|
#include <string.h>
|
|
9
10
|
#include <unistd.h>
|
|
10
11
|
|
|
12
|
+
static int is_own_preload_token(const char *token) {
|
|
13
|
+
const char *basename = strrchr(token, '/');
|
|
14
|
+
basename = basename == NULL ? token : basename + 1;
|
|
15
|
+
return strcmp(basename, "replicas-lockmem.so") == 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static void scrub_own_preload(void) {
|
|
19
|
+
const char *current = getenv("LD_PRELOAD");
|
|
20
|
+
if (current == NULL) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
char *copy = strdup(current);
|
|
25
|
+
if (copy == NULL) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
char *next = copy;
|
|
30
|
+
char *token;
|
|
31
|
+
size_t output_len = 0;
|
|
32
|
+
int removed = 0;
|
|
33
|
+
char *output = malloc(strlen(current) + 1);
|
|
34
|
+
if (output == NULL) {
|
|
35
|
+
free(copy);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
output[0] = '\0';
|
|
39
|
+
|
|
40
|
+
while ((token = strsep(&next, ":")) != NULL) {
|
|
41
|
+
if (is_own_preload_token(token)) {
|
|
42
|
+
removed = 1;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (output_len > 0) {
|
|
47
|
+
output[output_len++] = ':';
|
|
48
|
+
output[output_len] = '\0';
|
|
49
|
+
}
|
|
50
|
+
strcpy(output + output_len, token);
|
|
51
|
+
output_len += strlen(token);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (removed) {
|
|
55
|
+
if (output_len == 0) {
|
|
56
|
+
unsetenv("LD_PRELOAD");
|
|
57
|
+
} else {
|
|
58
|
+
setenv("LD_PRELOAD", output, 1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
free(output);
|
|
63
|
+
free(copy);
|
|
64
|
+
}
|
|
65
|
+
|
|
11
66
|
__attribute__((constructor))
|
|
12
67
|
static void replicas_lockmem_init(void) {
|
|
68
|
+
scrub_own_preload();
|
|
69
|
+
|
|
13
70
|
if (mlockall(MCL_CURRENT) != 0) {
|
|
14
71
|
fprintf(stderr, "[lockmem] mlockall(MCL_CURRENT) failed: %s (errno=%d); engine running unprotected\n",
|
|
15
72
|
strerror(errno), errno);
|
|
16
73
|
return;
|
|
17
74
|
}
|
|
18
|
-
|
|
75
|
+
|
|
76
|
+
if (getenv("REPLICAS_LOCKMEM_VERBOSE") != NULL) {
|
|
77
|
+
fprintf(stderr, "[lockmem] engine pages locked (pid=%d)\n", getpid());
|
|
78
|
+
}
|
|
19
79
|
}
|