Skip to content

Conversation

@Akira-AA83
Copy link

@Akira-AA83 Akira-AA83 commented Nov 23, 2025

Summary

This PR adds WSL (Windows Subsystem for Linux) support and fixes several broken API calls that were
returning "API error 3 (Unavailable)" or "400 Bad Request".

Changes

WSL Support

  • Add NLM_USE_ORIGINAL_PROFILE=1 environment variable to use Windows Chrome profile from WSL
  • Add missing Linux browser path functions in chrome_linux.go
  • Add docs/WSL.md setup guide

API Fixes

  • Fix ActOnSources encoder (summarize, faq, mindmap, explain, study-guide, etc.)

    • Corrected payload nesting levels to match browser format
    • Added NotebookID to RPC calls for proper source-path routing
  • Fix GenerateFreeFormStreamed (generate-chat)

    • Changed from batchexecute (RPC ID: BD) to gRPC endpoint
    • Uses /google.internal.labs.tailwind.orchestration.v1.LabsTailwindOrchestrationService/GenerateFree FormStreamed
    • Fixed payload format with correct 4-level source ID nesting

Dynamic API Parameters

  • Remove hardcoded bl and f.sid parameters
  • Add GetAPIParams() function that extracts parameters dynamically from NotebookLM page HTML
  • Parameters are cached after first extraction
  • Fallback chain: env vars (NLM_BUILD_VERSION, NLM_SESSION_ID) → page extraction → defaults

JSON Parsing Fix

  • Fix parsing of notebook titles containing backslash characters (e.g., C:\Users\Desktop)
  • Add sanitizeJSON() function to handle invalid escape sequences in server responses

Testing

All commands tested and working:

  • nlm list
  • nlm sources
  • nlm generate-chat ✅ (was broken)
  • nlm summarize ✅ (was broken)
  • nlm faq ✅ (was broken)
  • nlm auth ✅ (with WSL)

Related Issues

Fixes #14 (API error 3 - Service unavailable)
Fixes #7 (invalid character '\n' in string escape code)
May fix #5 (JSON parsing improvements)

Breaking Changes

None - all changes are backwards compatible.

  - Fix ActOnSources encoder with correct payload nesting (summarize, faq, mindmap, etc.)
  - Fix GenerateFreeFormStreamed to use gRPC endpoint instead of batchexecute
  - Add dynamic extraction of bl and f.sid parameters from NotebookLM page
  - Remove hardcoded API parameters - now fetched automatically
  - Add fallback to env vars (NLM_BUILD_VERSION, NLM_SESSION_ID) and defaults
  - Add NotebookID to RPC calls for proper source-path routing

  Fixes generate-chat, summarize, faq, and other commands that were returning
  "API error 3 (Unavailable)" or "400 Bad Request".
@Akira-AA83 Akira-AA83 changed the title feat: Add WSL support and fix broken API calls (generate-chat, summarize, faq, etc.) feat: Add WSL support, fix broken API calls (generate-chat, summarize, faq, etc.) and JSON parsing fix. Nov 23, 2025
  - Add RPC o4cbdc for binary source registration
  - Implement Google resumable upload protocol (3-step process)
  - Support PDF, DOCX, images, and other binary formats
  - Extract SOURCE_ID from o4cbdc response
  - Initialize upload session and get upload URL
  - Upload file content with proper headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generation services API error 3 invalid character '\n' in string escape code (sanitization) error

1 participant