Commit graph

1 commit

Author SHA1 Message Date
google-labs-jules[bot]
4577a68dfd Fix: Improve vision logging and add comments
This commit addresses several aspects of the vision logging system:

1.  **Always Active Vision Logging:**
    *   Ensures that when `settings.vision_mode` is 'always', a vision log entry is created each time a message is handled.
    *   The full conversation history is now correctly formatted into a JSON string and passed as the `visionMessage` (4th argument) to `logger.logVision`. This ensures the entire input context is logged for these "always active" vision captures, similar to 'normal' and 'reasoning' text logs.
    *   I implemented this by adding a `formatHistoryForVisionLog` helper function to `Agent.js` and calling it within `handleMessage` to prepare the history string. This approach was chosen due to difficulties in directly modifying `logger.js` to always use its internal full history formatter.

2.  **Comments:**
    *   I added detailed comments in `agent.js` to explain the `formatHistoryForVisionLog` helper function and the logic for "always active" vision logging, including the rationale for the approach.
    *   I clarified how `latestScreenshotPath` is managed in relation to "always active" logs and other history entries.

3.  **General Code Health:**
    *   I ensured necessary imports (`fs`, `path`, `logger`) are present in `agent.js`.

I tested the changes by simulating the "always active" vision scenario and verifying that `logger.logVision` was called with the correct arguments, including the complete formatted history string.
2025-06-07 22:29:19 +00:00