/** * CLI-specific hydration for o11y display. * * Node.js revivers that use `Buffer.from()` for base64 decoding and add * `util.inspect.custom` to ClassInstanceRef for pretty CLI output. */ import { inspect } from 'node:util'; import { type Revivers } from '@workflow/core/serialization-format'; /** * A function that resolves an encryption key for a run, or null to skip * decryption. Accepts a runId; the resolver is responsible for looking * up the WorkflowRun internally (with caching) if the World needs it. */ export type EncryptionKeyResolver = ((runId: string) => Promise) | null; export { CLASS_INSTANCE_REF_TYPE, ClassInstanceRef, ENCRYPTED_PLACEHOLDER, extractStreamIds, isClassInstanceRef, isEncryptedData, isStreamId, isStreamRef, type Revivers, STREAM_REF_TYPE, type StreamRef, truncateId, } from '@workflow/core/serialization-format'; /** * Placeholder object for encrypted data fields in CLI output. * * Uses `util.inspect.custom` to render as a styled, unquoted string * (e.g., dim yellow "🔒 Encrypted") instead of a plain quoted string. * Also provides `toJSON()` for `--json` output. */ declare class EncryptedDataRef { [inspect.custom](): string; toJSON(): string; toString(): string; } /** Check if a value is an EncryptedDataRef (for custom table formatting in CLI) */ export declare function isEncryptedRef(value: unknown): value is EncryptedDataRef; /** * Placeholder object for expired data fields in CLI output. * * Uses `util.inspect.custom` to render as a styled, unquoted string * (e.g., dim gray "") instead of a raw stub object. * Also provides `toJSON()` for `--json` output. */ declare class ExpiredDataRef { [inspect.custom](): string; toJSON(): string; toString(): string; } /** Check if a value is an ExpiredDataRef (for custom table formatting in CLI) */ export declare function isExpiredRef(value: unknown): value is ExpiredDataRef; /** * The set of revivers used by CLI inspect output. * * Built on top of `getCommonRevivers()` from `@workflow/core` so that the * CLI stays in sync with the runtime's reviver set automatically. Without * this, every new reviver added to core (e.g. `FatalError`, * `RetryableError`, the built-in `Error` subclasses) would silently * disappear from CLI output: devalue throws "Unknown type X" for * unrecognized reduced types, and `hydrateResourceIO` swallows that error * and surfaces the raw `Uint8Array` payload to consumers, which then * shows up as `step.error` / `run.error` byte dumps instead of usable * `{ message, stack, … }` objects. * * On top of the common set we layer: * - A `toJSON` shim on each Error reviver so non-enumerable * `Error.prototype` fields survive `JSON.stringify` for `--json` output * while leaving `util.inspect` rendering untouched * - `observabilityRevivers` for streams / step+workflow function refs * - CLI-specific overrides that produce display-friendly placeholders * for `Class` / `Instance` (the runtime versions need full class * identity which the CLI doesn't have access to) */ export declare function getCLIRevivers(): Revivers; /** * Hydrate the serialized data fields of a resource for CLI display. * * When `encryptorResolver` is null (default / no --decrypt flag), encrypted * fields are shown as styled "🔒 Encrypted" placeholders via EncryptedDataRef. * * When `encryptorResolver` is provided (--decrypt flag), encrypted fields * are decrypted before hydration so the actual user data is displayed. */ export declare function hydrateResourceIO(resource: T, keyResolver?: EncryptionKeyResolver): Promise; //# sourceMappingURL=hydration.d.ts.map