replicas-engine 0.1.77 → 0.1.78
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 +51 -2
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -923,7 +923,7 @@ var PLANS = {
|
|
|
923
923
|
monthlyPrice: 30,
|
|
924
924
|
seatPriceCents: 3e3,
|
|
925
925
|
creditsIncluded: 0,
|
|
926
|
-
features: ["Unlimited usage", "API access ($
|
|
926
|
+
features: ["Unlimited usage", "API access ($0.0166/min)"]
|
|
927
927
|
},
|
|
928
928
|
team: {
|
|
929
929
|
id: "team",
|
|
@@ -1082,7 +1082,7 @@ function parseReplicasConfigString(content, filename) {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
|
|
1084
1084
|
// ../shared/src/engine/environment.ts
|
|
1085
|
-
var DAYTONA_SNAPSHOT_ID = "08-04-2026-islington-
|
|
1085
|
+
var DAYTONA_SNAPSHOT_ID = "08-04-2026-islington-v7";
|
|
1086
1086
|
|
|
1087
1087
|
// ../shared/src/engine/types.ts
|
|
1088
1088
|
var DEFAULT_CHAT_TITLES = {
|
|
@@ -2971,6 +2971,52 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
2971
2971
|
}
|
|
2972
2972
|
};
|
|
2973
2973
|
|
|
2974
|
+
// src/services/keep-alive-service.ts
|
|
2975
|
+
var KeepAliveService = class _KeepAliveService {
|
|
2976
|
+
interval = null;
|
|
2977
|
+
activeTurns = 0;
|
|
2978
|
+
static PING_INTERVAL_MS = 5 * 60 * 1e3;
|
|
2979
|
+
// 5 minutes
|
|
2980
|
+
start() {
|
|
2981
|
+
this.activeTurns++;
|
|
2982
|
+
if (this.interval) return;
|
|
2983
|
+
this.interval = setInterval(() => {
|
|
2984
|
+
this.ping().catch((error) => {
|
|
2985
|
+
console.error("[KeepAlive] Ping failed:", error);
|
|
2986
|
+
});
|
|
2987
|
+
}, _KeepAliveService.PING_INTERVAL_MS);
|
|
2988
|
+
}
|
|
2989
|
+
stop() {
|
|
2990
|
+
if (this.activeTurns > 0) this.activeTurns--;
|
|
2991
|
+
if (this.activeTurns === 0 && this.interval) {
|
|
2992
|
+
clearInterval(this.interval);
|
|
2993
|
+
this.interval = null;
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
async ping() {
|
|
2997
|
+
if (!ENGINE_ENV.MONOLITH_URL || !ENGINE_ENV.REPLICAS_ENGINE_SECRET || !ENGINE_ENV.WORKSPACE_ID) {
|
|
2998
|
+
return;
|
|
2999
|
+
}
|
|
3000
|
+
try {
|
|
3001
|
+
const response = await fetch(`${ENGINE_ENV.MONOLITH_URL}/v1/engine/keep-alive`, {
|
|
3002
|
+
method: "POST",
|
|
3003
|
+
headers: {
|
|
3004
|
+
Authorization: `Bearer ${ENGINE_ENV.REPLICAS_ENGINE_SECRET}`,
|
|
3005
|
+
"X-Workspace-Id": ENGINE_ENV.WORKSPACE_ID,
|
|
3006
|
+
"Content-Type": "application/json"
|
|
3007
|
+
},
|
|
3008
|
+
body: JSON.stringify({})
|
|
3009
|
+
});
|
|
3010
|
+
if (!response.ok) {
|
|
3011
|
+
console.warn(`[KeepAlive] Ping returned ${response.status}`);
|
|
3012
|
+
}
|
|
3013
|
+
} catch (error) {
|
|
3014
|
+
console.error("[KeepAlive] Failed to reach monolith:", error);
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
};
|
|
3018
|
+
var keepAliveService = new KeepAliveService();
|
|
3019
|
+
|
|
2974
3020
|
// src/services/chat/errors.ts
|
|
2975
3021
|
var ChatNotFoundError = class extends Error {
|
|
2976
3022
|
constructor(chatId) {
|
|
@@ -3090,6 +3136,7 @@ var ChatService = class {
|
|
|
3090
3136
|
const chat = this.requireChat(chatId);
|
|
3091
3137
|
const result = await chat.provider.interrupt();
|
|
3092
3138
|
chat.hasActiveTurn = false;
|
|
3139
|
+
keepAliveService.stop();
|
|
3093
3140
|
chat.pendingMessageIds = [];
|
|
3094
3141
|
this.touch(chat);
|
|
3095
3142
|
await this.publish({
|
|
@@ -3208,6 +3255,7 @@ var ChatService = class {
|
|
|
3208
3255
|
return;
|
|
3209
3256
|
}
|
|
3210
3257
|
chat.hasActiveTurn = true;
|
|
3258
|
+
keepAliveService.start();
|
|
3211
3259
|
this.publish({
|
|
3212
3260
|
type: "chat.turn.started",
|
|
3213
3261
|
payload: {
|
|
@@ -3237,6 +3285,7 @@ var ChatService = class {
|
|
|
3237
3285
|
return;
|
|
3238
3286
|
}
|
|
3239
3287
|
chat.hasActiveTurn = false;
|
|
3288
|
+
keepAliveService.stop();
|
|
3240
3289
|
this.publish({
|
|
3241
3290
|
type: "chat.turn.completed",
|
|
3242
3291
|
payload: {
|