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, 04:45 UTC
| 1 | import { Effect } from 'effect'; |
| 2 | import { loginWithAgentIdentity, safeAgentSummary, type AgentIdentity } from 'src/services/agents'; |
| 3 | import { TerminalUI } from 'src/services/terminal-ui'; |
| 4 | |
| 5 | /** |
| 6 | * Stores an agent identity's credential as the CLI's login and reports it: the success line on |
| 7 | * stderr, the identity summary with `logged_in: true` on stdout. Shared by `composio agent |
| 8 | * login` and the agent paths of `composio login`, so both print the same payload. |
| 9 | */ |
| 10 | export const completeAgentLogin = (identity: AgentIdentity) => |
| 11 | Effect.gen(function* () { |
| 12 | const ui = yield* TerminalUI; |
| 13 | yield* loginWithAgentIdentity(identity); |
| 14 | const summary = safeAgentSummary(identity); |
| 15 | yield* ui.log.success(`Logged in as Composio agent ${summary.email ?? summary.slug ?? ''}`); |
| 16 | yield* ui.output(JSON.stringify({ ...summary, logged_in: true })); |
| 17 | }); |