replicas-engine 0.1.42 → 0.1.43
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
CHANGED
|
@@ -1134,6 +1134,10 @@ var DEFAULT_CHAT_TITLES = {
|
|
|
1134
1134
|
};
|
|
1135
1135
|
var IMAGE_MEDIA_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
1136
1136
|
|
|
1137
|
+
// ../shared/src/routes/workspaces.ts
|
|
1138
|
+
var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
|
|
1139
|
+
var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
1140
|
+
|
|
1137
1141
|
// src/managers/claude-manager.ts
|
|
1138
1142
|
import {
|
|
1139
1143
|
query
|
|
@@ -1330,6 +1334,46 @@ function convertClaudeEvent(event, linearSessionId) {
|
|
|
1330
1334
|
}
|
|
1331
1335
|
return null;
|
|
1332
1336
|
}
|
|
1337
|
+
function mapTodoStatus(status) {
|
|
1338
|
+
if (status === "in_progress") {
|
|
1339
|
+
return "inProgress";
|
|
1340
|
+
}
|
|
1341
|
+
if (status === "completed") {
|
|
1342
|
+
return "completed";
|
|
1343
|
+
}
|
|
1344
|
+
if (status === "cancelled" || status === "canceled") {
|
|
1345
|
+
return "canceled";
|
|
1346
|
+
}
|
|
1347
|
+
return "pending";
|
|
1348
|
+
}
|
|
1349
|
+
function extractPlanFromClaudeEvent(event) {
|
|
1350
|
+
if (event.type !== "assistant") {
|
|
1351
|
+
return null;
|
|
1352
|
+
}
|
|
1353
|
+
const message = event;
|
|
1354
|
+
const contentBlocks = message.message?.content || [];
|
|
1355
|
+
for (const block of contentBlocks) {
|
|
1356
|
+
if (block.type !== "tool_use" || block.name !== "TodoWrite") {
|
|
1357
|
+
continue;
|
|
1358
|
+
}
|
|
1359
|
+
const input = typeof block.input === "string" ? (() => {
|
|
1360
|
+
try {
|
|
1361
|
+
return JSON.parse(block.input);
|
|
1362
|
+
} catch {
|
|
1363
|
+
return null;
|
|
1364
|
+
}
|
|
1365
|
+
})() : typeof block.input === "object" && block.input !== null ? block.input : null;
|
|
1366
|
+
const todos = input?.todos;
|
|
1367
|
+
if (!todos || todos.length === 0) {
|
|
1368
|
+
return null;
|
|
1369
|
+
}
|
|
1370
|
+
return todos.filter((todo) => Boolean(todo.content && todo.content.trim().length > 0)).map((todo) => ({
|
|
1371
|
+
content: todo.content.trim(),
|
|
1372
|
+
status: mapTodoStatus(todo.status)
|
|
1373
|
+
}));
|
|
1374
|
+
}
|
|
1375
|
+
return null;
|
|
1376
|
+
}
|
|
1333
1377
|
function convertCodexEvent(event, linearSessionId) {
|
|
1334
1378
|
if (event.type === "turn.started") {
|
|
1335
1379
|
return {
|
|
@@ -1518,6 +1562,24 @@ function convertCodexEvent(event, linearSessionId) {
|
|
|
1518
1562
|
}
|
|
1519
1563
|
return null;
|
|
1520
1564
|
}
|
|
1565
|
+
function extractPlanFromCodexEvent(event) {
|
|
1566
|
+
if (event.type !== "item.started" && event.type !== "item.completed") {
|
|
1567
|
+
return null;
|
|
1568
|
+
}
|
|
1569
|
+
const item = event.item;
|
|
1570
|
+
if (!item || item.type !== "todo_list") {
|
|
1571
|
+
return null;
|
|
1572
|
+
}
|
|
1573
|
+
const items = "items" in item && Array.isArray(item.items) ? item.items : [];
|
|
1574
|
+
if (items.length === 0) {
|
|
1575
|
+
return null;
|
|
1576
|
+
}
|
|
1577
|
+
const hasIncomplete = items.some((entry) => !entry.completed);
|
|
1578
|
+
return items.filter((entry) => Boolean(entry.text && entry.text.trim().length > 0)).map((entry) => ({
|
|
1579
|
+
content: entry.text.trim(),
|
|
1580
|
+
status: entry.completed ? "completed" : hasIncomplete ? "inProgress" : "pending"
|
|
1581
|
+
}));
|
|
1582
|
+
}
|
|
1521
1583
|
|
|
1522
1584
|
// src/utils/image-utils.ts
|
|
1523
1585
|
function isImageMediaType(value) {
|
|
@@ -1913,6 +1975,14 @@ var ClaudeManager = class extends CodingAgentManager {
|
|
|
1913
1975
|
for await (const msg of response) {
|
|
1914
1976
|
await this.handleMessage(msg);
|
|
1915
1977
|
if (linearSessionId) {
|
|
1978
|
+
const plan = extractPlanFromClaudeEvent(msg);
|
|
1979
|
+
if (plan) {
|
|
1980
|
+
monolithService.sendEvent({
|
|
1981
|
+
type: "agent_plan_update",
|
|
1982
|
+
payload: { linearSessionId, plan }
|
|
1983
|
+
}).catch(() => {
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1916
1986
|
const linearEvent = convertClaudeEvent(msg, linearSessionId);
|
|
1917
1987
|
if (linearEvent) {
|
|
1918
1988
|
if (latestThoughtEvent) {
|
|
@@ -2141,6 +2211,14 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
2141
2211
|
let latestThoughtEvent = null;
|
|
2142
2212
|
for await (const event of events) {
|
|
2143
2213
|
if (linearSessionId) {
|
|
2214
|
+
const plan = extractPlanFromCodexEvent(event);
|
|
2215
|
+
if (plan) {
|
|
2216
|
+
monolithService.sendEvent({
|
|
2217
|
+
type: "agent_plan_update",
|
|
2218
|
+
payload: { linearSessionId, plan }
|
|
2219
|
+
}).catch(() => {
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2144
2222
|
const linearEvent = convertCodexEvent(event, linearSessionId);
|
|
2145
2223
|
if (linearEvent) {
|
|
2146
2224
|
if (latestThoughtEvent) {
|
|
@@ -167,8 +167,8 @@ var require_utils = __commonJS({
|
|
|
167
167
|
Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
|
-
module.exports.wrapperSymbol =
|
|
171
|
-
module.exports.implSymbol =
|
|
170
|
+
module.exports.wrapperSymbol = Symbol("wrapper");
|
|
171
|
+
module.exports.implSymbol = Symbol("impl");
|
|
172
172
|
module.exports.wrapperForImpl = function(impl) {
|
|
173
173
|
return impl[module.exports.wrapperSymbol];
|
|
174
174
|
};
|
|
@@ -361,7 +361,7 @@ var require_url_state_machine = __commonJS({
|
|
|
361
361
|
ws: 80,
|
|
362
362
|
wss: 443
|
|
363
363
|
};
|
|
364
|
-
var failure =
|
|
364
|
+
var failure = Symbol("failure");
|
|
365
365
|
function countSymbols(str) {
|
|
366
366
|
return punycode.ucs2.decode(str).length;
|
|
367
367
|
}
|
|
@@ -1787,8 +1787,8 @@ var require_lib2 = __commonJS({
|
|
|
1787
1787
|
var https = _interopDefault(__require("https"));
|
|
1788
1788
|
var zlib = _interopDefault(__require("zlib"));
|
|
1789
1789
|
var Readable = Stream.Readable;
|
|
1790
|
-
var BUFFER =
|
|
1791
|
-
var TYPE =
|
|
1790
|
+
var BUFFER = Symbol("buffer");
|
|
1791
|
+
var TYPE = Symbol("type");
|
|
1792
1792
|
var Blob = class _Blob {
|
|
1793
1793
|
constructor() {
|
|
1794
1794
|
this[TYPE] = "";
|
|
@@ -1899,7 +1899,7 @@ var require_lib2 = __commonJS({
|
|
|
1899
1899
|
FetchError.prototype.constructor = FetchError;
|
|
1900
1900
|
FetchError.prototype.name = "FetchError";
|
|
1901
1901
|
var convert;
|
|
1902
|
-
var INTERNALS =
|
|
1902
|
+
var INTERNALS = Symbol("Body internals");
|
|
1903
1903
|
var PassThrough = Stream.PassThrough;
|
|
1904
1904
|
function Body(body) {
|
|
1905
1905
|
var _this = this;
|
|
@@ -2239,7 +2239,7 @@ var require_lib2 = __commonJS({
|
|
|
2239
2239
|
}
|
|
2240
2240
|
return void 0;
|
|
2241
2241
|
}
|
|
2242
|
-
var MAP =
|
|
2242
|
+
var MAP = Symbol("map");
|
|
2243
2243
|
var Headers = class _Headers {
|
|
2244
2244
|
/**
|
|
2245
2245
|
* Headers class
|
|
@@ -2447,7 +2447,7 @@ var require_lib2 = __commonJS({
|
|
|
2447
2447
|
return [k.toLowerCase(), headers[MAP][k].join(", ")];
|
|
2448
2448
|
});
|
|
2449
2449
|
}
|
|
2450
|
-
var INTERNAL =
|
|
2450
|
+
var INTERNAL = Symbol("internal");
|
|
2451
2451
|
function createHeadersIterator(target, kind) {
|
|
2452
2452
|
const iterator = Object.create(HeadersIteratorPrototype);
|
|
2453
2453
|
iterator[INTERNAL] = {
|
|
@@ -2516,7 +2516,7 @@ var require_lib2 = __commonJS({
|
|
|
2516
2516
|
}
|
|
2517
2517
|
return headers;
|
|
2518
2518
|
}
|
|
2519
|
-
var INTERNALS$1 =
|
|
2519
|
+
var INTERNALS$1 = Symbol("Response internals");
|
|
2520
2520
|
var STATUS_CODES = http.STATUS_CODES;
|
|
2521
2521
|
var Response = class _Response {
|
|
2522
2522
|
constructor() {
|
|
@@ -2592,7 +2592,7 @@ var require_lib2 = __commonJS({
|
|
|
2592
2592
|
enumerable: false,
|
|
2593
2593
|
configurable: true
|
|
2594
2594
|
});
|
|
2595
|
-
var INTERNALS$2 =
|
|
2595
|
+
var INTERNALS$2 = Symbol("Request internals");
|
|
2596
2596
|
var URL = Url.URL || whatwgUrl.URL;
|
|
2597
2597
|
var parse_url = Url.parse;
|
|
2598
2598
|
var format_url = Url.format;
|