feat: add LETTA_DEBUG env var for debug logging (#190)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-12-11 22:59:34 -08:00
committed by GitHub
parent c39bda9a01
commit 97e6b7e2a7
3 changed files with 65 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ import type { Stream } from "@letta-ai/letta-client/core/streaming";
import type { LettaStreamingResponse } from "@letta-ai/letta-client/resources/agents/messages";
import type { StopReasonType } from "@letta-ai/letta-client/resources/runs/runs";
import { getClient } from "../../agent/client";
import { debugWarn } from "../../utils/debug";
import {
type createBuffers,
@@ -179,10 +180,11 @@ export async function drainStream(
}));
if (approvals.length === 0) {
console.error(
"[drainStream] No approvals collected despite requires_approval stop reason",
debugWarn(
"drainStream",
"No approvals collected despite requires_approval stop reason",
);
console.error("[drainStream] Pending approvals map:", allPending);
debugWarn("drainStream", "Pending approvals map:", allPending);
} else {
// Set legacy singular field for backward compatibility
approval = approvals[0] || null;