Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 09:45 UTC
feat(core): accept instant.returnPricesInSearch on sessions (#4861)
## Summary The platform added an experimental Session flag, `instant.return_prices_in_search`. When it is set, session search results list each Instant tool's published price at `toolkit_connection_statuses[].instant_account.prices`, keyed by tool slug (`{ description, discount }`). The auto-generated docs PR (#4846) syncs the OpenAPI spec, but neither SDK could send the flag, and the TS search transformer dropped `prices`. This PR adds the SDK side. Designated PR reviewer: [@jkomyno](mailto:alberto@composio.dev). ## Changes - **TypeScript**: - `sessions.create()` and `session.update()` accept `instant.returnPricesInSearch`, sent as `return_prices_in_search`. - `session.search()` returns `toolkitConnectionStatuses[].instantAccount.prices`. The search response schema now includes `prices`, so the Zod parse keeps it. - `session.config.instant.return_prices_in_search` and its config-history equivalent are typed. - New exports: `ToolRouterToolPricing` and `ToolRouterToolPricingSchema`. - **Python**: - `ToolRouterInstantConfig` gains `return_prices_in_search`. - A typing-only `ToolRouterInstantPolicy` Protocol types `session.config.instant.return_prices_in_search`. - Docstrings cover `instant_account.prices` on search results. The generated model keeps it as an extra field. - **Docs**: the Instant guide gets a "Show prices in search" section with Python and TS examples. The TS snippet uses `// @noErrors` because the docs build against the published `@composio/core` 0.23.0. - **Changeset**: `@composio/core` patch, the same scope as the `proxyExecute` option. ### Matches the `return_instant_charge` approach The pinned generated clients (`@composio/client` 2.0.0-rc.13 and `composio-client` 2.0.0rc13) don't type `return_prices_in_search` or `instant_account.prices` yet. Both forward the `instant` body unchanged. As #4694 did for `return_instant_charge`, small SDK-owned types bridge the gap: - TS `SessionInstantBody` - TS `WithInstantReturnPricesInSearch` - Python `ToolRouterInstantPolicy` Each is commented as temporary and can go when the clients regenerate from the new spec. No runtime transport workaround is needed. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactor/Chore - [x] Documentation - [ ] Breaking change ## How Has This Been Tested? - **TS core**: - `pnpm typecheck`, including `type-tests/instant-contract.test-d.ts`: passes. - Full vitest suite: 1819 passed, 2 expected failures. - New tests cover create and update mapping, `session.search()` returning `prices` through the Zod parse, and the raw transformer. All four fail without the source change. - `pnpm lint` and `pnpm validate:changesets`: pass. - **Python**: - `pytest tests/test_tool_router.py`: 201 passed. Transport tests now cover sending `return_prices_in_search` on create and patch, reading it from the returned config, and reading `instant_account.prices` from search through the real generated client. The Python change is typing-only, so these tests pin behavior rather than fail-then-pass. - `ruff check` and `ruff format` with `config/ruff.toml`: pass. - `mypy composio/`: one existing error in `utils/schema_converter.py` that also shows on `next`; no new errors. - **Docs**: `bun test tests/static/`: 626 passed. The full docs build (Twoslash) was not run locally. ## Checklist - [ ] I have read the Code of Conduct and this PR adheres to it - [x] I have read and understand every line of this diff, including any LLM-generated code - [x] Any third-party docs links or promotional content follow the [third-party links policy](https://github.com/ComposioHQ/composio/blob/next/CONTRIBUTING.md#third-party-links-in-docs) - [x] I ran linters/tests locally and they passed - [x] I updated documentation as needed - [x] I added tests or explain why not applicable - [x] I added a changeset if this change affects published packages ## Additional context Follow-up to #4846. Python versioning and release notes go in the release commit, per repo convention. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Ex46Sq8AkDMMmYyLXbBJhF --- _Generated by [Claude Code](https://claude.ai/code/session_01Ex46Sq8AkDMMmYyLXbBJhF)_ --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: jkomyno <alberto@composio.dev>