@chanl-ai/cli 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/bin/chanl.js +10 -0
  2. package/dist/__tests__/cli.test.d.ts +2 -0
  3. package/dist/__tests__/cli.test.js +2313 -0
  4. package/dist/__tests__/cli.test.js.map +1 -0
  5. package/dist/cli.d.ts +12 -0
  6. package/dist/cli.js +72 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/agents.d.ts +8 -0
  9. package/dist/commands/agents.js +671 -0
  10. package/dist/commands/agents.js.map +1 -0
  11. package/dist/commands/auth.d.ts +16 -0
  12. package/dist/commands/auth.js +294 -0
  13. package/dist/commands/auth.js.map +1 -0
  14. package/dist/commands/call.d.ts +8 -0
  15. package/dist/commands/call.js +166 -0
  16. package/dist/commands/call.js.map +1 -0
  17. package/dist/commands/calls.d.ts +8 -0
  18. package/dist/commands/calls.js +719 -0
  19. package/dist/commands/calls.js.map +1 -0
  20. package/dist/commands/chat.d.ts +8 -0
  21. package/dist/commands/chat.js +203 -0
  22. package/dist/commands/chat.js.map +1 -0
  23. package/dist/commands/config.d.ts +8 -0
  24. package/dist/commands/config.js +231 -0
  25. package/dist/commands/config.js.map +1 -0
  26. package/dist/commands/health.d.ts +8 -0
  27. package/dist/commands/health.js +55 -0
  28. package/dist/commands/health.js.map +1 -0
  29. package/dist/commands/index.d.ts +18 -0
  30. package/dist/commands/index.js +39 -0
  31. package/dist/commands/index.js.map +1 -0
  32. package/dist/commands/knowledge.d.ts +8 -0
  33. package/dist/commands/knowledge.js +539 -0
  34. package/dist/commands/knowledge.js.map +1 -0
  35. package/dist/commands/mcp.d.ts +8 -0
  36. package/dist/commands/mcp.js +589 -0
  37. package/dist/commands/mcp.js.map +1 -0
  38. package/dist/commands/memory.d.ts +8 -0
  39. package/dist/commands/memory.js +408 -0
  40. package/dist/commands/memory.js.map +1 -0
  41. package/dist/commands/personas.d.ts +8 -0
  42. package/dist/commands/personas.js +356 -0
  43. package/dist/commands/personas.js.map +1 -0
  44. package/dist/commands/prompts.d.ts +8 -0
  45. package/dist/commands/prompts.js +295 -0
  46. package/dist/commands/prompts.js.map +1 -0
  47. package/dist/commands/scenarios.d.ts +8 -0
  48. package/dist/commands/scenarios.js +591 -0
  49. package/dist/commands/scenarios.js.map +1 -0
  50. package/dist/commands/scorecards.d.ts +8 -0
  51. package/dist/commands/scorecards.js +570 -0
  52. package/dist/commands/scorecards.js.map +1 -0
  53. package/dist/commands/tools.d.ts +8 -0
  54. package/dist/commands/tools.js +632 -0
  55. package/dist/commands/tools.js.map +1 -0
  56. package/dist/commands/toolsets.d.ts +8 -0
  57. package/dist/commands/toolsets.js +464 -0
  58. package/dist/commands/toolsets.js.map +1 -0
  59. package/dist/commands/workspaces.d.ts +8 -0
  60. package/dist/commands/workspaces.js +170 -0
  61. package/dist/commands/workspaces.js.map +1 -0
  62. package/dist/index.d.ts +2 -0
  63. package/dist/index.js +6 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/utils/config-store.d.ts +117 -0
  66. package/dist/utils/config-store.js +191 -0
  67. package/dist/utils/config-store.js.map +1 -0
  68. package/dist/utils/interactive.d.ts +41 -0
  69. package/dist/utils/interactive.js +83 -0
  70. package/dist/utils/interactive.js.map +1 -0
  71. package/dist/utils/output.d.ts +100 -0
  72. package/dist/utils/output.js +221 -0
  73. package/dist/utils/output.js.map +1 -0
  74. package/dist/utils/sdk-factory.d.ts +15 -0
  75. package/dist/utils/sdk-factory.js +34 -0
  76. package/dist/utils/sdk-factory.js.map +1 -0
  77. package/package.json +67 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/mcp.ts"],"sourcesContent":["import { Command } from 'commander';\nimport ora from 'ora';\nimport chalk from 'chalk';\nimport type { McpConfigResponse, McpStatusResponse, McpTool, McpToolCallResult } from '@chanl-ai/sdk';\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';\nimport { configStore } from '../utils/config-store.js';\nimport { createSdk } from '../utils/sdk-factory.js';\nimport {\n printSuccess,\n printError,\n printInfo,\n printLabel,\n printBlank,\n printSimpleTable,\n isJsonOutput,\n printJson,\n} from '../utils/output.js';\n\n/**\n * Create the MCP command group\n */\nexport function createMcpCommand(): Command {\n const mcp = new Command('mcp')\n .description('MCP server configuration and status')\n .addHelpText(\n 'after',\n `\nWhat is MCP?\n Model Context Protocol (MCP) lets AI agents (Claude, Cursor, etc.) use your\n Chanl tools, knowledge base, and prompts. The MCP server bridges your workspace\n with AI clients.\n\nQuick Start:\n $ chanl mcp # Check server status\n $ chanl mcp test # Run protocol test\n $ chanl mcp config # Get config for your AI client\n\nConnecting AI Clients:\n 1. Run 'chanl mcp config --format claude' to get Claude Desktop config\n 2. Add the JSON to Claude Desktop's settings\n 3. Your Chanl tools will appear in Claude!`\n )\n .action(handleMcpDefault); // Default action when no subcommand\n\n // mcp info\n mcp\n .command('info')\n .description('Show MCP server URL, status, and resource counts')\n .addHelpText(\n 'after',\n `\nExample:\n $ chanl mcp info # Show server details\n $ chanl mcp info --json # Output as JSON`\n )\n .action(handleMcpInfo);\n\n // mcp status\n mcp\n .command('status')\n .description('Health check the MCP server')\n .addHelpText(\n 'after',\n `\nExample:\n $ chanl mcp status # Quick health check`\n )\n .action(handleMcpStatus);\n\n // mcp test\n mcp\n .command('test')\n .description('Run MCP protocol test with real MCP client')\n .addHelpText(\n 'after',\n `\nTests the full MCP protocol handshake:\n 1. Connect to MCP server\n 2. List available tools\n 3. List resources (knowledge base)\n 4. List prompts\n\nExample:\n $ chanl mcp test # Run all protocol tests\n $ chanl mcp test --json # Output results as JSON`\n )\n .action(handleMcpTest);\n\n // mcp config\n mcp\n .command('config')\n .description('Output MCP configuration for AI clients')\n .option('-f, --format <format>', 'Format: claude, cursor, generic', 'generic')\n .addHelpText(\n 'after',\n `\nGenerates configuration JSON for connecting AI clients to your MCP server.\n\nSupported formats:\n claude - Claude Desktop (claude_desktop_config.json)\n cursor - Cursor IDE settings\n generic - Generic MCP client format\n\nExamples:\n $ chanl mcp config # Generic format\n $ chanl mcp config --format claude # Claude Desktop format\n $ chanl mcp config --format cursor # Cursor IDE format\n $ chanl mcp config --format claude > config.json # Save to file\n\nSetup Claude Desktop:\n 1. Run: chanl mcp config --format claude\n 2. Copy the JSON output\n 3. Paste into ~/Library/Application Support/Claude/claude_desktop_config.json`\n )\n .action(handleMcpConfig);\n\n // mcp tools <agent-id>\n mcp\n .command('tools <agent-id>')\n .description('List MCP tools available for an agent')\n .addHelpText(\n 'after',\n `\nExample:\n $ chanl mcp tools agent_123 # List tools for agent\n $ chanl mcp tools agent_123 --json # Output as JSON`\n )\n .action(handleMcpTools);\n\n // mcp call <agent-id> <tool-name> [args]\n mcp\n .command('call <agent-id> <tool-name> [args]')\n .description('Call an MCP tool by name')\n .addHelpText(\n 'after',\n `\nExample:\n $ chanl mcp call agent_123 get_weather '{\"city\":\"London\"}'\n $ chanl mcp call agent_123 ping\n $ chanl mcp call agent_123 get_weather '{\"city\":\"London\"}' --json`\n )\n .action(handleMcpCall);\n\n // mcp inspect <agent-id> <tool-name>\n mcp\n .command('inspect <agent-id> <tool-name>')\n .description('Show schema and details for a specific MCP tool')\n .addHelpText(\n 'after',\n `\nExample:\n $ chanl mcp inspect agent_123 get_weather\n $ chanl mcp inspect agent_123 get_weather --json`\n )\n .action(handleMcpInspect);\n\n // mcp install\n mcp\n .command('install')\n .description('Generate MCP config snippet for editors (Cursor, VSCode, Claude)')\n .option('-f, --format <format>', 'Format: claude, cursor, vscode, generic', 'generic')\n .addHelpText(\n 'after',\n `\nGenerates a ready-to-use MCP configuration using your stored API key and workspace.\nNo server call needed — works offline.\n\nSupported formats:\n claude - Claude Desktop / Claude Code\n cursor - Cursor IDE\n vscode - Visual Studio Code\n generic - Generic MCP client (default)\n\nExamples:\n $ chanl mcp install # Generic format\n $ chanl mcp install --format claude # Claude Desktop format\n $ chanl mcp install --format cursor # Cursor IDE format\n $ chanl mcp install --format vscode # VSCode format\n $ chanl mcp install --format claude > mcp.json # Save to file`\n )\n .action(handleMcpInstall);\n\n return mcp;\n}\n\n/**\n * Handle mcp info command\n */\nasync function handleMcpInfo(): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const spinner = ora('Fetching MCP configuration...').start();\n\n try {\n const response = await sdk.mcp.getConfig();\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to fetch MCP configuration', response.message);\n process.exitCode = 1;\n return;\n }\n\n const config: McpConfigResponse = response.data;\n\n if (isJsonOutput()) {\n printJson(config);\n return;\n }\n\n printBlank();\n printSimpleTable(\n ['Property', 'Value'],\n [\n ['Server URL', config.serverUrl],\n ['Environment', config.environment],\n ['Status', config.status === 'active' ? chalk.green('active') : chalk.red('disabled')],\n ['Tools', config.toolCount.toString()],\n ['Resources', config.resourceCount.toString()],\n ['Prompts', config.promptCount.toString()],\n ...(config.toolsetName ? [['Toolset', config.toolsetName]] : []),\n ]\n );\n printBlank();\n } catch (error) {\n spinner.fail('Failed to fetch MCP configuration');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle mcp status command\n */\nasync function handleMcpStatus(): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const spinner = ora('Checking MCP server health...').start();\n\n try {\n const response = await sdk.mcp.getStatus();\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to check MCP status', response.message);\n process.exitCode = 1;\n return;\n }\n\n const status: McpStatusResponse = response.data;\n\n if (isJsonOutput()) {\n printJson(status);\n return;\n }\n\n printBlank();\n if (status.healthy) {\n printSuccess('MCP server is healthy');\n printLabel('Message', status.message);\n if (status.responseTimeMs) {\n printLabel('Response Time', status.responseTimeMs + 'ms');\n }\n } else {\n printError('MCP server is unhealthy', status.message);\n if (status.error) {\n printLabel('Error', status.error);\n }\n process.exitCode = 1;\n }\n printBlank();\n } catch (error) {\n spinner.fail('Failed to check MCP status');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle mcp config command\n */\nasync function handleMcpConfig(options: { format: string }): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const spinner = ora('Fetching MCP configuration...').start();\n\n try {\n const response = await sdk.mcp.getConfig();\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to fetch MCP configuration', response.message);\n process.exitCode = 1;\n return;\n }\n\n const config: McpConfigResponse = response.data;\n const format = options.format.toLowerCase();\n\n let output: unknown;\n\n switch (format) {\n case 'claude':\n output = config.agentConfigs.claude;\n break;\n case 'cursor':\n output = config.agentConfigs.cursor;\n break;\n case 'generic':\n default:\n output = config.agentConfigs.generic;\n break;\n }\n\n // Always output JSON for config command (it's meant to be piped/copied)\n printJson(output);\n\n if (!isJsonOutput()) {\n printBlank();\n printInfo(`Configuration for ${format} format. Copy and paste into your ${format === 'claude' ? 'Claude Desktop' : format === 'cursor' ? 'Cursor IDE' : 'MCP client'} configuration.`);\n printInfo(`Replace \\${CHANL_MCP_API_KEY} with your actual MCP API key.`);\n }\n } catch (error) {\n spinner.fail('Failed to fetch MCP configuration');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle bare 'chanl mcp' command (default)\n * Shows combined info + status\n */\nasync function handleMcpDefault(): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const spinner = ora('Checking MCP server...').start();\n\n try {\n // Fetch config and status in parallel\n const [configResponse, statusResponse] = await Promise.all([\n sdk.mcp.getConfig(),\n sdk.mcp.getStatus(),\n ]);\n\n spinner.stop();\n\n if (!configResponse.success || !configResponse.data) {\n printError('Failed to fetch MCP configuration', configResponse.message);\n process.exitCode = 1;\n return;\n }\n\n const config: McpConfigResponse = configResponse.data;\n const status: McpStatusResponse | undefined = statusResponse.data;\n\n if (isJsonOutput()) {\n printJson({ config, status });\n return;\n }\n\n // Format status indicator\n const statusIcon = status?.healthy ? chalk.green('✓') : chalk.red('✗');\n const statusText = status?.healthy ? 'Connected' : 'Unhealthy';\n const latency = status?.responseTimeMs ? ` (${status.responseTimeMs}ms)` : '';\n\n printBlank();\n console.log(chalk.bold('MCP Server'));\n console.log(chalk.dim('─'.repeat(40)));\n printLabel('Server URL', config.serverUrl);\n printLabel('Status', `${statusIcon} ${statusText}${latency}`);\n printLabel('Tools', `${config.toolCount} enabled`);\n printLabel('Resources', config.resourceCount.toString());\n printLabel('Prompts', config.promptCount.toString());\n console.log(chalk.dim('─'.repeat(40)));\n printBlank();\n\n if (!status?.healthy) {\n printInfo(\"Run 'chanl mcp test' for detailed diagnostics\");\n process.exitCode = 1;\n }\n } catch (error) {\n spinner.fail('Failed to check MCP server');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle mcp tools command\n * Lists MCP tools available for an agent\n */\nasync function handleMcpTools(agentId: string): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const spinner = ora('Fetching MCP tools...').start();\n\n try {\n const response = await sdk.mcp.listTools(agentId);\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to fetch MCP tools', response.message);\n process.exitCode = 1;\n return;\n }\n\n const tools: McpTool[] = response.data.tools;\n\n if (isJsonOutput()) {\n printJson({ tools });\n return;\n }\n\n if (tools.length === 0) {\n printBlank();\n printInfo('No MCP tools available for this agent');\n printBlank();\n return;\n }\n\n printBlank();\n printSimpleTable(\n ['Name', 'Description'],\n tools.map((t) => [\n t.name,\n t.description || chalk.dim('No description'),\n ])\n );\n printBlank();\n printInfo(`Total: ${tools.length} tool${tools.length === 1 ? '' : 's'}`);\n printBlank();\n } catch (error) {\n spinner.fail('Failed to fetch MCP tools');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle mcp call command\n * Calls an MCP tool by name with optional JSON arguments\n */\nasync function handleMcpCall(agentId: string, toolName: string, argsJson?: string): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n // Parse args if provided\n let args: Record<string, unknown> | undefined;\n if (argsJson) {\n try {\n args = JSON.parse(argsJson) as Record<string, unknown>;\n } catch {\n printError('Invalid JSON arguments', `Could not parse: ${argsJson}`);\n process.exitCode = 1;\n return;\n }\n }\n\n const spinner = ora(`Calling tool '${toolName}'...`).start();\n\n try {\n const response = await sdk.mcp.callTool(agentId, toolName, args);\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to call tool', response.message);\n process.exitCode = 1;\n return;\n }\n\n const result: McpToolCallResult = response.data;\n\n if (isJsonOutput()) {\n printJson(result);\n return;\n }\n\n // Check if tool returned an error\n if (result.isError) {\n for (const item of result.content) {\n if (item.text) {\n printError('Tool returned an error', item.text);\n }\n }\n process.exitCode = 1;\n return;\n }\n\n // Display result content\n printBlank();\n for (const item of result.content) {\n if (item.text) {\n console.log(item.text);\n } else {\n // Non-text content: display as JSON\n printJson(item);\n }\n }\n printBlank();\n } catch (error) {\n spinner.fail('Failed to call tool');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle mcp inspect command\n * Shows schema and details for a specific MCP tool\n */\nasync function handleMcpInspect(agentId: string, toolName: string): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const spinner = ora(`Fetching tool '${toolName}'...`).start();\n\n try {\n const response = await sdk.mcp.getTool(agentId, toolName);\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to fetch tool details', response.message);\n process.exitCode = 1;\n return;\n }\n\n const tool: McpTool = response.data.tool;\n\n if (isJsonOutput()) {\n printJson(tool);\n return;\n }\n\n printBlank();\n console.log(chalk.bold(tool.name));\n console.log(chalk.dim('─'.repeat(40)));\n if (tool.description) {\n printLabel('Description', tool.description);\n }\n printBlank();\n\n // Display input schema\n console.log(chalk.bold('Input Schema'));\n console.log(chalk.dim('─'.repeat(40)));\n\n const schema = tool.inputSchema;\n const properties = schema['properties'] as Record<string, Record<string, unknown>> | undefined;\n const required = (schema['required'] as string[]) || [];\n\n if (properties) {\n const rows: string[][] = [];\n for (const [name, prop] of Object.entries(properties)) {\n const isRequired = required.includes(name);\n const typeStr = String(prop['type'] || 'any');\n const desc = String(prop['description'] || '');\n const reqStr = isRequired ? chalk.red('*') : ' ';\n rows.push([`${reqStr} ${name}`, typeStr, desc]);\n }\n printSimpleTable(['Parameter', 'Type', 'Description'], rows);\n } else {\n printInfo('No parameters defined');\n }\n\n printBlank();\n } catch (error) {\n spinner.fail('Failed to fetch tool details');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle mcp install command\n * Generates MCP config snippets for various editors, using stored API key\n */\nasync function handleMcpInstall(options: { format: string }): Promise<void> {\n const apiKey = configStore.getApiKey();\n if (!apiKey) {\n printError('Not authenticated', \"Run 'chanl login' to authenticate first\");\n process.exitCode = 1;\n return;\n }\n\n const baseUrl = configStore.getBaseUrl() || 'https://api.chanl.ai';\n // Derive MCP server URL from base URL\n // Production: https://api.chanl.ai -> workspace.chanl.app/mcp (generic)\n // For install, use the base URL with /mcp path\n const mcpUrl = baseUrl.replace(/\\/$/, '') + '/mcp';\n\n const format = options.format.toLowerCase();\n\n const serverConfig = {\n url: mcpUrl,\n headers: { 'X-API-Key': apiKey },\n transport: 'streamable-http' as const,\n };\n\n let output: unknown;\n\n switch (format) {\n case 'claude':\n output = {\n mcpServers: {\n chanl: serverConfig,\n },\n };\n break;\n case 'cursor':\n output = {\n mcpServers: {\n chanl: serverConfig,\n },\n };\n break;\n case 'vscode':\n output = {\n mcpServers: {\n chanl: serverConfig,\n },\n };\n break;\n case 'generic':\n default:\n output = {\n mcpServers: {\n chanl: serverConfig,\n },\n };\n break;\n }\n\n // Always output JSON (config is meant to be copied)\n printJson(output);\n\n if (!isJsonOutput()) {\n printBlank();\n const targetName =\n format === 'claude' ? 'Claude Desktop / Claude Code' :\n format === 'cursor' ? 'Cursor IDE' :\n format === 'vscode' ? 'Visual Studio Code' :\n 'your MCP client';\n printInfo(`Copy the JSON above into your ${targetName} configuration.`);\n printBlank();\n }\n}\n\n/**\n * Handle mcp test command\n * Runs real MCP protocol test using @modelcontextprotocol/sdk\n */\nasync function handleMcpTest(): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n // First get the MCP config to know the server URL\n const spinner = ora('Fetching MCP configuration...').start();\n\n let config: McpConfigResponse;\n try {\n const configResponse = await sdk.mcp.getConfig();\n if (!configResponse.success || !configResponse.data) {\n spinner.fail('Failed to fetch MCP configuration');\n printError('Error', configResponse.message || 'Unknown error');\n process.exitCode = 1;\n return;\n }\n config = configResponse.data;\n } catch (error) {\n spinner.fail('Failed to fetch MCP configuration');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n return;\n }\n\n spinner.text = 'Running MCP protocol test...';\n\n // Get API key for MCP authentication\n // Use MCP_API_KEY env var if set (for local dev), otherwise fall back to stored key\n const apiKey = process.env.MCP_API_KEY || configStore.getApiKey();\n if (!apiKey) {\n spinner.fail('No API key available');\n printError('Error', 'API key required for MCP test. Set MCP_API_KEY env var for local dev.');\n process.exitCode = 1;\n return;\n }\n\n const results: { test: string; passed: boolean; detail: string }[] = [];\n\n try {\n // Create MCP client with Streamable HTTP transport\n const transport = new StreamableHTTPClientTransport(new URL(config.serverUrl), {\n requestInit: {\n headers: { 'X-API-Key': apiKey },\n },\n });\n\n const client = new Client(\n { name: 'chanl-cli', version: '1.0.0' },\n { capabilities: {} }\n );\n\n // Test 1: Connect\n spinner.text = 'Connecting to MCP server...';\n const connectStart = Date.now();\n await client.connect(transport);\n const connectTime = Date.now() - connectStart;\n results.push({ test: 'Connection', passed: true, detail: `${connectTime}ms` });\n\n // Test 2: List tools\n spinner.text = 'Testing tools/list...';\n try {\n const tools = await client.listTools();\n results.push({ test: 'tools/list', passed: true, detail: `${tools.tools.length} tools` });\n } catch (err) {\n results.push({ test: 'tools/list', passed: false, detail: err instanceof Error ? err.message : 'Failed' });\n }\n\n // Test 3: List resources\n spinner.text = 'Testing resources/list...';\n try {\n const resources = await client.listResources();\n results.push({ test: 'resources/list', passed: true, detail: `${resources.resources.length} resources` });\n } catch (err) {\n // Resources may not be available (no knowledge base)\n results.push({ test: 'resources/list', passed: true, detail: 'N/A (no knowledge base)' });\n }\n\n // Test 4: List prompts\n spinner.text = 'Testing prompts/list...';\n try {\n const prompts = await client.listPrompts();\n results.push({ test: 'prompts/list', passed: true, detail: `${prompts.prompts.length} prompts` });\n } catch (err) {\n results.push({ test: 'prompts/list', passed: true, detail: 'N/A' });\n }\n\n await client.close();\n spinner.stop();\n\n // Output results\n if (isJsonOutput()) {\n printJson({ serverUrl: config.serverUrl, results });\n return;\n }\n\n printBlank();\n console.log(chalk.bold('🧪 MCP Protocol Test'));\n console.log(chalk.dim('─'.repeat(50)));\n printLabel('Server', config.serverUrl);\n console.log(chalk.dim('─'.repeat(50)));\n\n let allPassed = true;\n for (const result of results) {\n const icon = result.passed ? chalk.green('✓') : chalk.red('✗');\n console.log(`${icon} ${result.test}: ${result.detail}`);\n if (!result.passed) allPassed = false;\n }\n\n console.log(chalk.dim('─'.repeat(50)));\n\n if (allPassed) {\n printSuccess('All tests passed');\n } else {\n printError('Some tests failed', 'Check the results above');\n process.exitCode = 1;\n }\n printBlank();\n } catch (error) {\n spinner.fail('MCP protocol test failed');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Connection failed', message);\n printInfo('Make sure the MCP server is running and accessible');\n process.exitCode = 1;\n }\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,OAAO,SAAS;AAChB,OAAO,WAAW;AAElB,SAAS,cAAc;AACvB,SAAS,qCAAqC;AAC9C,SAAS,mBAAmB;AAC5B,SAAS,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AM,CAAC;AAAA,IACpE;AAEA,UAAM,OAAO,MAAM;AACnB,YAAQ,KAAK;AAGb,QAAI,aAAa,GAAG;AAClB,gBAAU,EAAE,WAAW,OAAO,WAAW,QAAQ,CAAC;AAClD;AAAA,IACF;AAEA,eAAW;AACX,YAAQ,IAAI,MAAM,KAAK,6BAAsB,CAAC;AAC9C,YAAQ,IAAI,MAAM,IAAI,SAAI,OAAO,EAAE,CAAC,CAAC;AACrC,eAAW,UAAU,OAAO,SAAS;AACrC,YAAQ,IAAI,MAAM,IAAI,SAAI,OAAO,EAAE,CAAC,CAAC;AAErC,QAAI,YAAY;AAChB,eAAW,UAAU,SAAS;AAC5B,YAAM,OAAO,OAAO,SAAS,MAAM,MAAM,QAAG,IAAI,MAAM,IAAI,QAAG;AAC7D,cAAQ,IAAI,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,OAAO,MAAM,EAAE;AACtD,UAAI,CAAC,OAAO,OAAQ,aAAY;AAAA,IAClC;AAEA,YAAQ,IAAI,MAAM,IAAI,SAAI,OAAO,EAAE,CAAC,CAAC;AAErC,QAAI,WAAW;AACb,mBAAa,kBAAkB;AAAA,IACjC,OAAO;AACL,iBAAW,qBAAqB,yBAAyB;AACzD,cAAQ,WAAW;AAAA,IACrB;AACA,eAAW;AAAA,EACb,SAAS,OAAO;AACd,YAAQ,KAAK,0BAA0B;AACvC,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,eAAW,qBAAqB,OAAO;AACvC,cAAU,oDAAoD;AAC9D,YAAQ,WAAW;AAAA,EACrB;AACF;","names":[]}
@@ -0,0 +1,8 @@
1
+ import { Command } from 'commander';
2
+
3
+ /**
4
+ * Create the memory command group
5
+ */
6
+ declare function createMemoryCommand(): Command;
7
+
8
+ export { createMemoryCommand };
@@ -0,0 +1,408 @@
1
+ import { Command } from "commander";
2
+ import { readFile } from "fs/promises";
3
+ import { confirm } from "@inquirer/prompts";
4
+ import ora from "ora";
5
+ import chalk from "chalk";
6
+ import { createSdk } from "../utils/sdk-factory.js";
7
+ import {
8
+ printSuccess,
9
+ printError,
10
+ printInfo,
11
+ printLabel,
12
+ printBlank,
13
+ printSimpleTable,
14
+ isJsonOutput,
15
+ printJson,
16
+ formatDate
17
+ } from "../utils/output.js";
18
+ function createMemoryCommand() {
19
+ const memory = new Command("memory").description("Manage agent memory");
20
+ memory.command("list").description("List memories with optional filters").option("--entity-type <type>", "Filter by entity type: customer, session, agent, conversation").option("--entity-id <id>", "Filter by entity ID").option("--agent-id <id>", "Filter by agent ID").option("--source <source>", "Filter by source: conversation, manual, extraction").option("-l, --limit <number>", "Items per page (default: 20)", "20").option("-p, --page <number>", "Page number (default: 1)", "1").addHelpText(
21
+ "after",
22
+ `
23
+ Examples:
24
+ $ chanl memory list # List all memories
25
+ $ chanl memory list --entity-type customer # Filter by entity type
26
+ $ chanl memory list --entity-id cust_123 --limit 10 # Filter by entity ID
27
+ $ chanl memory list --agent-id agent_abc # Filter by agent
28
+ $ chanl memory list --source manual # Filter by source
29
+ $ chanl memory list --json # Output as JSON`
30
+ ).action(handleMemoryList);
31
+ memory.command("get <id>").description("Get detailed info about a memory").addHelpText(
32
+ "after",
33
+ `
34
+ Examples:
35
+ $ chanl memory get 680a1b2c3d4e5f6789012345
36
+ $ chanl memory get 680a1b2c3d4e5f6789012345 --json`
37
+ ).action(handleMemoryGet);
38
+ memory.command("create").description("Create a new memory").option("--entity-type <type>", "Entity type: customer, session, agent, conversation").option("--entity-id <id>", "Entity ID").option("--content <text>", "Memory content text").option("--agent-id <id>", "Optional agent scope").option("--source <source>", "Source: conversation, manual, extraction").option("--ttl <seconds>", "Time-to-live in seconds").option("-f, --file <path>", "Path to JSON file with memory definition (overrides other options)").addHelpText(
39
+ "after",
40
+ `
41
+ Examples:
42
+ $ chanl memory create --entity-type customer --entity-id cust_123 --content "Prefers email"
43
+ $ chanl memory create --entity-type customer --entity-id cust_123 --content "VIP" --source manual
44
+ $ chanl memory create --entity-type customer --entity-id cust_123 --content "Note" --ttl 86400
45
+ $ chanl memory create -f memory.json
46
+
47
+ Required (unless using -f):
48
+ --entity-type Entity type
49
+ --entity-id Entity ID
50
+ --content Memory content text
51
+
52
+ Optional:
53
+ --agent-id Scope to a specific agent
54
+ --source Memory source (sets metadata.source)
55
+ --ttl TTL in seconds
56
+ -f, --file JSON file (overrides all other options)`
57
+ ).action(handleMemoryCreate);
58
+ memory.command("update <id>").description("Update an existing memory").option("--content <text>", "Updated content text").option("--deactivate", "Deactivate the memory (sets isActive: false)").option("--activate", "Reactivate the memory (sets isActive: true)").addHelpText(
59
+ "after",
60
+ `
61
+ Examples:
62
+ $ chanl memory update 680a1b2c3d4e5f6789012345 --content "Updated preference"
63
+ $ chanl memory update 680a1b2c3d4e5f6789012345 --deactivate
64
+ $ chanl memory update 680a1b2c3d4e5f6789012345 --activate
65
+ $ chanl memory update 680a1b2c3d4e5f6789012345 --content "New text" --deactivate`
66
+ ).action(handleMemoryUpdate);
67
+ memory.command("delete <id>").description("Delete a memory permanently").option("-y, --yes", "Skip confirmation prompt").addHelpText(
68
+ "after",
69
+ `
70
+ Examples:
71
+ $ chanl memory delete 680a1b2c3d4e5f6789012345 # With confirmation
72
+ $ chanl memory delete 680a1b2c3d4e5f6789012345 -y # Skip confirmation`
73
+ ).action(handleMemoryDelete);
74
+ memory.command("search").description("Search memories using semantic similarity").option("--entity-type <type>", "Entity type (required): customer, session, agent, conversation").option("--entity-id <id>", "Entity ID (required)").option("--query <text>", "Search query text (required)").option("--agent-id <id>", "Optional agent scope filter").option("-l, --limit <number>", "Maximum results").option("--min-score <number>", "Minimum relevance score (0-1)").addHelpText(
75
+ "after",
76
+ `
77
+ Examples:
78
+ $ chanl memory search --entity-type customer --entity-id cust_123 --query "email preferences"
79
+ $ chanl memory search --entity-type customer --entity-id cust_123 --query "contact" --limit 5
80
+ $ chanl memory search --entity-type customer --entity-id cust_123 --query "VIP" --min-score 0.8
81
+ $ chanl memory search --entity-type customer --entity-id cust_123 --query "test" --json`
82
+ ).action(handleMemorySearch);
83
+ return memory;
84
+ }
85
+ function truncate(str, maxLen) {
86
+ if (str.length <= maxLen) return str;
87
+ return str.substring(0, maxLen - 3) + "...";
88
+ }
89
+ async function handleMemoryList(options) {
90
+ const sdk = createSdk();
91
+ if (!sdk) return;
92
+ const spinner = ora("Fetching memories...").start();
93
+ try {
94
+ const response = await sdk.memory.list({
95
+ entityType: options.entityType,
96
+ entityId: options.entityId,
97
+ agentId: options.agentId,
98
+ source: options.source,
99
+ limit: parseInt(options.limit, 10),
100
+ page: parseInt(options.page, 10)
101
+ });
102
+ spinner.stop();
103
+ if (!response.success || !response.data) {
104
+ printError("Failed to fetch memories", response.message);
105
+ process.exitCode = 1;
106
+ return;
107
+ }
108
+ const { memories, total, pagination } = response.data;
109
+ if (isJsonOutput()) {
110
+ printJson({ memories, total, pagination });
111
+ return;
112
+ }
113
+ if (memories.length === 0) {
114
+ printInfo("No memories found");
115
+ return;
116
+ }
117
+ printBlank();
118
+ printSimpleTable(
119
+ ["ID", "Entity Type", "Entity ID", "Content", "Source", "Active", "Created"],
120
+ memories.map((m) => [
121
+ truncate(m.id, 12),
122
+ m.entityType,
123
+ m.entityId,
124
+ truncate(m.content, 50),
125
+ m.metadata?.source || "unknown",
126
+ m.isActive ? chalk.green("Yes") : chalk.red("No"),
127
+ formatDate(m.createdAt)
128
+ ])
129
+ );
130
+ printBlank();
131
+ if (pagination) {
132
+ printInfo(`Total: ${total} memories (Page ${pagination.page} of ${pagination.totalPages})`);
133
+ } else {
134
+ printInfo(`Total: ${total} memories`);
135
+ }
136
+ } catch (error) {
137
+ spinner.fail("Failed to fetch memories");
138
+ const message = error instanceof Error ? error.message : "Unknown error";
139
+ printError("Error", message);
140
+ process.exitCode = 1;
141
+ }
142
+ }
143
+ async function handleMemoryGet(id) {
144
+ const sdk = createSdk();
145
+ if (!sdk) return;
146
+ const spinner = ora("Fetching memory...").start();
147
+ try {
148
+ const response = await sdk.memory.get(id);
149
+ spinner.stop();
150
+ if (!response.success || !response.data) {
151
+ printError("Failed to fetch memory", response.message);
152
+ process.exitCode = 1;
153
+ return;
154
+ }
155
+ const { memory } = response.data;
156
+ if (isJsonOutput()) {
157
+ printJson(memory);
158
+ return;
159
+ }
160
+ printBlank();
161
+ printMemoryDetails(memory);
162
+ } catch (error) {
163
+ spinner.fail("Failed to fetch memory");
164
+ const message = error instanceof Error ? error.message : "Unknown error";
165
+ printError("Error", message);
166
+ process.exitCode = 1;
167
+ }
168
+ }
169
+ async function handleMemoryCreate(options) {
170
+ const sdk = createSdk();
171
+ if (!sdk) return;
172
+ let input;
173
+ if (options.file) {
174
+ try {
175
+ const content = await readFile(options.file, "utf-8");
176
+ input = JSON.parse(content);
177
+ } catch (error) {
178
+ const message = error instanceof Error ? error.message : "Unknown error";
179
+ printError("Failed to read file", message);
180
+ process.exitCode = 1;
181
+ return;
182
+ }
183
+ } else {
184
+ if (!options.entityType || !options.entityId || !options.content) {
185
+ printError(
186
+ "Missing required options",
187
+ "Provide --entity-type, --entity-id, and --content, or use '-f <path>' for JSON file"
188
+ );
189
+ printInfo("Run 'chanl memory create --help' for usage");
190
+ process.exitCode = 1;
191
+ return;
192
+ }
193
+ input = {
194
+ entityType: options.entityType,
195
+ entityId: options.entityId,
196
+ content: options.content
197
+ };
198
+ if (options.agentId) {
199
+ input.agentId = options.agentId;
200
+ }
201
+ if (options.source) {
202
+ input.metadata = { ...input.metadata, source: options.source };
203
+ }
204
+ if (options.ttl) {
205
+ const ttl = parseInt(options.ttl, 10);
206
+ if (isNaN(ttl) || ttl <= 0) {
207
+ printError("Invalid TTL value", "TTL must be a positive number of seconds");
208
+ process.exitCode = 1;
209
+ return;
210
+ }
211
+ input.ttlSeconds = ttl;
212
+ }
213
+ }
214
+ const spinner = ora("Creating memory...").start();
215
+ try {
216
+ const response = await sdk.memory.create(input);
217
+ spinner.stop();
218
+ if (!response.success || !response.data) {
219
+ printError("Failed to create memory", response.message);
220
+ process.exitCode = 1;
221
+ return;
222
+ }
223
+ const { memory } = response.data;
224
+ if (isJsonOutput()) {
225
+ printJson({ success: true, memory });
226
+ return;
227
+ }
228
+ printSuccess(`Created memory: ${memory.id}`);
229
+ } catch (error) {
230
+ spinner.fail("Failed to create memory");
231
+ const message = error instanceof Error ? error.message : "Unknown error";
232
+ printError("Error", message);
233
+ process.exitCode = 1;
234
+ }
235
+ }
236
+ async function handleMemoryUpdate(id, options) {
237
+ const sdk = createSdk();
238
+ if (!sdk) return;
239
+ const input = {};
240
+ if (options.content) {
241
+ input.content = options.content;
242
+ }
243
+ if (options.deactivate) {
244
+ input.isActive = false;
245
+ }
246
+ if (options.activate) {
247
+ input.isActive = true;
248
+ }
249
+ if (!options.content && !options.deactivate && !options.activate) {
250
+ printError("No updates specified", "Provide --content, --deactivate, or --activate");
251
+ process.exitCode = 1;
252
+ return;
253
+ }
254
+ const spinner = ora("Updating memory...").start();
255
+ try {
256
+ const response = await sdk.memory.update(id, input);
257
+ spinner.stop();
258
+ if (!response.success || !response.data) {
259
+ printError("Failed to update memory", response.message);
260
+ process.exitCode = 1;
261
+ return;
262
+ }
263
+ const { memory } = response.data;
264
+ if (isJsonOutput()) {
265
+ printJson({ success: true, memory });
266
+ return;
267
+ }
268
+ printSuccess(`Updated memory: ${memory.id}`);
269
+ } catch (error) {
270
+ spinner.fail("Failed to update memory");
271
+ const message = error instanceof Error ? error.message : "Unknown error";
272
+ printError("Error", message);
273
+ process.exitCode = 1;
274
+ }
275
+ }
276
+ async function handleMemoryDelete(id, options) {
277
+ const sdk = createSdk();
278
+ if (!sdk) return;
279
+ if (!options.yes) {
280
+ try {
281
+ const confirmed = await confirm({
282
+ message: `Are you sure you want to delete memory '${id}'?`,
283
+ default: false
284
+ });
285
+ if (!confirmed) {
286
+ printInfo("Deletion cancelled");
287
+ return;
288
+ }
289
+ } catch {
290
+ printBlank();
291
+ printInfo("Deletion cancelled");
292
+ return;
293
+ }
294
+ }
295
+ const spinner = ora("Deleting memory...").start();
296
+ try {
297
+ const response = await sdk.memory.delete(id);
298
+ spinner.stop();
299
+ if (!response.success) {
300
+ printError("Failed to delete memory", response.message);
301
+ process.exitCode = 1;
302
+ return;
303
+ }
304
+ if (isJsonOutput()) {
305
+ printJson({ success: true, deleted: true, id });
306
+ return;
307
+ }
308
+ printSuccess(`Deleted memory: ${id}`);
309
+ } catch (error) {
310
+ spinner.fail("Failed to delete memory");
311
+ const message = error instanceof Error ? error.message : "Unknown error";
312
+ printError("Error", message);
313
+ process.exitCode = 1;
314
+ }
315
+ }
316
+ async function handleMemorySearch(options) {
317
+ if (!options.entityType || !options.entityId || !options.query) {
318
+ printError("Missing required options", "Provide --entity-type, --entity-id, and --query");
319
+ printInfo("Run 'chanl memory search --help' for usage");
320
+ process.exitCode = 1;
321
+ return;
322
+ }
323
+ const sdk = createSdk();
324
+ if (!sdk) return;
325
+ const input = {
326
+ entityType: options.entityType,
327
+ entityId: options.entityId,
328
+ query: options.query
329
+ };
330
+ if (options.agentId) {
331
+ input.agentId = options.agentId;
332
+ }
333
+ if (options.limit) {
334
+ input.limit = parseInt(options.limit, 10);
335
+ }
336
+ if (options.minScore) {
337
+ input.minScore = parseFloat(options.minScore);
338
+ }
339
+ const spinner = ora("Searching memories...").start();
340
+ try {
341
+ const response = await sdk.memory.search(input);
342
+ spinner.stop();
343
+ if (!response.success || !response.data) {
344
+ printError("Failed to search memories", response.message);
345
+ process.exitCode = 1;
346
+ return;
347
+ }
348
+ const { memories } = response.data;
349
+ if (isJsonOutput()) {
350
+ printJson({ memories });
351
+ return;
352
+ }
353
+ if (memories.length === 0) {
354
+ printInfo("No matching memories found");
355
+ return;
356
+ }
357
+ printBlank();
358
+ printSimpleTable(
359
+ ["ID", "Score", "Content", "Entity Type", "Entity ID"],
360
+ memories.map((m) => [
361
+ truncate(m.id, 12),
362
+ (m.score ?? 0).toFixed(2),
363
+ truncate(m.content, 50),
364
+ m.entityType,
365
+ m.entityId
366
+ ])
367
+ );
368
+ printBlank();
369
+ printInfo(`Found ${memories.length} matching memories`);
370
+ } catch (error) {
371
+ spinner.fail("Failed to search memories");
372
+ const message = error instanceof Error ? error.message : "Unknown error";
373
+ printError("Error", message);
374
+ process.exitCode = 1;
375
+ }
376
+ }
377
+ function printMemoryDetails(memory) {
378
+ printLabel("ID", memory.id);
379
+ printLabel("Entity Type", memory.entityType);
380
+ printLabel("Entity ID", memory.entityId);
381
+ printBlank();
382
+ printInfo("Content:");
383
+ console.log(chalk.gray(memory.content));
384
+ if (memory.agentId) {
385
+ printBlank();
386
+ printLabel("Agent ID", memory.agentId);
387
+ }
388
+ printBlank();
389
+ printLabel("Active", memory.isActive ? chalk.green("Yes") : chalk.red("No"));
390
+ if (memory.metadata && Object.keys(memory.metadata).length > 0) {
391
+ printBlank();
392
+ printInfo("Metadata:");
393
+ console.log(chalk.gray(JSON.stringify(memory.metadata, null, 2)));
394
+ }
395
+ if (memory.expiresAt) {
396
+ printLabel("Expires", formatDate(memory.expiresAt));
397
+ }
398
+ printBlank();
399
+ printLabel("Created", formatDate(memory.createdAt));
400
+ if (memory.updatedAt) {
401
+ printLabel("Updated", formatDate(memory.updatedAt));
402
+ }
403
+ printBlank();
404
+ }
405
+ export {
406
+ createMemoryCommand
407
+ };
408
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/memory.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { readFile } from 'fs/promises';\nimport { confirm } from '@inquirer/prompts';\nimport ora from 'ora';\nimport chalk from 'chalk';\nimport type {\n Memory,\n MemorySearchResult,\n CreateMemoryInput,\n UpdateMemoryInput,\n SearchMemoryInput,\n MemoryEntityType,\n MemorySource,\n} from '@chanl-ai/sdk';\nimport { createSdk } from '../utils/sdk-factory.js';\nimport {\n printSuccess,\n printError,\n printInfo,\n printLabel,\n printBlank,\n printSimpleTable,\n isJsonOutput,\n printJson,\n formatDate,\n} from '../utils/output.js';\n\n/**\n * Create the memory command group\n */\nexport function createMemoryCommand(): Command {\n const memory = new Command('memory').description('Manage agent memory');\n\n // memory list\n memory\n .command('list')\n .description('List memories with optional filters')\n .option('--entity-type <type>', 'Filter by entity type: customer, session, agent, conversation')\n .option('--entity-id <id>', 'Filter by entity ID')\n .option('--agent-id <id>', 'Filter by agent ID')\n .option('--source <source>', 'Filter by source: conversation, manual, extraction')\n .option('-l, --limit <number>', 'Items per page (default: 20)', '20')\n .option('-p, --page <number>', 'Page number (default: 1)', '1')\n .addHelpText(\n 'after',\n `\nExamples:\n $ chanl memory list # List all memories\n $ chanl memory list --entity-type customer # Filter by entity type\n $ chanl memory list --entity-id cust_123 --limit 10 # Filter by entity ID\n $ chanl memory list --agent-id agent_abc # Filter by agent\n $ chanl memory list --source manual # Filter by source\n $ chanl memory list --json # Output as JSON`\n )\n .action(handleMemoryList);\n\n // memory get <id>\n memory\n .command('get <id>')\n .description('Get detailed info about a memory')\n .addHelpText(\n 'after',\n `\nExamples:\n $ chanl memory get 680a1b2c3d4e5f6789012345\n $ chanl memory get 680a1b2c3d4e5f6789012345 --json`\n )\n .action(handleMemoryGet);\n\n // memory create\n memory\n .command('create')\n .description('Create a new memory')\n .option('--entity-type <type>', 'Entity type: customer, session, agent, conversation')\n .option('--entity-id <id>', 'Entity ID')\n .option('--content <text>', 'Memory content text')\n .option('--agent-id <id>', 'Optional agent scope')\n .option('--source <source>', 'Source: conversation, manual, extraction')\n .option('--ttl <seconds>', 'Time-to-live in seconds')\n .option('-f, --file <path>', 'Path to JSON file with memory definition (overrides other options)')\n .addHelpText(\n 'after',\n `\nExamples:\n $ chanl memory create --entity-type customer --entity-id cust_123 --content \"Prefers email\"\n $ chanl memory create --entity-type customer --entity-id cust_123 --content \"VIP\" --source manual\n $ chanl memory create --entity-type customer --entity-id cust_123 --content \"Note\" --ttl 86400\n $ chanl memory create -f memory.json\n\nRequired (unless using -f):\n --entity-type Entity type\n --entity-id Entity ID\n --content Memory content text\n\nOptional:\n --agent-id Scope to a specific agent\n --source Memory source (sets metadata.source)\n --ttl TTL in seconds\n -f, --file JSON file (overrides all other options)`\n )\n .action(handleMemoryCreate);\n\n // memory update <id>\n memory\n .command('update <id>')\n .description('Update an existing memory')\n .option('--content <text>', 'Updated content text')\n .option('--deactivate', 'Deactivate the memory (sets isActive: false)')\n .option('--activate', 'Reactivate the memory (sets isActive: true)')\n .addHelpText(\n 'after',\n `\nExamples:\n $ chanl memory update 680a1b2c3d4e5f6789012345 --content \"Updated preference\"\n $ chanl memory update 680a1b2c3d4e5f6789012345 --deactivate\n $ chanl memory update 680a1b2c3d4e5f6789012345 --activate\n $ chanl memory update 680a1b2c3d4e5f6789012345 --content \"New text\" --deactivate`\n )\n .action(handleMemoryUpdate);\n\n // memory delete <id>\n memory\n .command('delete <id>')\n .description('Delete a memory permanently')\n .option('-y, --yes', 'Skip confirmation prompt')\n .addHelpText(\n 'after',\n `\nExamples:\n $ chanl memory delete 680a1b2c3d4e5f6789012345 # With confirmation\n $ chanl memory delete 680a1b2c3d4e5f6789012345 -y # Skip confirmation`\n )\n .action(handleMemoryDelete);\n\n // memory search\n memory\n .command('search')\n .description('Search memories using semantic similarity')\n .option('--entity-type <type>', 'Entity type (required): customer, session, agent, conversation')\n .option('--entity-id <id>', 'Entity ID (required)')\n .option('--query <text>', 'Search query text (required)')\n .option('--agent-id <id>', 'Optional agent scope filter')\n .option('-l, --limit <number>', 'Maximum results')\n .option('--min-score <number>', 'Minimum relevance score (0-1)')\n .addHelpText(\n 'after',\n `\nExamples:\n $ chanl memory search --entity-type customer --entity-id cust_123 --query \"email preferences\"\n $ chanl memory search --entity-type customer --entity-id cust_123 --query \"contact\" --limit 5\n $ chanl memory search --entity-type customer --entity-id cust_123 --query \"VIP\" --min-score 0.8\n $ chanl memory search --entity-type customer --entity-id cust_123 --query \"test\" --json`\n )\n .action(handleMemorySearch);\n\n return memory;\n}\n\n// ============================================================================\n// Helpers (module-local)\n// ============================================================================\n\n/**\n * Truncate a string to a max length, appending '...' if truncated\n */\nfunction truncate(str: string, maxLen: number): string {\n if (str.length <= maxLen) return str;\n return str.substring(0, maxLen - 3) + '...';\n}\n\n// ============================================================================\n// Command Handlers\n// ============================================================================\n\n/**\n * Handle memory list command\n */\nasync function handleMemoryList(options: {\n entityType?: string;\n entityId?: string;\n agentId?: string;\n source?: string;\n limit: string;\n page: string;\n}): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const spinner = ora('Fetching memories...').start();\n\n try {\n const response = await sdk.memory.list({\n entityType: options.entityType as MemoryEntityType | undefined,\n entityId: options.entityId,\n agentId: options.agentId,\n source: options.source as MemorySource | undefined,\n limit: parseInt(options.limit, 10),\n page: parseInt(options.page, 10),\n });\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to fetch memories', response.message);\n process.exitCode = 1;\n return;\n }\n\n const { memories, total, pagination } = response.data;\n\n if (isJsonOutput()) {\n printJson({ memories, total, pagination });\n return;\n }\n\n if (memories.length === 0) {\n printInfo('No memories found');\n return;\n }\n\n printBlank();\n printSimpleTable(\n ['ID', 'Entity Type', 'Entity ID', 'Content', 'Source', 'Active', 'Created'],\n memories.map((m: Memory) => [\n truncate(m.id, 12),\n m.entityType,\n m.entityId,\n truncate(m.content, 50),\n m.metadata?.source || 'unknown',\n m.isActive ? chalk.green('Yes') : chalk.red('No'),\n formatDate(m.createdAt),\n ])\n );\n\n printBlank();\n if (pagination) {\n printInfo(`Total: ${total} memories (Page ${pagination.page} of ${pagination.totalPages})`);\n } else {\n printInfo(`Total: ${total} memories`);\n }\n } catch (error) {\n spinner.fail('Failed to fetch memories');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle memory get command\n */\nasync function handleMemoryGet(id: string): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const spinner = ora('Fetching memory...').start();\n\n try {\n const response = await sdk.memory.get(id);\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to fetch memory', response.message);\n process.exitCode = 1;\n return;\n }\n\n const { memory } = response.data;\n\n if (isJsonOutput()) {\n printJson(memory);\n return;\n }\n\n printBlank();\n printMemoryDetails(memory);\n } catch (error) {\n spinner.fail('Failed to fetch memory');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle memory create command\n */\nasync function handleMemoryCreate(options: {\n entityType?: string;\n entityId?: string;\n content?: string;\n agentId?: string;\n source?: string;\n ttl?: string;\n file?: string;\n}): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n let input: CreateMemoryInput;\n\n if (options.file) {\n // Read from JSON file\n try {\n const content = await readFile(options.file, 'utf-8');\n input = JSON.parse(content);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Failed to read file', message);\n process.exitCode = 1;\n return;\n }\n } else {\n // Build from individual options\n if (!options.entityType || !options.entityId || !options.content) {\n printError(\n 'Missing required options',\n \"Provide --entity-type, --entity-id, and --content, or use '-f <path>' for JSON file\"\n );\n printInfo(\"Run 'chanl memory create --help' for usage\");\n process.exitCode = 1;\n return;\n }\n\n input = {\n entityType: options.entityType as MemoryEntityType,\n entityId: options.entityId,\n content: options.content,\n };\n\n if (options.agentId) {\n input.agentId = options.agentId;\n }\n\n if (options.source) {\n input.metadata = { ...input.metadata, source: options.source as MemorySource };\n }\n\n if (options.ttl) {\n const ttl = parseInt(options.ttl, 10);\n if (isNaN(ttl) || ttl <= 0) {\n printError('Invalid TTL value', 'TTL must be a positive number of seconds');\n process.exitCode = 1;\n return;\n }\n input.ttlSeconds = ttl;\n }\n }\n\n const spinner = ora('Creating memory...').start();\n\n try {\n const response = await sdk.memory.create(input);\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to create memory', response.message);\n process.exitCode = 1;\n return;\n }\n\n const { memory } = response.data;\n\n if (isJsonOutput()) {\n printJson({ success: true, memory });\n return;\n }\n\n printSuccess(`Created memory: ${memory.id}`);\n } catch (error) {\n spinner.fail('Failed to create memory');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle memory update command\n */\nasync function handleMemoryUpdate(\n id: string,\n options: {\n content?: string;\n deactivate?: boolean;\n activate?: boolean;\n }\n): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n const input: UpdateMemoryInput = {};\n\n if (options.content) {\n input.content = options.content;\n }\n\n if (options.deactivate) {\n input.isActive = false;\n }\n\n if (options.activate) {\n input.isActive = true;\n }\n\n if (!options.content && !options.deactivate && !options.activate) {\n printError('No updates specified', 'Provide --content, --deactivate, or --activate');\n process.exitCode = 1;\n return;\n }\n\n const spinner = ora('Updating memory...').start();\n\n try {\n const response = await sdk.memory.update(id, input);\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to update memory', response.message);\n process.exitCode = 1;\n return;\n }\n\n const { memory } = response.data;\n\n if (isJsonOutput()) {\n printJson({ success: true, memory });\n return;\n }\n\n printSuccess(`Updated memory: ${memory.id}`);\n } catch (error) {\n spinner.fail('Failed to update memory');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle memory delete command\n */\nasync function handleMemoryDelete(id: string, options: { yes?: boolean }): Promise<void> {\n const sdk = createSdk();\n if (!sdk) return;\n\n // Confirm deletion unless --yes flag is provided\n if (!options.yes) {\n try {\n const confirmed = await confirm({\n message: `Are you sure you want to delete memory '${id}'?`,\n default: false,\n });\n\n if (!confirmed) {\n printInfo('Deletion cancelled');\n return;\n }\n } catch {\n // User cancelled (Ctrl+C)\n printBlank();\n printInfo('Deletion cancelled');\n return;\n }\n }\n\n const spinner = ora('Deleting memory...').start();\n\n try {\n const response = await sdk.memory.delete(id);\n\n spinner.stop();\n\n if (!response.success) {\n printError('Failed to delete memory', response.message);\n process.exitCode = 1;\n return;\n }\n\n if (isJsonOutput()) {\n printJson({ success: true, deleted: true, id });\n return;\n }\n\n printSuccess(`Deleted memory: ${id}`);\n } catch (error) {\n spinner.fail('Failed to delete memory');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n/**\n * Handle memory search command\n */\nasync function handleMemorySearch(options: {\n entityType?: string;\n entityId?: string;\n query?: string;\n agentId?: string;\n limit?: string;\n minScore?: string;\n}): Promise<void> {\n if (!options.entityType || !options.entityId || !options.query) {\n printError('Missing required options', 'Provide --entity-type, --entity-id, and --query');\n printInfo(\"Run 'chanl memory search --help' for usage\");\n process.exitCode = 1;\n return;\n }\n\n const sdk = createSdk();\n if (!sdk) return;\n\n const input: SearchMemoryInput = {\n entityType: options.entityType as MemoryEntityType,\n entityId: options.entityId,\n query: options.query,\n };\n\n if (options.agentId) {\n input.agentId = options.agentId;\n }\n\n if (options.limit) {\n input.limit = parseInt(options.limit, 10);\n }\n\n if (options.minScore) {\n input.minScore = parseFloat(options.minScore);\n }\n\n const spinner = ora('Searching memories...').start();\n\n try {\n const response = await sdk.memory.search(input);\n\n spinner.stop();\n\n if (!response.success || !response.data) {\n printError('Failed to search memories', response.message);\n process.exitCode = 1;\n return;\n }\n\n const { memories } = response.data;\n\n if (isJsonOutput()) {\n printJson({ memories });\n return;\n }\n\n if (memories.length === 0) {\n printInfo('No matching memories found');\n return;\n }\n\n printBlank();\n printSimpleTable(\n ['ID', 'Score', 'Content', 'Entity Type', 'Entity ID'],\n memories.map((m: MemorySearchResult) => [\n truncate(m.id, 12),\n (m.score ?? 0).toFixed(2),\n truncate(m.content, 50),\n m.entityType,\n m.entityId,\n ])\n );\n\n printBlank();\n printInfo(`Found ${memories.length} matching memories`);\n } catch (error) {\n spinner.fail('Failed to search memories');\n const message = error instanceof Error ? error.message : 'Unknown error';\n printError('Error', message);\n process.exitCode = 1;\n }\n}\n\n// ============================================================================\n// Display Helpers\n// ============================================================================\n\n/**\n * Print memory details in formatted output\n */\nfunction printMemoryDetails(memory: Memory): void {\n printLabel('ID', memory.id);\n printLabel('Entity Type', memory.entityType);\n printLabel('Entity ID', memory.entityId);\n\n printBlank();\n printInfo('Content:');\n console.log(chalk.gray(memory.content));\n\n if (memory.agentId) {\n printBlank();\n printLabel('Agent ID', memory.agentId);\n }\n\n printBlank();\n printLabel('Active', memory.isActive ? chalk.green('Yes') : chalk.red('No'));\n\n if (memory.metadata && Object.keys(memory.metadata).length > 0) {\n printBlank();\n printInfo('Metadata:');\n console.log(chalk.gray(JSON.stringify(memory.metadata, null, 2)));\n }\n\n if (memory.expiresAt) {\n printLabel('Expires', formatDate(memory.expiresAt));\n }\n\n printBlank();\n printLabel('Created', formatDate(memory.createdAt));\n if (memory.updatedAt) {\n printLabel('Updated', formatDate(memory.updatedAt));\n }\n printBlank();\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,OAAO,SAAS;AAChB,OAAO,WAAW;AAUlB,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKA,SAAS,sBAA+B;AAC7C,QAAM,SAAS,IAAI,QAAQ,QAAQ,EAAE,YAAY,qBAAqB;AAGtE,SACG,QAAQ,MAAM,EACd,YAAY,qCAAqC,EACjD,OAAO,wBAAwB,+DAA+D,EAC9F,OAAO,oBAAoB,qBAAqB,EAChD,OAAO,mBAAmB,oBAAoB,EAC9C,OAAO,qBAAqB,oDAAoD,EAChF,OAAO,wBAAwB,gCAAgC,IAAI,EACnE,OAAO,uBAAuB,4BAA4B,GAAG,EAC7D;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQF,EACC,OAAO,gBAAgB;AAG1B,SACG,QAAQ,UAAU,EAClB,YAAY,kCAAkC,EAC9C;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,eAAe;AAGzB,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AK,KAAK,UAAU,OAAO,UAAU,MAAM,CAAC,CAAC,CAAC;AAAA,EAClE;AAEA,MAAI,OAAO,WAAW;AACpB,eAAW,WAAW,WAAW,OAAO,SAAS,CAAC;AAAA,EACpD;AAEA,aAAW;AACX,aAAW,WAAW,WAAW,OAAO,SAAS,CAAC;AAClD,MAAI,OAAO,WAAW;AACpB,eAAW,WAAW,WAAW,OAAO,SAAS,CAAC;AAAA,EACpD;AACA,aAAW;AACb;","names":[]}
@@ -0,0 +1,8 @@
1
+ import { Command } from 'commander';
2
+
3
+ /**
4
+ * Create the personas command group
5
+ */
6
+ declare function createPersonasCommand(): Command;
7
+
8
+ export { createPersonasCommand };