@devries-cameron20 / composio Mirror · read-only
Fork 0

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

next
ts 25 lines 924 Bytes
Raw
1 import { Effect } from 'effect';
2 import { handleAgentAuthError } from 'src/effects/handle-agent-auth-error';
3 import { fetchAgentInbox, resolveStoredAgentKey } from 'src/services/agents';
4 import { TerminalUI } from 'src/services/terminal-ui';
5
6 /** The flags of `composio agent inbox`. */
7 export type AgentInboxParams = {
8 readonly limit: number;
9 };
10
11 /**
12 * Prints the stored agent's inbox as the agents API returns it, on stdout even when stdout is a
13 * terminal: the JSON is the whole output. A missing or human login is reported by
14 * `handleAgentAuthError` and exits 1.
15 */
16 export const runAgentInbox = ({ limit }: AgentInboxParams) =>
17 handleAgentAuthError(
18 Effect.gen(function* () {
19 const ui = yield* TerminalUI;
20 const agentKey = yield* resolveStoredAgentKey;
21 const inbox = yield* fetchAgentInbox({ agentKey, limit });
22
23 yield* ui.output(JSON.stringify(inbox), { force: true });
24 })
25 );