UNPKG

@agentled/cli

Version:

CLI for Agentled — manage workflows, apps, and knowledge from the command line. Zero context-window cost for AI agents.

53 lines 2.12 kB
/** * `agentled chat` — Conversational interface to Agentled. * * Send a message and get a response from the Agentled AI assistant. * Optionally continue a conversation with --session-id. * * Examples: * agentled chat "List my workflows" * agentled chat "Create a workflow that enriches companies" --session-id abc123 * agentled chat-result external-chat-turn-123 */ import { AgentledClient } from '../client.js'; import { printOutput, printError } from '../utils/output.js'; export function registerChatCommands(program) { program .command('chat <message>') .description('Send a message to the Agentled AI assistant; monitor any started workflow separately until terminal') .option('--session-id <id>', 'Continue an existing chat session') .option('--format <fmt>', 'Output format: json, table, minimal', 'json') .action(async (message, opts) => { try { const client = new AgentledClient(); if (!client.isAuthenticated) { printError('Not authenticated. Run "agentled auth login" or set AGENTLED_API_KEY.'); return; } const result = await client.chat(message, opts.sessionId); printOutput(result, opts.format); } catch (e) { printError(e.message); } }); program .command('chat-result <turnId>') .description('Get a durable chat turn result; a completed turn may still hand off to a running workflow') .option('--format <fmt>', 'Output format: json, table, minimal', 'json') .action(async (turnId, opts) => { try { const client = new AgentledClient(); if (!client.isAuthenticated) { printError('Not authenticated. Run "agentled auth login" or set AGENTLED_API_KEY.'); return; } const result = await client.getChatTurnResult(turnId); printOutput(result, opts.format); } catch (e) { printError(e.message); } }); } //# sourceMappingURL=chat.js.map