replicas-engine 0.1.659 → 0.1.661
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.
|
@@ -802,6 +802,16 @@ function getCodexAspTurnResponse(turn) {
|
|
|
802
802
|
if (normalizeCodexAspTranscriptStatus(turn.status) === "in_progress") return null;
|
|
803
803
|
return turn.items.findLast((item) => item.type === "agentMessage") ?? null;
|
|
804
804
|
}
|
|
805
|
+
function renumberCodexAspTranscriptItems(transcript) {
|
|
806
|
+
let sequence = 0;
|
|
807
|
+
return {
|
|
808
|
+
...transcript,
|
|
809
|
+
turns: transcript.turns.map((turn) => ({
|
|
810
|
+
...turn,
|
|
811
|
+
items: turn.items.map((item) => ({ ...item, sequence: sequence++ }))
|
|
812
|
+
}))
|
|
813
|
+
};
|
|
814
|
+
}
|
|
805
815
|
function isCodexAspTranscript(value) {
|
|
806
816
|
if (!isRecord(value)) return false;
|
|
807
817
|
return typeof value.threadId === "string" && typeof value.updatedAt === "string" && Array.isArray(value.turns);
|
|
@@ -5560,7 +5570,12 @@ function mergeCodexAspDisplayMessages(primary, supplemental) {
|
|
|
5560
5570
|
indexMessage(message, merged.push(message) - 1);
|
|
5561
5571
|
} else if (message.type === "user") {
|
|
5562
5572
|
unindexMessage(merged[duplicateIndex], duplicateIndex);
|
|
5563
|
-
merged[duplicateIndex] = {
|
|
5573
|
+
merged[duplicateIndex] = {
|
|
5574
|
+
...merged[duplicateIndex],
|
|
5575
|
+
id: message.id,
|
|
5576
|
+
timestamp: message.timestamp
|
|
5577
|
+
};
|
|
5578
|
+
firstIndexById.set(message.id, duplicateIndex);
|
|
5564
5579
|
indexMessage(merged[duplicateIndex], duplicateIndex);
|
|
5565
5580
|
}
|
|
5566
5581
|
}
|
|
@@ -6230,7 +6245,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
6230
6245
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
6231
6246
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
6232
6247
|
var codexCliVersionEnsured = null;
|
|
6233
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6248
|
+
var ENGINE_PACKAGE_VERSION = "0.1.661";
|
|
6234
6249
|
var INITIALIZE_METHOD = "initialize";
|
|
6235
6250
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6236
6251
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -6561,6 +6576,7 @@ export {
|
|
|
6561
6576
|
imageContentToUserMessageImages,
|
|
6562
6577
|
createAcceptedUserMessageEvent,
|
|
6563
6578
|
getCodexAspTurnResponse,
|
|
6579
|
+
renumberCodexAspTranscriptItems,
|
|
6564
6580
|
isCodexAspTranscript,
|
|
6565
6581
|
isCodexAspTranscriptDelta,
|
|
6566
6582
|
applyCodexAspTranscriptDelta,
|
package/dist/src/index.js
CHANGED
|
@@ -178,12 +178,13 @@ import {
|
|
|
178
178
|
readJsonlPage,
|
|
179
179
|
readReplicasRuntimeEnv,
|
|
180
180
|
recoverCompletedTurn,
|
|
181
|
+
renumberCodexAspTranscriptItems,
|
|
181
182
|
resolveWarmHookConfig,
|
|
182
183
|
sanitizeCanvasFilename,
|
|
183
184
|
serializeCanvasContentResponse,
|
|
184
185
|
shellQuotePosix,
|
|
185
186
|
stripAgentDiagnosticErrors
|
|
186
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-I6NKBVNU.js";
|
|
187
188
|
|
|
188
189
|
// src/index.ts
|
|
189
190
|
import { serve } from "@hono/node-server";
|
|
@@ -6053,7 +6054,6 @@ function threadToAspTranscript(thread) {
|
|
|
6053
6054
|
return turnsToAspTranscript(thread.id, timestampFromSeconds(thread.updatedAt), thread.turns);
|
|
6054
6055
|
}
|
|
6055
6056
|
function turnsToAspTranscript(threadId, updatedAt, sourceTurns) {
|
|
6056
|
-
let sequence = 0;
|
|
6057
6057
|
const turns = sourceTurns.map((turn, index) => ({ turn, index })).sort((a, b) => (a.turn.startedAt ?? a.turn.completedAt ?? Number.MAX_SAFE_INTEGER) - (b.turn.startedAt ?? b.turn.completedAt ?? Number.MAX_SAFE_INTEGER) || a.index - b.index).map(({ turn }) => {
|
|
6058
6058
|
const startedAt = timestampFromSeconds(turn.startedAt);
|
|
6059
6059
|
const completedAt = turn.completedAt === null ? null : timestampFromSeconds(turn.completedAt);
|
|
@@ -6063,7 +6063,7 @@ function turnsToAspTranscript(threadId, updatedAt, sourceTurns) {
|
|
|
6063
6063
|
for (const item of transcriptItemsForTurn(turn)) {
|
|
6064
6064
|
const transcriptItem = itemToTranscriptItem(item, item.type === "userMessage" ? startedAt : itemTimestamp, status);
|
|
6065
6065
|
if (transcriptItem) {
|
|
6066
|
-
items.push(
|
|
6066
|
+
items.push(transcriptItem);
|
|
6067
6067
|
}
|
|
6068
6068
|
}
|
|
6069
6069
|
if (turn.error) {
|
|
@@ -6071,8 +6071,7 @@ function turnsToAspTranscript(threadId, updatedAt, sourceTurns) {
|
|
|
6071
6071
|
type: "error",
|
|
6072
6072
|
id: `${turn.id}-error`,
|
|
6073
6073
|
message: formatTurnFailure(turn),
|
|
6074
|
-
timestamp: itemTimestamp
|
|
6075
|
-
sequence: sequence++
|
|
6074
|
+
timestamp: itemTimestamp
|
|
6076
6075
|
});
|
|
6077
6076
|
}
|
|
6078
6077
|
return {
|
|
@@ -6083,11 +6082,11 @@ function turnsToAspTranscript(threadId, updatedAt, sourceTurns) {
|
|
|
6083
6082
|
items
|
|
6084
6083
|
};
|
|
6085
6084
|
});
|
|
6086
|
-
return {
|
|
6085
|
+
return renumberCodexAspTranscriptItems({
|
|
6087
6086
|
threadId,
|
|
6088
6087
|
updatedAt,
|
|
6089
6088
|
turns
|
|
6090
|
-
};
|
|
6089
|
+
});
|
|
6091
6090
|
}
|
|
6092
6091
|
function latestIsoTimestamp(a, b) {
|
|
6093
6092
|
return Date.parse(a) >= Date.parse(b) ? a : b;
|
|
@@ -6142,18 +6141,14 @@ function dedupeTranscriptItems(items) {
|
|
|
6142
6141
|
return deduped;
|
|
6143
6142
|
}
|
|
6144
6143
|
function normalizeCodexAspTranscriptSequences(transcript) {
|
|
6145
|
-
let sequence = 0;
|
|
6146
6144
|
const turns = [...transcript.turns].map((turn, index) => ({ turn, index })).sort((a, b) => Date.parse(a.turn.startedAt) - Date.parse(b.turn.startedAt) || a.index - b.index).map(({ turn }) => ({
|
|
6147
6145
|
...turn,
|
|
6148
|
-
items: sortTranscriptItems(dedupeTranscriptItems(turn.items))
|
|
6149
|
-
...item,
|
|
6150
|
-
sequence: sequence++
|
|
6151
|
-
}))
|
|
6146
|
+
items: sortTranscriptItems(dedupeTranscriptItems(turn.items))
|
|
6152
6147
|
}));
|
|
6153
|
-
return {
|
|
6148
|
+
return renumberCodexAspTranscriptItems({
|
|
6154
6149
|
...transcript,
|
|
6155
6150
|
turns
|
|
6156
|
-
};
|
|
6151
|
+
});
|
|
6157
6152
|
}
|
|
6158
6153
|
function mergeCodexAspTranscriptItem(current, candidate) {
|
|
6159
6154
|
if (current.type === "agentMessage" && candidate.type === "agentMessage" && candidate.text.length === 0) {
|
|
@@ -11580,7 +11575,7 @@ var ChatService = class {
|
|
|
11580
11575
|
if (!result.success) {
|
|
11581
11576
|
return result;
|
|
11582
11577
|
}
|
|
11583
|
-
if (chat.persisted.provider !== "claude") {
|
|
11578
|
+
if (chat.persisted.provider !== "claude" && chat.persisted.provider !== "relay") {
|
|
11584
11579
|
chat.pendingMessageIds = chat.pendingMessageIds.filter((pendingMessageId) => pendingMessageId !== messageId);
|
|
11585
11580
|
return result;
|
|
11586
11581
|
}
|