replicas-engine 0.1.404 → 0.1.405
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 +29 -17
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -484,7 +484,7 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
484
484
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
485
485
|
|
|
486
486
|
// ../shared/src/e2b.ts
|
|
487
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-06-
|
|
487
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-06-v7";
|
|
488
488
|
|
|
489
489
|
// ../shared/src/runtime-env.ts
|
|
490
490
|
function parsePosixEnvFile(content) {
|
|
@@ -6989,6 +6989,9 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
6989
6989
|
isAuthRetrying() {
|
|
6990
6990
|
return this.authRetrying;
|
|
6991
6991
|
}
|
|
6992
|
+
hasActiveBackgroundTasks() {
|
|
6993
|
+
return this.activeBackgroundTasks.size > 0;
|
|
6994
|
+
}
|
|
6992
6995
|
async listSlashCommands() {
|
|
6993
6996
|
await this.initialized;
|
|
6994
6997
|
if (!this.activeQuery || this.isProcessing()) {
|
|
@@ -8014,7 +8017,7 @@ var AspClient = class {
|
|
|
8014
8017
|
// src/managers/codex-asp/app-server-process.ts
|
|
8015
8018
|
var DEFAULT_CODEX_BINARY = "codex";
|
|
8016
8019
|
var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
8017
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
8020
|
+
var ENGINE_PACKAGE_VERSION = "0.1.405";
|
|
8018
8021
|
var INITIALIZE_METHOD = "initialize";
|
|
8019
8022
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
8020
8023
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -11383,6 +11386,9 @@ var RelayManager = class {
|
|
|
11383
11386
|
isProcessing() {
|
|
11384
11387
|
return this.inner.isProcessing();
|
|
11385
11388
|
}
|
|
11389
|
+
hasActiveBackgroundTasks() {
|
|
11390
|
+
return this.inner.hasActiveBackgroundTasks();
|
|
11391
|
+
}
|
|
11386
11392
|
isCompacting() {
|
|
11387
11393
|
return this.inner.isCompacting();
|
|
11388
11394
|
}
|
|
@@ -11406,24 +11412,29 @@ var RelayManager = class {
|
|
|
11406
11412
|
// src/services/keep-alive-service.ts
|
|
11407
11413
|
var KeepAliveService = class _KeepAliveService {
|
|
11408
11414
|
interval = null;
|
|
11409
|
-
|
|
11415
|
+
lastActivityMs = 0;
|
|
11416
|
+
activityCheck = null;
|
|
11410
11417
|
static PING_INTERVAL_MS = 5 * 60 * 1e3;
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11418
|
+
setActivityCheck(check) {
|
|
11419
|
+
this.activityCheck = check;
|
|
11420
|
+
}
|
|
11421
|
+
noteActivity() {
|
|
11422
|
+
this.lastActivityMs = Date.now();
|
|
11414
11423
|
if (this.interval) return;
|
|
11415
11424
|
this.interval = setInterval(() => {
|
|
11416
|
-
this.
|
|
11425
|
+
this.tick().catch((error) => {
|
|
11417
11426
|
console.error("[KeepAlive] Ping failed:", error);
|
|
11418
11427
|
});
|
|
11419
11428
|
}, _KeepAliveService.PING_INTERVAL_MS);
|
|
11420
11429
|
}
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
if (
|
|
11424
|
-
clearInterval(this.interval);
|
|
11430
|
+
async tick() {
|
|
11431
|
+
const active = (this.activityCheck?.() ?? false) || Date.now() - this.lastActivityMs < _KeepAliveService.PING_INTERVAL_MS;
|
|
11432
|
+
if (!active) {
|
|
11433
|
+
if (this.interval) clearInterval(this.interval);
|
|
11425
11434
|
this.interval = null;
|
|
11435
|
+
return;
|
|
11426
11436
|
}
|
|
11437
|
+
await this.ping();
|
|
11427
11438
|
}
|
|
11428
11439
|
async ping() {
|
|
11429
11440
|
if (!ENGINE_ENV.MONOLITH_URL || !ENGINE_ENV.REPLICAS_ENGINE_SECRET || !ENGINE_ENV.WORKSPACE_ID) {
|
|
@@ -11738,6 +11749,9 @@ function acceptedEventInCodexTranscript(acceptedEvent, transcript) {
|
|
|
11738
11749
|
return getCodexTranscriptUserMessages(transcript).includes(message);
|
|
11739
11750
|
}
|
|
11740
11751
|
var LAST_MESSAGE_PREVIEW_MAX = 200;
|
|
11752
|
+
function isChatActive(chat) {
|
|
11753
|
+
return chat.provider.isProcessing() || (chat.provider.hasActiveBackgroundTasks?.() ?? false);
|
|
11754
|
+
}
|
|
11741
11755
|
function isPersistedChat(value) {
|
|
11742
11756
|
if (!isRecord4(value)) {
|
|
11743
11757
|
return false;
|
|
@@ -11785,6 +11799,7 @@ function createUserMessageEvent(message, messageId, images) {
|
|
|
11785
11799
|
var ChatService = class {
|
|
11786
11800
|
constructor(workingDirectory) {
|
|
11787
11801
|
this.workingDirectory = workingDirectory;
|
|
11802
|
+
keepAliveService.setActivityCheck(() => [...this.chats.values()].some(isChatActive));
|
|
11788
11803
|
}
|
|
11789
11804
|
workingDirectory;
|
|
11790
11805
|
chats = /* @__PURE__ */ new Map();
|
|
@@ -11963,7 +11978,6 @@ var ChatService = class {
|
|
|
11963
11978
|
const result = await chat.provider.interrupt();
|
|
11964
11979
|
chat.hasActiveTurn = false;
|
|
11965
11980
|
chat.activeMessageId = null;
|
|
11966
|
-
keepAliveService.stop();
|
|
11967
11981
|
chat.pendingMessageIds = [];
|
|
11968
11982
|
chat.acceptedUserEvents.clear();
|
|
11969
11983
|
this.touch(chat);
|
|
@@ -11985,7 +11999,6 @@ var ChatService = class {
|
|
|
11985
11999
|
const interruptResult = await chat.provider.interrupt();
|
|
11986
12000
|
chat.hasActiveTurn = false;
|
|
11987
12001
|
chat.activeMessageId = null;
|
|
11988
|
-
keepAliveService.stop();
|
|
11989
12002
|
chat.pendingMessageIds = [];
|
|
11990
12003
|
chat.acceptedUserEvents.clear();
|
|
11991
12004
|
const goal = await chat.provider.clearGoal();
|
|
@@ -12123,7 +12136,7 @@ var ChatService = class {
|
|
|
12123
12136
|
getProcessingCount() {
|
|
12124
12137
|
let count = 0;
|
|
12125
12138
|
for (const chat of this.chats.values()) {
|
|
12126
|
-
if (chat
|
|
12139
|
+
if (isChatActive(chat)) {
|
|
12127
12140
|
count += 1;
|
|
12128
12141
|
}
|
|
12129
12142
|
}
|
|
@@ -12236,7 +12249,7 @@ var ChatService = class {
|
|
|
12236
12249
|
title: chat.persisted.title,
|
|
12237
12250
|
createdAt: chat.persisted.createdAt,
|
|
12238
12251
|
updatedAt: chat.persisted.updatedAt,
|
|
12239
|
-
processing: chat
|
|
12252
|
+
processing: isChatActive(chat),
|
|
12240
12253
|
awaitingInput: chat.provider.isAwaitingInput?.() ?? false,
|
|
12241
12254
|
isCompacting: chat.provider.isCompacting?.() ?? false,
|
|
12242
12255
|
isAuthRetrying: chat.provider.isAuthRetrying?.() ?? false,
|
|
@@ -12257,6 +12270,7 @@ var ChatService = class {
|
|
|
12257
12270
|
if (!chat) {
|
|
12258
12271
|
return;
|
|
12259
12272
|
}
|
|
12273
|
+
keepAliveService.noteActivity();
|
|
12260
12274
|
if (!chat.hasActiveTurn && chat.pendingMessageIds.length > 0) {
|
|
12261
12275
|
const messageId = chat.pendingMessageIds.shift();
|
|
12262
12276
|
if (!messageId) {
|
|
@@ -12264,7 +12278,6 @@ var ChatService = class {
|
|
|
12264
12278
|
}
|
|
12265
12279
|
chat.hasActiveTurn = true;
|
|
12266
12280
|
chat.activeMessageId = messageId;
|
|
12267
|
-
keepAliveService.start();
|
|
12268
12281
|
this.publish({
|
|
12269
12282
|
type: "chat.turn.started",
|
|
12270
12283
|
payload: {
|
|
@@ -12333,7 +12346,6 @@ var ChatService = class {
|
|
|
12333
12346
|
}
|
|
12334
12347
|
chat.hasActiveTurn = false;
|
|
12335
12348
|
chat.activeMessageId = null;
|
|
12336
|
-
keepAliveService.stop();
|
|
12337
12349
|
this.publish({
|
|
12338
12350
|
type: "chat.turn.completed",
|
|
12339
12351
|
payload: {
|