replicas-engine 0.1.63 → 0.1.64
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 +38 -7
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -847,6 +847,10 @@ var EngineLogger = class {
|
|
|
847
847
|
}
|
|
848
848
|
});
|
|
849
849
|
}
|
|
850
|
+
/** Wait for all queued log writes to complete. */
|
|
851
|
+
flush() {
|
|
852
|
+
return this.writeChain;
|
|
853
|
+
}
|
|
850
854
|
createSessionId() {
|
|
851
855
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-");
|
|
852
856
|
const suffix = randomBytes(3).toString("hex");
|
|
@@ -2150,7 +2154,9 @@ var MessageQueueService = class {
|
|
|
2150
2154
|
position: this.queue.length
|
|
2151
2155
|
};
|
|
2152
2156
|
}
|
|
2153
|
-
this.startProcessing(queuedMessage)
|
|
2157
|
+
this.startProcessing(queuedMessage).catch((error) => {
|
|
2158
|
+
console.error("[MessageQueue] Unhandled error in startProcessing:", error);
|
|
2159
|
+
});
|
|
2154
2160
|
return {
|
|
2155
2161
|
queued: false,
|
|
2156
2162
|
messageId,
|
|
@@ -2507,7 +2513,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
2507
2513
|
this.activePromptStream?.close();
|
|
2508
2514
|
this.activePromptStream = null;
|
|
2509
2515
|
this.pendingInterrupt = false;
|
|
2510
|
-
|
|
2516
|
+
try {
|
|
2517
|
+
await this.onTurnComplete();
|
|
2518
|
+
} catch (error) {
|
|
2519
|
+
console.error("[ClaudeManager] onTurnComplete failed:", error);
|
|
2520
|
+
}
|
|
2511
2521
|
}
|
|
2512
2522
|
}
|
|
2513
2523
|
/**
|
|
@@ -2773,7 +2783,11 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
2773
2783
|
if (stopTail) {
|
|
2774
2784
|
await stopTail();
|
|
2775
2785
|
}
|
|
2776
|
-
|
|
2786
|
+
try {
|
|
2787
|
+
await this.onTurnComplete();
|
|
2788
|
+
} catch (error) {
|
|
2789
|
+
console.error("[CodexManager] onTurnComplete failed:", error);
|
|
2790
|
+
}
|
|
2777
2791
|
this.activeAbortController = null;
|
|
2778
2792
|
}
|
|
2779
2793
|
}
|
|
@@ -3232,10 +3246,19 @@ var ChatService = class {
|
|
|
3232
3246
|
} catch {
|
|
3233
3247
|
}
|
|
3234
3248
|
const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3249
|
+
let repoStatuses;
|
|
3250
|
+
try {
|
|
3251
|
+
repoStatuses = await gitService.refreshRepos();
|
|
3252
|
+
console.log(`Repository Statuses Refreshed: `, repoStatuses);
|
|
3253
|
+
} catch (error) {
|
|
3254
|
+
console.error("[ChatService] Failed to refresh repo statuses:", error);
|
|
3255
|
+
}
|
|
3256
|
+
try {
|
|
3257
|
+
const payload = linearSessionId ? { linearSessionId, repoStatuses: repoStatuses ?? [] } : { repoStatuses: repoStatuses ?? [] };
|
|
3258
|
+
await monolithService.sendEvent({ type: "agent_turn_complete", payload });
|
|
3259
|
+
} catch (error) {
|
|
3260
|
+
console.error("[ChatService] Failed to send agent_turn_complete event:", error);
|
|
3261
|
+
}
|
|
3239
3262
|
}
|
|
3240
3263
|
};
|
|
3241
3264
|
|
|
@@ -3949,6 +3972,14 @@ function createV1Routes(deps) {
|
|
|
3949
3972
|
|
|
3950
3973
|
// src/index.ts
|
|
3951
3974
|
await engineLogger.initialize();
|
|
3975
|
+
process.on("uncaughtException", (error) => {
|
|
3976
|
+
console.error("[FATAL] Uncaught exception:", error);
|
|
3977
|
+
engineLogger.flush().finally(() => process.exit(1));
|
|
3978
|
+
});
|
|
3979
|
+
process.on("unhandledRejection", (reason) => {
|
|
3980
|
+
console.error("[FATAL] Unhandled rejection:", reason);
|
|
3981
|
+
engineLogger.flush().finally(() => process.exit(1));
|
|
3982
|
+
});
|
|
3952
3983
|
await eventService.initialize();
|
|
3953
3984
|
var READY_MESSAGE = "========= REPLICAS WORKSPACE READY ==========";
|
|
3954
3985
|
var COMPLETION_MESSAGE = "========= REPLICAS WORKSPACE INITIALIZATION COMPLETE ==========";
|