export { createAbortableStream, once, untilAborted } from "./abortable"; export * from "./async"; export * from "./broken-pipe"; export * from "./color"; export * from "./crash-fingerprint"; export * from "./crash-journal"; export * from "./crash-redaction"; export * from "./dirs"; export * from "./env"; export * from "./error-classification"; export * from "./fetch-retry"; export * from "./format"; export * from "./frontmatter"; export * from "./fs-error"; export * from "./glob"; export * from "./header-value"; export * from "./hook-fetch"; export * from "./json"; export * as logger from "./logger"; export * from "./mermaid-ascii"; export * from "./mime"; export * from "./peek-file"; export * as postmortem from "./postmortem"; export * as procmgr from "./procmgr"; export * as prompt from "./prompt"; export * as ptree from "./ptree"; export { AbortError, ChildProcess, Exception, NonZeroExitError } from "./ptree"; export * from "./safe-error"; export * from "./safe-stderr"; export * from "./sanitize-text"; export * from "./snowflake"; export * from "./stream"; export * from "./tab-spacing"; export * from "./temp"; export * from "./type-guards"; export * from "./which"; function isPlainObject(val: object): val is Record { return Object.getPrototypeOf(val) === Object.prototype || Array.isArray(val); } export function structuredCloneJSON(value: T): T { // primitives|null|undefined, copy if (!value || typeof value !== "object") { return value; } // deep clone if (isPlainObject(value)) { try { return structuredClone(value); } catch { // might still fail due to nested structures } } return JSON.parse(JSON.stringify(value)) as T; }