replicas-cli 0.2.803 → 0.2.804
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.cjs +53 -47
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -27127,6 +27127,17 @@ function createSubagentMessage(messageIndex, timestamp, fields) {
|
|
|
27127
27127
|
function collectNestedEvents(events, toolUseId) {
|
|
27128
27128
|
return events.filter((e) => e.payload.parent_tool_use_id === toolUseId).map(({ timestamp, type, payload }) => ({ timestamp, type, payload }));
|
|
27129
27129
|
}
|
|
27130
|
+
function readToolResult(event) {
|
|
27131
|
+
if (event.type !== "claude-user") return void 0;
|
|
27132
|
+
const toolResult = normalizeContentBlocks(event.payload.message?.content).find((c) => c.type === "tool_result");
|
|
27133
|
+
if (!toolResult?.tool_use_id) return void 0;
|
|
27134
|
+
return {
|
|
27135
|
+
toolResult,
|
|
27136
|
+
toolUseId: toolResult.tool_use_id,
|
|
27137
|
+
output: extractToolResultText(toolResult.content),
|
|
27138
|
+
status: toolResult.is_error ? "failed" : "completed"
|
|
27139
|
+
};
|
|
27140
|
+
}
|
|
27130
27141
|
function coerceClaudeResultPayload(payload) {
|
|
27131
27142
|
return {
|
|
27132
27143
|
is_error: typeof payload.is_error === "boolean" ? payload.is_error : void 0,
|
|
@@ -27568,52 +27579,47 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27568
27579
|
messages.push(fileOrCommandMessage(tool.name, tool.id, "filePath" in tool ? { file_path: tool.filePath } : { command: tool.command }, timestamp));
|
|
27569
27580
|
}
|
|
27570
27581
|
filteredEvents.forEach((event) => {
|
|
27571
|
-
|
|
27572
|
-
|
|
27573
|
-
|
|
27574
|
-
|
|
27575
|
-
|
|
27576
|
-
|
|
27577
|
-
|
|
27578
|
-
|
|
27579
|
-
|
|
27580
|
-
|
|
27581
|
-
|
|
27582
|
-
|
|
27583
|
-
|
|
27584
|
-
|
|
27585
|
-
|
|
27586
|
-
|
|
27587
|
-
|
|
27588
|
-
|
|
27589
|
-
|
|
27590
|
-
|
|
27591
|
-
|
|
27592
|
-
|
|
27593
|
-
|
|
27594
|
-
|
|
27595
|
-
|
|
27596
|
-
|
|
27597
|
-
|
|
27598
|
-
|
|
27599
|
-
|
|
27600
|
-
|
|
27601
|
-
|
|
27602
|
-
|
|
27603
|
-
|
|
27604
|
-
|
|
27605
|
-
|
|
27606
|
-
|
|
27607
|
-
|
|
27608
|
-
|
|
27609
|
-
|
|
27610
|
-
|
|
27611
|
-
|
|
27612
|
-
} else if (message.type === "subagent_followup") {
|
|
27613
|
-
message.output = resultContent;
|
|
27614
|
-
message.status = status;
|
|
27615
|
-
}
|
|
27616
|
-
}
|
|
27582
|
+
const result = readToolResult(event);
|
|
27583
|
+
if (!result) return;
|
|
27584
|
+
const { toolResult, output: resultContent, status } = result;
|
|
27585
|
+
const toolInfo = toolCallMap.get(result.toolUseId);
|
|
27586
|
+
if (!toolInfo) return;
|
|
27587
|
+
const isError = status === "failed";
|
|
27588
|
+
if (toolInfo.toolName === "TaskCreate" && !isError) {
|
|
27589
|
+
taskAccumulator.processContentBlock(toolResult);
|
|
27590
|
+
}
|
|
27591
|
+
const message = messages[toolInfo.messageIndex];
|
|
27592
|
+
if (!message) return;
|
|
27593
|
+
if (message.type === "command") {
|
|
27594
|
+
message.output = resultContent;
|
|
27595
|
+
message.status = status;
|
|
27596
|
+
const exitCodeMatch = resultContent.match(/exit code:?\s*(\d+)/i);
|
|
27597
|
+
if (exitCodeMatch) {
|
|
27598
|
+
message.exitCode = parseInt(exitCodeMatch[1], 10);
|
|
27599
|
+
} else {
|
|
27600
|
+
message.exitCode = isError ? 1 : 0;
|
|
27601
|
+
}
|
|
27602
|
+
} else if (message.type === "patch") {
|
|
27603
|
+
message.status = status;
|
|
27604
|
+
} else if (message.type === "web_search") {
|
|
27605
|
+
message.status = status;
|
|
27606
|
+
} else if (message.type === "tool_call") {
|
|
27607
|
+
message.output = resultContent;
|
|
27608
|
+
message.status = status;
|
|
27609
|
+
} else if (message.type === "skill") {
|
|
27610
|
+
message.status = status;
|
|
27611
|
+
} else if (message.type === "subagent") {
|
|
27612
|
+
message.output = resultContent;
|
|
27613
|
+
message.status = status;
|
|
27614
|
+
if (!message.chatId && resultContent) {
|
|
27615
|
+
const parsed = safeJsonParse(resultContent, {});
|
|
27616
|
+
if (parsed.chatId) {
|
|
27617
|
+
message.chatId = parsed.chatId;
|
|
27618
|
+
}
|
|
27619
|
+
}
|
|
27620
|
+
} else if (message.type === "subagent_followup") {
|
|
27621
|
+
message.output = resultContent;
|
|
27622
|
+
message.status = status;
|
|
27617
27623
|
}
|
|
27618
27624
|
});
|
|
27619
27625
|
for (const message of messages) {
|
|
@@ -28055,7 +28061,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
28055
28061
|
});
|
|
28056
28062
|
|
|
28057
28063
|
// ../shared/src/cli-version.ts
|
|
28058
|
-
var CLI_VERSION = "0.2.
|
|
28064
|
+
var CLI_VERSION = "0.2.804";
|
|
28059
28065
|
|
|
28060
28066
|
// ../shared/src/version.ts
|
|
28061
28067
|
function compareVersions(v1, v2) {
|