mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
agent_hook_install_failed sent up to 200 chars of the raw installer error, which embeds home-directory paths (and so the OS user name) and can echo config contents. Send only the error's errno code or 'unknown', and enforce that in the event schema. The anchored, capped errno pattern now lives in src/shared/errno-code.ts and is shared with the renderer launch probe and the file-write precondition instead of their own copies. Fixes #21492 Co-authored-by: brynnclaw <261708852+brynnclaw@users.noreply.github.com> Co-authored-by: Neil <neil@stably.ai>
8 lines
399 B
TypeScript
8 lines
399 B
TypeScript
// Node/libuv errno codes (`EACCES`, `E2BIG`); anchored and capped so a code can't carry a path.
|
|
export const ERRNO_CODE_PATTERN = /^E[A-Z0-9]{1,15}$/
|
|
|
|
export function errnoCodeOrUnknown(error: unknown): string {
|
|
const code = typeof error === 'object' && error !== null && 'code' in error ? error.code : null
|
|
return typeof code === 'string' && ERRNO_CODE_PATTERN.test(code) ? code : 'unknown'
|
|
}
|