Remove REA permission grants, scope ceilings, approval confirmations, and inert settings. Preserve selected local evidence, accept caller-chosen commands and paths, and report actual runtime failures. Harden provider results, schema serialization, snapshot evidence binding, archive paths, source maps, native screenshots, managed EH parsing, and cancellation cleanup. Regenerate tool metadata and document direct invocation. BREAKING CHANGE: Removed permission configuration and policy commands, approval fields, filesystem scope inputs, and fixed confirmation options. Process capture inherits the host environment and accepts command names; callers must refresh tool schemas and migrate removed fields.
29 lines
904 B
TypeScript
29 lines
904 B
TypeScript
import pino, { type Logger } from "pino";
|
|
import { z } from "zod";
|
|
|
|
/** Supported structured log levels at the process boundary. */
|
|
export type LogLevel = z.infer<typeof logLevelSchema>;
|
|
|
|
const logLevelSchema = z
|
|
.enum(["trace", "debug", "info", "warn", "error", "fatal", "silent"])
|
|
.default("info");
|
|
|
|
/** Parse the optional REA_LOG_LEVEL environment variable. */
|
|
export const parseLogLevel = (value: unknown): LogLevel =>
|
|
logLevelSchema.parse(value);
|
|
|
|
/** Create a JSON logger on stderr so protocol and CLI result stdout stay valid. */
|
|
export const createLogger = (mode: "mcp" | "cli", level: LogLevel): Logger =>
|
|
pino(
|
|
{
|
|
level,
|
|
base: { application: "rea", mode },
|
|
},
|
|
pino.destination({ dest: 2, sync: false }),
|
|
);
|
|
|
|
/** Logger used by embedders that have not opted into process output. */
|
|
export const silentLogger = pino({ level: "silent" });
|
|
|
|
export type { Logger };
|