replicas-engine 0.1.676 → 0.1.678
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.
|
@@ -1444,6 +1444,7 @@ var WEB_APP_PATHS = {
|
|
|
1444
1444
|
automations: `${HOME_PATH}/automations`,
|
|
1445
1445
|
environment: `${HOME_PATH}/environment`,
|
|
1446
1446
|
analytics: `${HOME_PATH}/analytics`,
|
|
1447
|
+
memory: `${HOME_PATH}/memory`,
|
|
1447
1448
|
dashboard: DASHBOARD_PATH,
|
|
1448
1449
|
agents: `${DASHBOARD_PATH}/agents`,
|
|
1449
1450
|
integrations: `${DASHBOARD_PATH}/integrations`,
|
|
@@ -5016,7 +5017,11 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
5016
5017
|
const assistantTextCounts = /* @__PURE__ */ new Map();
|
|
5017
5018
|
const acceptedUserMessageIndexes = /* @__PURE__ */ new Set();
|
|
5018
5019
|
const canonicalUserMessageIndexes = /* @__PURE__ */ new Set();
|
|
5019
|
-
const findMatchingUserMessageIndex = (indexes, content, timestamp) => {
|
|
5020
|
+
const findMatchingUserMessageIndex = (indexes, content, timestamp, messageId) => {
|
|
5021
|
+
if (typeof messageId === "string") {
|
|
5022
|
+
const byId = messages.findIndex((message) => message.type === "user" && message.id === messageId);
|
|
5023
|
+
if (byId !== -1) return byId;
|
|
5024
|
+
}
|
|
5020
5025
|
return [...indexes].find((index) => {
|
|
5021
5026
|
const message = messages[index];
|
|
5022
5027
|
return message?.type === "user" && areUserMessagesWithinMatchWindow(message, { content, timestamp });
|
|
@@ -5034,7 +5039,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
5034
5039
|
const images = userMessageImages(event.payload.images);
|
|
5035
5040
|
if (content || images) {
|
|
5036
5041
|
const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
|
|
5037
|
-
const canonicalIndex = findMatchingUserMessageIndex(canonicalUserMessageIndexes, content, event.timestamp);
|
|
5042
|
+
const canonicalIndex = findMatchingUserMessageIndex(canonicalUserMessageIndexes, content, event.timestamp, messageId);
|
|
5038
5043
|
const canonical = canonicalIndex === void 0 ? void 0 : messages[canonicalIndex];
|
|
5039
5044
|
const message = {
|
|
5040
5045
|
id: typeof messageId === "string" ? messageId : `user-${event.timestamp}`,
|
|
@@ -5109,14 +5114,16 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
5109
5114
|
};
|
|
5110
5115
|
}).filter((img) => img.data);
|
|
5111
5116
|
if (textContent || images.length > 0) {
|
|
5117
|
+
const stampedId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
|
|
5112
5118
|
const acceptedIndex = findMatchingUserMessageIndex(
|
|
5113
5119
|
acceptedUserMessageIndexes,
|
|
5114
5120
|
textContent,
|
|
5115
|
-
event.timestamp
|
|
5121
|
+
event.timestamp,
|
|
5122
|
+
stampedId
|
|
5116
5123
|
);
|
|
5117
5124
|
const accepted = acceptedIndex === void 0 ? void 0 : messages[acceptedIndex];
|
|
5118
5125
|
const message = {
|
|
5119
|
-
id: accepted?.id ?? `user-${event.timestamp}
|
|
5126
|
+
id: accepted?.id ?? (typeof stampedId === "string" ? stampedId : `user-${event.timestamp}`),
|
|
5120
5127
|
type: "user",
|
|
5121
5128
|
content: textContent || (images.length > 0 ? `[${images.length} image${images.length > 1 ? "s" : ""} attached]` : ""),
|
|
5122
5129
|
images: images.length > 0 ? images : accepted?.type === "user" ? accepted.images : void 0,
|
|
@@ -6397,7 +6404,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
6397
6404
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
6398
6405
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
6399
6406
|
var codexCliVersionEnsured = null;
|
|
6400
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6407
|
+
var ENGINE_PACKAGE_VERSION = "0.1.678";
|
|
6401
6408
|
var INITIALIZE_METHOD = "initialize";
|
|
6402
6409
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6403
6410
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -6794,6 +6801,7 @@ export {
|
|
|
6794
6801
|
isTerminalBackgroundTaskStatus,
|
|
6795
6802
|
areUserMessagesWithinMatchWindow,
|
|
6796
6803
|
getUserMessage,
|
|
6804
|
+
getUserMessageId,
|
|
6797
6805
|
getEventTimestampMs,
|
|
6798
6806
|
areSameUserMessageEvents,
|
|
6799
6807
|
parseAgentEventJsonlWithCodexAspTranscript,
|
package/dist/src/index.js
CHANGED
|
@@ -138,6 +138,7 @@ import {
|
|
|
138
138
|
getGoalCommandObjectiveValidationError,
|
|
139
139
|
getSlashCommandsForProvider,
|
|
140
140
|
getUserMessage,
|
|
141
|
+
getUserMessageId,
|
|
141
142
|
gitIdentityConfigCommands,
|
|
142
143
|
hasChatStarted,
|
|
143
144
|
imageContentToUserMessageImages,
|
|
@@ -189,7 +190,7 @@ import {
|
|
|
189
190
|
serializeCanvasContentResponse,
|
|
190
191
|
shellQuotePosix,
|
|
191
192
|
stripAgentDiagnosticErrors
|
|
192
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-G2NKXO3H.js";
|
|
193
194
|
|
|
194
195
|
// src/index.ts
|
|
195
196
|
import { serve } from "@hono/node-server";
|
|
@@ -3406,6 +3407,9 @@ var MessageQueueService = class {
|
|
|
3406
3407
|
const queuedMessage = {
|
|
3407
3408
|
id: messageId,
|
|
3408
3409
|
...request,
|
|
3410
|
+
// Providers stamp this id onto the transcript user event so history
|
|
3411
|
+
// rendering can pair it with the accepted snapshot by identity.
|
|
3412
|
+
messageId,
|
|
3409
3413
|
queuedAt: request.submittedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
3410
3414
|
};
|
|
3411
3415
|
if (this.processing) {
|
|
@@ -5016,7 +5020,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
5016
5020
|
session_id: this.sessionId ?? ""
|
|
5017
5021
|
};
|
|
5018
5022
|
if (!options.skipUserMessageRecord) {
|
|
5019
|
-
await this.recordEvent(userMessage);
|
|
5023
|
+
await this.recordEvent(userMessage, request.messageId);
|
|
5020
5024
|
}
|
|
5021
5025
|
const combinedInstructions = this.buildCombinedInstructions(customInstructions, true);
|
|
5022
5026
|
const systemPrompt = this.systemPromptOverride?.(combinedInstructions);
|
|
@@ -5633,12 +5637,12 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
5633
5637
|
this.setCompacting(false);
|
|
5634
5638
|
}
|
|
5635
5639
|
}
|
|
5636
|
-
async recordEvent(event) {
|
|
5640
|
+
async recordEvent(event, replicasMessageId) {
|
|
5637
5641
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
5638
5642
|
const jsonEvent = {
|
|
5639
5643
|
timestamp,
|
|
5640
5644
|
type: `claude-${event.type}`,
|
|
5641
|
-
payload: event
|
|
5645
|
+
payload: replicasMessageId ? { ...event, [USER_MESSAGE_ID_PAYLOAD_KEY]: replicasMessageId } : event
|
|
5642
5646
|
};
|
|
5643
5647
|
this.historyFile.append(jsonEvent);
|
|
5644
5648
|
this.onEvent(jsonEvent);
|
|
@@ -11861,6 +11865,8 @@ function isCursorAvailable() {
|
|
|
11861
11865
|
return Boolean(ENGINE_ENV.CURSOR_API_KEY);
|
|
11862
11866
|
}
|
|
11863
11867
|
function isSameAcceptedUserEvent(event, acceptedEvent) {
|
|
11868
|
+
const eventMessageId = getUserMessageId(event);
|
|
11869
|
+
if (eventMessageId && eventMessageId === getUserMessageId(acceptedEvent)) return true;
|
|
11864
11870
|
if (areSameUserMessageEvents(event, acceptedEvent)) return true;
|
|
11865
11871
|
const eventMessage = getUserMessage(event);
|
|
11866
11872
|
const acceptedMessage = getUserMessage(acceptedEvent);
|
|
@@ -12253,6 +12259,19 @@ var ChatService = class {
|
|
|
12253
12259
|
updateQueuedMessage(chatId, messageId, message) {
|
|
12254
12260
|
const chat = this.requireChat(chatId);
|
|
12255
12261
|
const success = chat.provider.updateQueuedMessage(messageId, message);
|
|
12262
|
+
if (success) {
|
|
12263
|
+
const acceptedEvent = chat.acceptedUserEvents.get(messageId);
|
|
12264
|
+
if (acceptedEvent) {
|
|
12265
|
+
chat.acceptedUserEvents.set(messageId, {
|
|
12266
|
+
...acceptedEvent,
|
|
12267
|
+
payload: { ...acceptedEvent.payload, message }
|
|
12268
|
+
});
|
|
12269
|
+
}
|
|
12270
|
+
if (chat.pendingMessageIds.at(-1) === messageId) {
|
|
12271
|
+
chat.persisted.lastMessageText = message.trim().slice(0, LAST_MESSAGE_PREVIEW_MAX) || null;
|
|
12272
|
+
this.touch(chat);
|
|
12273
|
+
}
|
|
12274
|
+
}
|
|
12256
12275
|
return {
|
|
12257
12276
|
success,
|
|
12258
12277
|
queue: chat.provider.getQueue()
|