replicas-cli 0.2.323 → 0.2.325
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 +73 -12
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9536,7 +9536,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
|
9536
9536
|
var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
9537
9537
|
|
|
9538
9538
|
// ../shared/src/cli-version.ts
|
|
9539
|
-
var CLI_VERSION = "0.2.
|
|
9539
|
+
var CLI_VERSION = "0.2.325";
|
|
9540
9540
|
|
|
9541
9541
|
// ../shared/src/engine/environment.ts
|
|
9542
9542
|
var DESKTOP_NOVNC_PORT = 6080;
|
|
@@ -10486,6 +10486,11 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
10486
10486
|
const toolCallMap = /* @__PURE__ */ new Map();
|
|
10487
10487
|
const taskMessageMap = /* @__PURE__ */ new Map();
|
|
10488
10488
|
const partialIndexes = /* @__PURE__ */ new Map();
|
|
10489
|
+
const completedStreamIds = /* @__PURE__ */ new Set();
|
|
10490
|
+
const supersededStreamIds = /* @__PURE__ */ new Set();
|
|
10491
|
+
let liveStreamId = null;
|
|
10492
|
+
const assistantThinking = /* @__PURE__ */ new Map();
|
|
10493
|
+
const assistantTextCounts = /* @__PURE__ */ new Map();
|
|
10489
10494
|
const taskAccumulator = new TaskAccumulator();
|
|
10490
10495
|
const taskSnapshot = () => taskAccumulator.getTasks().map((task) => ({
|
|
10491
10496
|
text: task.subject,
|
|
@@ -10496,6 +10501,10 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
10496
10501
|
if (event.type === CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE) {
|
|
10497
10502
|
const payload = coerceClaudePartialMessagePayload(event.payload);
|
|
10498
10503
|
if (!payload) return;
|
|
10504
|
+
if (liveStreamId !== null && liveStreamId !== payload.streamId) {
|
|
10505
|
+
supersededStreamIds.add(liveStreamId);
|
|
10506
|
+
}
|
|
10507
|
+
liveStreamId = payload.streamId;
|
|
10499
10508
|
const existing = partialIndexes.get(payload.streamId) ?? {};
|
|
10500
10509
|
if (payload.thinking) {
|
|
10501
10510
|
const reasoningMessage = {
|
|
@@ -10558,24 +10567,51 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
10558
10567
|
if (event.type === "claude-assistant") {
|
|
10559
10568
|
const messageId = event.payload.message?.id;
|
|
10560
10569
|
const contentBlocks = normalizeContentBlocks(event.payload.message?.content);
|
|
10561
|
-
const
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10570
|
+
const messageKey = messageId || event.timestamp;
|
|
10571
|
+
const streamRefs = messageId ? partialIndexes.get(messageId) : void 0;
|
|
10572
|
+
if (messageId) {
|
|
10573
|
+
completedStreamIds.add(messageId);
|
|
10574
|
+
if (liveStreamId !== null && liveStreamId !== messageId) {
|
|
10575
|
+
supersededStreamIds.add(liveStreamId);
|
|
10576
|
+
}
|
|
10577
|
+
liveStreamId = null;
|
|
10578
|
+
}
|
|
10579
|
+
const thinkingBlocks = contentBlocks.flatMap(
|
|
10580
|
+
(block) => block.type === "thinking" && typeof block.thinking === "string" ? [block.thinking] : []
|
|
10581
|
+
);
|
|
10582
|
+
if (thinkingBlocks.length > 0) {
|
|
10583
|
+
const allThinking = [...assistantThinking.get(messageKey) ?? [], ...thinkingBlocks];
|
|
10584
|
+
assistantThinking.set(messageKey, allThinking);
|
|
10585
|
+
const reasoningMessage = {
|
|
10586
|
+
id: `reasoning-${messageKey}-thinking`,
|
|
10565
10587
|
type: "reasoning",
|
|
10566
|
-
content:
|
|
10588
|
+
content: allThinking.join("\n\n"),
|
|
10567
10589
|
status: "completed",
|
|
10568
10590
|
timestamp: event.timestamp
|
|
10569
|
-
}
|
|
10591
|
+
};
|
|
10592
|
+
if (streamRefs?.reasoning !== void 0) {
|
|
10593
|
+
messages[streamRefs.reasoning] = reasoningMessage;
|
|
10594
|
+
streamRefs.reasoning = void 0;
|
|
10595
|
+
} else {
|
|
10596
|
+
upsertDisplayMessage(messages, reasoningMessage);
|
|
10597
|
+
}
|
|
10570
10598
|
}
|
|
10571
|
-
contentBlocks.forEach((block
|
|
10599
|
+
contentBlocks.forEach((block) => {
|
|
10572
10600
|
if (block.type === "text" && block.text) {
|
|
10573
|
-
|
|
10574
|
-
|
|
10601
|
+
const textIndex = assistantTextCounts.get(messageKey) ?? 0;
|
|
10602
|
+
assistantTextCounts.set(messageKey, textIndex + 1);
|
|
10603
|
+
const agentMessage = {
|
|
10604
|
+
id: `agent-${messageKey}-${textIndex}`,
|
|
10575
10605
|
type: "agent",
|
|
10576
10606
|
content: block.text,
|
|
10577
10607
|
timestamp: event.timestamp
|
|
10578
|
-
}
|
|
10608
|
+
};
|
|
10609
|
+
if (streamRefs?.agent !== void 0) {
|
|
10610
|
+
messages[streamRefs.agent] = agentMessage;
|
|
10611
|
+
streamRefs.agent = void 0;
|
|
10612
|
+
} else {
|
|
10613
|
+
upsertDisplayMessage(messages, agentMessage);
|
|
10614
|
+
}
|
|
10579
10615
|
}
|
|
10580
10616
|
if (block.type === "tool_use" && block.id) {
|
|
10581
10617
|
const toolName = block.name || "unknown";
|
|
@@ -10847,7 +10883,14 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
10847
10883
|
}
|
|
10848
10884
|
}
|
|
10849
10885
|
});
|
|
10850
|
-
|
|
10886
|
+
const staleIndexes = /* @__PURE__ */ new Set();
|
|
10887
|
+
for (const streamId of [...completedStreamIds, ...supersededStreamIds]) {
|
|
10888
|
+
const refs = partialIndexes.get(streamId);
|
|
10889
|
+
if (refs?.reasoning !== void 0) staleIndexes.add(refs.reasoning);
|
|
10890
|
+
if (refs?.agent !== void 0) staleIndexes.add(refs.agent);
|
|
10891
|
+
}
|
|
10892
|
+
if (staleIndexes.size === 0) return messages;
|
|
10893
|
+
return messages.filter((_, index) => !staleIndexes.has(index));
|
|
10851
10894
|
}
|
|
10852
10895
|
|
|
10853
10896
|
// ../shared/src/agent-event-utils.ts
|
|
@@ -10935,6 +10978,21 @@ function messageForItem(item) {
|
|
|
10935
10978
|
timestamp: item.timestamp
|
|
10936
10979
|
};
|
|
10937
10980
|
}
|
|
10981
|
+
if (item.type === "subagent") {
|
|
10982
|
+
return {
|
|
10983
|
+
id: `subagent-${item.id}`,
|
|
10984
|
+
type: "subagent",
|
|
10985
|
+
toolUseId: item.id,
|
|
10986
|
+
description: item.description,
|
|
10987
|
+
prompt: item.prompt,
|
|
10988
|
+
subagentType: item.subagentType,
|
|
10989
|
+
...item.model ? { model: item.model } : {},
|
|
10990
|
+
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
10991
|
+
...item.output ? { output: item.output } : {},
|
|
10992
|
+
nestedEvents: [],
|
|
10993
|
+
timestamp: item.timestamp
|
|
10994
|
+
};
|
|
10995
|
+
}
|
|
10938
10996
|
if (item.type === "webSearch") {
|
|
10939
10997
|
return {
|
|
10940
10998
|
id: `web-search-${item.id}`,
|
|
@@ -10989,6 +11047,9 @@ function duplicateMessage(a, b) {
|
|
|
10989
11047
|
if (a.type === "reasoning" && b.type === "reasoning") return a.content === b.content;
|
|
10990
11048
|
if (a.type === "command" && b.type === "command") return a.command === b.command;
|
|
10991
11049
|
if (a.type === "web_search" && b.type === "web_search") return a.query === b.query;
|
|
11050
|
+
if (a.type === "subagent" && b.type === "subagent") {
|
|
11051
|
+
return a.description === b.description && a.prompt === b.prompt && a.subagentType === b.subagentType && a.model === b.model;
|
|
11052
|
+
}
|
|
10992
11053
|
if (a.type === "todo_list" && b.type === "todo_list") {
|
|
10993
11054
|
return stableString(a.items) === stableString(b.items);
|
|
10994
11055
|
}
|