copilotkit 0.0.13 → 0.0.15
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.
- package/README.md +28 -1
- package/dist/commands/base-command.js +1 -1
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/dev.js +28 -18
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/init.d.ts +36 -0
- package/dist/commands/init.js +848 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.js +2 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +2 -5
- package/dist/commands/logout.js.map +1 -1
- package/dist/lib/init/index.d.ts +9 -0
- package/dist/lib/init/index.js +441 -0
- package/dist/lib/init/index.js.map +1 -0
- package/dist/lib/init/questions.d.ts +6 -0
- package/dist/lib/init/questions.js +133 -0
- package/dist/lib/init/questions.js.map +1 -0
- package/dist/lib/init/scaffold/env.d.ts +6 -0
- package/dist/lib/init/scaffold/env.js +68 -0
- package/dist/lib/init/scaffold/env.js.map +1 -0
- package/dist/lib/init/scaffold/github.d.ts +20 -0
- package/dist/lib/init/scaffold/github.js +138 -0
- package/dist/lib/init/scaffold/github.js.map +1 -0
- package/dist/lib/init/scaffold/index.d.ts +7 -0
- package/dist/lib/init/scaffold/index.js +339 -0
- package/dist/lib/init/scaffold/index.js.map +1 -0
- package/dist/lib/init/scaffold/packages.d.ts +6 -0
- package/dist/lib/init/scaffold/packages.js +60 -0
- package/dist/lib/init/scaffold/packages.js.map +1 -0
- package/dist/lib/init/scaffold/shadcn.d.ts +6 -0
- package/dist/lib/init/scaffold/shadcn.js +79 -0
- package/dist/lib/init/scaffold/shadcn.js.map +1 -0
- package/dist/lib/init/types/index.d.ts +3 -0
- package/dist/lib/init/types/index.js +41 -0
- package/dist/lib/init/types/index.js.map +1 -0
- package/dist/lib/init/types/questions.d.ts +55 -0
- package/dist/lib/init/types/questions.js +28 -0
- package/dist/lib/init/types/questions.js.map +1 -0
- package/dist/lib/init/types/templates.d.ts +6 -0
- package/dist/lib/init/types/templates.js +15 -0
- package/dist/lib/init/types/templates.js.map +1 -0
- package/dist/services/auth.service.js +1 -4
- package/dist/services/auth.service.js.map +1 -1
- package/dist/services/events.d.ts +11 -8
- package/dist/utils/detect-endpoint-type.utils.d.ts +2 -1
- package/dist/utils/detect-endpoint-type.utils.js +27 -13
- package/dist/utils/detect-endpoint-type.utils.js.map +1 -1
- package/dist/utils/trpc.d.ts +64 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/utils/version.js.map +1 -1
- package/oclif.manifest.json +158 -1
- package/package.json +3 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/scaffold/shadcn.ts","../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/types/templates.ts","../../../../src/lib/init/scaffold/env.ts","../../../../src/lib/init/scaffold/github.ts","../../../../src/lib/init/scaffold/packages.ts"],"sourcesContent":["import spawn from \"cross-spawn\"\nimport { \n templateMapping, \n ChatTemplate, \n Config \n} from \"../types/index.js\"\n\nexport async function scaffoldShadCN(userAnswers: Config) {\n try {\n // Determine which components to install based on user choices\n const components = [\n templateMapping[userAnswers.chatUi as ChatTemplate]\n ]\n \n // Add additional components based on agent framework\n if (userAnswers.agentFramework !== 'None') {\n switch (userAnswers.agentFramework) {\n case 'LangGraph':\n components.push(templateMapping.LangGraphPlatform)\n break\n case 'CrewAI':\n if (userAnswers.crewType === 'Crews') {\n components.push(templateMapping.CrewEnterprise)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n break\n default:\n components.push(templateMapping.RemoteEndpoint)\n break\n }\n }\n \n // Small pause before running shadcn\n await new Promise(resolve => setTimeout(resolve, 100));\n \n try {\n // Run shadcn with inherited stdio for all streams to allow for user input\n const result = spawn.sync('npx', ['shadcn@latest', 'add', ...components], { \n stdio: 'inherit' // This ensures stdin/stdout/stderr are all passed through\n });\n \n if (result.status !== 0) {\n throw new Error(`The shadcn installation process exited with code ${result.status}`);\n }\n } catch (error) {\n throw error;\n }\n } catch (error) {\n throw error;\n }\n}","import { Flags } from \"@oclif/core\"\n\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: Fields\n message: string\n choices?: string[]\n default?: string\n when?: (answers: Record<string, any>) => boolean\n}\n\n// Agent framework options\nexport const AGENT_FRAMEWORKS = ['CrewAI', 'LangGraph', 'None'] as const;\nexport type AgentFramework = typeof AGENT_FRAMEWORKS[number];\n\n// CrewAI types\nexport const CREW_TYPES = ['Crews', 'Flows'] as const;\nexport type CrewType = typeof CREW_TYPES[number];\n\n// UI component options\nexport const CHAT_COMPONENTS = ['CopilotChat','CopilotSidebar', 'Headless', 'CopilotPopup'] as const;\nexport type ChatComponent = typeof CHAT_COMPONENTS[number];\n\n// LangGraph agent types\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter', 'None'] as const;\nexport type LangGraphAgent = typeof LANGGRAPH_AGENTS[number];\n\n// Yes/No type for consistent options\nexport type YesNo = 'Yes' | 'No';\n\n// All possible field names for questions\nexport type Fields = \n \"copilotKitVersion\" | \n \"agentFramework\" | \n \"alreadyDeployed\" |\n \"fastApiEnabled\" | \n \"useCopilotCloud\" | \n \"chatUi\" | \n \"langGraphAgent\" | \n \"langGraphPlatform\" |\n \"langGraphPlatformUrl\" | \n \"crewType\" | \n \"crewName\" | \n \"langGraphRemoteEndpointURL\" |\n \"crewUrl\" | \n \"crewBearerToken\" | \n \"langSmithApiKey\" | \n \"llmToken\";\n\n// Complete configuration shape that holds all possible answers\nexport interface Config {\n copilotKitVersion: string;\n agentFramework: AgentFramework;\n alreadyDeployed?: YesNo;\n fastApiEnabled?: YesNo;\n useCopilotCloud?: YesNo;\n chatUi: ChatComponent;\n\n // LangGraph\n langGraphAgent?: LangGraphAgent;\n langGraphPlatform?: YesNo;\n langGraphPlatformUrl?: string;\n langGraphRemoteEndpointURL?: string;\n\n // CrewAI\n crewType?: CrewType;\n crewName?: string;\n crewUrl?: string;\n crewBearerToken?: string;\n\n // API keys and tokens\n copilotCloudPublicApiKey?: string;\n langSmithApiKey?: string;\n llmToken?: string;\n}\n\n// CLI flags definition - single source of truth for flag descriptions\nexport const ConfigFlags = {\n copilotKitVersion: Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n agentFramework: Flags.string({description: 'Agent framework to power your copilot', options: AGENT_FRAMEWORKS}),\n fastApiEnabled: Flags.string({description: 'Use FastAPI to serve your agent locally', options: ['Yes', 'No']}),\n useCopilotCloud: Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: ['Yes', 'No']}),\n chatUi: Flags.string({description: 'Chat UI component to add to your app', options: CHAT_COMPONENTS}),\n langGraphAgent: Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n crewType: Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n crewName: Flags.string({description: 'Name for your CrewAI agent'}),\n crewUrl: Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n crewBearerToken: Flags.string({description: 'Bearer token for CrewAI authentication'}),\n langSmithApiKey: Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n llmToken: Flags.string({description: 'API key for your preferred LLM provider'}),\n}","export type ChatTemplate = \n \"CopilotChat\" |\n \"CopilotPopup\" |\n \"CopilotSidebar\"\n\nexport type StarterTemplate = \n \"LangGraphPlatform\" |\n \"RemoteEndpoint\" |\n \"Standard\" |\n \"CrewEnterprise\"\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = \"http://registry.copilotkit.ai/r\"\n\nexport const templateMapping: Record<Template, string> = {\n \"LangGraphPlatform\": `${BASE_URL}/langgraph-platform-starter.json`,\n \"RemoteEndpoint\": `${BASE_URL}/remote-endpoint-starter.json`,\n \"CrewEnterprise\": `${BASE_URL}/agent-layout.json`,\n\n \"Standard\": `${BASE_URL}/standard-starter.json`,\n \"CopilotChat\": `${BASE_URL}/chat.json`,\n \"CopilotPopup\": `${BASE_URL}/popup.json`,\n \"CopilotSidebar\": `${BASE_URL}/sidebar.json`,\n}","import path from \"path\"\nimport fs from \"fs\"\nimport { Config } from \"../types/index.js\"\nimport chalk from \"chalk\"\nimport ora from \"ora\"\n\nexport async function scaffoldEnv(flags: any, userAnswers: Config) {\n const spinner = ora({\n text: chalk.cyan('Configuring environment variables...'),\n color: 'cyan'\n }).start();\n\n try {\n // Define the env file path\n const envFile = path.join(process.cwd(), '.env')\n \n // Create the env file if it doesn't exist\n if (!fs.existsSync(envFile)) {\n fs.writeFileSync(envFile, '', 'utf8')\n spinner.text = chalk.cyan('Created .env file...');\n } else {\n spinner.text = chalk.cyan('Updating existing .env file...');\n }\n \n // Build environment variables based on user selections\n let newEnvValues = ''\n let varsAdded = false;\n \n // Copilot Cloud API key\n if (userAnswers.copilotCloudPublicApiKey) {\n newEnvValues += `NEXT_PUBLIC_COPILOT_API_KEY=${userAnswers.copilotCloudPublicApiKey}\\n`\n spinner.text = chalk.cyan('Adding Copilot Cloud API key...');\n varsAdded = true;\n }\n \n // LangSmith API key (for LangGraph)\n if (userAnswers.langSmithApiKey) {\n newEnvValues += `LANG_SMITH_API_KEY=${userAnswers.langSmithApiKey}\\n`\n spinner.text = chalk.cyan('Adding LangSmith API key...');\n varsAdded = true;\n }\n \n // LLM API key\n if (userAnswers.llmToken) {\n newEnvValues += `LLM_TOKEN=${userAnswers.llmToken}\\n`\n spinner.text = chalk.cyan('Adding LLM token...');\n varsAdded = true;\n }\n \n // CrewAI name\n if (userAnswers.crewName) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=${userAnswers.crewName}\\n`\n spinner.text = chalk.cyan('Adding Crew agent name...');\n varsAdded = true;\n }\n \n // Runtime URL if provided via flags\n if (flags.runtimeUrl) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=${flags.runtimeUrl}\\n`\n spinner.text = chalk.cyan('Adding runtime URL...');\n varsAdded = true;\n }\n \n if (!varsAdded) {\n spinner.text = chalk.cyan('No environment variables needed...');\n }\n \n // Append the variables to the .env file\n if (newEnvValues) {\n fs.appendFileSync(envFile, newEnvValues)\n spinner.succeed(chalk('Environment variables configured successfully'));\n } else {\n spinner.info(chalk.yellow('No environment variables were added'));\n }\n } catch (error) {\n spinner.fail(chalk.red('Failed to update environment variables'));\n throw error;\n }\n}\n","import { execSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { Config } from '../types/index.js';\nimport chalk from \"chalk\"\nimport ora, {Ora} from \"ora\";\n\nexport async function scaffoldAgent(userAnswers: Config) {\n // Skip if no agent framework or using CrewAI Crews (which are handled by cloud)\n if (userAnswers.agentFramework === 'None' || \n (userAnswers.agentFramework === 'CrewAI' && userAnswers.crewType === 'Crews') ||\n (userAnswers.agentFramework === 'LangGraph' && (!userAnswers.langGraphAgent || userAnswers.langGraphAgent === 'None'))) {\n return;\n }\n \n const spinner = ora({\n text: chalk.cyan('Setting up AI agent...'),\n color: 'cyan'\n }).start();\n \n try {\n if (userAnswers.agentFramework === 'LangGraph') {\n switch (userAnswers.langGraphAgent) {\n case 'Python Starter':\n spinner.text = chalk.cyan('Setting up Python LangGraph agent...');\n await new Promise(resolve => setTimeout(resolve, 50));\n \n await cloneGitHubSubdirectory(\n 'https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-starter/agent-py', \n path.join(process.cwd(), 'agent'),\n spinner\n );\n break;\n \n case 'TypeScript Starter':\n spinner.text = chalk.cyan('Setting up TypeScript LangGraph agent...');\n await new Promise(resolve => setTimeout(resolve, 50));\n \n await cloneGitHubSubdirectory(\n 'https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-starter/agent-js', \n path.join(process.cwd(), 'agent'),\n spinner\n );\n break;\n \n default:\n break;\n }\n } else if (userAnswers.agentFramework === 'CrewAI' && userAnswers.crewType === 'Flows') {\n spinner.text = chalk.cyan('Setting up CrewAI Flows agent...');\n await new Promise(resolve => setTimeout(resolve, 50));\n \n // CrewAI local flows scaffolding would go here when implemented\n spinner.info(chalk.yellow('CrewAI Flows support is coming soon...'));\n }\n \n spinner.succeed(chalk.green('AI agent setup complete'));\n } catch (error) {\n spinner.fail(chalk.red('Failed to set up AI agent'));\n throw error;\n }\n}\n\n/**\n * Clones a specific subdirectory from a GitHub repository\n * \n * @param githubUrl - The GitHub URL to the repository or subdirectory\n * @param destinationPath - The local path where the content should be copied\n * @param spinner - The spinner to update with progress information\n * @returns A boolean indicating success or failure\n */\nexport async function cloneGitHubSubdirectory(\n githubUrl: string,\n destinationPath: string,\n spinner: Ora\n): Promise<boolean> {\n try {\n // Parse the GitHub URL to extract repo info\n const { owner, repo, branch, subdirectoryPath } = parseGitHubUrl(githubUrl);\n \n spinner.text = chalk.cyan(`Cloning from ${owner}/${repo}...`);\n \n // Method 1: Use sparse checkout (more efficient than full clone)\n return await sparseCheckout(owner, repo, branch, subdirectoryPath, destinationPath, spinner);\n } catch (error) {\n spinner.text = chalk.red(`Failed to clone from GitHub: ${error}`);\n return false;\n }\n}\n\n/**\n * Uses Git sparse-checkout to efficiently download only the needed subdirectory\n */\nasync function sparseCheckout(\n owner: string,\n repo: string,\n branch: string,\n subdirectoryPath: string,\n destinationPath: string,\n spinner: Ora\n): Promise<boolean> {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'copilotkit-sparse-'));\n \n try {\n spinner.text = chalk.cyan('Creating temporary workspace...');\n \n // Initialize git repo\n execSync('git init', { cwd: tempDir, stdio: 'pipe' });\n \n spinner.text = chalk.cyan('Connecting to repository...');\n \n // Add remote\n execSync(`git remote add origin https://github.com/${owner}/${repo}.git`, { cwd: tempDir, stdio: 'pipe' });\n \n // Enable sparse checkout\n execSync('git config core.sparseCheckout true', { cwd: tempDir, stdio: 'pipe' });\n \n // Specify which subdirectory to checkout\n fs.writeFileSync(path.join(tempDir, '.git/info/sparse-checkout'), subdirectoryPath);\n \n spinner.text = chalk.cyan('Downloading agent files...');\n \n // Pull only the specified branch\n execSync(`git pull origin ${branch} --depth=1`, { cwd: tempDir, stdio: 'pipe' });\n \n // Copy the subdirectory to the destination\n const sourcePath = path.join(tempDir, subdirectoryPath);\n if (!fs.existsSync(sourcePath)) {\n throw new Error(`Subdirectory '${subdirectoryPath}' not found in the repository.`);\n }\n \n // Ensure destination directory exists\n fs.mkdirSync(destinationPath, { recursive: true });\n \n spinner.text = chalk.cyan('Installing agent files...');\n \n // Copy the subdirectory to the destination\n await copyDirectoryAsync(sourcePath, destinationPath);\n \n return true;\n } finally {\n // Clean up the temporary directory\n try {\n fs.rmSync(tempDir, { recursive: true, force: true });\n } catch (error) {\n console.warn(`Failed to clean up temporary directory: ${error}`);\n }\n }\n}\n\n/**\n * Recursively copies a directory with async pauses\n */\nasync function copyDirectoryAsync(source: string, destination: string): Promise<void> {\n // Create destination directory if it doesn't exist\n if (!fs.existsSync(destination)) {\n fs.mkdirSync(destination, { recursive: true });\n }\n \n // Read all files/directories from source\n const entries = fs.readdirSync(source, { withFileTypes: true });\n \n for (const entry of entries) {\n const srcPath = path.join(source, entry.name);\n const destPath = path.join(destination, entry.name);\n \n if (entry.isDirectory()) {\n // Recursively copy subdirectories\n await copyDirectoryAsync(srcPath, destPath);\n } else {\n // Copy files\n fs.copyFileSync(srcPath, destPath);\n }\n \n // For large directories, add small pauses\n if (entries.length > 10) {\n await new Promise(resolve => setTimeout(resolve, 1));\n }\n }\n}\n\n/**\n * Parses a GitHub URL to extract owner, repo, branch and subdirectory path\n */\nfunction parseGitHubUrl(githubUrl: string): { \n owner: string; \n repo: string; \n branch: string;\n subdirectoryPath: string;\n} {\n const url = new URL(githubUrl);\n \n if (url.hostname !== 'github.com') {\n throw new Error('Only GitHub URLs are supported');\n }\n \n const pathParts = url.pathname.split('/').filter(Boolean);\n \n if (pathParts.length < 2) {\n throw new Error('Invalid GitHub URL format');\n }\n \n const owner = pathParts[0];\n const repo = pathParts[1];\n let branch = 'main'; // Default branch\n let subdirectoryPath = '';\n \n if (pathParts.length > 3 && (pathParts[2] === 'tree' || pathParts[2] === 'blob')) {\n branch = pathParts[3];\n subdirectoryPath = pathParts.slice(4).join('/');\n }\n \n return { owner, repo, branch, subdirectoryPath };\n}\n\n/**\n * Validates if a string is a valid GitHub URL\n */\nexport function isValidGitHubUrl(url: string): boolean {\n try {\n const parsedUrl = new URL(url);\n return parsedUrl.hostname === 'github.com' && \n parsedUrl.pathname.split('/').filter(Boolean).length >= 2;\n } catch {\n return false;\n }\n}\n","/*\n Currently unusued but will be used in the future once we have more time to think\n about what to use outside of shadcn/ui.\n*/\n\nimport spawn from \"cross-spawn\";\nimport { Config } from \"../types/index.js\";\nimport chalk from \"chalk\";\nimport fs from \"fs\";\nimport ora from \"ora\";\n\ntype PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\nexport async function scaffoldPackages(userAnswers: Config) {\n const spinner = ora({\n text: chalk.cyan('Preparing to install packages...'),\n color: 'cyan'\n }).start();\n\n try {\n const packages = [\n `@copilotkit/react-ui@${userAnswers.copilotKitVersion}`,\n `@copilotkit/react-core@${userAnswers.copilotKitVersion}`,\n `@copilotkit/runtime@${userAnswers.copilotKitVersion}`,\n ];\n\n // Small pause before starting\n await new Promise(resolve => setTimeout(resolve, 50));\n\n const packageManager = detectPackageManager();\n const installCommand = detectInstallCommand(packageManager);\n \n spinner.text = chalk.cyan(`Using ${packageManager} to install packages...`);\n \n // Pause the spinner for the package installation\n spinner.stop();\n \n console.log(chalk.cyan('\\n⚙️ Installing packages...\\n'));\n \n const result = spawn.sync(packageManager, [installCommand, ...packages], { \n stdio: 'inherit' // This ensures stdin/stdout/stderr are all passed through\n });\n \n if (result.status !== 0) {\n throw new Error(`Package installation process exited with code ${result.status}`);\n }\n \n // Resume the spinner for success message\n spinner.start();\n spinner.succeed(chalk.green('CopilotKit packages installed successfully'));\n } catch (error) {\n // Use spinner for consistent error reporting\n if (!spinner.isSpinning) {\n spinner.start();\n }\n spinner.fail(chalk.red('Failed to install CopilotKit packages'));\n throw error;\n }\n}\n\nfunction detectPackageManager(): PackageManager {\n // Check for lock files in the current directory\n const files = fs.readdirSync(process.cwd());\n \n if (files.includes('bun.lockb')) return 'bun';\n if (files.includes('pnpm-lock.yaml')) return 'pnpm';\n if (files.includes('yarn.lock')) return 'yarn';\n if (files.includes('package-lock.json')) return 'npm';\n\n // Default to npm if no lock file found\n return 'npm';\n}\n\nfunction detectInstallCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case 'yarn':\n case 'pnpm':\n return 'add';\n default:\n return 'install';\n }\n}"],"mappings":";AAAA,OAAO,WAAW;;;ACAlB,SAAS,aAAa;AAYf,IAAM,mBAAmB,CAAC,UAAU,aAAa,MAAM;AAIvD,IAAM,aAAa,CAAC,SAAS,OAAO;AAIpC,IAAM,kBAAkB,CAAC,eAAc,kBAAkB,YAAY,cAAc;AAInF,IAAM,mBAAmB,CAAC,kBAAkB,sBAAsB,MAAM;AAqDxE,IAAM,cAAc;AAAA,EACzB,mBAAmB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACvF,gBAAgB,MAAM,OAAO,EAAC,aAAa,yCAAyC,SAAS,iBAAgB,CAAC;AAAA,EAC9G,gBAAgB,MAAM,OAAO,EAAC,aAAa,2CAA2C,SAAS,CAAC,OAAO,IAAI,EAAC,CAAC;AAAA,EAC7G,iBAAiB,MAAM,OAAO,EAAC,aAAa,kDAAkD,SAAS,CAAC,OAAO,IAAI,EAAC,CAAC;AAAA,EACrH,QAAQ,MAAM,OAAO,EAAC,aAAa,wCAAwC,SAAS,gBAAe,CAAC;AAAA,EACpG,gBAAgB,MAAM,OAAO,EAAC,aAAa,mCAAmC,SAAS,iBAAgB,CAAC;AAAA,EACxG,UAAU,MAAM,OAAO,EAAC,aAAa,8BAA8B,SAAS,WAAU,CAAC;AAAA,EACvF,UAAU,MAAM,OAAO,EAAC,aAAa,6BAA4B,CAAC;AAAA,EAClE,SAAS,MAAM,OAAO,EAAC,aAAa,qCAAoC,CAAC;AAAA,EACzE,iBAAiB,MAA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,UAAM,SAASD,OAAM,KAAK,gBAAgB,CAAC,gBAAgB,GAAG,QAAQ,GAAG;AAAA,MACvE,OAAO;AAAA;AAAA,IACT,CAAC;AAED,QAAI,OAAO,WAAW,GAAG;AACvB,YAAM,IAAI,MAAM,iDAAiD,OAAO,MAAM,EAAE;AAAA,IAClF;AAGA,YAAQ,MAAM;AACd,YAAQ,QAAQC,OAAM,MAAM,4CAA4C,CAAC;AAAA,EAC3E,SAAS,OAAO;AAEd,QAAI,CAAC,QAAQ,YAAY;AACvB,cAAQ,MAAM;AAAA,IAChB;AACA,YAAQ,KAAKA,OAAM,IAAI,uCAAuC,CAAC;AAC/D,UAAM;AAAA,EACR;AACF;AAEA,SAAS,uBAAuC;AAE9C,QAAM,QAAQC,IAAG,YAAY,QAAQ,IAAI,CAAC;AAE1C,MAAI,MAAM,SAAS,WAAW,EAAG,QAAO;AACxC,MAAI,MAAM,SAAS,gBAAgB,EAAG,QAAO;AAC7C,MAAI,MAAM,SAAS,WAAW,EAAG,QAAO;AACxC,MAAI,MAAM,SAAS,mBAAmB,EAAG,QAAO;AAGhD,SAAO;AACT;AAEA,SAAS,qBAAqB,gBAAwC;AACpE,UAAQ,gBAAgB;AAAA,IACtB,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["fs","path","chalk","ora","spawn","chalk","fs","ora"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/lib/init/scaffold/packages.ts
|
|
2
|
+
import spawn from "cross-spawn";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import ora from "ora";
|
|
6
|
+
async function scaffoldPackages(userAnswers) {
|
|
7
|
+
const spinner = ora({
|
|
8
|
+
text: chalk.cyan("Preparing to install packages..."),
|
|
9
|
+
color: "cyan"
|
|
10
|
+
}).start();
|
|
11
|
+
try {
|
|
12
|
+
const packages = [
|
|
13
|
+
`@copilotkit/react-ui@${userAnswers.copilotKitVersion}`,
|
|
14
|
+
`@copilotkit/react-core@${userAnswers.copilotKitVersion}`,
|
|
15
|
+
`@copilotkit/runtime@${userAnswers.copilotKitVersion}`
|
|
16
|
+
];
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
18
|
+
const packageManager = detectPackageManager();
|
|
19
|
+
const installCommand = detectInstallCommand(packageManager);
|
|
20
|
+
spinner.text = chalk.cyan(`Using ${packageManager} to install packages...`);
|
|
21
|
+
spinner.stop();
|
|
22
|
+
console.log(chalk.cyan("\n\u2699\uFE0F Installing packages...\n"));
|
|
23
|
+
const result = spawn.sync(packageManager, [installCommand, ...packages], {
|
|
24
|
+
stdio: "inherit"
|
|
25
|
+
// This ensures stdin/stdout/stderr are all passed through
|
|
26
|
+
});
|
|
27
|
+
if (result.status !== 0) {
|
|
28
|
+
throw new Error(`Package installation process exited with code ${result.status}`);
|
|
29
|
+
}
|
|
30
|
+
spinner.start();
|
|
31
|
+
spinner.succeed(chalk.green("CopilotKit packages installed successfully"));
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (!spinner.isSpinning) {
|
|
34
|
+
spinner.start();
|
|
35
|
+
}
|
|
36
|
+
spinner.fail(chalk.red("Failed to install CopilotKit packages"));
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function detectPackageManager() {
|
|
41
|
+
const files = fs.readdirSync(process.cwd());
|
|
42
|
+
if (files.includes("bun.lockb")) return "bun";
|
|
43
|
+
if (files.includes("pnpm-lock.yaml")) return "pnpm";
|
|
44
|
+
if (files.includes("yarn.lock")) return "yarn";
|
|
45
|
+
if (files.includes("package-lock.json")) return "npm";
|
|
46
|
+
return "npm";
|
|
47
|
+
}
|
|
48
|
+
function detectInstallCommand(packageManager) {
|
|
49
|
+
switch (packageManager) {
|
|
50
|
+
case "yarn":
|
|
51
|
+
case "pnpm":
|
|
52
|
+
return "add";
|
|
53
|
+
default:
|
|
54
|
+
return "install";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
scaffoldPackages
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/scaffold/packages.ts"],"sourcesContent":["/*\n Currently unusued but will be used in the future once we have more time to think\n about what to use outside of shadcn/ui.\n*/\n\nimport spawn from \"cross-spawn\";\nimport { Config } from \"../types/index.js\";\nimport chalk from \"chalk\";\nimport fs from \"fs\";\nimport ora from \"ora\";\n\ntype PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\nexport async function scaffoldPackages(userAnswers: Config) {\n const spinner = ora({\n text: chalk.cyan('Preparing to install packages...'),\n color: 'cyan'\n }).start();\n\n try {\n const packages = [\n `@copilotkit/react-ui@${userAnswers.copilotKitVersion}`,\n `@copilotkit/react-core@${userAnswers.copilotKitVersion}`,\n `@copilotkit/runtime@${userAnswers.copilotKitVersion}`,\n ];\n\n // Small pause before starting\n await new Promise(resolve => setTimeout(resolve, 50));\n\n const packageManager = detectPackageManager();\n const installCommand = detectInstallCommand(packageManager);\n \n spinner.text = chalk.cyan(`Using ${packageManager} to install packages...`);\n \n // Pause the spinner for the package installation\n spinner.stop();\n \n console.log(chalk.cyan('\\n⚙️ Installing packages...\\n'));\n \n const result = spawn.sync(packageManager, [installCommand, ...packages], { \n stdio: 'inherit' // This ensures stdin/stdout/stderr are all passed through\n });\n \n if (result.status !== 0) {\n throw new Error(`Package installation process exited with code ${result.status}`);\n }\n \n // Resume the spinner for success message\n spinner.start();\n spinner.succeed(chalk.green('CopilotKit packages installed successfully'));\n } catch (error) {\n // Use spinner for consistent error reporting\n if (!spinner.isSpinning) {\n spinner.start();\n }\n spinner.fail(chalk.red('Failed to install CopilotKit packages'));\n throw error;\n }\n}\n\nfunction detectPackageManager(): PackageManager {\n // Check for lock files in the current directory\n const files = fs.readdirSync(process.cwd());\n \n if (files.includes('bun.lockb')) return 'bun';\n if (files.includes('pnpm-lock.yaml')) return 'pnpm';\n if (files.includes('yarn.lock')) return 'yarn';\n if (files.includes('package-lock.json')) return 'npm';\n\n // Default to npm if no lock file found\n return 'npm';\n}\n\nfunction detectInstallCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case 'yarn':\n case 'pnpm':\n return 'add';\n default:\n return 'install';\n }\n}"],"mappings":";AAKA,OAAO,WAAW;AAElB,OAAO,WAAW;AAClB,OAAO,QAAQ;AACf,OAAO,SAAS;AAIhB,eAAsB,iBAAiB,aAAqB;AAC1D,QAAM,UAAU,IAAI;AAAA,IAClB,MAAM,MAAM,KAAK,kCAAkC;AAAA,IACnD,OAAO;AAAA,EACT,CAAC,EAAE,MAAM;AAET,MAAI;AACF,UAAM,WAAW;AAAA,MACf,wBAAwB,YAAY,iBAAiB;AAAA,MACrD,0BAA0B,YAAY,iBAAiB;AAAA,MACvD,uBAAuB,YAAY,iBAAiB;AAAA,IACtD;AAGA,UAAM,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AAEpD,UAAM,iBAAiB,qBAAqB;AAC5C,UAAM,iBAAiB,qBAAqB,cAAc;AAE1D,YAAQ,OAAO,MAAM,KAAK,SAAS,cAAc,yBAAyB;AAG1E,YAAQ,KAAK;AAEb,YAAQ,IAAI,MAAM,KAAK,0CAAgC,CAAC;AAExD,UAAM,SAAS,MAAM,KAAK,gBAAgB,CAAC,gBAAgB,GAAG,QAAQ,GAAG;AAAA,MACvE,OAAO;AAAA;AAAA,IACT,CAAC;AAED,QAAI,OAAO,WAAW,GAAG;AACvB,YAAM,IAAI,MAAM,iDAAiD,OAAO,MAAM,EAAE;AAAA,IAClF;AAGA,YAAQ,MAAM;AACd,YAAQ,QAAQ,MAAM,MAAM,4CAA4C,CAAC;AAAA,EAC3E,SAAS,OAAO;AAEd,QAAI,CAAC,QAAQ,YAAY;AACvB,cAAQ,MAAM;AAAA,IAChB;AACA,YAAQ,KAAK,MAAM,IAAI,uCAAuC,CAAC;AAC/D,UAAM;AAAA,EACR;AACF;AAEA,SAAS,uBAAuC;AAE9C,QAAM,QAAQ,GAAG,YAAY,QAAQ,IAAI,CAAC;AAE1C,MAAI,MAAM,SAAS,WAAW,EAAG,QAAO;AACxC,MAAI,MAAM,SAAS,gBAAgB,EAAG,QAAO;AAC7C,MAAI,MAAM,SAAS,WAAW,EAAG,QAAO;AACxC,MAAI,MAAM,SAAS,mBAAmB,EAAG,QAAO;AAGhD,SAAO;AACT;AAEA,SAAS,qBAAqB,gBAAwC;AACpE,UAAQ,gBAAgB;AAAA,IACtB,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/lib/init/scaffold/shadcn.ts
|
|
2
|
+
import spawn from "cross-spawn";
|
|
3
|
+
|
|
4
|
+
// src/lib/init/types/questions.ts
|
|
5
|
+
import { Flags } from "@oclif/core";
|
|
6
|
+
var AGENT_FRAMEWORKS = ["CrewAI", "LangGraph", "None"];
|
|
7
|
+
var CREW_TYPES = ["Crews", "Flows"];
|
|
8
|
+
var CHAT_COMPONENTS = ["CopilotChat", "CopilotSidebar", "Headless", "CopilotPopup"];
|
|
9
|
+
var LANGGRAPH_AGENTS = ["Python Starter", "TypeScript Starter", "None"];
|
|
10
|
+
var ConfigFlags = {
|
|
11
|
+
copilotKitVersion: Flags.string({ description: "CopilotKit version to use (e.g. 1.7.0)" }),
|
|
12
|
+
agentFramework: Flags.string({ description: "Agent framework to power your copilot", options: AGENT_FRAMEWORKS }),
|
|
13
|
+
fastApiEnabled: Flags.string({ description: "Use FastAPI to serve your agent locally", options: ["Yes", "No"] }),
|
|
14
|
+
useCopilotCloud: Flags.string({ description: "Use Copilot Cloud for production-ready hosting", options: ["Yes", "No"] }),
|
|
15
|
+
chatUi: Flags.string({ description: "Chat UI component to add to your app", options: CHAT_COMPONENTS }),
|
|
16
|
+
langGraphAgent: Flags.string({ description: "LangGraph agent template to use", options: LANGGRAPH_AGENTS }),
|
|
17
|
+
crewType: Flags.string({ description: "CrewAI implementation type", options: CREW_TYPES }),
|
|
18
|
+
crewName: Flags.string({ description: "Name for your CrewAI agent" }),
|
|
19
|
+
crewUrl: Flags.string({ description: "URL endpoint for your CrewAI agent" }),
|
|
20
|
+
crewBearerToken: Flags.string({ description: "Bearer token for CrewAI authentication" }),
|
|
21
|
+
langSmithApiKey: Flags.string({ description: "LangSmith API key for LangGraph observability" }),
|
|
22
|
+
llmToken: Flags.string({ description: "API key for your preferred LLM provider" })
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/lib/init/types/templates.ts
|
|
26
|
+
var BASE_URL = "http://registry.copilotkit.ai/r";
|
|
27
|
+
var templateMapping = {
|
|
28
|
+
"LangGraphPlatform": `${BASE_URL}/langgraph-platform-starter.json`,
|
|
29
|
+
"RemoteEndpoint": `${BASE_URL}/remote-endpoint-starter.json`,
|
|
30
|
+
"CrewEnterprise": `${BASE_URL}/agent-layout.json`,
|
|
31
|
+
"Standard": `${BASE_URL}/standard-starter.json`,
|
|
32
|
+
"CopilotChat": `${BASE_URL}/chat.json`,
|
|
33
|
+
"CopilotPopup": `${BASE_URL}/popup.json`,
|
|
34
|
+
"CopilotSidebar": `${BASE_URL}/sidebar.json`
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/lib/init/scaffold/shadcn.ts
|
|
38
|
+
async function scaffoldShadCN(userAnswers) {
|
|
39
|
+
try {
|
|
40
|
+
const components = [
|
|
41
|
+
templateMapping[userAnswers.chatUi]
|
|
42
|
+
];
|
|
43
|
+
if (userAnswers.agentFramework !== "None") {
|
|
44
|
+
switch (userAnswers.agentFramework) {
|
|
45
|
+
case "LangGraph":
|
|
46
|
+
components.push(templateMapping.LangGraphPlatform);
|
|
47
|
+
break;
|
|
48
|
+
case "CrewAI":
|
|
49
|
+
if (userAnswers.crewType === "Crews") {
|
|
50
|
+
components.push(templateMapping.CrewEnterprise);
|
|
51
|
+
} else {
|
|
52
|
+
components.push(templateMapping.RemoteEndpoint);
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
components.push(templateMapping.RemoteEndpoint);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
61
|
+
try {
|
|
62
|
+
const result = spawn.sync("npx", ["shadcn@latest", "add", ...components], {
|
|
63
|
+
stdio: "inherit"
|
|
64
|
+
// This ensures stdin/stdout/stderr are all passed through
|
|
65
|
+
});
|
|
66
|
+
if (result.status !== 0) {
|
|
67
|
+
throw new Error(`The shadcn installation process exited with code ${result.status}`);
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
scaffoldShadCN
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=shadcn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/scaffold/shadcn.ts","../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/types/templates.ts"],"sourcesContent":["import spawn from \"cross-spawn\"\nimport { \n templateMapping, \n ChatTemplate, \n Config \n} from \"../types/index.js\"\n\nexport async function scaffoldShadCN(userAnswers: Config) {\n try {\n // Determine which components to install based on user choices\n const components = [\n templateMapping[userAnswers.chatUi as ChatTemplate]\n ]\n \n // Add additional components based on agent framework\n if (userAnswers.agentFramework !== 'None') {\n switch (userAnswers.agentFramework) {\n case 'LangGraph':\n components.push(templateMapping.LangGraphPlatform)\n break\n case 'CrewAI':\n if (userAnswers.crewType === 'Crews') {\n components.push(templateMapping.CrewEnterprise)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n break\n default:\n components.push(templateMapping.RemoteEndpoint)\n break\n }\n }\n \n // Small pause before running shadcn\n await new Promise(resolve => setTimeout(resolve, 100));\n \n try {\n // Run shadcn with inherited stdio for all streams to allow for user input\n const result = spawn.sync('npx', ['shadcn@latest', 'add', ...components], { \n stdio: 'inherit' // This ensures stdin/stdout/stderr are all passed through\n });\n \n if (result.status !== 0) {\n throw new Error(`The shadcn installation process exited with code ${result.status}`);\n }\n } catch (error) {\n throw error;\n }\n } catch (error) {\n throw error;\n }\n}","import { Flags } from \"@oclif/core\"\n\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: Fields\n message: string\n choices?: string[]\n default?: string\n when?: (answers: Record<string, any>) => boolean\n}\n\n// Agent framework options\nexport const AGENT_FRAMEWORKS = ['CrewAI', 'LangGraph', 'None'] as const;\nexport type AgentFramework = typeof AGENT_FRAMEWORKS[number];\n\n// CrewAI types\nexport const CREW_TYPES = ['Crews', 'Flows'] as const;\nexport type CrewType = typeof CREW_TYPES[number];\n\n// UI component options\nexport const CHAT_COMPONENTS = ['CopilotChat','CopilotSidebar', 'Headless', 'CopilotPopup'] as const;\nexport type ChatComponent = typeof CHAT_COMPONENTS[number];\n\n// LangGraph agent types\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter', 'None'] as const;\nexport type LangGraphAgent = typeof LANGGRAPH_AGENTS[number];\n\n// Yes/No type for consistent options\nexport type YesNo = 'Yes' | 'No';\n\n// All possible field names for questions\nexport type Fields = \n \"copilotKitVersion\" | \n \"agentFramework\" | \n \"alreadyDeployed\" |\n \"fastApiEnabled\" | \n \"useCopilotCloud\" | \n \"chatUi\" | \n \"langGraphAgent\" | \n \"langGraphPlatform\" |\n \"langGraphPlatformUrl\" | \n \"crewType\" | \n \"crewName\" | \n \"langGraphRemoteEndpointURL\" |\n \"crewUrl\" | \n \"crewBearerToken\" | \n \"langSmithApiKey\" | \n \"llmToken\";\n\n// Complete configuration shape that holds all possible answers\nexport interface Config {\n copilotKitVersion: string;\n agentFramework: AgentFramework;\n alreadyDeployed?: YesNo;\n fastApiEnabled?: YesNo;\n useCopilotCloud?: YesNo;\n chatUi: ChatComponent;\n\n // LangGraph\n langGraphAgent?: LangGraphAgent;\n langGraphPlatform?: YesNo;\n langGraphPlatformUrl?: string;\n langGraphRemoteEndpointURL?: string;\n\n // CrewAI\n crewType?: CrewType;\n crewName?: string;\n crewUrl?: string;\n crewBearerToken?: string;\n\n // API keys and tokens\n copilotCloudPublicApiKey?: string;\n langSmithApiKey?: string;\n llmToken?: string;\n}\n\n// CLI flags definition - single source of truth for flag descriptions\nexport const ConfigFlags = {\n copilotKitVersion: Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n agentFramework: Flags.string({description: 'Agent framework to power your copilot', options: AGENT_FRAMEWORKS}),\n fastApiEnabled: Flags.string({description: 'Use FastAPI to serve your agent locally', options: ['Yes', 'No']}),\n useCopilotCloud: Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: ['Yes', 'No']}),\n chatUi: Flags.string({description: 'Chat UI component to add to your app', options: CHAT_COMPONENTS}),\n langGraphAgent: Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n crewType: Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n crewName: Flags.string({description: 'Name for your CrewAI agent'}),\n crewUrl: Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n crewBearerToken: Flags.string({description: 'Bearer token for CrewAI authentication'}),\n langSmithApiKey: Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n llmToken: Flags.string({description: 'API key for your preferred LLM provider'}),\n}","export type ChatTemplate = \n \"CopilotChat\" |\n \"CopilotPopup\" |\n \"CopilotSidebar\"\n\nexport type StarterTemplate = \n \"LangGraphPlatform\" |\n \"RemoteEndpoint\" |\n \"Standard\" |\n \"CrewEnterprise\"\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = \"http://registry.copilotkit.ai/r\"\n\nexport const templateMapping: Record<Template, string> = {\n \"LangGraphPlatform\": `${BASE_URL}/langgraph-platform-starter.json`,\n \"RemoteEndpoint\": `${BASE_URL}/remote-endpoint-starter.json`,\n \"CrewEnterprise\": `${BASE_URL}/agent-layout.json`,\n\n \"Standard\": `${BASE_URL}/standard-starter.json`,\n \"CopilotChat\": `${BASE_URL}/chat.json`,\n \"CopilotPopup\": `${BASE_URL}/popup.json`,\n \"CopilotSidebar\": `${BASE_URL}/sidebar.json`,\n}"],"mappings":";AAAA,OAAO,WAAW;;;ACAlB,SAAS,aAAa;AAYf,IAAM,mBAAmB,CAAC,UAAU,aAAa,MAAM;AAIvD,IAAM,aAAa,CAAC,SAAS,OAAO;AAIpC,IAAM,kBAAkB,CAAC,eAAc,kBAAkB,YAAY,cAAc;AAInF,IAAM,mBAAmB,CAAC,kBAAkB,sBAAsB,MAAM;AAqDxE,IAAM,cAAc;AAAA,EACzB,mBAAmB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACvF,gBAAgB,MAAM,OAAO,EAAC,aAAa,yCAAyC,SAAS,iBAAgB,CAAC;AAAA,EAC9G,gBAAgB,MAAM,OAAO,EAAC,aAAa,2CAA2C,SAAS,CAAC,OAAO,IAAI,EAAC,CAAC;AAAA,EAC7G,iBAAiB,MAAM,OAAO,EAAC,aAAa,kDAAkD,SAAS,CAAC,OAAO,IAAI,EAAC,CAAC;AAAA,EACrH,QAAQ,MAAM,OAAO,EAAC,aAAa,wCAAwC,SAAS,gBAAe,CAAC;AAAA,EACpG,gBAAgB,MAAM,OAAO,EAAC,aAAa,mCAAmC,SAAS,iBAAgB,CAAC;AAAA,EACxG,UAAU,MAAM,OAAO,EAAC,aAAa,8BAA8B,SAAS,WAAU,CAAC;AAAA,EACvF,UAAU,MAAM,OAAO,EAAC,aAAa,6BAA4B,CAAC;AAAA,EAClE,SAAS,MAAM,OAAO,EAAC,aAAa,qCAAoC,CAAC;AAAA,EACzE,iBAAiB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACrF,iBAAiB,MAAM,OAAO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|
+
export { AGENT_FRAMEWORKS, AgentFramework, CHAT_COMPONENTS, CREW_TYPES, ChatComponent, Config, ConfigFlags, CrewType, Fields, LANGGRAPH_AGENTS, LangGraphAgent, Question, YesNo } from './questions.js';
|
|
2
|
+
export { ChatTemplate, StarterTemplate, Template, templateMapping } from './templates.js';
|
|
3
|
+
import '@oclif/core/interfaces';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/lib/init/types/questions.ts
|
|
2
|
+
import { Flags } from "@oclif/core";
|
|
3
|
+
var AGENT_FRAMEWORKS = ["CrewAI", "LangGraph", "None"];
|
|
4
|
+
var CREW_TYPES = ["Crews", "Flows"];
|
|
5
|
+
var CHAT_COMPONENTS = ["CopilotChat", "CopilotSidebar", "Headless", "CopilotPopup"];
|
|
6
|
+
var LANGGRAPH_AGENTS = ["Python Starter", "TypeScript Starter", "None"];
|
|
7
|
+
var ConfigFlags = {
|
|
8
|
+
copilotKitVersion: Flags.string({ description: "CopilotKit version to use (e.g. 1.7.0)" }),
|
|
9
|
+
agentFramework: Flags.string({ description: "Agent framework to power your copilot", options: AGENT_FRAMEWORKS }),
|
|
10
|
+
fastApiEnabled: Flags.string({ description: "Use FastAPI to serve your agent locally", options: ["Yes", "No"] }),
|
|
11
|
+
useCopilotCloud: Flags.string({ description: "Use Copilot Cloud for production-ready hosting", options: ["Yes", "No"] }),
|
|
12
|
+
chatUi: Flags.string({ description: "Chat UI component to add to your app", options: CHAT_COMPONENTS }),
|
|
13
|
+
langGraphAgent: Flags.string({ description: "LangGraph agent template to use", options: LANGGRAPH_AGENTS }),
|
|
14
|
+
crewType: Flags.string({ description: "CrewAI implementation type", options: CREW_TYPES }),
|
|
15
|
+
crewName: Flags.string({ description: "Name for your CrewAI agent" }),
|
|
16
|
+
crewUrl: Flags.string({ description: "URL endpoint for your CrewAI agent" }),
|
|
17
|
+
crewBearerToken: Flags.string({ description: "Bearer token for CrewAI authentication" }),
|
|
18
|
+
langSmithApiKey: Flags.string({ description: "LangSmith API key for LangGraph observability" }),
|
|
19
|
+
llmToken: Flags.string({ description: "API key for your preferred LLM provider" })
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/lib/init/types/templates.ts
|
|
23
|
+
var BASE_URL = "http://registry.copilotkit.ai/r";
|
|
24
|
+
var templateMapping = {
|
|
25
|
+
"LangGraphPlatform": `${BASE_URL}/langgraph-platform-starter.json`,
|
|
26
|
+
"RemoteEndpoint": `${BASE_URL}/remote-endpoint-starter.json`,
|
|
27
|
+
"CrewEnterprise": `${BASE_URL}/agent-layout.json`,
|
|
28
|
+
"Standard": `${BASE_URL}/standard-starter.json`,
|
|
29
|
+
"CopilotChat": `${BASE_URL}/chat.json`,
|
|
30
|
+
"CopilotPopup": `${BASE_URL}/popup.json`,
|
|
31
|
+
"CopilotSidebar": `${BASE_URL}/sidebar.json`
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
AGENT_FRAMEWORKS,
|
|
35
|
+
CHAT_COMPONENTS,
|
|
36
|
+
CREW_TYPES,
|
|
37
|
+
ConfigFlags,
|
|
38
|
+
LANGGRAPH_AGENTS,
|
|
39
|
+
templateMapping
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/types/templates.ts"],"sourcesContent":["import { Flags } from \"@oclif/core\"\n\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: Fields\n message: string\n choices?: string[]\n default?: string\n when?: (answers: Record<string, any>) => boolean\n}\n\n// Agent framework options\nexport const AGENT_FRAMEWORKS = ['CrewAI', 'LangGraph', 'None'] as const;\nexport type AgentFramework = typeof AGENT_FRAMEWORKS[number];\n\n// CrewAI types\nexport const CREW_TYPES = ['Crews', 'Flows'] as const;\nexport type CrewType = typeof CREW_TYPES[number];\n\n// UI component options\nexport const CHAT_COMPONENTS = ['CopilotChat','CopilotSidebar', 'Headless', 'CopilotPopup'] as const;\nexport type ChatComponent = typeof CHAT_COMPONENTS[number];\n\n// LangGraph agent types\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter', 'None'] as const;\nexport type LangGraphAgent = typeof LANGGRAPH_AGENTS[number];\n\n// Yes/No type for consistent options\nexport type YesNo = 'Yes' | 'No';\n\n// All possible field names for questions\nexport type Fields = \n \"copilotKitVersion\" | \n \"agentFramework\" | \n \"alreadyDeployed\" |\n \"fastApiEnabled\" | \n \"useCopilotCloud\" | \n \"chatUi\" | \n \"langGraphAgent\" | \n \"langGraphPlatform\" |\n \"langGraphPlatformUrl\" | \n \"crewType\" | \n \"crewName\" | \n \"langGraphRemoteEndpointURL\" |\n \"crewUrl\" | \n \"crewBearerToken\" | \n \"langSmithApiKey\" | \n \"llmToken\";\n\n// Complete configuration shape that holds all possible answers\nexport interface Config {\n copilotKitVersion: string;\n agentFramework: AgentFramework;\n alreadyDeployed?: YesNo;\n fastApiEnabled?: YesNo;\n useCopilotCloud?: YesNo;\n chatUi: ChatComponent;\n\n // LangGraph\n langGraphAgent?: LangGraphAgent;\n langGraphPlatform?: YesNo;\n langGraphPlatformUrl?: string;\n langGraphRemoteEndpointURL?: string;\n\n // CrewAI\n crewType?: CrewType;\n crewName?: string;\n crewUrl?: string;\n crewBearerToken?: string;\n\n // API keys and tokens\n copilotCloudPublicApiKey?: string;\n langSmithApiKey?: string;\n llmToken?: string;\n}\n\n// CLI flags definition - single source of truth for flag descriptions\nexport const ConfigFlags = {\n copilotKitVersion: Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n agentFramework: Flags.string({description: 'Agent framework to power your copilot', options: AGENT_FRAMEWORKS}),\n fastApiEnabled: Flags.string({description: 'Use FastAPI to serve your agent locally', options: ['Yes', 'No']}),\n useCopilotCloud: Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: ['Yes', 'No']}),\n chatUi: Flags.string({description: 'Chat UI component to add to your app', options: CHAT_COMPONENTS}),\n langGraphAgent: Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n crewType: Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n crewName: Flags.string({description: 'Name for your CrewAI agent'}),\n crewUrl: Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n crewBearerToken: Flags.string({description: 'Bearer token for CrewAI authentication'}),\n langSmithApiKey: Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n llmToken: Flags.string({description: 'API key for your preferred LLM provider'}),\n}","export type ChatTemplate = \n \"CopilotChat\" |\n \"CopilotPopup\" |\n \"CopilotSidebar\"\n\nexport type StarterTemplate = \n \"LangGraphPlatform\" |\n \"RemoteEndpoint\" |\n \"Standard\" |\n \"CrewEnterprise\"\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = \"http://registry.copilotkit.ai/r\"\n\nexport const templateMapping: Record<Template, string> = {\n \"LangGraphPlatform\": `${BASE_URL}/langgraph-platform-starter.json`,\n \"RemoteEndpoint\": `${BASE_URL}/remote-endpoint-starter.json`,\n \"CrewEnterprise\": `${BASE_URL}/agent-layout.json`,\n\n \"Standard\": `${BASE_URL}/standard-starter.json`,\n \"CopilotChat\": `${BASE_URL}/chat.json`,\n \"CopilotPopup\": `${BASE_URL}/popup.json`,\n \"CopilotSidebar\": `${BASE_URL}/sidebar.json`,\n}"],"mappings":";AAAA,SAAS,aAAa;AAYf,IAAM,mBAAmB,CAAC,UAAU,aAAa,MAAM;AAIvD,IAAM,aAAa,CAAC,SAAS,OAAO;AAIpC,IAAM,kBAAkB,CAAC,eAAc,kBAAkB,YAAY,cAAc;AAInF,IAAM,mBAAmB,CAAC,kBAAkB,sBAAsB,MAAM;AAqDxE,IAAM,cAAc;AAAA,EACzB,mBAAmB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACvF,gBAAgB,MAAM,OAAO,EAAC,aAAa,yCAAyC,SAAS,iBAAgB,CAAC;AAAA,EAC9G,gBAAgB,MAAM,OAAO,EAAC,aAAa,2CAA2C,SAAS,CAAC,OAAO,IAAI,EAAC,CAAC;AAAA,EAC7G,iBAAiB,MAAM,OAAO,EAAC,aAAa,kDAAkD,SAAS,CAAC,OAAO,IAAI,EAAC,CAAC;AAAA,EACrH,QAAQ,MAAM,OAAO,EAAC,aAAa,wCAAwC,SAAS,gBAAe,CAAC;AAAA,EACpG,gBAAgB,MAAM,OAAO,EAAC,aAAa,mCAAmC,SAAS,iBAAgB,CAAC;AAAA,EACxG,UAAU,MAAM,OAAO,EAAC,aAAa,8BAA8B,SAAS,WAAU,CAAC;AAAA,EACvF,UAAU,MAAM,OAAO,EAAC,aAAa,6BAA4B,CAAC;AAAA,EAClE,SAAS,MAAM,OAAO,EAAC,aAAa,qCAAoC,CAAC;AAAA,EACzE,iBAAiB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACrF,iBAAiB,MAAM,OAAO,EAAC,aAAa,gDAA+C,CAAC;AAAA,EAC5F,UAAU,MAAM,OAAO,EAAC,aAAa,0CAAyC,CAAC;AACjF;;;AC7EA,IAAM,WAAW;AAEV,IAAM,kBAA4C;AAAA,EACrD,qBAAqB,GAAG,QAAQ;AAAA,EAChC,kBAAkB,GAAG,QAAQ;AAAA,EAC7B,kBAAkB,GAAG,QAAQ;AAAA,EAE7B,YAAY,GAAG,QAAQ;AAAA,EACvB,eAAe,GAAG,QAAQ;AAAA,EAC1B,gBAAgB,GAAG,QAAQ;AAAA,EAC3B,kBAAkB,GAAG,QAAQ;AACjC;","names":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as _oclif_core_interfaces from '@oclif/core/interfaces';
|
|
2
|
+
|
|
3
|
+
type Question = {
|
|
4
|
+
type: 'input' | 'yes/no' | 'select';
|
|
5
|
+
name: Fields;
|
|
6
|
+
message: string;
|
|
7
|
+
choices?: string[];
|
|
8
|
+
default?: string;
|
|
9
|
+
when?: (answers: Record<string, any>) => boolean;
|
|
10
|
+
};
|
|
11
|
+
declare const AGENT_FRAMEWORKS: readonly ["CrewAI", "LangGraph", "None"];
|
|
12
|
+
type AgentFramework = typeof AGENT_FRAMEWORKS[number];
|
|
13
|
+
declare const CREW_TYPES: readonly ["Crews", "Flows"];
|
|
14
|
+
type CrewType = typeof CREW_TYPES[number];
|
|
15
|
+
declare const CHAT_COMPONENTS: readonly ["CopilotChat", "CopilotSidebar", "Headless", "CopilotPopup"];
|
|
16
|
+
type ChatComponent = typeof CHAT_COMPONENTS[number];
|
|
17
|
+
declare const LANGGRAPH_AGENTS: readonly ["Python Starter", "TypeScript Starter", "None"];
|
|
18
|
+
type LangGraphAgent = typeof LANGGRAPH_AGENTS[number];
|
|
19
|
+
type YesNo = 'Yes' | 'No';
|
|
20
|
+
type Fields = "copilotKitVersion" | "agentFramework" | "alreadyDeployed" | "fastApiEnabled" | "useCopilotCloud" | "chatUi" | "langGraphAgent" | "langGraphPlatform" | "langGraphPlatformUrl" | "crewType" | "crewName" | "langGraphRemoteEndpointURL" | "crewUrl" | "crewBearerToken" | "langSmithApiKey" | "llmToken";
|
|
21
|
+
interface Config {
|
|
22
|
+
copilotKitVersion: string;
|
|
23
|
+
agentFramework: AgentFramework;
|
|
24
|
+
alreadyDeployed?: YesNo;
|
|
25
|
+
fastApiEnabled?: YesNo;
|
|
26
|
+
useCopilotCloud?: YesNo;
|
|
27
|
+
chatUi: ChatComponent;
|
|
28
|
+
langGraphAgent?: LangGraphAgent;
|
|
29
|
+
langGraphPlatform?: YesNo;
|
|
30
|
+
langGraphPlatformUrl?: string;
|
|
31
|
+
langGraphRemoteEndpointURL?: string;
|
|
32
|
+
crewType?: CrewType;
|
|
33
|
+
crewName?: string;
|
|
34
|
+
crewUrl?: string;
|
|
35
|
+
crewBearerToken?: string;
|
|
36
|
+
copilotCloudPublicApiKey?: string;
|
|
37
|
+
langSmithApiKey?: string;
|
|
38
|
+
llmToken?: string;
|
|
39
|
+
}
|
|
40
|
+
declare const ConfigFlags: {
|
|
41
|
+
copilotKitVersion: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
42
|
+
agentFramework: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
43
|
+
fastApiEnabled: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
44
|
+
useCopilotCloud: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
45
|
+
chatUi: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
46
|
+
langGraphAgent: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
47
|
+
crewType: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
48
|
+
crewName: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
49
|
+
crewUrl: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
50
|
+
crewBearerToken: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
51
|
+
langSmithApiKey: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
52
|
+
llmToken: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { AGENT_FRAMEWORKS, type AgentFramework, CHAT_COMPONENTS, CREW_TYPES, type ChatComponent, type Config, ConfigFlags, type CrewType, type Fields, LANGGRAPH_AGENTS, type LangGraphAgent, type Question, type YesNo };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/lib/init/types/questions.ts
|
|
2
|
+
import { Flags } from "@oclif/core";
|
|
3
|
+
var AGENT_FRAMEWORKS = ["CrewAI", "LangGraph", "None"];
|
|
4
|
+
var CREW_TYPES = ["Crews", "Flows"];
|
|
5
|
+
var CHAT_COMPONENTS = ["CopilotChat", "CopilotSidebar", "Headless", "CopilotPopup"];
|
|
6
|
+
var LANGGRAPH_AGENTS = ["Python Starter", "TypeScript Starter", "None"];
|
|
7
|
+
var ConfigFlags = {
|
|
8
|
+
copilotKitVersion: Flags.string({ description: "CopilotKit version to use (e.g. 1.7.0)" }),
|
|
9
|
+
agentFramework: Flags.string({ description: "Agent framework to power your copilot", options: AGENT_FRAMEWORKS }),
|
|
10
|
+
fastApiEnabled: Flags.string({ description: "Use FastAPI to serve your agent locally", options: ["Yes", "No"] }),
|
|
11
|
+
useCopilotCloud: Flags.string({ description: "Use Copilot Cloud for production-ready hosting", options: ["Yes", "No"] }),
|
|
12
|
+
chatUi: Flags.string({ description: "Chat UI component to add to your app", options: CHAT_COMPONENTS }),
|
|
13
|
+
langGraphAgent: Flags.string({ description: "LangGraph agent template to use", options: LANGGRAPH_AGENTS }),
|
|
14
|
+
crewType: Flags.string({ description: "CrewAI implementation type", options: CREW_TYPES }),
|
|
15
|
+
crewName: Flags.string({ description: "Name for your CrewAI agent" }),
|
|
16
|
+
crewUrl: Flags.string({ description: "URL endpoint for your CrewAI agent" }),
|
|
17
|
+
crewBearerToken: Flags.string({ description: "Bearer token for CrewAI authentication" }),
|
|
18
|
+
langSmithApiKey: Flags.string({ description: "LangSmith API key for LangGraph observability" }),
|
|
19
|
+
llmToken: Flags.string({ description: "API key for your preferred LLM provider" })
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
AGENT_FRAMEWORKS,
|
|
23
|
+
CHAT_COMPONENTS,
|
|
24
|
+
CREW_TYPES,
|
|
25
|
+
ConfigFlags,
|
|
26
|
+
LANGGRAPH_AGENTS
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=questions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/types/questions.ts"],"sourcesContent":["import { Flags } from \"@oclif/core\"\n\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: Fields\n message: string\n choices?: string[]\n default?: string\n when?: (answers: Record<string, any>) => boolean\n}\n\n// Agent framework options\nexport const AGENT_FRAMEWORKS = ['CrewAI', 'LangGraph', 'None'] as const;\nexport type AgentFramework = typeof AGENT_FRAMEWORKS[number];\n\n// CrewAI types\nexport const CREW_TYPES = ['Crews', 'Flows'] as const;\nexport type CrewType = typeof CREW_TYPES[number];\n\n// UI component options\nexport const CHAT_COMPONENTS = ['CopilotChat','CopilotSidebar', 'Headless', 'CopilotPopup'] as const;\nexport type ChatComponent = typeof CHAT_COMPONENTS[number];\n\n// LangGraph agent types\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter', 'None'] as const;\nexport type LangGraphAgent = typeof LANGGRAPH_AGENTS[number];\n\n// Yes/No type for consistent options\nexport type YesNo = 'Yes' | 'No';\n\n// All possible field names for questions\nexport type Fields = \n \"copilotKitVersion\" | \n \"agentFramework\" | \n \"alreadyDeployed\" |\n \"fastApiEnabled\" | \n \"useCopilotCloud\" | \n \"chatUi\" | \n \"langGraphAgent\" | \n \"langGraphPlatform\" |\n \"langGraphPlatformUrl\" | \n \"crewType\" | \n \"crewName\" | \n \"langGraphRemoteEndpointURL\" |\n \"crewUrl\" | \n \"crewBearerToken\" | \n \"langSmithApiKey\" | \n \"llmToken\";\n\n// Complete configuration shape that holds all possible answers\nexport interface Config {\n copilotKitVersion: string;\n agentFramework: AgentFramework;\n alreadyDeployed?: YesNo;\n fastApiEnabled?: YesNo;\n useCopilotCloud?: YesNo;\n chatUi: ChatComponent;\n\n // LangGraph\n langGraphAgent?: LangGraphAgent;\n langGraphPlatform?: YesNo;\n langGraphPlatformUrl?: string;\n langGraphRemoteEndpointURL?: string;\n\n // CrewAI\n crewType?: CrewType;\n crewName?: string;\n crewUrl?: string;\n crewBearerToken?: string;\n\n // API keys and tokens\n copilotCloudPublicApiKey?: string;\n langSmithApiKey?: string;\n llmToken?: string;\n}\n\n// CLI flags definition - single source of truth for flag descriptions\nexport const ConfigFlags = {\n copilotKitVersion: Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n agentFramework: Flags.string({description: 'Agent framework to power your copilot', options: AGENT_FRAMEWORKS}),\n fastApiEnabled: Flags.string({description: 'Use FastAPI to serve your agent locally', options: ['Yes', 'No']}),\n useCopilotCloud: Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: ['Yes', 'No']}),\n chatUi: Flags.string({description: 'Chat UI component to add to your app', options: CHAT_COMPONENTS}),\n langGraphAgent: Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n crewType: Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n crewName: Flags.string({description: 'Name for your CrewAI agent'}),\n crewUrl: Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n crewBearerToken: Flags.string({description: 'Bearer token for CrewAI authentication'}),\n langSmithApiKey: Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n llmToken: Flags.string({description: 'API key for your preferred LLM provider'}),\n}"],"mappings":";AAAA,SAAS,aAAa;AAYf,IAAM,mBAAmB,CAAC,UAAU,aAAa,MAAM;AAIvD,IAAM,aAAa,CAAC,SAAS,OAAO;AAIpC,IAAM,kBAAkB,CAAC,eAAc,kBAAkB,YAAY,cAAc;AAInF,IAAM,mBAAmB,CAAC,kBAAkB,sBAAsB,MAAM;AAqDxE,IAAM,cAAc;AAAA,EACzB,mBAAmB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACvF,gBAAgB,MAAM,OAAO,EAAC,aAAa,yCAAyC,SAAS,iBAAgB,CAAC;AAAA,EAC9G,gBAAgB,MAAM,OAAO,EAAC,aAAa,2CAA2C,SAAS,CAAC,OAAO,IAAI,EAAC,CAAC;AAAA,EAC7G,iBAAiB,MAAM,OAAO,EAAC,aAAa,kDAAkD,SAAS,CAAC,OAAO,IAAI,EAAC,CAAC;AAAA,EACrH,QAAQ,MAAM,OAAO,EAAC,aAAa,wCAAwC,SAAS,gBAAe,CAAC;AAAA,EACpG,gBAAgB,MAAM,OAAO,EAAC,aAAa,mCAAmC,SAAS,iBAAgB,CAAC;AAAA,EACxG,UAAU,MAAM,OAAO,EAAC,aAAa,8BAA8B,SAAS,WAAU,CAAC;AAAA,EACvF,UAAU,MAAM,OAAO,EAAC,aAAa,6BAA4B,CAAC;AAAA,EAClE,SAAS,MAAM,OAAO,EAAC,aAAa,qCAAoC,CAAC;AAAA,EACzE,iBAAiB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACrF,iBAAiB,MAAM,OAAO,EAAC,aAAa,gDAA+C,CAAC;AAAA,EAC5F,UAAU,MAAM,OAAO,EAAC,aAAa,0CAAyC,CAAC;AACjF;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type ChatTemplate = "CopilotChat" | "CopilotPopup" | "CopilotSidebar";
|
|
2
|
+
type StarterTemplate = "LangGraphPlatform" | "RemoteEndpoint" | "Standard" | "CrewEnterprise";
|
|
3
|
+
type Template = ChatTemplate | StarterTemplate;
|
|
4
|
+
declare const templateMapping: Record<Template, string>;
|
|
5
|
+
|
|
6
|
+
export { type ChatTemplate, type StarterTemplate, type Template, templateMapping };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/lib/init/types/templates.ts
|
|
2
|
+
var BASE_URL = "http://registry.copilotkit.ai/r";
|
|
3
|
+
var templateMapping = {
|
|
4
|
+
"LangGraphPlatform": `${BASE_URL}/langgraph-platform-starter.json`,
|
|
5
|
+
"RemoteEndpoint": `${BASE_URL}/remote-endpoint-starter.json`,
|
|
6
|
+
"CrewEnterprise": `${BASE_URL}/agent-layout.json`,
|
|
7
|
+
"Standard": `${BASE_URL}/standard-starter.json`,
|
|
8
|
+
"CopilotChat": `${BASE_URL}/chat.json`,
|
|
9
|
+
"CopilotPopup": `${BASE_URL}/popup.json`,
|
|
10
|
+
"CopilotSidebar": `${BASE_URL}/sidebar.json`
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
templateMapping
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/types/templates.ts"],"sourcesContent":["export type ChatTemplate = \n \"CopilotChat\" |\n \"CopilotPopup\" |\n \"CopilotSidebar\"\n\nexport type StarterTemplate = \n \"LangGraphPlatform\" |\n \"RemoteEndpoint\" |\n \"Standard\" |\n \"CrewEnterprise\"\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = \"http://registry.copilotkit.ai/r\"\n\nexport const templateMapping: Record<Template, string> = {\n \"LangGraphPlatform\": `${BASE_URL}/langgraph-platform-starter.json`,\n \"RemoteEndpoint\": `${BASE_URL}/remote-endpoint-starter.json`,\n \"CrewEnterprise\": `${BASE_URL}/agent-layout.json`,\n\n \"Standard\": `${BASE_URL}/standard-starter.json`,\n \"CopilotChat\": `${BASE_URL}/chat.json`,\n \"CopilotPopup\": `${BASE_URL}/popup.json`,\n \"CopilotSidebar\": `${BASE_URL}/sidebar.json`,\n}"],"mappings":";AAaA,IAAM,WAAW;AAEV,IAAM,kBAA4C;AAAA,EACrD,qBAAqB,GAAG,QAAQ;AAAA,EAChC,kBAAkB,GAAG,QAAQ;AAAA,EAC7B,kBAAkB,GAAG,QAAQ;AAAA,EAE7B,YAAY,GAAG,QAAQ;AAAA,EACvB,eAAe,GAAG,QAAQ;AAAA,EAC1B,gBAAgB,GAAG,QAAQ;AAAA,EAC3B,kBAAkB,GAAG,QAAQ;AACjC;","names":[]}
|
|
@@ -138,8 +138,6 @@ var AuthService = class {
|
|
|
138
138
|
if (shouldLogin) {
|
|
139
139
|
const loginResult = await this.login({ exitAfterLogin: false });
|
|
140
140
|
cliToken = loginResult.cliToken;
|
|
141
|
-
cmd.log(`\u{1FA81} Logged in as ${chalk.hex("#7553fc")(loginResult.user.email)}
|
|
142
|
-
`);
|
|
143
141
|
return loginResult;
|
|
144
142
|
} else {
|
|
145
143
|
cmd.error("Authentication required to proceed.");
|
|
@@ -199,8 +197,7 @@ var AuthService = class {
|
|
|
199
197
|
}
|
|
200
198
|
this.config.set("cliToken", cliToken);
|
|
201
199
|
res.status(200).json({ message: "Callback called" });
|
|
202
|
-
spinner.succeed(`\u{1FA81} Successfully logged in as ${chalk.hex("#7553fc")(user.email)}
|
|
203
|
-
`);
|
|
200
|
+
spinner.succeed(`\u{1FA81} Successfully logged in as ${chalk.hex("#7553fc")(user.email)}`);
|
|
204
201
|
if (exitAfterLogin) {
|
|
205
202
|
process.exit(0);
|
|
206
203
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts"],"sourcesContent":["// @ts-ignore\nimport Conf from 'conf'\nimport cors from 'cors'\nimport express from 'express'\nimport crypto from 'node:crypto'\nimport open from 'open'\nimport getPort from 'get-port'\nimport ora from 'ora'\nimport chalk from 'chalk'\nimport inquirer from 'inquirer'\nimport {Command} from '@oclif/core'\nimport {createTRPCClient} from '../utils/trpc.js'\nimport {AnalyticsService} from '../services/analytics.service.js'\nimport { BaseCommand } from '../commands/base-command.js'\n\ninterface LoginResponse {\n cliToken: string\n user: {\n email: string\n id: string\n }\n organization: {\n id: string\n }\n}\n\nexport class AuthService {\n private readonly config = new Conf({projectName: 'CopilotKitCLI'})\n private readonly COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || 'https://cloud.copilotkit.ai'\n\n getToken(): string | undefined {\n return this.config.get('cliToken') as string | undefined\n }\n\n getCLIToken(): string | undefined {\n const cliToken = this.config.get('cliToken') as string | undefined\n return cliToken\n }\n\n async logout(cmd: BaseCommand): Promise<void> {\n this.config.delete('cliToken')\n }\n\n async requireLogin(cmd: Command): Promise<LoginResponse> {\n let cliToken = this.getCLIToken()\n\n // Check authentication\n if (!cliToken) {\n try {\n const {shouldLogin} = await inquirer.prompt([\n {\n name: 'shouldLogin',\n type: 'confirm',\n message: 'You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)',\n default: true,\n },\n ])\n\n if (shouldLogin) {\n const loginResult = await this.login({exitAfterLogin: false})\n cliToken = loginResult.cliToken\n cmd.log(`🪁 Logged in as ${chalk.hex('#7553fc')(loginResult.user.email)}\\n`)\n return loginResult\n } else {\n cmd.error('Authentication required to proceed.')\n }\n } catch (error) {\n if (error instanceof Error && error.name === 'ExitPromptError') {\n cmd.error(chalk.yellow('\\nAuthentication cancelled'))\n }\n\n throw error\n }\n }\n\n let me\n\n const trpcClient = createTRPCClient(cliToken)\n try {\n me = await trpcClient.me.query()\n } catch (error) {\n cmd.log(chalk.red('Could not authenticate with Copilot Cloud. Please try again.'))\n process.exit(1)\n }\n\n if (!me.organization || !me.user) {\n cmd.error('Authentication required to proceed.')\n }\n\n return {cliToken, user: me.user, organization: me.organization}\n }\n\n async login({exitAfterLogin}: {exitAfterLogin?: boolean} = {exitAfterLogin: true}): Promise<LoginResponse> {\n let analytics: AnalyticsService\n analytics = new AnalyticsService()\n\n const app = express()\n app.use(cors())\n app.use(express.urlencoded({extended: true}))\n app.use(express.json())\n\n const port = await getPort()\n const state = crypto.randomBytes(16).toString('hex')\n\n return new Promise(async (resolve) => {\n const server = app.listen(port, () => {})\n\n await analytics.track({\n event: 'cli.login.initiated',\n properties: {},\n })\n\n const spinner = ora('Waiting for browser authentication to complete...\\n').start()\n\n app.post('/callback', async (req, res) => {\n const {cliToken, user, organization} = req.body\n\n analytics = new AnalyticsService({userId: user.id, organizationId: organization.id, email: user.email})\n await analytics.track({\n event: 'cli.login.success',\n properties: {\n organizationId: organization.id,\n userId: user.id,\n email: user.email,\n },\n })\n\n if (state !== req.query.state) {\n res.status(401).json({message: 'Invalid state'})\n spinner.fail('Invalid state')\n return\n }\n\n this.config.set('cliToken', cliToken)\n res.status(200).json({message: 'Callback called'})\n spinner.succeed(`🪁 Successfully logged in as ${chalk.hex('#7553fc')(user.email)}\\n`)\n if (exitAfterLogin) {\n process.exit(0)\n } else {\n server.close();\n resolve({cliToken, user, organization});\n }\n })\n\n open(`${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`)\n })\n }\n}\n","import {createTRPCClient as createTRPClient_, unstable_httpBatchStreamLink} from '@trpc/client'\nimport type {CLIRouter} from '@repo/trpc-cli/cli-router'\nimport superjson from 'superjson'\n\nexport const COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || 'https://cloud.copilotkit.ai'\n\nexport function createTRPCClient(cliToken: string) {\n return createTRPClient_<CLIRouter>({\n links: [\n unstable_httpBatchStreamLink({\n transformer: superjson,\n url: `${COPILOT_CLOUD_BASE_URL}/api/trpc-cli`,\n headers: () => {\n const headers = new Headers()\n headers.set('x-trpc-source', 'cli')\n headers.set('x-cli-token', cliToken)\n return headers\n },\n }),\n ],\n })\n}\n","import {Analytics} from '@segment/analytics-node'\nimport {AnalyticsEvents} from './events.js'\nimport Conf from 'conf'\n\nexport class AnalyticsService {\n private segment: Analytics | undefined\n private globalProperties: Record<string, any> = {}\n private userId: string | undefined;\n private email: string | undefined;\n private organizationId: string | undefined;\n private config = new Conf({projectName: 'CopilotKitCLI'})\n\n constructor(private readonly authData?: {\n userId: string,\n email: string,\n organizationId: string,\n }) {\n if (process.env.SEGMENT_DISABLED === 'true') {\n return;\n }\n\n const segmentWriteKey = process.env.SEGMENT_WRITE_KEY || \"9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf\"\n\n this.globalProperties = {\n service: 'cli',\n }\n\n\n if (this.authData?.userId) {\n this.userId = this.authData.userId\n }\n\n if (this.authData?.email) {\n this.email = this.authData.email\n this.globalProperties.email = this.authData.email\n }\n\n if (this.authData?.organizationId) {\n this.organizationId = this.authData.organizationId\n }\n\n this.segment = new Analytics({\n writeKey: segmentWriteKey,\n disable: process.env.SEGMENT_DISABLE === 'true',\n })\n\n const config = new Conf({projectName: 'CopilotKitCLI'})\n if (!config.get('anonymousId')) {\n config.set('anonymousId', crypto.randomUUID())\n }\n }\n\n private getAnonymousId(): string {\n const anonymousId = this.config.get('anonymousId')\n if (!anonymousId) {\n const anonymousId = crypto.randomUUID()\n this.config.set('anonymousId', anonymousId)\n return anonymousId\n }\n\n return anonymousId as string;\n }\n\n public track<K extends keyof AnalyticsEvents>(\n event: Omit<Parameters<Analytics['track']>[0], 'userId'> & {\n event: K\n properties: AnalyticsEvents[K]\n },\n ): Promise<void> {\n if (!this.segment) {\n return Promise.resolve();\n }\n\n const payload = {\n userId: this.userId ? this.userId : undefined,\n email: this.email ? this.email : undefined,\n anonymousId: this.getAnonymousId(),\n event: event.event,\n properties: {\n ...this.globalProperties,\n ...event.properties,\n $groups: this.organizationId ? {\n segment_group: this.organizationId,\n } : undefined,\n eventProperties: {\n ...event.properties,\n ...this.globalProperties,\n },\n },\n }\n\n return new Promise((resolve, reject) => {\n this.segment!.track(payload, (err) => {\n if (err) {\n // Resolve anyway\n resolve();\n }\n\n resolve();\n })\n });\n }\n}\n"],"mappings":";AACA,OAAOA,WAAU;AACjB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAOC,aAAY;AACnB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAO,cAAc;;;ACTrB,SAAQ,oBAAoB,kBAAkB,oCAAmC;AAEjF,OAAO,eAAe;AAEf,IAAM,yBAAyB,QAAQ,IAAI,0BAA0B;AAErE,SAAS,iBAAiB,UAAkB;AACjD,SAAO,iBAA4B;AAAA,IACjC,OAAO;AAAA,MACL,6BAA6B;AAAA,QAC3B,aAAa;AAAA,QACb,KAAK,GAAG,sBAAsB;AAAA,QAC9B,SAAS,MAAM;AACb,gBAAM,UAAU,IAAI,QAAQ;AAC5B,kBAAQ,IAAI,iBAAiB,KAAK;AAClC,kBAAQ,IAAI,eAAe,QAAQ;AACnC,iBAAO;AAAA,QAC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CAAC;AAExC,YAAM,UAAU,MAAM;AAAA,QACpB,OAAO;AAAA,QACP,YAAY,CAAC;AAAA,MACf,CAAC;AAED,YAAM,UAAU,IAAI,qDAAqD,EAAE,MAAM;AAEjF,UAAI,KAAK,aAAa,OAAO,KAAK,QAAQ;AACxC,cAAM,EAAC,UAAU,MAAM,aAAY,IAAI,IAAI;AAE3C,oBAAY,IAAI,iBAAiB,EAAC,QAAQ,KAAK,IAAI,gBAAgB,aAAa,IAAI,OAAO,KAAK,MAAK,CAAC;AACtG,cAAM,UAAU,MAAM;AAAA,UACpB,OAAO;AAAA,UACP,YAAY;AAAA,YACV,gBAAgB,aAAa;AAAA,YAC7B,QAAQ,KAAK;AAAA,YACb,OAAO,KAAK;AAAA,UACd;AAAA,QACF,CAAC;AAED,YAAI,UAAU,IAAI,MAAM,OAAO;AAC7B,cAAI,OAAO,GAAG,EAAE,KAAK,EAAC,SAAS,gBAAe,CAAC;AAC/C,kBAAQ,KAAK,eAAe;AAC5B;AAAA,QACF;AAEA,aAAK,OAAO,IAAI,YAAY,QAAQ;AACpC,YAAI,OAAO,GAAG,EAAE,KAAK,EAAC,SAAS,kBAAiB,CAAC;AACjD,gBAAQ,QAAQ,uCAAgC,MAAM,IAAI,SAAS,EAAE,KAAK,KAAK,CAAC;AAAA,CAAI;AACpF,YAAI,gBAAgB;AAClB,kBAAQ,KAAK,CAAC;AAAA,QAChB,OAAO;AACL,iBAAO,MAAM;AACb,kBAAQ,EAAC,UAAU,MAAM,aAAY,CAAC;AAAA,QACxC;AAAA,MACF,CAAC;AAED,WAAK,GAAG,KAAK,sBAAsB,0CAA0C,IAAI,mBAAmB,KAAK,EAAE;AAAA,IAC7G,CAAC;AAAA,EACH;AACF;","names":["Conf","crypto","anonymousId","Conf","crypto"]}
|
|
1
|
+
{"version":3,"sources":["../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts"],"sourcesContent":["// @ts-ignore\nimport Conf from 'conf'\nimport cors from 'cors'\nimport express from 'express'\nimport crypto from 'node:crypto'\nimport open from 'open'\nimport getPort from 'get-port'\nimport ora from 'ora'\nimport chalk from 'chalk'\nimport inquirer from 'inquirer'\nimport {Command} from '@oclif/core'\nimport {createTRPCClient} from '../utils/trpc.js'\nimport {AnalyticsService} from '../services/analytics.service.js'\nimport { BaseCommand } from '../commands/base-command.js'\n\ninterface LoginResponse {\n cliToken: string\n user: {\n email: string\n id: string\n }\n organization: {\n id: string\n }\n}\n\nexport class AuthService {\n private readonly config = new Conf({projectName: 'CopilotKitCLI'})\n private readonly COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || 'https://cloud.copilotkit.ai'\n\n getToken(): string | undefined {\n return this.config.get('cliToken') as string | undefined\n }\n\n getCLIToken(): string | undefined {\n const cliToken = this.config.get('cliToken') as string | undefined\n return cliToken\n }\n\n async logout(cmd: BaseCommand): Promise<void> {\n this.config.delete('cliToken')\n }\n\n async requireLogin(cmd: Command): Promise<LoginResponse> {\n let cliToken = this.getCLIToken()\n\n // Check authentication\n if (!cliToken) {\n try {\n const {shouldLogin} = await inquirer.prompt([\n {\n name: 'shouldLogin',\n type: 'confirm',\n message: 'You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)',\n default: true,\n },\n ])\n\n if (shouldLogin) {\n const loginResult = await this.login({exitAfterLogin: false})\n cliToken = loginResult.cliToken\n return loginResult\n } else {\n cmd.error('Authentication required to proceed.')\n }\n } catch (error) {\n if (error instanceof Error && error.name === 'ExitPromptError') {\n cmd.error(chalk.yellow('\\nAuthentication cancelled'))\n }\n\n throw error\n }\n }\n\n let me\n\n const trpcClient = createTRPCClient(cliToken)\n try {\n me = await trpcClient.me.query()\n } catch (error) {\n cmd.log(chalk.red('Could not authenticate with Copilot Cloud. Please try again.'))\n process.exit(1)\n }\n\n if (!me.organization || !me.user) {\n cmd.error('Authentication required to proceed.')\n }\n\n return {cliToken, user: me.user, organization: me.organization}\n }\n\n async login({exitAfterLogin}: {exitAfterLogin?: boolean} = {exitAfterLogin: true}): Promise<LoginResponse> {\n let analytics: AnalyticsService\n analytics = new AnalyticsService()\n\n const app = express()\n app.use(cors())\n app.use(express.urlencoded({extended: true}))\n app.use(express.json())\n\n const port = await getPort()\n const state = crypto.randomBytes(16).toString('hex')\n\n return new Promise(async (resolve) => {\n const server = app.listen(port, () => {})\n\n await analytics.track({\n event: 'cli.login.initiated',\n properties: {},\n })\n\n const spinner = ora('Waiting for browser authentication to complete...\\n').start()\n\n app.post('/callback', async (req, res) => {\n const {cliToken, user, organization} = req.body\n\n analytics = new AnalyticsService({userId: user.id, organizationId: organization.id, email: user.email})\n await analytics.track({\n event: 'cli.login.success',\n properties: {\n organizationId: organization.id,\n userId: user.id,\n email: user.email,\n },\n })\n\n if (state !== req.query.state) {\n res.status(401).json({message: 'Invalid state'})\n spinner.fail('Invalid state')\n return\n }\n\n this.config.set('cliToken', cliToken)\n res.status(200).json({message: 'Callback called'})\n spinner.succeed(`🪁 Successfully logged in as ${chalk.hex('#7553fc')(user.email)}`)\n if (exitAfterLogin) {\n process.exit(0)\n } else {\n server.close();\n resolve({cliToken, user, organization});\n }\n })\n\n open(`${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`)\n })\n }\n}\n","import {createTRPCClient as createTRPClient_, unstable_httpBatchStreamLink} from '@trpc/client'\nimport type {CLIRouter} from '@repo/trpc-cli/cli-router'\nimport superjson from 'superjson'\n\nexport const COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || 'https://cloud.copilotkit.ai'\n\nexport function createTRPCClient(cliToken: string) {\n return createTRPClient_<CLIRouter>({\n links: [\n unstable_httpBatchStreamLink({\n transformer: superjson,\n url: `${COPILOT_CLOUD_BASE_URL}/api/trpc-cli`,\n headers: () => {\n const headers = new Headers()\n headers.set('x-trpc-source', 'cli')\n headers.set('x-cli-token', cliToken)\n return headers\n },\n }),\n ],\n })\n}\n","import {Analytics} from '@segment/analytics-node'\nimport {AnalyticsEvents} from './events.js'\nimport Conf from 'conf'\n\nexport class AnalyticsService {\n private segment: Analytics | undefined\n private globalProperties: Record<string, any> = {}\n private userId: string | undefined;\n private email: string | undefined;\n private organizationId: string | undefined;\n private config = new Conf({projectName: 'CopilotKitCLI'})\n\n constructor(private readonly authData?: {\n userId: string,\n email: string,\n organizationId: string,\n }) {\n if (process.env.SEGMENT_DISABLED === 'true') {\n return;\n }\n\n const segmentWriteKey = process.env.SEGMENT_WRITE_KEY || \"9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf\"\n\n this.globalProperties = {\n service: 'cli',\n }\n\n\n if (this.authData?.userId) {\n this.userId = this.authData.userId\n }\n\n if (this.authData?.email) {\n this.email = this.authData.email\n this.globalProperties.email = this.authData.email\n }\n\n if (this.authData?.organizationId) {\n this.organizationId = this.authData.organizationId\n }\n\n this.segment = new Analytics({\n writeKey: segmentWriteKey,\n disable: process.env.SEGMENT_DISABLE === 'true',\n })\n\n const config = new Conf({projectName: 'CopilotKitCLI'})\n if (!config.get('anonymousId')) {\n config.set('anonymousId', crypto.randomUUID())\n }\n }\n\n private getAnonymousId(): string {\n const anonymousId = this.config.get('anonymousId')\n if (!anonymousId) {\n const anonymousId = crypto.randomUUID()\n this.config.set('anonymousId', anonymousId)\n return anonymousId\n }\n\n return anonymousId as string;\n }\n\n public track<K extends keyof AnalyticsEvents>(\n event: Omit<Parameters<Analytics['track']>[0], 'userId'> & {\n event: K\n properties: AnalyticsEvents[K]\n },\n ): Promise<void> {\n if (!this.segment) {\n return Promise.resolve();\n }\n\n const payload = {\n userId: this.userId ? this.userId : undefined,\n email: this.email ? this.email : undefined,\n anonymousId: this.getAnonymousId(),\n event: event.event,\n properties: {\n ...this.globalProperties,\n ...event.properties,\n $groups: this.organizationId ? {\n segment_group: this.organizationId,\n } : undefined,\n eventProperties: {\n ...event.properties,\n ...this.globalProperties,\n },\n },\n }\n\n return new Promise((resolve, reject) => {\n this.segment!.track(payload, (err) => {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AAC,SAAS,kBAAiB,CAAC;AACjD,gBAAQ,QAAQ,uCAAgC,MAAM,IAAI,SAAS,EAAE,KAAK,KAAK,CAAC,EAAE;AAClF,YAAI,gBAAgB;AAClB,kBAAQ,KAAK,CAAC;AAAA,QAChB,OAAO;AACL,iBAAO,MAAM;AACb,kBAAQ,EAAC,UAAU,MAAM,aAAY,CAAC;AAAA,QACxC;AAAA,MACF,CAAC;AAED,WAAK,GAAG,KAAK,sBAAsB,0CAA0C,IAAI,mBAAmB,KAAK,EAAE;AAAA,IAC7G,CAAC;AAAA,EACH;AACF;","names":["Conf","crypto","anonymousId","Conf","crypto"]}
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { RemoteEndpointType } from '../utils/detect-endpoint-type.utils.js';
|
|
2
2
|
|
|
3
3
|
type AnalyticsEvents = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
'cli.login.initiated': {};
|
|
5
|
+
'cli.login.success': {
|
|
6
6
|
organizationId: string;
|
|
7
7
|
userId: string;
|
|
8
8
|
email: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
'cli.logout': {
|
|
11
11
|
organizationId: string;
|
|
12
12
|
userId: string;
|
|
13
13
|
email: string;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
'cli.dev.initiatied': {
|
|
16
16
|
port: string;
|
|
17
17
|
projectId: string;
|
|
18
|
-
endpointType: RemoteEndpointType.LangGraphPlatform | RemoteEndpointType.CopilotKit;
|
|
18
|
+
endpointType: RemoteEndpointType.LangGraphPlatform | RemoteEndpointType.CopilotKit | RemoteEndpointType.CrewAI;
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
'cli.dev.tunnel.created': {
|
|
21
21
|
tunnelId: string;
|
|
22
22
|
port: string;
|
|
23
23
|
projectId: string;
|
|
24
|
-
endpointType: RemoteEndpointType.LangGraphPlatform | RemoteEndpointType.CopilotKit;
|
|
24
|
+
endpointType: RemoteEndpointType.LangGraphPlatform | RemoteEndpointType.CopilotKit | RemoteEndpointType.CrewAI;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
'cli.dev.tunnel.closed': {
|
|
27
27
|
tunnelId: string;
|
|
28
28
|
};
|
|
29
|
+
'cli.init.cloud_used': {
|
|
30
|
+
userId: string;
|
|
31
|
+
};
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
export type { AnalyticsEvents };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
declare enum RemoteEndpointType {
|
|
2
2
|
LangGraphPlatform = "LangGraphPlatform",
|
|
3
3
|
CopilotKit = "CopilotKit",
|
|
4
|
+
CrewAI = "CrewAI",
|
|
4
5
|
Invalid = "Invalid"
|
|
5
6
|
}
|
|
6
|
-
declare const getHumanReadableEndpointType: (type: RemoteEndpointType) => "CopilotKit" | "
|
|
7
|
+
declare const getHumanReadableEndpointType: (type: RemoteEndpointType) => "CopilotKit" | "CrewAI" | "Invalid" | "LangGraph Platform";
|
|
7
8
|
declare function detectRemoteEndpointType(url: string): Promise<{
|
|
8
9
|
url: string;
|
|
9
10
|
type: RemoteEndpointType;
|