import { inspect } from 'node:util'; /** * Formats an arbitrary value for an error or log message. * * Unlike `JSON.stringify`, this never throws (BigInts, circular references, * symbols), never runs the value's own code (`toString`, `toJSON`, getters, * `util.inspect.custom` or proxy traps), never prints a function's source, * and bounds the output size. * * Imports `node:util`, so it is a subpath export rather than part of the * package root, which also loads inside the workflow sandbox. */ export function inspectValue(value: unknown): string { try { return inspect(value, { depth: 2, maxArrayLength: 10, maxStringLength: 200, breakLength: Number.POSITIVE_INFINITY, customInspect: false, getters: false, showProxy: false, }); } catch { return typeof value; } }