replicas-engine 0.1.244 → 0.1.245
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 +47 -11
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -289,7 +289,7 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
289
289
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
290
290
|
|
|
291
291
|
// ../shared/src/e2b.ts
|
|
292
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-05-30-
|
|
292
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-05-30-v6";
|
|
293
293
|
|
|
294
294
|
// ../shared/src/runtime-env.ts
|
|
295
295
|
function parsePosixEnvFile(content) {
|
|
@@ -1823,6 +1823,18 @@ function normalizeCodexAspTranscriptStatus(status, failed = false) {
|
|
|
1823
1823
|
if (status === "completed") return "completed";
|
|
1824
1824
|
return "in_progress";
|
|
1825
1825
|
}
|
|
1826
|
+
function imageContentToUserMessageImages(images) {
|
|
1827
|
+
const userImages = [];
|
|
1828
|
+
for (const image of images ?? []) {
|
|
1829
|
+
if (image.source.type !== "base64" || image.source.data.length === 0) continue;
|
|
1830
|
+
userImages.push({
|
|
1831
|
+
type: "image",
|
|
1832
|
+
mediaType: image.source.media_type,
|
|
1833
|
+
data: image.source.data
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
return userImages.length > 0 ? userImages : void 0;
|
|
1837
|
+
}
|
|
1826
1838
|
function isCodexAspTranscript(value) {
|
|
1827
1839
|
if (!isRecord(value)) return false;
|
|
1828
1840
|
return typeof value.threadId === "string" && typeof value.updatedAt === "string" && Array.isArray(value.turns);
|
|
@@ -4118,7 +4130,7 @@ async function registerDesktopPreview() {
|
|
|
4118
4130
|
}
|
|
4119
4131
|
|
|
4120
4132
|
// src/services/chat/chat-service.ts
|
|
4121
|
-
import { existsSync as
|
|
4133
|
+
import { existsSync as existsSync8 } from "fs";
|
|
4122
4134
|
import { appendFile as appendFile5, copyFile, mkdir as mkdir11, readFile as readFile8, rename as rename2, rm } from "fs/promises";
|
|
4123
4135
|
import { homedir as homedir13 } from "os";
|
|
4124
4136
|
import { join as join15 } from "path";
|
|
@@ -6102,7 +6114,7 @@ var AspClient = class {
|
|
|
6102
6114
|
// src/managers/codex-asp/app-server-process.ts
|
|
6103
6115
|
var DEFAULT_CODEX_BINARY = "codex";
|
|
6104
6116
|
var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
6105
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6117
|
+
var ENGINE_PACKAGE_VERSION = "0.1.245";
|
|
6106
6118
|
var INITIALIZE_METHOD = "initialize";
|
|
6107
6119
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6108
6120
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -6369,6 +6381,8 @@ function isCodexAuthError(error) {
|
|
|
6369
6381
|
}
|
|
6370
6382
|
|
|
6371
6383
|
// src/managers/codex-asp/mappers.ts
|
|
6384
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
|
|
6385
|
+
var localImageCache = /* @__PURE__ */ new Map();
|
|
6372
6386
|
var DEFAULT_MODEL = DEFAULT_CODEX_MODEL;
|
|
6373
6387
|
var THREAD_START_METHOD = "thread/start";
|
|
6374
6388
|
var THREAD_RESUME_METHOD = "thread/resume";
|
|
@@ -6441,6 +6455,22 @@ function transcriptItemsForTurn(turn) {
|
|
|
6441
6455
|
const otherItems = turn.items.filter((item) => item.type !== "userMessage");
|
|
6442
6456
|
return [...userItems, ...otherItems];
|
|
6443
6457
|
}
|
|
6458
|
+
function userImageForLocalPath(path4) {
|
|
6459
|
+
const cached = localImageCache.get(path4);
|
|
6460
|
+
if (cached) return cached;
|
|
6461
|
+
if (!existsSync6(path4)) return null;
|
|
6462
|
+
const image = {
|
|
6463
|
+
type: "image",
|
|
6464
|
+
mediaType: inferMediaType(path4),
|
|
6465
|
+
data: readFileSync3(path4).toString("base64")
|
|
6466
|
+
};
|
|
6467
|
+
if (image.data.length > 0) localImageCache.set(path4, image);
|
|
6468
|
+
return image;
|
|
6469
|
+
}
|
|
6470
|
+
function userImagesForInput(input) {
|
|
6471
|
+
const images = input.filter((item) => item.type === "localImage").map((item) => userImageForLocalPath(item.path)).filter((image) => image !== null && image.data.length > 0);
|
|
6472
|
+
return images.length > 0 ? images : void 0;
|
|
6473
|
+
}
|
|
6444
6474
|
function itemToTranscriptItem(item, timestamp, status) {
|
|
6445
6475
|
if (item.type === "userMessage") {
|
|
6446
6476
|
const content = item.content.filter((input) => input.type === "text").map((input) => input.text).join("\n");
|
|
@@ -6448,6 +6478,7 @@ function itemToTranscriptItem(item, timestamp, status) {
|
|
|
6448
6478
|
type: "userMessage",
|
|
6449
6479
|
id: item.id,
|
|
6450
6480
|
content,
|
|
6481
|
+
images: userImagesForInput(item.content),
|
|
6451
6482
|
timestamp
|
|
6452
6483
|
};
|
|
6453
6484
|
}
|
|
@@ -6707,6 +6738,7 @@ function mergeCodexAspTranscriptItem(current, candidate) {
|
|
|
6707
6738
|
...current,
|
|
6708
6739
|
...candidate,
|
|
6709
6740
|
id: current.id,
|
|
6741
|
+
...current.type === "userMessage" && candidate.type === "userMessage" && !candidate.images && current.images ? { images: current.images } : {},
|
|
6710
6742
|
timestamp: current.timestamp,
|
|
6711
6743
|
sequence: current.sequence ?? candidate.sequence
|
|
6712
6744
|
};
|
|
@@ -7002,9 +7034,11 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
7002
7034
|
const recordUserMessage = (extraPayload = {}) => {
|
|
7003
7035
|
if (userMessageRecorded) return;
|
|
7004
7036
|
userMessageRecorded = true;
|
|
7037
|
+
const images = imageContentToUserMessageImages(request.images);
|
|
7005
7038
|
this.recordHistoryEvent("event_msg", {
|
|
7006
7039
|
type: "user_message",
|
|
7007
7040
|
message: request.message,
|
|
7041
|
+
...images ? { images } : {},
|
|
7008
7042
|
...extraPayload
|
|
7009
7043
|
});
|
|
7010
7044
|
};
|
|
@@ -7615,7 +7649,7 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
7615
7649
|
// src/managers/codex-manager.ts
|
|
7616
7650
|
import { Codex } from "@openai/codex-sdk";
|
|
7617
7651
|
import { readdir as readdir3, stat as stat2, writeFile as writeFile6, mkdir as mkdir10, readFile as readFile7 } from "fs/promises";
|
|
7618
|
-
import { existsSync as
|
|
7652
|
+
import { existsSync as existsSync7 } from "fs";
|
|
7619
7653
|
import { join as join14 } from "path";
|
|
7620
7654
|
import { homedir as homedir12 } from "os";
|
|
7621
7655
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
@@ -7700,7 +7734,7 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
7700
7734
|
const codexDir = join14(homedir12(), ".codex");
|
|
7701
7735
|
await mkdir10(codexDir, { recursive: true });
|
|
7702
7736
|
let config = {};
|
|
7703
|
-
if (
|
|
7737
|
+
if (existsSync7(CODEX_CONFIG_PATH)) {
|
|
7704
7738
|
try {
|
|
7705
7739
|
const existingContent = await readFile7(CODEX_CONFIG_PATH, "utf-8");
|
|
7706
7740
|
const parsed = parseToml(existingContent);
|
|
@@ -8629,7 +8663,7 @@ function isChatMessageSender(value) {
|
|
|
8629
8663
|
return typeof value.senderUserId === "string" && typeof value.senderEmail === "string" && typeof value.recordedAt === "string";
|
|
8630
8664
|
}
|
|
8631
8665
|
function isCodexAvailable() {
|
|
8632
|
-
return
|
|
8666
|
+
return existsSync8(CODEX_AUTH_PATH2) || Boolean(ENGINE_ENV.OPENAI_API_KEY);
|
|
8633
8667
|
}
|
|
8634
8668
|
function isSameAcceptedUserEvent(event, acceptedEvent) {
|
|
8635
8669
|
if (areSameUserMessageEvents(event, acceptedEvent)) return true;
|
|
@@ -8688,7 +8722,8 @@ function parsePersistedChatsContent(content) {
|
|
|
8688
8722
|
function corruptChatsFilePath() {
|
|
8689
8723
|
return `${CHATS_FILE}.corrupt-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`;
|
|
8690
8724
|
}
|
|
8691
|
-
function createUserMessageEvent(message, messageId) {
|
|
8725
|
+
function createUserMessageEvent(message, messageId, images) {
|
|
8726
|
+
const eventImages = imageContentToUserMessageImages(images);
|
|
8692
8727
|
return {
|
|
8693
8728
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8694
8729
|
type: "event_msg",
|
|
@@ -8696,7 +8731,8 @@ function createUserMessageEvent(message, messageId) {
|
|
|
8696
8731
|
type: "user_message",
|
|
8697
8732
|
message,
|
|
8698
8733
|
source: ACCEPTED_USER_MESSAGE_SOURCE,
|
|
8699
|
-
[USER_MESSAGE_ID_PAYLOAD_KEY]: messageId
|
|
8734
|
+
[USER_MESSAGE_ID_PAYLOAD_KEY]: messageId,
|
|
8735
|
+
...eventImages ? { images: eventImages } : {}
|
|
8700
8736
|
}
|
|
8701
8737
|
};
|
|
8702
8738
|
}
|
|
@@ -8778,7 +8814,7 @@ var ChatService = class {
|
|
|
8778
8814
|
async sendMessage(chatId, request) {
|
|
8779
8815
|
const chat = this.requireChat(chatId);
|
|
8780
8816
|
const result = await chat.provider.enqueueMessage(request);
|
|
8781
|
-
const acceptedEvent = createUserMessageEvent(request.message, result.messageId);
|
|
8817
|
+
const acceptedEvent = createUserMessageEvent(request.message, result.messageId, request.images);
|
|
8782
8818
|
chat.pendingMessageIds.push(result.messageId);
|
|
8783
8819
|
chat.acceptedUserEvents.set(result.messageId, acceptedEvent);
|
|
8784
8820
|
this.touch(chat);
|
|
@@ -9598,7 +9634,7 @@ var planService = new PlanService();
|
|
|
9598
9634
|
// src/services/warm-hooks-service.ts
|
|
9599
9635
|
import { spawn as spawn3 } from "child_process";
|
|
9600
9636
|
import { readFile as readFile12 } from "fs/promises";
|
|
9601
|
-
import { existsSync as
|
|
9637
|
+
import { existsSync as existsSync9 } from "fs";
|
|
9602
9638
|
import { join as join19 } from "path";
|
|
9603
9639
|
|
|
9604
9640
|
// src/services/warm-hook-logs-service.ts
|
|
@@ -9720,7 +9756,7 @@ var warmHookLogsService = new WarmHookLogsService();
|
|
|
9720
9756
|
async function readRepoWarmHook(repoPath) {
|
|
9721
9757
|
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
9722
9758
|
const configPath = join19(repoPath, filename);
|
|
9723
|
-
if (!
|
|
9759
|
+
if (!existsSync9(configPath)) {
|
|
9724
9760
|
continue;
|
|
9725
9761
|
}
|
|
9726
9762
|
try {
|