replicas-cli 0.2.803 → 0.2.805
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 +68 -47
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23096,6 +23096,7 @@ function normalizeBackgroundTaskStatus(status) {
|
|
|
23096
23096
|
// ../shared/src/display-message/constants.ts
|
|
23097
23097
|
var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
|
|
23098
23098
|
var COMPACTION_CONTENT = "Context compacted";
|
|
23099
|
+
var GOAL_TOOL_NAME = "goal";
|
|
23099
23100
|
|
|
23100
23101
|
// ../shared/src/shell-commands.ts
|
|
23101
23102
|
var SHELL_OPAQUE = "\0";
|
|
@@ -27127,6 +27128,17 @@ function createSubagentMessage(messageIndex, timestamp, fields) {
|
|
|
27127
27128
|
function collectNestedEvents(events, toolUseId) {
|
|
27128
27129
|
return events.filter((e) => e.payload.parent_tool_use_id === toolUseId).map(({ timestamp, type, payload }) => ({ timestamp, type, payload }));
|
|
27129
27130
|
}
|
|
27131
|
+
function readToolResult(event) {
|
|
27132
|
+
if (event.type !== "claude-user") return void 0;
|
|
27133
|
+
const toolResult = normalizeContentBlocks(event.payload.message?.content).find((c) => c.type === "tool_result");
|
|
27134
|
+
if (!toolResult?.tool_use_id) return void 0;
|
|
27135
|
+
return {
|
|
27136
|
+
toolResult,
|
|
27137
|
+
toolUseId: toolResult.tool_use_id,
|
|
27138
|
+
output: extractToolResultText(toolResult.content),
|
|
27139
|
+
status: toolResult.is_error ? "failed" : "completed"
|
|
27140
|
+
};
|
|
27141
|
+
}
|
|
27130
27142
|
function coerceClaudeResultPayload(payload) {
|
|
27131
27143
|
return {
|
|
27132
27144
|
is_error: typeof payload.is_error === "boolean" ? payload.is_error : void 0,
|
|
@@ -27294,6 +27306,20 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27294
27306
|
const messageId = event.payload.message?.id;
|
|
27295
27307
|
const contentBlocks = normalizeContentBlocks(event.payload.message?.content);
|
|
27296
27308
|
const messageKey = messageId || event.timestamp;
|
|
27309
|
+
const localCommand = event.payload.local_command_run;
|
|
27310
|
+
const goalArgs = isRecord(localCommand) && localCommand.command === GOAL_TOOL_NAME && typeof localCommand.args === "string" ? localCommand.args.trim() : "";
|
|
27311
|
+
if (goalArgs) {
|
|
27312
|
+
upsertDisplayMessage(messages, {
|
|
27313
|
+
id: `goal-${messageKey}`,
|
|
27314
|
+
type: "tool_call",
|
|
27315
|
+
server: "claude",
|
|
27316
|
+
tool: GOAL_TOOL_NAME,
|
|
27317
|
+
input: goalArgs === "clear" ? void 0 : { objective: goalArgs },
|
|
27318
|
+
status: "completed",
|
|
27319
|
+
timestamp: event.timestamp
|
|
27320
|
+
});
|
|
27321
|
+
return;
|
|
27322
|
+
}
|
|
27297
27323
|
const streamRefs = messageId ? partialIndexes.get(messageId) : void 0;
|
|
27298
27324
|
if (messageId) {
|
|
27299
27325
|
if (liveStreamId !== null && liveStreamId !== messageId) {
|
|
@@ -27568,52 +27594,47 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27568
27594
|
messages.push(fileOrCommandMessage(tool.name, tool.id, "filePath" in tool ? { file_path: tool.filePath } : { command: tool.command }, timestamp));
|
|
27569
27595
|
}
|
|
27570
27596
|
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
|
-
}
|
|
27597
|
+
const result = readToolResult(event);
|
|
27598
|
+
if (!result) return;
|
|
27599
|
+
const { toolResult, output: resultContent, status } = result;
|
|
27600
|
+
const toolInfo = toolCallMap.get(result.toolUseId);
|
|
27601
|
+
if (!toolInfo) return;
|
|
27602
|
+
const isError = status === "failed";
|
|
27603
|
+
if (toolInfo.toolName === "TaskCreate" && !isError) {
|
|
27604
|
+
taskAccumulator.processContentBlock(toolResult);
|
|
27605
|
+
}
|
|
27606
|
+
const message = messages[toolInfo.messageIndex];
|
|
27607
|
+
if (!message) return;
|
|
27608
|
+
if (message.type === "command") {
|
|
27609
|
+
message.output = resultContent;
|
|
27610
|
+
message.status = status;
|
|
27611
|
+
const exitCodeMatch = resultContent.match(/exit code:?\s*(\d+)/i);
|
|
27612
|
+
if (exitCodeMatch) {
|
|
27613
|
+
message.exitCode = parseInt(exitCodeMatch[1], 10);
|
|
27614
|
+
} else {
|
|
27615
|
+
message.exitCode = isError ? 1 : 0;
|
|
27616
|
+
}
|
|
27617
|
+
} else if (message.type === "patch") {
|
|
27618
|
+
message.status = status;
|
|
27619
|
+
} else if (message.type === "web_search") {
|
|
27620
|
+
message.status = status;
|
|
27621
|
+
} else if (message.type === "tool_call") {
|
|
27622
|
+
message.output = resultContent;
|
|
27623
|
+
message.status = status;
|
|
27624
|
+
} else if (message.type === "skill") {
|
|
27625
|
+
message.status = status;
|
|
27626
|
+
} else if (message.type === "subagent") {
|
|
27627
|
+
message.output = resultContent;
|
|
27628
|
+
message.status = status;
|
|
27629
|
+
if (!message.chatId && resultContent) {
|
|
27630
|
+
const parsed = safeJsonParse(resultContent, {});
|
|
27631
|
+
if (parsed.chatId) {
|
|
27632
|
+
message.chatId = parsed.chatId;
|
|
27633
|
+
}
|
|
27634
|
+
}
|
|
27635
|
+
} else if (message.type === "subagent_followup") {
|
|
27636
|
+
message.output = resultContent;
|
|
27637
|
+
message.status = status;
|
|
27617
27638
|
}
|
|
27618
27639
|
});
|
|
27619
27640
|
for (const message of messages) {
|
|
@@ -28055,7 +28076,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
28055
28076
|
});
|
|
28056
28077
|
|
|
28057
28078
|
// ../shared/src/cli-version.ts
|
|
28058
|
-
var CLI_VERSION = "0.2.
|
|
28079
|
+
var CLI_VERSION = "0.2.805";
|
|
28059
28080
|
|
|
28060
28081
|
// ../shared/src/version.ts
|
|
28061
28082
|
function compareVersions(v1, v2) {
|