newo
Version:
NEWO CLI: Professional command-line tool with modular architecture for NEWO AI Agent development. Features account migration, integration management, webhook automation, AKB knowledge base, project attributes, sandbox testing, IDN-based file management, r
47 lines (43 loc) ⢠2.12 kB
text/typescript
/**
* Conversations command handler
*/
import { makeClient } from '../../api.js';
import { pullConversations } from '../../sync.js';
import { getValidAccessToken } from '../../auth.js';
import { selectSingleCustomer } from '../customer-selection.js';
import type { MultiCustomerConfig, CliArgs } from '../../types.js';
export async function handleConversationsCommand(
customerConfig: MultiCustomerConfig,
args: CliArgs,
verbose: boolean
): Promise<void> {
const { selectedCustomer, allCustomers, isMultiCustomer } = selectSingleCustomer(
customerConfig,
args.customer as string | undefined
);
// Parse conversation-specific options - load all data by default
const conversationOptions = {
includeAll: true, // Always include all data for conversations
maxPersonas: undefined, // No limit on personas
maxActsPerPersona: undefined // No limit on acts per persona
};
if (selectedCustomer) {
// Single customer conversations
const accessToken = await getValidAccessToken(selectedCustomer);
const client = await makeClient(verbose, accessToken);
console.log(`š¬ Pulling conversations for customer: ${selectedCustomer.idn} (all data)`);
await pullConversations(client, selectedCustomer, conversationOptions, verbose);
console.log(`ā
Conversations saved to newo_customers/${selectedCustomer.idn}/conversations.yaml`);
} else if (isMultiCustomer) {
// Multi-customer conversations
if (verbose) console.log(`š¬ No default customer specified, pulling conversations from all ${allCustomers.length} customers`);
console.log(`š¬ Pulling conversations from ${allCustomers.length} customers (all data)...`);
for (const customer of allCustomers) {
console.log(`\nš¬ Pulling conversations for customer: ${customer.idn}`);
const accessToken = await getValidAccessToken(customer);
const client = await makeClient(verbose, accessToken);
await pullConversations(client, customer, conversationOptions, verbose);
}
console.log(`\nā
Conversations pull completed for all ${allCustomers.length} customers`);
}
}