Skip to content

Починить composio-direct для актуального Composio API#201

Merged
xlabtg merged 4 commits into
xlabtg:mainfrom
konard:issue-200-f30abe528f7c
Jun 26, 2026
Merged

Починить composio-direct для актуального Composio API#201
xlabtg merged 4 commits into
xlabtg:mainfrom
konard:issue-200-f30abe528f7c

Conversation

@konard

@konard konard commented Jun 26, 2026

Copy link
Copy Markdown

Fixes #200

Причина

Предыдущие исправления научили composio-direct переключаться между x-api-key и x-user-api-key, но официальная OpenAPI-схема Composio v3.1 также описывает x-org-api-key. Поэтому ключи с правами уровня организации могли продолжать получать 401/403, даже если в Composio у них были полные права.

Дополнительно проверен актуальный TypeScript custom provider flow Composio: для Teleton это не прямой импорт SDK provider-класса, а Teleton-specific adapter поверх статически зарегистрированных plugin tools.

Источники проверки:

Решение

  • Добавлена поддержка api_key_auth_scheme: org и алиасов organization / x-org-api-key.
  • В режиме auto для endpoint-ов, которые не являются project-only, теперь используются попытки x-api-key -> x-user-api-key -> x-org-api-key.
  • Для Files и Webhooks fallback на user/org отключён, потому что эти endpoint-ы в OpenAPI требуют project key.
  • Обновлены диагностика 401/403, README/GUIDE и версия плагина до 1.9.4.
  • README/GUIDE теперь явно описывают, как composio-direct соответствует custom provider model: discovery/schema tools выполняют transform step, execute/multi_execute выполняют execution step, а auth/connection/toolkit/file/trigger/webhook/meta tools являются provider helpers.
  • Добавлен тест на SDK-style tool shape (inputParameters / outputParameters), чтобы закрепить Teleton wrapper contract для provider-like discovery.

Как воспроизвести

Минимальный сценарий покрыт тестом: вызов composio_execute_tool получает 403 на x-api-key, 401 на x-user-api-key, затем успешно выполняется через x-org-api-key. До изменения выполнение останавливалось после project/user попыток.

Для замечания про custom providers добавлен защитный тест: Composio tool object в SDK-style форме преобразуется в Teleton-visible result с tool_slug, схемами и execute_with, а не в прямой SDK provider object.

Проверка

  • node --test plugins/composio-direct/tests/guide.test.js plugins/composio-direct/tests/index.test.js plugins/composio-direct/test/unit/composio-direct.test.js plugins/composio-direct/test/integration/composio-api.test.js — passed, 66/66
  • npm run validate — passed, 0 errors, 1 существующее предупреждение casino: tools array is empty
  • npm run lint — passed, 0 errors, существующие warnings вне этого изменения
  • npm run typecheck — passed
  • npm test — passed, 497/497

konard added 2 commits June 26, 2026 16:24
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: xlabtg#200
@konard konard changed the title [WIP] The composio direct plugin does not work Поддержать org API key в composio-direct Jun 26, 2026
@konard konard marked this pull request as ready for review June 26, 2026 16:36
@konard

konard commented Jun 26, 2026

Copy link
Copy Markdown
Author

Working session summary

Готово: PR 201 обновлён и переведён в ready for review: #201

Сделано:

  • Добавлена поддержка Composio org API key через x-org-api-key.
  • api_key_auth_scheme теперь принимает org, organization, x-org-api-key.
  • В auto fallback теперь: x-api-key -> x-user-api-key -> x-org-api-key для endpoint-ов, которые не project-only.
  • Files/Webhooks оставлены project-only.
  • Обновлены README/GUIDE, диагностика 401/403 и версия composio-direct до 1.9.4.
  • Добавлены регрессионные тесты на org fallback и запрет fallback для Files API.

Проверка:

  • node --test ...composio-direct... passed, 64/64
  • npm run validate passed
  • npm run lint passed
  • npm run typecheck passed
  • npm test passed, 496/496
  • GitHub Actions для b9fede8 passed: CI, Plugin Dependencies, Deploy to Vercel, CodeQL

Рабочая копия чистая, upstream/main уже входит в текущую ветку, PR merge state: CLEAN.


This summary was automatically extracted from the AI working session output.

@konard

konard commented Jun 26, 2026

Copy link
Copy Markdown
Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.5
  • Provider: OpenAI
  • Public pricing estimate: $8.017999

📊 Context and tokens usage:

  • 290.4K / 200K (145%) input tokens, 27.8K / 128K (22%) output tokens

Total: (290.4K + 3.9M cached) input tokens, 27.8K output tokens, $8.017999 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Thinking level: max (~31999 tokens)
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Gist (2883KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jun 26, 2026

Copy link
Copy Markdown
Author

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@xlabtg

xlabtg commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Did you take that into account too https://docs.composio.dev/docs/providers/custom-providers/typescript

@konard konard marked this pull request as draft June 26, 2026 17:10
@konard

konard commented Jun 26, 2026

Copy link
Copy Markdown
Author

🤖 AI Work Session Started

Starting automated work session at 2026-06-26T17:10:27.045Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

@konard konard changed the title Поддержать org API key в composio-direct Починить composio-direct для актуального Composio API Jun 26, 2026
@konard

konard commented Jun 26, 2026

Copy link
Copy Markdown
Author

Да, учёл это тоже.

Проверил актуальный документ Composio про TypeScript custom providers: https://docs.composio.dev/docs/providers/custom-providers/typescript

Вывод для этого PR: composio-direct не должен напрямую импортировать provider-классы из @composio/core, потому что Teleton регистрирует статический набор plugin tools. Поэтому плагин реализует тот же provider contract как Teleton-specific direct adapter поверх REST:

  • transform step: composio_search_tools / composio_get_tool_schemas возвращают tool_slug, schema и execute_with;
  • execution step: composio_execute_tool / composio_multi_execute вызывают Composio execute API с user_id, arguments, connected_account_id;
  • provider helpers: auth, connections, toolkits, files, triggers, webhooks и remote meta-tools.

Я добавил это в README.md и GUIDE.md, а также добавил тест на SDK-style shape (inputParameters / outputParameters), чтобы зафиксировать wrapper contract. Sessions/MCP по текущей документации Composio лучше делать отдельной интеграцией, а не скрыто менять direct plugin, потому что этот PR чинит именно прямой REST-flow и direct-only поверхности вроде triggers/webhooks/files.

@konard konard marked this pull request as ready for review June 26, 2026 17:22
@konard

konard commented Jun 26, 2026

Copy link
Copy Markdown
Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.5
  • Provider: OpenAI
  • Public pricing estimate: $7.102886

📊 Context and tokens usage:

  • 340.6K / 200K (170%) input tokens, 25.1K / 128K (20%) output tokens

Total: (340.6K + 2.6M cached) input tokens, 25.1K output tokens, $7.102886 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Thinking level: max (~31999 tokens)
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Gist (4541KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jun 26, 2026

Copy link
Copy Markdown
Author

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@xlabtg xlabtg merged commit cd5c671 into xlabtg:main Jun 26, 2026
9 checks passed
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.

The composio direct plugin does not work

2 participants