Исправить авторизацию user API key в composio-direct#199
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: xlabtg#198
Working session summaryГотово: PR #199 обновлён и переведён в ready for review: #199 Исправление: Проверки локально:
GitHub Actions: для текущего head This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (486.2K + 8.5M cached) input tokens, 40.4K output tokens, $15.145061 cost 🤖 Models used:
📎 Log file uploaded as Repository (48781KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Что исправлено
Fixes #198.
composio-directвсегда отправлялcomposio_api_keyв заголовкеx-api-key. По OpenAPI Composio v3.1 большинство рабочих endpoints принимают и project key (x-api-key), и user key (x-user-api-key). Если оператор вставлял user/full-access key из настроек Composio, API мог отвечать 401/403, хотя сам ключ был валидным.Решение
api_key_auth_schemeсо значением по умолчаниюauto.autoplugin сначала сохраняет прежнее поведение черезx-api-key, а при 401/403 на endpoints с поддержкой user key повторяет запрос черезx-user-api-key.projectилиuser.auth_required; ошибки остаются ошибками API key/permissions.composio-directподнята до1.9.3, README/GUIDE обновлены.Как воспроизвести
До исправления запрос
composio_execute_toolс user API key уходил только сx-api-keyи на 403 завершался ошибкой. Новый регрессионный тест имитирует этот ответ Composio и проверяет повторный успешный запрос сx-user-api-key.Проверка
node --test plugins/composio-direct/tests/index.test.js plugins/composio-direct/test/unit/composio-direct.test.js plugins/composio-direct/test/integration/composio-api.test.jsnpm run validatenode scripts/build-sdk.mjsnpm run lint(0 errors, существующие 32 warnings вне этого исправления)npm run typechecknpm test