replicas-engine 0.1.38 → 0.1.40
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 +23 -39
- package/package.json +4 -4
package/dist/src/index.js
CHANGED
|
@@ -732,6 +732,7 @@ var DEFAULT_CHAT_TITLES = {
|
|
|
732
732
|
claude: "Claude Code",
|
|
733
733
|
codex: "Codex"
|
|
734
734
|
};
|
|
735
|
+
var IMAGE_MEDIA_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
735
736
|
|
|
736
737
|
// src/services/replicas-config.ts
|
|
737
738
|
var execAsync = promisify(exec);
|
|
@@ -1087,7 +1088,7 @@ function isJsonlEvent(value) {
|
|
|
1087
1088
|
if (!isRecord3(value)) {
|
|
1088
1089
|
return false;
|
|
1089
1090
|
}
|
|
1090
|
-
return typeof value.timestamp === "string" && typeof value.type === "string" &&
|
|
1091
|
+
return typeof value.timestamp === "string" && typeof value.type === "string" && isRecord3(value.payload);
|
|
1091
1092
|
}
|
|
1092
1093
|
function parseJsonlEvents(lines) {
|
|
1093
1094
|
const events = [];
|
|
@@ -1488,9 +1489,9 @@ function convertCodexEvent(event, linearSessionId) {
|
|
|
1488
1489
|
}
|
|
1489
1490
|
|
|
1490
1491
|
// src/utils/image-utils.ts
|
|
1491
|
-
var
|
|
1492
|
+
var IMAGE_MEDIA_TYPES2 = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
|
|
1492
1493
|
function isImageMediaType(value) {
|
|
1493
|
-
return
|
|
1494
|
+
return IMAGE_MEDIA_TYPES2.has(value);
|
|
1494
1495
|
}
|
|
1495
1496
|
function inferMediaType(url, contentType) {
|
|
1496
1497
|
if (contentType) {
|
|
@@ -2113,7 +2114,7 @@ function isJsonlEvent2(value) {
|
|
|
2113
2114
|
if (!isRecord4(value)) {
|
|
2114
2115
|
return false;
|
|
2115
2116
|
}
|
|
2116
|
-
return typeof value.timestamp === "string" && typeof value.type === "string" &&
|
|
2117
|
+
return typeof value.timestamp === "string" && typeof value.type === "string" && isRecord4(value.payload);
|
|
2117
2118
|
}
|
|
2118
2119
|
function sleep(ms) {
|
|
2119
2120
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -2452,35 +2453,30 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
2452
2453
|
};
|
|
2453
2454
|
}
|
|
2454
2455
|
let active = true;
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2456
|
+
const seenLines = /* @__PURE__ */ new Set();
|
|
2457
|
+
const seedSeenLines = async () => {
|
|
2458
|
+
try {
|
|
2459
|
+
const content = await readFile5(sessionFile, "utf-8");
|
|
2460
|
+
const lines = content.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
2461
|
+
for (const line of lines) {
|
|
2462
|
+
seenLines.add(line);
|
|
2463
|
+
}
|
|
2464
|
+
} catch {
|
|
2465
|
+
}
|
|
2466
|
+
};
|
|
2467
|
+
await seedSeenLines();
|
|
2463
2468
|
const pump = async () => {
|
|
2464
2469
|
let emitted = 0;
|
|
2465
2470
|
try {
|
|
2466
2471
|
const content = await readFile5(sessionFile, "utf-8");
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
}
|
|
2471
|
-
const chunk = content.slice(offset);
|
|
2472
|
-
offset = content.length;
|
|
2473
|
-
if (!chunk) {
|
|
2474
|
-
return 0;
|
|
2475
|
-
}
|
|
2476
|
-
const buffered = `${remainder}${chunk}`;
|
|
2477
|
-
const lines = buffered.split("\n");
|
|
2478
|
-
remainder = lines.pop() ?? "";
|
|
2479
|
-
for (const line of lines) {
|
|
2472
|
+
const lines = content.split("\n");
|
|
2473
|
+
const completeLines = content.endsWith("\n") ? lines : lines.slice(0, -1);
|
|
2474
|
+
for (const line of completeLines) {
|
|
2480
2475
|
const trimmed = line.trim();
|
|
2481
|
-
if (!trimmed) {
|
|
2476
|
+
if (!trimmed || seenLines.has(trimmed)) {
|
|
2482
2477
|
continue;
|
|
2483
2478
|
}
|
|
2479
|
+
seenLines.add(trimmed);
|
|
2484
2480
|
try {
|
|
2485
2481
|
const parsed = JSON.parse(trimmed);
|
|
2486
2482
|
if (isJsonlEvent2(parsed)) {
|
|
@@ -2512,17 +2508,6 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
2512
2508
|
}
|
|
2513
2509
|
await sleep(100);
|
|
2514
2510
|
}
|
|
2515
|
-
const tail = remainder.trim();
|
|
2516
|
-
if (!tail) {
|
|
2517
|
-
return;
|
|
2518
|
-
}
|
|
2519
|
-
try {
|
|
2520
|
-
const parsed = JSON.parse(tail);
|
|
2521
|
-
if (isJsonlEvent2(parsed)) {
|
|
2522
|
-
onEvent(parsed);
|
|
2523
|
-
}
|
|
2524
|
-
} catch {
|
|
2525
|
-
}
|
|
2526
2511
|
};
|
|
2527
2512
|
}
|
|
2528
2513
|
};
|
|
@@ -2955,8 +2940,7 @@ var createChatSchema = z.object({
|
|
|
2955
2940
|
title: z.string().min(1).optional(),
|
|
2956
2941
|
repoScope: z.union([z.literal("all"), z.array(z.string().min(1))]).optional()
|
|
2957
2942
|
});
|
|
2958
|
-
var
|
|
2959
|
-
var imageMediaTypeSchema = z.enum(imageMediaTypes);
|
|
2943
|
+
var imageMediaTypeSchema = z.enum(IMAGE_MEDIA_TYPES);
|
|
2960
2944
|
var sendMessageSchema = z.object({
|
|
2961
2945
|
message: z.string().min(1),
|
|
2962
2946
|
model: z.string().optional(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replicas-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
4
4
|
"description": "Lightweight API server for Replicas workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"author": "Replicas",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@anthropic-ai/claude-agent-sdk": "^0.
|
|
30
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.41",
|
|
31
31
|
"@hono/node-server": "^1.19.5",
|
|
32
|
-
"@openai/codex-sdk": "^0.
|
|
32
|
+
"@openai/codex-sdk": "^0.101.0",
|
|
33
33
|
"dotenv": "^17.2.3",
|
|
34
34
|
"hono": "^4.10.3",
|
|
35
35
|
"smol-toml": "^1.6.0",
|
|
36
|
-
"zod": "^
|
|
36
|
+
"zod": "^4.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^20.11.17",
|