replicas-cli 0.2.248 → 0.2.250
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/index.mjs +189 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9157,7 +9157,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
|
9157
9157
|
var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
9158
9158
|
|
|
9159
9159
|
// ../shared/src/cli-version.ts
|
|
9160
|
-
var CLI_VERSION = "0.2.
|
|
9160
|
+
var CLI_VERSION = "0.2.250";
|
|
9161
9161
|
|
|
9162
9162
|
// ../shared/src/engine/environment.ts
|
|
9163
9163
|
var DESKTOP_NOVNC_PORT = 6080;
|
|
@@ -9243,6 +9243,11 @@ function classifyCanvasFilename(filename) {
|
|
|
9243
9243
|
|
|
9244
9244
|
// ../shared/src/engine/v1.ts
|
|
9245
9245
|
var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
|
|
9246
|
+
function normalizeCodexAspTranscriptStatus(status, failed = false) {
|
|
9247
|
+
if (failed || status === "failed" || status === "declined") return "failed";
|
|
9248
|
+
if (status === "completed") return "completed";
|
|
9249
|
+
return "in_progress";
|
|
9250
|
+
}
|
|
9246
9251
|
|
|
9247
9252
|
// ../shared/src/routes/workspaces.ts
|
|
9248
9253
|
function workspaceConfigWithCapabilities(config2, capabilities = {}) {
|
|
@@ -10151,8 +10156,180 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
10151
10156
|
return messages;
|
|
10152
10157
|
}
|
|
10153
10158
|
|
|
10159
|
+
// ../shared/src/agent-event-utils.ts
|
|
10160
|
+
function parseTimestampMs(timestamp) {
|
|
10161
|
+
const value = Date.parse(timestamp);
|
|
10162
|
+
return Number.isFinite(value) ? value : 0;
|
|
10163
|
+
}
|
|
10164
|
+
|
|
10154
10165
|
// ../shared/src/display-message/parsers/codex-asp-parser.ts
|
|
10155
10166
|
var DUPLICATE_WINDOW_MS = 5 * 60 * 1e3;
|
|
10167
|
+
function nearTimestamp(a, b) {
|
|
10168
|
+
return Math.abs(parseTimestampMs(a) - parseTimestampMs(b)) <= DUPLICATE_WINDOW_MS;
|
|
10169
|
+
}
|
|
10170
|
+
function inputForDisplay(input) {
|
|
10171
|
+
if (input === void 0 || input === null) return void 0;
|
|
10172
|
+
if (typeof input === "string") return input;
|
|
10173
|
+
if (isRecord(input)) return input;
|
|
10174
|
+
return String(input);
|
|
10175
|
+
}
|
|
10176
|
+
function isInternalUserMessage(content) {
|
|
10177
|
+
const trimmed = content.trim();
|
|
10178
|
+
return trimmed.startsWith("<environment_context>") || trimmed.startsWith("<goal_context>");
|
|
10179
|
+
}
|
|
10180
|
+
function messageForItem(item) {
|
|
10181
|
+
if (item.type === "userMessage") {
|
|
10182
|
+
if (isInternalUserMessage(item.content)) return null;
|
|
10183
|
+
return {
|
|
10184
|
+
id: `user-${item.id}`,
|
|
10185
|
+
type: "user",
|
|
10186
|
+
content: item.content,
|
|
10187
|
+
images: item.images,
|
|
10188
|
+
timestamp: item.timestamp
|
|
10189
|
+
};
|
|
10190
|
+
}
|
|
10191
|
+
if (item.type === "agentMessage") {
|
|
10192
|
+
if (!item.text) return null;
|
|
10193
|
+
return {
|
|
10194
|
+
id: `agent-${item.id}`,
|
|
10195
|
+
type: "agent",
|
|
10196
|
+
content: item.text,
|
|
10197
|
+
timestamp: item.timestamp
|
|
10198
|
+
};
|
|
10199
|
+
}
|
|
10200
|
+
if (item.type === "reasoning") {
|
|
10201
|
+
if (!item.text) return null;
|
|
10202
|
+
return {
|
|
10203
|
+
id: `reasoning-${item.id}`,
|
|
10204
|
+
type: "reasoning",
|
|
10205
|
+
content: item.text,
|
|
10206
|
+
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
10207
|
+
timestamp: item.timestamp
|
|
10208
|
+
};
|
|
10209
|
+
}
|
|
10210
|
+
if (item.type === "commandExecution") {
|
|
10211
|
+
return {
|
|
10212
|
+
id: `command-${item.id}`,
|
|
10213
|
+
type: "command",
|
|
10214
|
+
command: item.command,
|
|
10215
|
+
output: item.output,
|
|
10216
|
+
exitCode: item.exitCode ?? void 0,
|
|
10217
|
+
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
10218
|
+
timestamp: item.timestamp
|
|
10219
|
+
};
|
|
10220
|
+
}
|
|
10221
|
+
if (item.type === "fileChange") {
|
|
10222
|
+
return {
|
|
10223
|
+
id: `patch-${item.id}`,
|
|
10224
|
+
type: "patch",
|
|
10225
|
+
operations: item.operations,
|
|
10226
|
+
output: item.output,
|
|
10227
|
+
exitCode: item.exitCode ?? void 0,
|
|
10228
|
+
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
10229
|
+
timestamp: item.timestamp
|
|
10230
|
+
};
|
|
10231
|
+
}
|
|
10232
|
+
if (item.type === "toolCall") {
|
|
10233
|
+
return {
|
|
10234
|
+
id: `toolcall-${item.id}`,
|
|
10235
|
+
type: "tool_call",
|
|
10236
|
+
server: item.server,
|
|
10237
|
+
tool: item.tool,
|
|
10238
|
+
input: inputForDisplay(item.input),
|
|
10239
|
+
output: item.output,
|
|
10240
|
+
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
10241
|
+
timestamp: item.timestamp
|
|
10242
|
+
};
|
|
10243
|
+
}
|
|
10244
|
+
if (item.type === "webSearch") {
|
|
10245
|
+
return {
|
|
10246
|
+
id: `web-search-${item.id}`,
|
|
10247
|
+
type: "web_search",
|
|
10248
|
+
query: item.query,
|
|
10249
|
+
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
10250
|
+
timestamp: item.timestamp
|
|
10251
|
+
};
|
|
10252
|
+
}
|
|
10253
|
+
if (item.type === "plan") {
|
|
10254
|
+
if (!item.text) return null;
|
|
10255
|
+
return {
|
|
10256
|
+
id: `todo-${item.id}`,
|
|
10257
|
+
type: "todo_list",
|
|
10258
|
+
items: item.text.split("\n").map((line) => line.trim()).filter(Boolean).map((text) => ({ text, completed: item.status === "completed" })),
|
|
10259
|
+
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
10260
|
+
timestamp: item.timestamp
|
|
10261
|
+
};
|
|
10262
|
+
}
|
|
10263
|
+
if (item.type === "contextCompaction") {
|
|
10264
|
+
return {
|
|
10265
|
+
id: `reasoning-${item.id}`,
|
|
10266
|
+
type: "reasoning",
|
|
10267
|
+
content: "Context compacted",
|
|
10268
|
+
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
10269
|
+
timestamp: item.timestamp
|
|
10270
|
+
};
|
|
10271
|
+
}
|
|
10272
|
+
return {
|
|
10273
|
+
id: `error-${item.id}`,
|
|
10274
|
+
type: "error",
|
|
10275
|
+
message: item.message,
|
|
10276
|
+
timestamp: item.timestamp
|
|
10277
|
+
};
|
|
10278
|
+
}
|
|
10279
|
+
function stableString(value) {
|
|
10280
|
+
if (value === void 0) return "";
|
|
10281
|
+
if (typeof value !== "object" || value === null) return String(value);
|
|
10282
|
+
try {
|
|
10283
|
+
return JSON.stringify(value, Object.keys(value).sort());
|
|
10284
|
+
} catch {
|
|
10285
|
+
return String(value);
|
|
10286
|
+
}
|
|
10287
|
+
}
|
|
10288
|
+
function duplicateMessage(a, b) {
|
|
10289
|
+
if (a.id === b.id) return true;
|
|
10290
|
+
if (a.type !== b.type || !nearTimestamp(a.timestamp, b.timestamp)) {
|
|
10291
|
+
return false;
|
|
10292
|
+
}
|
|
10293
|
+
if (a.type === "user" && b.type === "user") return a.content === b.content;
|
|
10294
|
+
if (a.type === "agent" && b.type === "agent") return a.content === b.content;
|
|
10295
|
+
if (a.type === "reasoning" && b.type === "reasoning") return a.content === b.content;
|
|
10296
|
+
if (a.type === "command" && b.type === "command") return a.command === b.command;
|
|
10297
|
+
if (a.type === "web_search" && b.type === "web_search") return a.query === b.query;
|
|
10298
|
+
if (a.type === "todo_list" && b.type === "todo_list") {
|
|
10299
|
+
return stableString(a.items) === stableString(b.items);
|
|
10300
|
+
}
|
|
10301
|
+
if (a.type === "patch" && b.type === "patch") {
|
|
10302
|
+
return stableString(a.operations) === stableString(b.operations);
|
|
10303
|
+
}
|
|
10304
|
+
if (a.type === "tool_call" && b.type === "tool_call") {
|
|
10305
|
+
return a.server === b.server && a.tool === b.tool && stableString(a.input) === stableString(b.input);
|
|
10306
|
+
}
|
|
10307
|
+
return false;
|
|
10308
|
+
}
|
|
10309
|
+
function mergeCodexAspDisplayMessages(primary, supplemental) {
|
|
10310
|
+
const merged = [...primary];
|
|
10311
|
+
for (const message of supplemental) {
|
|
10312
|
+
if (!merged.some((existing) => duplicateMessage(existing, message))) {
|
|
10313
|
+
merged.push(message);
|
|
10314
|
+
}
|
|
10315
|
+
}
|
|
10316
|
+
return merged.map((message, index) => ({ message, index })).sort((a, b) => parseTimestampMs(a.message.timestamp) - parseTimestampMs(b.message.timestamp) || a.index - b.index).map(({ message }) => message);
|
|
10317
|
+
}
|
|
10318
|
+
function parseCodexAspTranscript(transcript) {
|
|
10319
|
+
const messages = [];
|
|
10320
|
+
const orderedItems = transcript.turns.map((turn, turnIndex) => ({ turn, turnIndex })).flatMap(({ turn, turnIndex }) => turn.items.map((item, itemIndex) => ({ item, turnIndex, itemIndex }))).sort((a, b) => {
|
|
10321
|
+
const aSequence = a.item.sequence ?? Number.MAX_SAFE_INTEGER;
|
|
10322
|
+
const bSequence = b.item.sequence ?? Number.MAX_SAFE_INTEGER;
|
|
10323
|
+
return aSequence - bSequence || parseTimestampMs(a.item.timestamp) - parseTimestampMs(b.item.timestamp) || a.turnIndex - b.turnIndex || a.itemIndex - b.itemIndex;
|
|
10324
|
+
});
|
|
10325
|
+
for (const { item } of orderedItems) {
|
|
10326
|
+
const message = messageForItem(item);
|
|
10327
|
+
if (message) {
|
|
10328
|
+
messages.push(message);
|
|
10329
|
+
}
|
|
10330
|
+
}
|
|
10331
|
+
return messages;
|
|
10332
|
+
}
|
|
10156
10333
|
|
|
10157
10334
|
// ../shared/src/display-message/parsers/index.ts
|
|
10158
10335
|
var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
|
|
@@ -10162,6 +10339,15 @@ function parseAgentEvents(events, agentType) {
|
|
|
10162
10339
|
}
|
|
10163
10340
|
return parseClaudeEvents(events);
|
|
10164
10341
|
}
|
|
10342
|
+
function parseDisplayMessages(events, agentType, codexAspTranscript, options = {}) {
|
|
10343
|
+
const shouldFilter = options.filter ?? true;
|
|
10344
|
+
const legacyMessages = shouldFilter ? filterDisplayMessages(parseAgentEvents(events, agentType), agentType) : parseAgentEvents(events, agentType);
|
|
10345
|
+
if (agentType !== "codex" || !codexAspTranscript) {
|
|
10346
|
+
return legacyMessages;
|
|
10347
|
+
}
|
|
10348
|
+
const nativeCodexMessages = shouldFilter ? filterDisplayMessages(parseCodexAspTranscript(codexAspTranscript), agentType) : parseCodexAspTranscript(codexAspTranscript);
|
|
10349
|
+
return mergeCodexAspDisplayMessages(nativeCodexMessages, legacyMessages);
|
|
10350
|
+
}
|
|
10165
10351
|
function isCodexInitializationPrompt(message) {
|
|
10166
10352
|
return message.type === "user" && removeReplicasInstructions(message.content).trim() === "Hello";
|
|
10167
10353
|
}
|
|
@@ -12437,7 +12623,7 @@ Conversation History
|
|
|
12437
12623
|
}
|
|
12438
12624
|
console.log(chalk15.gray("-".repeat(60)));
|
|
12439
12625
|
const agentType = response.coding_agent || "claude";
|
|
12440
|
-
const displayMessages =
|
|
12626
|
+
const displayMessages = parseDisplayMessages(response.events, agentType, response.codexAspTranscript);
|
|
12441
12627
|
for (const message of displayMessages) {
|
|
12442
12628
|
formatDisplayMessage(message);
|
|
12443
12629
|
}
|
|
@@ -16507,10 +16693,8 @@ function AppInner() {
|
|
|
16507
16693
|
if (isMockSelected) return mockMessages;
|
|
16508
16694
|
const rawEvents = historyData?.events ?? [];
|
|
16509
16695
|
const events = rawEvents.filter(isAgentBackendEvent);
|
|
16510
|
-
if (events.length === 0) return [];
|
|
16511
16696
|
const provider = selectedChat?.provider ?? "claude";
|
|
16512
|
-
|
|
16513
|
-
return filterDisplayMessages(parsed, provider);
|
|
16697
|
+
return parseDisplayMessages(events, provider, historyData?.codexAspTranscript);
|
|
16514
16698
|
}, [isMockSelected, mockMessages, historyData, selectedChat?.provider]);
|
|
16515
16699
|
const showInfoPanel = width >= 100;
|
|
16516
16700
|
const showWorkspacePanel = width >= 60;
|