replicas-engine 0.1.256 → 0.1.257
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 +36 -20
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { serve } from "@hono/node-server";
|
|
5
5
|
import { Hono as Hono2 } from "hono";
|
|
6
|
-
import { readFile as readFile14 } from "fs/promises";
|
|
7
6
|
import { execSync as execSync2 } from "child_process";
|
|
8
7
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
9
8
|
|
|
@@ -297,7 +296,7 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
297
296
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
298
297
|
|
|
299
298
|
// ../shared/src/e2b.ts
|
|
300
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-03-
|
|
299
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-03-v2";
|
|
301
300
|
|
|
302
301
|
// ../shared/src/runtime-env.ts
|
|
303
302
|
function parsePosixEnvFile(content) {
|
|
@@ -2234,6 +2233,13 @@ var MEDIA_KIND = {
|
|
|
2234
2233
|
};
|
|
2235
2234
|
var MEDIA_KINDS = [MEDIA_KIND.IMAGE, MEDIA_KIND.VIDEO, MEDIA_KIND.AUDIO];
|
|
2236
2235
|
|
|
2236
|
+
// ../shared/src/github/url.ts
|
|
2237
|
+
var GITHUB_HOST_RE = /(^|@|\/\/)github\.com[:/]/;
|
|
2238
|
+
function isGitHubUrl(url) {
|
|
2239
|
+
if (!url) return false;
|
|
2240
|
+
return GITHUB_HOST_RE.test(url);
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2237
2243
|
// src/runtime-env-loader.ts
|
|
2238
2244
|
function loadRuntimeEnvFile() {
|
|
2239
2245
|
let content;
|
|
@@ -2906,6 +2912,9 @@ function appendUniqueUrl(urls, url) {
|
|
|
2906
2912
|
var GitService = class {
|
|
2907
2913
|
defaultBranchCache = /* @__PURE__ */ new Map();
|
|
2908
2914
|
cachedPrByRepo = /* @__PURE__ */ new Map();
|
|
2915
|
+
// No invalidation on purpose — `git remote set-url` mid-session is rare and
|
|
2916
|
+
// the worst case is `gh pr view` stays skipped until the next engine restart.
|
|
2917
|
+
originIsGitHubCache = /* @__PURE__ */ new Map();
|
|
2909
2918
|
getWorkspaceRoot() {
|
|
2910
2919
|
return ENGINE_ENV.WORKSPACE_ROOT;
|
|
2911
2920
|
}
|
|
@@ -3224,6 +3233,9 @@ var GitService = class {
|
|
|
3224
3233
|
}
|
|
3225
3234
|
}
|
|
3226
3235
|
lookupPrOnRemote(repoName, repoPath, branch) {
|
|
3236
|
+
if (!this.originIsGitHub(repoPath)) {
|
|
3237
|
+
return { status: "not_found" };
|
|
3238
|
+
}
|
|
3227
3239
|
try {
|
|
3228
3240
|
const remoteRef = execFileSync2("git", ["ls-remote", "--heads", "origin", branch], {
|
|
3229
3241
|
cwd: repoPath,
|
|
@@ -3249,6 +3261,25 @@ var GitService = class {
|
|
|
3249
3261
|
return { status: "error" };
|
|
3250
3262
|
}
|
|
3251
3263
|
}
|
|
3264
|
+
originIsGitHub(repoPath) {
|
|
3265
|
+
const cached = this.originIsGitHubCache.get(repoPath);
|
|
3266
|
+
if (cached !== void 0) {
|
|
3267
|
+
return cached;
|
|
3268
|
+
}
|
|
3269
|
+
let isGitHub = false;
|
|
3270
|
+
try {
|
|
3271
|
+
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
3272
|
+
cwd: repoPath,
|
|
3273
|
+
encoding: "utf-8",
|
|
3274
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
3275
|
+
}).trim();
|
|
3276
|
+
isGitHub = isGitHubUrl(url);
|
|
3277
|
+
} catch {
|
|
3278
|
+
isGitHub = false;
|
|
3279
|
+
}
|
|
3280
|
+
this.originIsGitHubCache.set(repoPath, isGitHub);
|
|
3281
|
+
return isGitHub;
|
|
3282
|
+
}
|
|
3252
3283
|
resolveDefaultBranch(repoPath) {
|
|
3253
3284
|
const cached = this.defaultBranchCache.get(repoPath);
|
|
3254
3285
|
if (cached) {
|
|
@@ -6234,7 +6265,7 @@ var AspClient = class {
|
|
|
6234
6265
|
// src/managers/codex-asp/app-server-process.ts
|
|
6235
6266
|
var DEFAULT_CODEX_BINARY = "codex";
|
|
6236
6267
|
var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
6237
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6268
|
+
var ENGINE_PACKAGE_VERSION = "0.1.257";
|
|
6238
6269
|
var INITIALIZE_METHOD = "initialize";
|
|
6239
6270
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6240
6271
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -10943,8 +10974,6 @@ process.on("unhandledRejection", (reason) => {
|
|
|
10943
10974
|
engineLogger.flush().finally(() => process.exit(1));
|
|
10944
10975
|
});
|
|
10945
10976
|
await eventService.initialize();
|
|
10946
|
-
var READY_MESSAGE = "========= REPLICAS WORKSPACE READY ==========";
|
|
10947
|
-
var COMPLETION_MESSAGE = "========= REPLICAS WORKSPACE INITIALIZATION COMPLETE ==========";
|
|
10948
10977
|
function checkActiveSSHSessions() {
|
|
10949
10978
|
try {
|
|
10950
10979
|
const output = execSync2('who | grep -v "^$" | wc -l', { encoding: "utf-8" });
|
|
@@ -10972,24 +11001,11 @@ var authMiddleware = async (c, next) => {
|
|
|
10972
11001
|
await next();
|
|
10973
11002
|
};
|
|
10974
11003
|
var chatService = new ChatService(gitService.getWorkspaceRoot());
|
|
10975
|
-
app.get("/health",
|
|
11004
|
+
app.get("/health", (c) => {
|
|
10976
11005
|
if (!engineReady) {
|
|
10977
11006
|
return c.json({ status: "initializing", timestamp: (/* @__PURE__ */ new Date()).toISOString() }, 503);
|
|
10978
11007
|
}
|
|
10979
|
-
|
|
10980
|
-
const logContent = await readFile14("/var/log/cloud-init-output.log", "utf-8");
|
|
10981
|
-
let status;
|
|
10982
|
-
if (logContent.includes(COMPLETION_MESSAGE)) {
|
|
10983
|
-
status = "active";
|
|
10984
|
-
} else if (logContent.includes(READY_MESSAGE)) {
|
|
10985
|
-
status = "ready";
|
|
10986
|
-
} else {
|
|
10987
|
-
status = "initializing";
|
|
10988
|
-
}
|
|
10989
|
-
return c.json({ status, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
10990
|
-
} catch {
|
|
10991
|
-
return c.json({ status: "initializing", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
10992
|
-
}
|
|
11008
|
+
return c.json({ status: "active", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
10993
11009
|
});
|
|
10994
11010
|
app.use("*", authMiddleware);
|
|
10995
11011
|
app.get("/status", async (c) => {
|