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, 07:15 UTC
fix(cli): resolve the `listen` account like `execute` and `proxy` (#5122)
Closes #4797 This PR: - routes `composio listen` through `resolveConnectedAccountForToolkit`, the resolver `composio execute` and `composio proxy` already use, replacing its own `connectedAccounts.list` + `resolveConnectedAccountSelection` copy - an `--account` that matches nothing, or a failed account lookup, now fails with the shared `ConnectedAccountResolutionError` (an expected failure: plain message on stderr, exit 1) instead of `ListenCommandError`; the unused `connected_accounts` reason is dropped - with several active accounts, none aliased `default`, and no `--account`, `listen` now fails with the same "Multiple connected accounts exist … Pass --account" error as `execute`/`proxy`, instead of using the newest account - keeps listen's own "no active connected account … run `composio link`" failure and its unknown-slug check when the toolkit has no account; `--fail-fast` and the rest of the listener are untouched - `dev listen` (`dev triggers listen`) takes no `--account` and does no account selection, so it is unchanged - adds `listen` to the CLI changelog's ambiguity entry, plus a patch entry for the shared resolver, under Unreleased ## Context The ambiguity guard in `resolveConnectedAccountForToolkit` (originally #4745) landed on `next` via #5126, and this branch now includes it. Because `listen` goes through that resolver, it gets the guard with no listen-specific code. One message change: a mistyped trigger slug combined with an unmatched `--account` now reports the account mismatch rather than the unknown slug, the same as `execute`/`proxy` report a bad `--account`. A mistyped slug with a matching account is still reported as unknown when the trigger is created. Tests: - `listen.cmd.test.ts`: `--account work` among two active accounts creates the temporary trigger for `con_work`; `--account nope` fails with `ConnectedAccountResolutionError` and the shared "No connected account matched … Available accounts: …" message; no `--account` and no `default` alias fails with `ConnectedAccountResolutionError` and the shared "Multiple connected accounts exist … Pass --account <alias or id> to choose one." message. The last two cases fail without the fix. - `listen.client.cmd.test.ts`: the failed-lookup case now expects the shared error and message. Verified locally: `pnpm --filter @composio/cli test` (209 files, 2430 passed, 1 skipped; `validate:command-tests` OK), root `pnpm typecheck`, `lint:effect` (0 diagnostics), `oxlint ts/packages/cli` (0 errors, no findings in touched files), prettier. No VHS recording, because the command surface and documented workflow don't change.