Commit Graph

377 Commits

Author SHA1 Message Date
Claude b57defe61d Add ruff, ruff format, and ty best-practice rules to pyproject.toml
- [tool.ruff]: target-version=py314 (matches requires-python>=3.14.2), line-length=88
- [tool.ruff.lint]: select E/W/F/I/UP/B/C4/SIM/PERF/RUF; ignore E501 (formatter handles it)
- [tool.ruff.lint.isort]: known-first-party covers all local packages
- [tool.ruff.format]: double quotes, space indent, auto line-ending
- [tool.ty.environment]: python-version=3.14 for type-checking accuracy

https://claude.ai/code/session_01RVyLT88hTnfJZAVLUbWawS
2026-02-18 12:03:04 +00:00
Ali Khokhar 08a31aa3ed Merge pull request #36 from Alishahryar1/cursor/claude-api-403-error-944f 2026-02-16 23:35:26 -08:00
Cursor Agent e9beb28897 fix: validate API keys at provider init to prevent 403 'authorization missing'
When NVIDIA_NIM_API_KEY or OPENROUTER_API_KEY is empty or not set,
the proxy forwarded requests without a valid Authorization header,
causing providers to return 403 with 'Header of type authorization
was missing'.

Now fail fast with HTTP 503 and a clear message telling users to add
the key to .env, with links to obtain keys.

Fixes #29

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 07:33:56 +00:00
Alishahryar1 7300156925 Add status message handling for voice note processing
- Introduced a new optional field `status_message_id` in the IncomingMessage model to track the status of voice note processing.
- Updated the Telegram and Discord platforms to utilize the `status_message_id` for editing status messages instead of sending new ones.
- Modified tests to assert the correct status message ID is used during voice note handling.
- Changed status message text from "Processing voice note..." to "Transcribing voice note..." for clarity.
2026-02-16 20:48:47 -08:00
Alishahryar1 2b1ae3deea Add voice note processing feedback for Telegram and Discord platforms
- Implemented a queue message to indicate "Processing voice note..." for both Telegram and Discord platforms.
- Updated the Telegram platform to send a status message when handling voice notes.
- Enhanced the test for Telegram voice handling to verify the queue message is sent correctly.
2026-02-16 20:37:10 -08:00
Alishahryar1 454099d36c Merge branch 'main' of https://github.com/Alishahryar1/cc-nim 2026-02-16 20:32:26 -08:00
Alishahryar1 f5aeae21bd fixed weight warning 2026-02-16 20:32:24 -08:00
Ali Khokhar ed5162da17 Update README 2026-02-16 20:31:53 -08:00
Alishahryar1 2d68906f65 Updated gitignore 2026-02-16 20:29:16 -08:00
Alishahryar1 18a1cfa523 Enhance transcription model handling
- Introduced a mechanism to track models that fail CUDA inference, allowing for automatic fallback to CPU on subsequent requests.
- Updated the model loading logic to respect the CUDA failure state, improving robustness in audio transcription.
- Removed debug logging code from Discord platform to streamline error handling.
2026-02-16 20:28:48 -08:00
Alishahryar1 3c9514c6cc lint 2026-02-16 20:16:20 -08:00
Alishahryar1 d668f6e476 Add voice note transcription feature
- Introduced voice note handling for Discord and Telegram platforms.
- Added configuration options for voice note functionality in settings.py and .env.example.
- Updated README to include voice note instructions and configuration details.
- Implemented audio attachment processing and transcription using faster-whisper.
- Enabled voice note support through message handlers in both platforms.
2026-02-16 20:14:59 -08:00
Ali Khokhar 71a518ba8e Merge pull request #35 from Alishahryar1/claude/code-review-architecture-tRi3B
Fix type check errors and CI
2026-02-16 18:32:40 -08:00
Cursor Agent 034d185770 Fix type check errors and CI
- Add re-exports: _is_gfm_table_header_line, _normalize_gfm_tables (discord_markdown)
- Add re-exports: _parse_allowed_channels, _get_discord (discord)
- Add re-exports: NetworkError, RetryAfter, TelegramError (telegram)
- Fix Python 3 except syntax (discord, discord_markdown, telegram_markdown, request_utils)
- Update test patches to messaging.platforms.* for moved modules

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 02:31:40 +00:00
Ali Khokhar 951eefec85 Merge pull request #34 from Alishahryar1/claude/code-review-architecture-tRi3B
Phase 7: Directory restructuring (messaging/ and tests/)
2026-02-16 18:27:19 -08:00
Cursor Agent 4b4f87515d Phase 7: Directory restructuring (messaging/ and tests/)
- Create messaging/platforms/ (base, discord, telegram, factory)
- Create messaging/rendering/ (discord_markdown, telegram_markdown)
- Create messaging/trees/ (data, repository, processor, queue_manager)
- Organize tests/ into api/, providers/, messaging/, cli/, config/
- Add backward-compatible re-exports at old locations
- Update handler.py and test_messaging_factory.py imports
- Fix Telegram type hints for TELEGRAM_AVAILABLE=False case
- Fix Python 3 except syntax in discord_markdown

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 02:25:42 +00:00
Alishahryar1 bf9f15b98b docs: Remove redundant PowerShell version guideline from coding environment documentation. 2026-02-16 18:18:23 -08:00
Alishahryar1 eaa81f5922 Updated Readme 2026-02-16 18:16:41 -08:00
Ali Khokhar 386ef0c0d9 Merge pull request #33 from Alishahryar1/claude/code-review-architecture-tRi3B
Update README: project structure, command order, provider extension docs
2026-02-16 18:11:57 -08:00
Cursor Agent 38a7980546 Update README: project structure, command order, provider extension docs
Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 02:11:37 +00:00
Ali Khokhar f39d1bf6bf Merge pull request #32 from Alishahryar1/claude/code-review-architecture-tRi3B
Add architecture improvement plan from code review
2026-02-16 18:07:04 -08:00
Cursor Agent adc04ebfc7 Improve AGENTS.md and CLAUDE.md per best practices
- Remove Windows machine claim
- Replace informal tone with professional CI language
- Add explicit CI check order (ruff format, ruff check, ty check, pytest)
- Tighten bullets, add backticks for commands
- Clarify vague instructions (execute incrementally, prefer built-in tools)
- Add sync note for duplication; bold workflow steps

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 02:06:00 +00:00
Cursor Agent db1ae0fea9 Align AGENTS.md and CLAUDE.md with architecture plan principles
Add ARCHITECTURE PRINCIPLES section reflecting PLAN.md:
- Shared utilities, DRY, encapsulation, provider-specific config
- Dead code removal, performance, platform-agnostic naming
- No type ignores, backward compatibility
Fix typo: proapagate -> propagate

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 02:04:03 +00:00
Cursor Agent 794e64bba9 Fix ruff format for handler.py and session.py
Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 02:03:04 +00:00
Cursor Agent bfc781e0ed Phase 4-6: Dead code removal, performance, minor fixes
Phase 4:
- Remove legacy SessionRecord, _sessions, _msg_to_session from SessionStore
- Fix hardcoded provider in root endpoint (use settings.provider_type)
- Update session store tests

Phase 5:
- Use list-based string accumulation in ThinkingSegment, TextSegment, ToolCallSegment
- Cache MAX_MESSAGE_LOG_ENTRIES_PER_CHAT at SessionStore init
- Use iterative DFS in MessageTree.get_descendants

Phase 6:
- Add comment for abstract async generator workaround in BaseProvider
- Rename TELEGRAM_EDIT log tags to PLATFORM_EDIT in handler

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 02:01:01 +00:00
Cursor Agent 72b7e34999 Phase 3: Fix encapsulation violations
- Add MessageTree.set_current_task() method
- Update tree_processor to use set_current_task instead of _current_task
- Move nim_settings out of ProviderConfig, pass only to NvidiaNimProvider
- Update api/dependencies and all tests

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 01:58:51 +00:00
Cursor Agent bab86a2687 Phase 2: Extract OpenAICompatibleProvider base class
- Create providers/openai_compat.py with shared streaming logic
- Refactor NvidiaNimProvider, OpenRouterProvider, LMStudioProvider to extend it
- OpenRouter overrides _handle_extra_reasoning for reasoning_details
- Update test patches to providers.openai_compat

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 01:57:34 +00:00
Cursor Agent d3f5f8877f Phase 1: Extract shared provider utils into providers/common/
- Create providers/common/ with sse_builder, message_converter, think_parser,
  heuristic_tool_parser, error_mapping
- Update nvidia_nim/utils and errors to re-export from common for backward compat
- Update all provider clients and tests to import from providers.common
- Remove duplicated files from nvidia_nim/utils/

Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
2026-02-17 01:55:38 +00:00
Claude 33e17092ce Add architecture improvement plan from code review
Comprehensive 7-phase plan covering: shared provider utils extraction,
streaming base class, encapsulation fixes, dead code removal,
performance improvements, minor fixes, and directory restructuring.

https://claude.ai/code/session_01R3BN4qzAoJ21fQzSBnWCAY
2026-02-17 01:27:01 +00:00
Ali Khokhar 96553df53d Update README.md 2026-02-16 16:29:18 -08:00
Alishahryar1 6abcdb4017 Add clear command functionality to message handler
- Implemented handling of the `/clear` command to clear specific branches or entire trees based on message replies.
- Added tests for various scenarios of the clear command, including clearing branches, handling unknown replies, and clearing entire trees.
- Enhanced `TreeQueueManager` with methods to cancel branches and remove subtrees, ensuring proper state management in the session store.
- Updated `SessionStore` and `TreeRepository` to support removal of node mappings and trees, improving data integrity during clear operations.
2026-02-16 16:23:26 -08:00
Alishahryar1 e4ae59511e Updated models list 2026-02-16 16:06:32 -08:00
Alishahryar1 8a16efc1b1 Included agents files for cloud agents 2026-02-16 16:04:15 -08:00
Alishahryar1 416664ed41 Renamed a check in workflow 2026-02-16 15:59:25 -08:00
Alishahryar1 b8d1bfecbb Improved test coverage 2026-02-16 15:58:16 -08:00
Alishahryar1 b4b902619d Merge branch 'main' of https://github.com/Alishahryar1/cc-nim 2026-02-16 15:34:34 -08:00
Alishahryar1 71cc814efb Add plans directory support to CLI session management
- Introduced `plans_directory` parameter in `CLISessionManager`, `CLISession`, and updated related methods to handle plan files.
- Updated `api/app.py` to pass the plans directory to the CLI session manager.
- Added a new test in `test_cli.py` to verify that the `--settings plansDirectory` argument is included when starting a task with a specified plans directory.
2026-02-16 15:34:26 -08:00
Ali Khokhar c9b436b588 Remove GitHub stars and forks badges
Removed GitHub stars and forks badges from README.
2026-02-16 15:16:54 -08:00
Alishahryar1 6939b52bca removed support for nested subagent 2026-02-16 14:58:51 -08:00
Alishahryar1 0eb999a0c1 lint 2026-02-16 02:23:57 -08:00
Ali Khokhar fad4b2468f Merge pull request #27 from Alishahryar1/client-timeouts-new
Add configurable HTTP timeouts for provider API requests
2026-02-16 02:21:33 -08:00
Alishahryar1 01852e1638 Add configurable HTTP timeouts for provider API requests
Updated the README to include new timeout settings. Implemented these timeouts in the provider classes and added corresponding tests to ensure they are correctly passed to the client. Also included environment variable support for the new settings.
2026-02-16 01:40:15 -08:00
Ali Khokhar 5d46e116ca Change model from 'moonshotai/kimi-k2-thinking' to 'stepfun-ai/step-3.5-flash'
Updated model references in the README file.
2026-02-16 00:29:32 -08:00
Ali Khokhar ec21de55fc Add link to browse free models 2026-02-16 00:24:15 -08:00
Ali Khokhar e742ee0525 Add link to browse free models
Added a link to browse free models.
2026-02-16 00:23:23 -08:00
Alishahryar1 1cde6d425f lint 2026-02-16 00:20:28 -08:00
Alishahryar1 63e266027c update dependencies 2026-02-16 00:08:24 -08:00
Alishahryar1 6511542bfe Implement Discord bot support and update README for messaging platform changes 2026-02-16 00:08:09 -08:00
Alishahryar1 b53a1b20c5 lint 2026-02-15 23:55:57 -08:00
Alishahryar1 b6f870ffab Added space in example env 2026-02-15 23:53:42 -08:00