replicas-engine 0.1.260 → 0.1.262
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 +3 -2
- package/package.json +3 -2
- package/scripts/engine-watchdog.sh +21 -1
- package/scripts/lockmem.c +19 -0
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-04-
|
|
289
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-04-v4";
|
|
290
290
|
|
|
291
291
|
// ../shared/src/runtime-env.ts
|
|
292
292
|
function parsePosixEnvFile(content) {
|
|
@@ -2028,6 +2028,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
|
|
|
2028
2028
|
// ../shared/src/routes/workspaces.ts
|
|
2029
2029
|
var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
|
|
2030
2030
|
var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
2031
|
+
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
2031
2032
|
|
|
2032
2033
|
// ../shared/src/audit-log.ts
|
|
2033
2034
|
var AUDIT_LOG_ACTION = {
|
|
@@ -6372,7 +6373,7 @@ var AspClient = class {
|
|
|
6372
6373
|
// src/managers/codex-asp/app-server-process.ts
|
|
6373
6374
|
var DEFAULT_CODEX_BINARY = "codex";
|
|
6374
6375
|
var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
6375
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6376
|
+
var ENGINE_PACKAGE_VERSION = "0.1.262";
|
|
6376
6377
|
var INITIALIZE_METHOD = "initialize";
|
|
6377
6378
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6378
6379
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replicas-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.262",
|
|
4
4
|
"description": "Lightweight API server for Replicas workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
13
|
-
"scripts/engine-watchdog.sh"
|
|
13
|
+
"scripts/engine-watchdog.sh",
|
|
14
|
+
"scripts/lockmem.c"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
16
17
|
"dev": "tsx watch src/index.ts",
|
|
@@ -32,6 +32,22 @@ cleanup() {
|
|
|
32
32
|
|
|
33
33
|
trap cleanup SIGTERM SIGINT
|
|
34
34
|
|
|
35
|
+
# Default RLIMIT_MEMLOCK is 8 MB; engine needs ~120 MB. Cap at 512 MB so a
|
|
36
|
+
# runaway can't lock the whole sandbox.
|
|
37
|
+
sudo prlimit --memlock=536870912:536870912 --pid $$ 2>/dev/null || true
|
|
38
|
+
|
|
39
|
+
LOCKMEM_SO=/usr/local/lib/replicas-lockmem.so
|
|
40
|
+
if [ -r "$LOCKMEM_SO" ]; then
|
|
41
|
+
# Prepend (don't replace) so any inherited LD_PRELOAD still loads.
|
|
42
|
+
if [ -n "${LD_PRELOAD:-}" ]; then
|
|
43
|
+
ENGINE_LD_PRELOAD="$LOCKMEM_SO:$LD_PRELOAD"
|
|
44
|
+
else
|
|
45
|
+
ENGINE_LD_PRELOAD="$LOCKMEM_SO"
|
|
46
|
+
fi
|
|
47
|
+
else
|
|
48
|
+
ENGINE_LD_PRELOAD=""
|
|
49
|
+
fi
|
|
50
|
+
|
|
35
51
|
while true; do
|
|
36
52
|
if [ "$RESTART_COUNT" -ge "$MAX_RESTARTS" ]; then
|
|
37
53
|
log "Exceeded max restarts ($MAX_RESTARTS). Giving up."
|
|
@@ -42,7 +58,11 @@ while true; do
|
|
|
42
58
|
log "Starting replicas-engine (attempt $((RESTART_COUNT + 1)))${WARMING_FLAG:+ [warming mode]}"
|
|
43
59
|
|
|
44
60
|
START_TIME=$(date +%s)
|
|
45
|
-
|
|
61
|
+
if [ -n "$ENGINE_LD_PRELOAD" ]; then
|
|
62
|
+
LD_PRELOAD="$ENGINE_LD_PRELOAD" replicas-engine $WARMING_FLAG >> "$BOOTSTRAP_LOG" 2>&1 &
|
|
63
|
+
else
|
|
64
|
+
replicas-engine $WARMING_FLAG >> "$BOOTSTRAP_LOG" 2>&1 &
|
|
65
|
+
fi
|
|
46
66
|
ENGINE_PID=$!
|
|
47
67
|
echo "$ENGINE_PID" > "$PIDFILE"
|
|
48
68
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// MCL_FUTURE is incompatible with V8 (crashes Isolate::Initialize because V8
|
|
2
|
+
// remaps heap regions); MCL_CURRENT is enough since the sandbox has no swap so
|
|
3
|
+
// anonymous heap pages are already pinned.
|
|
4
|
+
#define _GNU_SOURCE
|
|
5
|
+
#include <sys/mman.h>
|
|
6
|
+
#include <stdio.h>
|
|
7
|
+
#include <errno.h>
|
|
8
|
+
#include <string.h>
|
|
9
|
+
#include <unistd.h>
|
|
10
|
+
|
|
11
|
+
__attribute__((constructor))
|
|
12
|
+
static void replicas_lockmem_init(void) {
|
|
13
|
+
if (mlockall(MCL_CURRENT) != 0) {
|
|
14
|
+
fprintf(stderr, "[lockmem] mlockall(MCL_CURRENT) failed: %s (errno=%d); engine running unprotected\n",
|
|
15
|
+
strerror(errno), errno);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
fprintf(stderr, "[lockmem] engine pages locked (pid=%d)\n", getpid());
|
|
19
|
+
}
|