fix: normalize Windows argv handling (#1564) (thanks @Takhoffman)
This commit is contained in:
parent
4ab6263762
commit
f2795754e9
@ -20,6 +20,7 @@ Docs: https://docs.clawd.bot
|
||||
|
||||
### Fixes
|
||||
- Agents: ignore IDENTITY.md template placeholders when parsing identity to avoid placeholder replies. (#1556)
|
||||
- CLI: normalize Windows argv to drop duplicate node.exe entries before commands. (#1564) Thanks @Takhoffman.
|
||||
- Docker: update gateway command in docker-compose and Hetzner guide. (#1514)
|
||||
- Sessions: reject array-backed session stores to prevent silent wipes. (#1469)
|
||||
- Voice wake: auto-save wake words on blur/submit across iOS/Android and align limits with macOS.
|
||||
|
||||
@ -90,6 +90,12 @@ function safeJsonStringify(value: unknown): string | null {
|
||||
}
|
||||
}
|
||||
|
||||
function formatError(error: unknown): string {
|
||||
if (typeof error === "string") return error;
|
||||
if (error instanceof Error) return error.stack ?? error.message;
|
||||
return safeJsonStringify(error) ?? "[unknown error]";
|
||||
}
|
||||
|
||||
function digest(value: unknown): string | undefined {
|
||||
const serialized = safeJsonStringify(value);
|
||||
if (!serialized) return undefined;
|
||||
@ -163,7 +169,7 @@ export function createAnthropicPayloadLogger(params: {
|
||||
options?.onPayload?.(payload);
|
||||
};
|
||||
return streamFn(model, context, {
|
||||
...(options ?? {}),
|
||||
...options,
|
||||
onPayload: nextOnPayload,
|
||||
});
|
||||
};
|
||||
@ -178,7 +184,7 @@ export function createAnthropicPayloadLogger(params: {
|
||||
...base,
|
||||
ts: new Date().toISOString(),
|
||||
stage: "usage",
|
||||
error: String(error),
|
||||
error: formatError(error),
|
||||
});
|
||||
}
|
||||
return;
|
||||
@ -188,7 +194,7 @@ export function createAnthropicPayloadLogger(params: {
|
||||
ts: new Date().toISOString(),
|
||||
stage: "usage",
|
||||
usage,
|
||||
error: error ? String(error) : undefined,
|
||||
error: error ? formatError(error) : undefined,
|
||||
});
|
||||
log.info("anthropic usage", {
|
||||
runId: params.runId,
|
||||
|
||||
@ -194,8 +194,22 @@ function sanitizeArgs(args: string | undefined): string | undefined {
|
||||
return args.slice(0, MAX_ARGS_LENGTH);
|
||||
}
|
||||
|
||||
const stripControlChars = (value: string): string => {
|
||||
let out = "";
|
||||
for (let i = 0; i < value.length; i += 1) {
|
||||
const code = value.charCodeAt(i);
|
||||
if (code === 9 || code === 10) {
|
||||
out += value[i];
|
||||
continue;
|
||||
}
|
||||
if (code < 32 || code === 127) continue;
|
||||
out += value[i];
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
// Remove control characters (except newlines and tabs which may be intentional)
|
||||
return args.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, "");
|
||||
return stripControlChars(args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user