@ljoukov/llm 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -675,6 +675,44 @@ const result = await runAgentLoop({
675
675
  Telemetry emits parent/child run correlation (`runId` + `parentRunId`) for subagents.
676
676
  See `docs/agent-telemetry.md` for event schema, design rationale, and backend adapter guidance.
677
677
 
678
+ ### Agent Logging (Console + Files + Redirects)
679
+
680
+ `runAgentLoop()` enables logging by default. It writes:
681
+
682
+ - console lines,
683
+ - `<workspace>/agent.log`,
684
+ - per-call artifacts under a sibling logs directory: `<workspace-parent>/logs/<timestamp>-<n>/<model-id>/`.
685
+
686
+ Each LLM call writes:
687
+
688
+ - `request.txt`, `request.metadata.json`, and extracted attachments immediately,
689
+ - streamed `thoughts.txt` and `response.txt` deltas during generation,
690
+ - `response.metadata.json` at completion/failure (usage/cost/status/error).
691
+
692
+ `image_url` data URLs are redacted in text/metadata logs (`data:...,...`) so base64 payloads are not printed inline.
693
+
694
+ ```ts
695
+ import { runAgentLoop } from "@ljoukov/llm";
696
+
697
+ await runAgentLoop({
698
+ model: "chatgpt-gpt-5.3-codex",
699
+ input: "Do the task",
700
+ filesystemTool: true,
701
+ logging: {
702
+ workspaceDir: process.cwd(), // optional; defaults to filesystem cwd or process.cwd()
703
+ mirrorToConsole: false, // useful for CLI UIs that already render stream events
704
+ sink: {
705
+ append: (line) => {
706
+ // Optional extra destination (file, socket, queue, etc.)
707
+ },
708
+ flush: async () => {},
709
+ },
710
+ },
711
+ });
712
+ ```
713
+
714
+ Set `logging: false` to disable logger output for a run.
715
+
678
716
  If you need exact control over tool definitions, build the filesystem toolset yourself and call `runToolLoop()` directly.
679
717
 
680
718
  ```ts