replicas-engine 0.1.647 → 0.1.649
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.
|
@@ -5645,6 +5645,9 @@ var memoryGenerationManifestSchema = z6.object({
|
|
|
5645
5645
|
rolloutSources: z6.record(z6.string(), z6.string()).optional()
|
|
5646
5646
|
});
|
|
5647
5647
|
|
|
5648
|
+
// ../shared/src/chat-transcript-pages.ts
|
|
5649
|
+
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
5650
|
+
|
|
5648
5651
|
// ../shared/src/skill-registry.ts
|
|
5649
5652
|
var SKILL_REGISTRY_MANIFEST_VERSION = 1;
|
|
5650
5653
|
function isSkillRegistryManifest(value) {
|
|
@@ -5919,7 +5922,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
5919
5922
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
5920
5923
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
5921
5924
|
var codexCliVersionEnsured = null;
|
|
5922
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
5925
|
+
var ENGINE_PACKAGE_VERSION = "0.1.649";
|
|
5923
5926
|
var INITIALIZE_METHOD = "initialize";
|
|
5924
5927
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
5925
5928
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
package/dist/src/index.js
CHANGED
|
@@ -172,7 +172,7 @@ import {
|
|
|
172
172
|
serializeCanvasContentResponse,
|
|
173
173
|
shellQuotePosix,
|
|
174
174
|
stripAgentDiagnosticErrors
|
|
175
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-O5DMGWM7.js";
|
|
176
176
|
|
|
177
177
|
// src/index.ts
|
|
178
178
|
import { serve } from "@hono/node-server";
|
|
@@ -5684,6 +5684,11 @@ var ACCOUNT_RATE_LIMITS_READ_METHOD = "account/rateLimits/read";
|
|
|
5684
5684
|
var MODEL_LIST_METHOD = "model/list";
|
|
5685
5685
|
var SKILLS_LIST_METHOD = "skills/list";
|
|
5686
5686
|
var MAX_CODEX_ASP_TRANSCRIPT_OUTPUT_CHARS = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS;
|
|
5687
|
+
function getReconciledActiveTurnId(error, expectedTurnId) {
|
|
5688
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5689
|
+
const match = message.match(/expected active turn id ([0-9a-f-]{36}) but found ([0-9a-f-]{36})/i);
|
|
5690
|
+
return match?.[1]?.toLowerCase() === expectedTurnId.toLowerCase() ? match[2] ?? null : null;
|
|
5691
|
+
}
|
|
5687
5692
|
function codexApprovalPolicyOverrides() {
|
|
5688
5693
|
return {
|
|
5689
5694
|
approvalPolicy: "untrusted",
|
|
@@ -6433,15 +6438,43 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
6433
6438
|
if (!this.currentThreadId || !this.activeTurnId) {
|
|
6434
6439
|
return;
|
|
6435
6440
|
}
|
|
6441
|
+
const threadId = this.currentThreadId;
|
|
6442
|
+
const expectedTurnId = this.activeTurnId;
|
|
6443
|
+
const result = await this.requestActiveTurnWithReconciliation(
|
|
6444
|
+
"interrupt",
|
|
6445
|
+
expectedTurnId,
|
|
6446
|
+
(host, turnId) => host.client.request(
|
|
6447
|
+
TURN_INTERRUPT_METHOD,
|
|
6448
|
+
{ threadId, turnId }
|
|
6449
|
+
)
|
|
6450
|
+
);
|
|
6451
|
+
if (result.ok) return;
|
|
6452
|
+
console.warn(
|
|
6453
|
+
result.error.code === "retry_failed" ? "[CodexAspManager] Failed to interrupt reconciled active turn; leaving shared Codex app-server running:" : "[CodexAspManager] Failed to interrupt active turn:",
|
|
6454
|
+
result.error.details
|
|
6455
|
+
);
|
|
6456
|
+
}
|
|
6457
|
+
async requestActiveTurnWithReconciliation(operation, expectedTurnId, request) {
|
|
6436
6458
|
try {
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
threadId: this.currentThreadId,
|
|
6440
|
-
turnId: this.activeTurnId
|
|
6441
|
-
};
|
|
6442
|
-
await host.client.request(TURN_INTERRUPT_METHOD, params);
|
|
6459
|
+
await request(await getCodexAspHost(), expectedTurnId);
|
|
6460
|
+
return createSuccessResult(expectedTurnId);
|
|
6443
6461
|
} catch (error) {
|
|
6444
|
-
|
|
6462
|
+
const reconciledTurnId = getReconciledActiveTurnId(error, expectedTurnId);
|
|
6463
|
+
if (!reconciledTurnId) {
|
|
6464
|
+
return createErrorResult({ code: "request_failed", message: `Failed to ${operation} active turn`, details: error });
|
|
6465
|
+
}
|
|
6466
|
+
this.activeTurnId = reconciledTurnId;
|
|
6467
|
+
console.warn(`[CodexAspManager] Active turn changed during ${operation}; retrying with provider turn:`, reconciledTurnId);
|
|
6468
|
+
try {
|
|
6469
|
+
await request(await getCodexAspHost(), reconciledTurnId);
|
|
6470
|
+
return createSuccessResult(reconciledTurnId);
|
|
6471
|
+
} catch (retryError) {
|
|
6472
|
+
return createErrorResult({
|
|
6473
|
+
code: "retry_failed",
|
|
6474
|
+
message: `Failed to ${operation} reconciled active turn`,
|
|
6475
|
+
details: retryError
|
|
6476
|
+
});
|
|
6477
|
+
}
|
|
6445
6478
|
}
|
|
6446
6479
|
}
|
|
6447
6480
|
// Serialize so concurrent steers can't race one `turn/steer` RPC ahead of another.
|
|
@@ -6455,18 +6488,23 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
6455
6488
|
if (this.isCompacting()) return false;
|
|
6456
6489
|
if (getGoalCommand(request.message, request.goalMode) || isCompactCommand(request.message)) return false;
|
|
6457
6490
|
const { input, tempImagePaths } = await buildTurnInput(request);
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6491
|
+
const result = await this.requestActiveTurnWithReconciliation(
|
|
6492
|
+
"steer",
|
|
6493
|
+
expectedTurnId,
|
|
6494
|
+
(host, turnId) => host.client.request(
|
|
6461
6495
|
TURN_STEER_METHOD,
|
|
6462
|
-
{ threadId, expectedTurnId, input }
|
|
6463
|
-
)
|
|
6464
|
-
|
|
6496
|
+
{ threadId, expectedTurnId: turnId, input }
|
|
6497
|
+
)
|
|
6498
|
+
);
|
|
6499
|
+
if (!result.ok) {
|
|
6465
6500
|
await removeTempImageFiles(tempImagePaths);
|
|
6466
|
-
console.warn(
|
|
6501
|
+
console.warn(
|
|
6502
|
+
result.error.code === "retry_failed" ? "[CodexAspManager] Failed to steer reconciled active turn, keeping message queued:" : "[CodexAspManager] Failed to steer active turn, keeping message queued:",
|
|
6503
|
+
result.error.details
|
|
6504
|
+
);
|
|
6467
6505
|
return false;
|
|
6468
6506
|
}
|
|
6469
|
-
if (this.activeTurnId ===
|
|
6507
|
+
if (this.activeTurnId === result.data) {
|
|
6470
6508
|
this.steeredTempImagePaths.push(...tempImagePaths);
|
|
6471
6509
|
} else {
|
|
6472
6510
|
await removeTempImageFiles(tempImagePaths);
|
|
@@ -6842,7 +6880,7 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
6842
6880
|
const model = request.model ?? DEFAULT_MODEL;
|
|
6843
6881
|
let tempImagePaths = [];
|
|
6844
6882
|
const linearForwarder = new LinearEventForwarder(linearSessionId);
|
|
6845
|
-
const matchesTurn = (notificationThreadId, notificationTurnId) => notificationThreadId === threadId && (!observedTurnId || notificationTurnId === null || notificationTurnId === observedTurnId);
|
|
6883
|
+
const matchesTurn = (notificationThreadId, notificationTurnId) => notificationThreadId === threadId && (!observedTurnId || notificationTurnId === null || notificationTurnId === observedTurnId || notificationTurnId === this.activeTurnId);
|
|
6846
6884
|
const resolveIfGoalIdle = () => {
|
|
6847
6885
|
if (!lastCompletedTurn || completedResolved) return;
|
|
6848
6886
|
if (!options.waitForActiveGoal || this.currentGoal?.status !== "active") {
|
|
@@ -6994,7 +7032,8 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
6994
7032
|
},
|
|
6995
7033
|
[TURN_COMPLETED_METHOD]: (notification) => {
|
|
6996
7034
|
if (notification.params.threadId !== threadId) return;
|
|
6997
|
-
if (!observedTurnIds.has(notification.params.turn.id)) return;
|
|
7035
|
+
if (!observedTurnIds.has(notification.params.turn.id) && notification.params.turn.id !== this.activeTurnId) return;
|
|
7036
|
+
observedTurnIds.add(notification.params.turn.id);
|
|
6998
7037
|
observedTurnId = notification.params.turn.id;
|
|
6999
7038
|
const completedTurn = recoverCompletedTurn(notification.params.turn, completedItems, agentMessageDeltas);
|
|
7000
7039
|
this.mergeTranscriptTurn(notification.params.threadId, completedTurn);
|