Commit graph

41 commits

Author SHA1 Message Date
Kayvan Sylvan 9b724f8cec fix: persist refreshed Codex tokens and reactivate configured vendors
- Persist rotated Codex OAuth tokens after every successful refresh.
- Reload stored credentials under cross-process locks before refreshing.
- Write environment updates atomically with secret-only file permissions.
- Preserve existing environment values while skipping empty replacements.
- Activate configured vendors lazily and surface configuration failures immediately.
- Reuse valid refresh tokens before starting interactive authentication.
- Localize Codex setup, provider, request, and persistence errors.
- Upgrade AI, cloud, telemetry, and supporting Go dependencies.
- Set Claude Opus 5 as default changelog summarizer.
- Document `.env` token sensitivity and rewrite behavior.
2026-08-27 18:12:08 -07:00
Kayvan Sylvan 9730808119 fix: include Grok in localized --search help text
PR #2092 added Grok (xAI) web search support and updated the go-flags
struct tag in internal/cli/flags.go, but `fabric --help` renders flag
descriptions from the i18n message catalog (internal/cli/help.go maps
"search" -> "enable_web_search_tool"), not from the struct tag. The
catalog value still listed only Anthropic, OpenAI, and Gemini, so the
Grok support stayed undiscoverable in --help even though it works.

Append "Grok" to the enable_web_search_tool value in all 11 locales,
using each locale's own list separator, and update the generated README
help block to match. No functional change.

The zsh and fish completion strings were already corrected in #2179,
so this carries forward only the remaining parts of #2140.

Co-Authored-By: Ken Hartman <khartman@users.noreply.github.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 15:22:22 -07:00
Kayvan Sylvan 080311effc docs: clarify show-metadata token details across CLI surfaces
- Specify input and output tokens in flag help text
- Synchronize metadata descriptions across shell completion definitions
- Localize clarified metadata guidance across supported languages
- Record description clarification in incoming changelog entry
2026-07-29 15:11:05 -07:00
Kayvan Sylvan ec0b7246c4 fix: declare completion arguments and synchronize CLI help
- Declare Fish completion arguments for dynamic and fixed values
- Enable filtered file suggestions for supported path options
- Add Spotify, transcription, metadata, and wire-debug completion options
- Include Grok among providers supporting web search completion
- Localize pattern, Spotify, and metadata help descriptions consistently
- Document expanded completion coverage and wire-level debug behavior
- Describe YouTube visual flags directly in generated help
2026-07-29 14:56:27 -07:00
OdinKral 1e650266ab fix: block path traversal in pattern name lookup (closes #2094)
Pattern names containing ".." could be used to escape the patterns
directory and read arbitrary files via filepath.Join. Guard added at
the top of getFromDB; i18n key pattern_invalid_name added to all
11 locale files; test cases cover all common traversal variants.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-28 08:08:03 -07:00
Kayvan Sylvan 59d26a7e89 feat: cache OpenAI model discovery and handle provider rate limits
- Add persistent cache for provider model discovery results
- Serve stale model caches during discovery failures
- Return concise localized errors for rate-limited model fetches
- Send GitHub Models API version header automatically
- Add Claude Fable 5 Anthropic model support
- Omit sampling parameters for Claude Fable 5
- Update model rate-limit translations across supported locales
- Add tests for cache, rate-limit, and GitHub headers
- Update Go dependencies for AI provider integrations
2026-06-09 14:36:46 -07:00
Kayvan Sylvan c78576deb7 feat: internationalize YouTube visual extraction flags and error messages
- Move visual flag descriptions to i18n locale system
- Add visual extraction strings to all 11 locale files
- Replace hardcoded English error messages with i18n lookups
- Register visual flags in `flagDescriptionMap` for help system
- Remove inline `description` tags from visual CLI flag structs
- Localize FFmpeg, Tesseract, and yt-dlp error messages
- Add `youtube_visual_frame_cue` translation key across locales
2026-04-05 15:22:28 -07:00
Kayvan Sylvan c271816d2d feat: add i18n translations for Codex OAuth and error messages
- Add 17 new Codex-related i18n keys across all locale files
- Replace hardcoded English strings in OAuth flow with i18n lookups
- Internationalize Codex error messages in `errors.go`
- Localize token exchange and refresh failure messages
- Translate OAuth callback server responses and browser fallback text
- Add translations for usage limit and request status errors
- Cover DE, EN, ES, FA, FR, IT, JA, PL, PT-BR, PT-PT, ZH locales
2026-03-25 16:49:12 -07:00
Prax Lannister 3dd498bc47 fix(chat): prevent streaming deadlock and unify strategy handling
## Bug: Streaming Deadlock in Chatter.Send

When a streaming error occurs, two goroutines can race to write to the
same buffered(1) error channel:

1. The SendStream goroutine returns an error and writes to errChan
2. The stream-update loop receives a StreamTypeError update and also
   writes to errChan

Since errChan has a buffer of 1, the second write blocks forever,
causing a goroutine leak and a deadlock — the caller never returns.

### Fix

Introduce `recordFirstStreamError()` which uses a non-blocking
select/default to safely send only the first error, discarding
subsequent ones. This prevents the deadlock while preserving the
original error for the caller.

### Scenario that triggers the deadlock (before this fix):

  1. Vendor stream emits a StreamTypeError update (e.g., rate limit)
  2. The update loop writes the error to errChan (buffer fills)
  3. SendStream also returns an error
  4. SendStream goroutine tries to write to errChan → BLOCKS FOREVER
  5. Chatter.Send never returns → user sees a hang

## Refactor: Unify Strategy Handling (Server + CLI)

The REST API server (chat.go) was loading strategy prompts inline by
reading JSON files directly with os.ReadFile, bypassing the core
Chatter layer entirely. This caused:

- Strategy prompts were prepended to UserInput instead of the system
  message, breaking the prompt architecture
- The StrategyName was not passed to GetChatter(), so the core layer
  had no knowledge of the strategy
- Duplicate strategy-loading logic between CLI and server paths

### Fix

- Pass StrategyName through to GetChatter() and ChatRequest so the
  core Chatter.BuildSession() handles strategy loading uniformly
- Extract `buildPromptChatRequest()` helper for clean request
  construction
- Remove inline os.ReadFile strategy loading from the server handler

## Refactor: Clean System Message Assembly

Replace raw string concatenation of context + pattern + strategy
prompts with `joinPromptSections()` which:

- Trims whitespace from each section
- Skips empty sections (no double newlines from missing context)
- Joins with a single newline separator

## Tests Added

- `TestChatter_BuildSession_SeparatesSystemSections`: Verifies
  strategy, context, and pattern are joined with newline separators
  in the correct order
- `TestChatter_Send_StreamingErrorUpdateAndReturnDoesNotDeadlock`:
  Regression test with 2-second timeout that catches the deadlock
  when both error paths fire simultaneously
- `TestBuildPromptChatRequest_PreservesStrategyAndUserInput`: Verifies
  the extracted helper preserves all fields including StrategyName
2026-03-18 04:42:03 +05:30
Kayvan Sylvan 3c40a3462d feat: add OpenAI Codex vendor with browser-based OAuth authentication
- Add new Codex AI vendor plugin with OpenAI OAuth PKCE flow
- Implement browser-based login with automatic token refresh on 401
- Register Codex client in the plugin registry
- Allow explicit Codex model selection bypassing model listing
- Expose shared OpenAI `BuildResponseParams` and `ExtractText` helpers
- Move system/developer messages into Codex `instructions` field
- Add Codex i18n strings across all supported locales
- Add comprehensive unit tests for Codex OAuth, streaming, and retry
- Update README with Codex feature entry and provider listing
- Trim older changelog entries from README recent features section
2026-03-16 10:20:23 -07:00
Prax Lannister 19430ec69d Merge branch 'danielmiessler:main' into feat/bedrock-bearer-token-auth 2026-03-08 17:15:16 +05:30
Kayvan Sylvan 24f3f82dc6 feat: internationalize Bedrock setup UI strings and add guided setup i18n keys
- Internationalize all Bedrock setup prompt strings via `i18n.T()`
- Add `bedrock_setup_*` i18n keys for auth, region, and model selection
- Add `bedrock_client_not_initialized` error message to all locale files
- Propagate new i18n keys across 11 locale files (de, en, es, fa, fr, it, ja, pl, pt-BR, pt-PT, zh)
- Replace hardcoded setup strings in `bedrock.go` with i18n lookups
- Reorder locale JSON keys alphabetically for consistency
2026-03-06 07:06:02 -08:00
Prax Lannister e59a70f8ba feat: add Bedrock bearer token (ABSK) authentication
Add 3-tier authentication for AWS Bedrock:
1. Bearer token (ABSK) - simplest, same as Claude Code
2. Static AWS credentials (access key + secret key)
3. Default AWS credential chain (existing behavior)

- Remove hasAWSCredentials() gate so Bedrock always appears in setup
- Custom guided Setup() flow: auth method, region, model
- Bearer token transport with token redaction
- Nil guards for uninitialized clients
- Temperature-only fix (no top_p) for Claude on Bedrock
- API key masking during re-setup
- Fallback model list when ListFoundationModels API is inaccessible
- i18n support for 11 locales (3 new keys each)
- 25 unit tests
2026-03-05 11:30:55 +05:30
Kayvan Sylvan c0b1f6175a i18n: add git CLI error message keys across all supported locales
- Add `githelper_failed_create_temp_directory` i18n key to all locales
- Add `githelper_failed_git_cli_clone` error key across 10 locale files
- Add `githelper_failed_git_cli_fallback` key for CLI fallback error messaging
- Replace hardcoded error strings in `githelper.go` with `i18n.T()` calls
- Support localized git CLI error reporting in de, en, es, fa, fr, it, ja, pt, zh
2026-02-28 17:41:13 -08:00
Kayvan Sylvan 103493206e fix: Address copilot review comments 2026-02-23 14:29:25 -08:00
Justin Lecher 283a548e05 feat: address PR #2014 feedback and add configurable Azure OpenAI API version
This commit addresses all review feedback from PR #2014 and adds
configurable API version support for Azure OpenAI backend.

PR Review Fixes:
- Add URL validation with HTTPS enforcement (ISC-C7)
- Implement cancellable context in SendStream with 300s timeout (ISC-C6)
- Add response body size limit (10MB) using io.LimitReader (ISC-C12)
- Update error body truncation from 200 to 500 characters (ISC-C13)
- Lowercase error messages per Go convention (ISC-C15)
- Add file-level documentation to all backend files (ISC-C14)
- Fix Bedrock max_tokens to respect opts.MaxTokens with fallback (ISC-C5)
- Document temperature/top_p mutual exclusivity in Bedrock (ISC-C11)
- Add debug logging when empty messages are skipped (ISC-C16)
- Add error check for empty message lists across all backends
- Verify and document Vertex AI endpoint path for APIM routing (ISC-C9)
- Update Azure OpenAI API version to 2025-04-01-preview (ISC-C10)

New Feature - Configurable API Version:
- Add APIVersion field to Client struct for Azure OpenAI backend
- Add optional setup question for API version (default: 2025-04-01-preview)
- Update AzureOpenAIBackend to accept and use configurable API version
- Maintain backward compatibility: empty version defaults to 2025-04-01-preview
- Add test coverage for custom API version and backward compatibility
- Update all existing tests to work with new backend signature

Test Coverage: 89.1% (maintained from 89.0%)
All 52 tests passing (49 existing + 3 new API version tests)

Internationalization polish: add AzureAIGateway locale strings across all 10 languages

- Add `azureaigateway_*` i18n keys to all 10 locale files
- Replace hardcoded error strings with `i18n.T()` calls
- Internationalize setup question prompts for gateway configuration
- Add `errors.New` in place of `fmt.Errorf` for static error strings
- Fix `url.QueryEscape` for API version query parameter encoding
- Correct `claude-opus-4-6-v1` model ID to include `:0` suffix
- Add error case for empty Bedrock text content blocks in `ParseResponse`
- Add test for Bedrock `ParseResponse` with no text content blocks
- Add `SendStream` context limitation note as inline code comment
- Truncate debug error body log output at 2000 characters
2026-02-23 13:58:32 -08:00
Kayvan Sylvan e7d0d64511 feat: add wire debug level (4) for full LLM request/response debug logging
## CHANGES

- Add `Wire` log level constant to debug level enum
- Expose `GetLevel()` function for safe concurrent level reads
- Log outbound message roles and content at wire debug level
- Log inbound stream updates and token usage at wire level
- Log non-streaming LLM responses at wire debug level
- Update `--debug` flag description to include new level 4
- Update `set_debug_level` locale strings across all 10 languages
2026-02-21 19:48:38 -08:00
Kayvan Sylvan 9514f6cdfe chore: add DigitalOcean error i18n strings and sort locale keys alphabetically
- Add three new DigitalOcean error message translation keys across all locales
- Add plugin registry vendor and setup default translation keys
- Move misplaced locale entries into correct alphabetical order
- Replace hardcoded English error strings with `i18n.T()` calls in DigitalOcean client
- Sort Go import statements alphabetically in YouTube tool
2026-02-21 15:55:50 -08:00
Kayvan Sylvan e84edd935b refactor: replace fmt.Errorf("%s", ...) with errors.New() and normalize i18n strings
- Replace `fmt.Errorf("%s", ...)` with `errors.New()` across all packages
- Add `errors` import where needed, remove unused `fmt` imports
- Lowercase error message strings in i18n locale files for Go conventions
- Add `plugin_registry_run_setup_select_defaults` i18n key for setup prompt
- Add `plugin_registry_could_not_find_vendor` i18n key for vendor errors
- Internationalize hardcoded English strings in `plugin_registry.go`
- Update `db_error_loading_env_file` format verb from `%s` to `%w` for wrapping
- Normalize error casing in en, de, es, fr, it, ja, pt-BR, pt-PT, zh, fa locales
2026-02-21 15:48:01 -08:00
Kayvan Sylvan e9b1b88d86 feat: replace hardcoded error strings with i18n translation keys
- Replace hardcoded error messages with `i18n.T()` calls across Go source files
- Add ~80 new translation keys to all locale files (en, de, es, fa, fr, it, ja, pt-BR, pt-PT, zh)
- Internationalize error strings in chat, attachment, storage, and template packages
- Internationalize error strings in plugin registry, server, and utility modules
- Internationalize githelper, notifications, patterns, and sessions modules
- Add i18n support for DigitalOcean, Gemini, and OpenAI-compatible providers
- Sort existing locale keys alphabetically in JSON files
- chore: incoming 2019 changelog entry
2026-02-21 13:28:52 -08:00
Kayvan Sylvan 94425b5778 feat: add Azure Entra ID authentication plugin with shared Azure utilities
## CHANGES

- Add new `azure_entra` plugin client to plugin registry
- Extract shared Azure logic into `azurecommon` package
- Move `ParseDeployments`, `BuildEndpoint`, and middleware to `azurecommon`
- Upgrade `azidentity` to v1.13.1 with Entra ID/MSAL support
- Add `golang-jwt`, `pkg/browser`, and `go-keychain` as new dependencies
- Add `azure_credential_failure`, `azure_base_url_question` i18n keys across all locales
- Validate Azure deployment names are non-empty on configure
2026-02-20 23:30:29 -08:00
Kayvan Sylvan 8f9798a69b chore: implement comprehensive i18n support across all plugins and tools
### CHANGES
- Implement internationalization support for all AI vendor plugins
- Update localization files for multiple languages with new keys
- Replace hardcoded strings in Spotify and YouTube tools
- Add unit tests for localized error handling in Ollama
- Refactor template plugins to use localized system error messages
- Standardize setup questions using the new i18n translation framework
2026-02-19 14:00:23 -08:00
Kayvan Sylvan f26e328d40 feat: internationalize file manager, Vertex AI, and Copilot error messages via i18n
- Replace hardcoded error strings in `file_manager.go` with i18n translation keys
- Add file manager, Vertex AI, and Copilot i18n keys to all 10 locale files
- Internationalize Copilot plugin error messages and debug logs
- Internationalize Vertex AI model fetching error messages
- Fix JSON trailing comma syntax errors across all locale files
- Normalize German locale JSON indentation from tabs to spaces
- Use `AddSetupQuestionWithEnvName` for Bedrock AWS region setup
2026-02-16 13:10:00 -08:00
Kayvan Sylvan eeb9567ce0 feat: add i18n translations for VertexAI, Gemini, Bedrock, and fetch plugins
- Add VertexAI error message translations across 10 locale files
- Add Gemini TTS and audio error translations to all locales
- Add AWS Bedrock client error translations to all locales
- Add fetch plugin error message translations to all locales
- Replace hardcoded English strings with `i18n.T()` calls in Bedrock plugin
- Replace hardcoded English strings with `i18n.T()` calls in Gemini plugin
- Replace hardcoded English strings with `i18n.T()` calls in VertexAI plugin
- Replace hardcoded English strings with `i18n.T()` calls in fetch plugin
- Use `errors.New` instead of `fmt.Errorf` for non-formatted error strings
2026-02-16 08:28:54 -08:00
Kayvan Sylvan a71a006f74 feat: add internationalization support for chatter and template file operations
- Replace hardcoded strings with i18n keys in chatter.go
- Add translation keys for errors, warnings, and metadata in locale files
- Update file.go to use i18n for operation messages and errors
- Provide translations in German, English, Spanish, Persian, French, Italian, Japanese, Portuguese, and Chinese
- Enable localized output for stream updates and file plugin operations
- Ensure consistent error handling across supported languages
- Maintain backward compatibility with existing functionality
2026-02-16 04:21:56 -08:00
Kayvan Sylvan 0ceb639c9d MAESTRO: i18n: extract hard-coded strings from internal/tools/spotify/spotify.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 00:54:12 -08:00
Kayvan Sylvan 7839ae6fa7 MAESTRO: i18n: extract hard-coded strings from internal/plugins/template/extension_executor.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 00:45:46 -08:00
Kayvan Sylvan 398b07f13f MAESTRO: i18n: extract hard-coded strings from internal/plugins/ai/openai/openai.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 00:32:38 -08:00
Kayvan Sylvan c8ca1792b4 MAESTRO: i18n: extract hard-coded strings from internal/plugins/template/extension_registry.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:52:59 -08:00
Kayvan Sylvan 7382ddaae5 MAESTRO: i18n: extract hard-coded strings from internal/plugins/ai/lmstudio/lmstudio.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:38:16 -08:00
Kayvan Sylvan 5fbddb2279 MAESTRO: i18n: extract hard-coded strings from internal/plugins/template/extension_manager.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:10:23 -08:00
Kayvan Sylvan 020656ccdc MAESTRO: i18n: extract hard-coded strings from internal/server/ollama.go
Replace 37 hard-coded error/log strings with i18n.T() calls and add
translations for all 10 supported languages (en, de, es, fa, fr, it,
ja, pt-BR, pt-PT, zh). Keys use ollama_ prefix following project
conventions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 20:49:08 -08:00
Kayvan Sylvan 719590abb6 feat: add Spotify metadata retrieval via --spotify flag
## CHANGES
- Add Spotify plugin with OAuth token handling and metadata
- Wire --spotify flag into CLI processing and output
- Register Spotify in plugin setup, env, and registry
- Update shell completions to include --spotify option
- Add i18n strings for Spotify configuration errors
- Add unit and integration tests for Spotify API
- Set gopls integration build tags for workspace
2026-01-20 15:57:59 -08:00
Kayvan Sylvan 7570e7930b feat: localize setup process and add funding configuration
- Add GitHub and Buy Me a Coffee funding configuration.
- Localize setup prompts and error messages across multiple languages.
- Implement helper for localized questions with static environment keys.
- Update environment variable builder to handle hyphenated plugin names.
- Replace hardcoded console output with localized i18n translation strings.
- Expand locale files with comprehensive pattern and strategy translations.
- Add new i18n keys for optional and required markers
- Remove hardcoded `[required]` markers from description strings
- Add custom patterns, Jina AI, YouTube, and language labels
- Switch plugin descriptions to use i18n translation keys
- Append markers dynamically to setup descriptions in Go code
- Remove trailing newlines from plugin question prompt strings
- Standardize all locale files with consistent formatting changes
2025-12-22 09:39:02 -08:00
Kayvan Sylvan 9f79877524 User Experience: implement automated first-time setup and improved configuration validation
### CHANGES

- Add automated first-time setup for patterns and strategies.
- Implement configuration validation to warn about missing required components.
- Update setup menu to group plugins into required and optional.
- Provide helpful guidance when no patterns are found in listing.
- Expand localization support for setup and error messaging across languages.
- Enhance strategy manager to reload and count installed strategies.
- Improve pattern error handling with specific guidance for empty directories.
2025-12-18 14:48:50 -08:00
Kayvan Sylvan 3c728cfacb feat: add GitHub Models provider and refactor model fetching with direct API fallback
- Add GitHub Models to supported OpenAI-compatible providers list
- Implement direct HTTP fallback for non-standard model responses
- Centralize model fetching logic in openai package
- Upgrade openai-go SDK dependency from v1.8.2 to v1.12.0
- Remove redundant model fetching code from openai_compatible package
- Add comprehensive GitHub Models setup documentation (700+ lines)
- Support custom models URL endpoint per provider configuration
- Add unit tests for direct model fetching functionality
- Update internationalization strings for model fetching errors
- Add VSCode dictionary entries for "azureml" and "Jamba"
2025-11-23 15:02:33 +07:00
Kayvan Sylvan 6708c7481b refactor: implement i18n support for YouTube tool error messages
CHANGES
- replace hardcoded error strings with i18n translation calls
- add localization keys for YouTube errors to all locale files
- introduce `extractAndValidateVideoId` helper to reduce code duplication
- update timestamp parsing logic to handle localized error formats
- standardize error handling in `yt-dlp` execution with i18n
- ensure rate limit and bot detection warnings use localized strings
2025-11-21 06:14:18 +07:00
Kayvan Sylvan b7fa02d91e docs: clarify --raw flag behavior for OpenAI and Anthropic providers
- Update `--raw` flag description across all documentation files
- Clarify flag only affects OpenAI-compatible providers behavior
- Document Anthropic models use smart parameter selection
- Remove outdated reference to system/user role changes
- Update help text in CLI flags definition
- Translate updated description to all supported locales
- Update shell completion descriptions for zsh and fish
- chore: incoming 1836 changelog entry
2025-11-18 04:27:38 -08:00
Kayvan Sylvan b34112d7ed feat(i18n): add i18n support for language variants (pt-BR/pt-PT)
• Add Brazilian Portuguese (pt-BR) translation file
• Add European Portuguese (pt-PT) translation file
• Implement BCP 47 locale normalization system
• Create fallback chain for language variants
• Add default variant mapping for Portuguese
• Update help text to show variant examples
• Add comprehensive test suite for variants
• Create documentation for i18n variant architecture
2025-09-21 16:04:59 -07:00
Kayvan Sylvan 651c5743f1 feat: add comprehensive internationalization support with English and Spanish locales
- Replace hardcoded strings with i18n.T translations
- Add en and es JSON locale files
- Implement custom translated help system
- Enable language detection from CLI args
- Add locale download capability
- Localize error messages throughout codebase
- Support TTS and notification translations
2025-09-09 09:34:54 -07:00
Kayvan Sylvan 20080fcb78 feat: add i18n support with Spanish localization and documentation improvements
- Add internationalization system with Spanish support
- Create contexts and sessions tutorial documentation
- Fix broken Warp sponsorship image URL
- Add locale detection from environment variables
- Update VSCode settings with new dictionary words
- Exclude VSCode settings from version workflows
- Update pattern descriptions and explanations
- Add comprehensive i18n test coverage
2025-09-08 09:17:23 -07:00