openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
44 lines (43 loc) • 1.31 kB
JavaScript
import { l as isRecord } from "./record-coerce-CVPuDqcc.mjs";
//#region src/infra/diagnostic-llm-content.ts
const NO_MODEL_CONTENT_CAPTURE = Object.freeze({
inputMessages: false,
outputMessages: false,
toolInputs: false,
toolOutputs: false,
systemPrompt: false,
toolDefinitions: false,
anyModelContent: false
});
function cloneDiagnosticContentValue(e) {
try {
return structuredClone(e);
} catch {
try {
const t = JSON.stringify(e);
return t === void 0 ? null : JSON.parse(t);
} catch {
return String(e);
}
}
}
/** Resolves model-content diagnostic capture from config, defaulting to no content capture. */
function resolveDiagnosticModelContentCapturePolicy(e) {
if (!isRecord(e)) return NO_MODEL_CONTENT_CAPTURE;
const t = e.diagnostics;
if (!isRecord(t) || t.enabled === false) return NO_MODEL_CONTENT_CAPTURE;
const n = t.otel;
if (!isRecord(n) || n.enabled !== true || n.traces === false) return NO_MODEL_CONTENT_CAPTURE;
if (n.captureContent === true) return {
inputMessages: true,
outputMessages: true,
toolInputs: true,
toolOutputs: true,
systemPrompt: false,
toolDefinitions: true,
anyModelContent: true
};
return NO_MODEL_CONTENT_CAPTURE;
}
//#endregion
export { resolveDiagnosticModelContentCapturePolicy as n, cloneDiagnosticContentValue as t };