fix merge; add control logging
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,8 @@ swift build -c "$BUILD_CONFIG" --product "$PRODUCT" --product "${PRODUCT}CLI" --
|
||||
|
||||
BIN="$BUILD_PATH/$BUILD_CONFIG/$PRODUCT"
|
||||
CLI_BIN="$BUILD_PATH/$BUILD_CONFIG/ClawdisCLI"
|
||||
echo "pkg: binary $BIN" >&2
|
||||
echo "pkg: cli $CLI_BIN" >&2
|
||||
echo "🧹 Cleaning old app bundle"
|
||||
rm -rf "$APP_ROOT"
|
||||
mkdir -p "$APP_ROOT/Contents/MacOS"
|
||||
|
||||
@@ -625,13 +625,10 @@ export async function runCommandReply(
|
||||
toolCallId?: string;
|
||||
tool_call_id?: string;
|
||||
};
|
||||
const role =
|
||||
typeof msg.role === "string" ? msg.role.toLowerCase() : "";
|
||||
const role = (msg.role ?? "") as string;
|
||||
const isToolResult =
|
||||
role === "toolresult" || role === "tool_result";
|
||||
if (!isToolResult || !Array.isArray(msg.content)) {
|
||||
// not a tool result message we care about
|
||||
} else {
|
||||
role === "toolResult" || role === "tool_result";
|
||||
if (isToolResult && Array.isArray(msg.content)) {
|
||||
const toolName = inferToolName(msg);
|
||||
const toolCallId = msg.toolCallId ?? msg.tool_call_id;
|
||||
const meta =
|
||||
@@ -675,6 +672,11 @@ export async function runCommandReply(
|
||||
flushPendingTool,
|
||||
TOOL_RESULT_DEBOUNCE_MS,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.role === "assistant") {
|
||||
streamAssistantFinal(msg as AssistantMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import net from "node:net";
|
||||
|
||||
import { getHealthSnapshot, type HealthSummary } from "../commands/health.js";
|
||||
import { getStatusSummary, type StatusSummary } from "../commands/status.js";
|
||||
import { logDebug, logError } from "../logger.js";
|
||||
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||
import { type AgentEventPayload, onAgentEvent } from "./agent-events.js";
|
||||
import {
|
||||
@@ -76,6 +77,7 @@ export async function startControlChannel(
|
||||
const lines = buffer.split(/\r?\n/);
|
||||
buffer = lines.pop() ?? "";
|
||||
for (const line of lines) {
|
||||
logDebug(`control: line ${line.slice(0, 200)}`);
|
||||
handleLine(socket, line.trim());
|
||||
}
|
||||
});
|
||||
@@ -104,7 +106,7 @@ export async function startControlChannel(
|
||||
try {
|
||||
parsed = JSON.parse(line) as ControlRequest;
|
||||
} catch (err) {
|
||||
runtime.log?.(
|
||||
logError(
|
||||
`control: parse error (${String(err)}) on line: ${line.slice(0, 200)}`,
|
||||
);
|
||||
return write(socket, {
|
||||
@@ -134,7 +136,7 @@ export async function startControlChannel(
|
||||
});
|
||||
|
||||
try {
|
||||
runtime.log?.(`control: recv ${parsed.method}`);
|
||||
logDebug(`control: recv ${parsed.method}`);
|
||||
switch (parsed.method) {
|
||||
case "ping": {
|
||||
respond({ pong: true, ts: Date.now() });
|
||||
@@ -177,11 +179,9 @@ export async function startControlChannel(
|
||||
respond(undefined, false, `unknown method: ${parsed.method}`);
|
||||
break;
|
||||
}
|
||||
runtime.log?.(
|
||||
`control: ${parsed.method} responded in ${Date.now() - started}ms`,
|
||||
);
|
||||
logDebug(`control: ${parsed.method} responded in ${Date.now() - started}ms`);
|
||||
} catch (err) {
|
||||
runtime.log?.(
|
||||
logError(
|
||||
`control: ${parsed.method} failed in ${Date.now() - started}ms: ${String(err)}`,
|
||||
);
|
||||
respond(undefined, false, String(err));
|
||||
|
||||
Reference in New Issue
Block a user