copilotkit 0.0.57 → 0.0.59

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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/dist/commands/base-command.js +9 -6
  3. package/dist/commands/base-command.js.map +1 -1
  4. package/dist/commands/create.d.ts +1 -1
  5. package/dist/commands/create.js +234 -59
  6. package/dist/commands/create.js.map +1 -1
  7. package/dist/commands/dev.js +94 -35
  8. package/dist/commands/dev.js.map +1 -1
  9. package/dist/commands/init.d.ts +0 -20
  10. package/dist/commands/init.js +243 -209
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/commands/login.js +44 -20
  13. package/dist/commands/login.js.map +1 -1
  14. package/dist/commands/logout.js +44 -20
  15. package/dist/commands/logout.js.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/lib/init/ide-docs.d.ts +1 -1
  18. package/dist/lib/init/ide-docs.js +19 -5
  19. package/dist/lib/init/ide-docs.js.map +1 -1
  20. package/dist/lib/init/index.js +171 -67
  21. package/dist/lib/init/index.js.map +1 -1
  22. package/dist/lib/init/questions.d.ts +1 -1
  23. package/dist/lib/init/questions.js +77 -18
  24. package/dist/lib/init/questions.js.map +1 -1
  25. package/dist/lib/init/scaffold/agent.js +30 -23
  26. package/dist/lib/init/scaffold/agent.js.map +1 -1
  27. package/dist/lib/init/scaffold/crew-inputs.js +17 -4
  28. package/dist/lib/init/scaffold/crew-inputs.js.map +1 -1
  29. package/dist/lib/init/scaffold/env.js +14 -11
  30. package/dist/lib/init/scaffold/env.js.map +1 -1
  31. package/dist/lib/init/scaffold/github.js +27 -6
  32. package/dist/lib/init/scaffold/github.js.map +1 -1
  33. package/dist/lib/init/scaffold/index.js +152 -62
  34. package/dist/lib/init/scaffold/index.js.map +1 -1
  35. package/dist/lib/init/scaffold/langgraph-assistants.js +14 -11
  36. package/dist/lib/init/scaffold/langgraph-assistants.js.map +1 -1
  37. package/dist/lib/init/scaffold/packages.js +3 -1
  38. package/dist/lib/init/scaffold/packages.js.map +1 -1
  39. package/dist/lib/init/scaffold/shadcn.js +88 -23
  40. package/dist/lib/init/scaffold/shadcn.js.map +1 -1
  41. package/dist/lib/init/types/index.js +77 -18
  42. package/dist/lib/init/types/index.js.map +1 -1
  43. package/dist/lib/init/types/questions.d.ts +19 -19
  44. package/dist/lib/init/types/questions.js +73 -17
  45. package/dist/lib/init/types/questions.js.map +1 -1
  46. package/dist/lib/init/types/templates.d.ts +2 -2
  47. package/dist/lib/init/types/templates.js +4 -1
  48. package/dist/lib/init/types/templates.js.map +1 -1
  49. package/dist/lib/init/utils.js.map +1 -1
  50. package/dist/services/analytics.service.d.ts +1 -1
  51. package/dist/services/analytics.service.js +4 -1
  52. package/dist/services/analytics.service.js.map +1 -1
  53. package/dist/services/auth.service.d.ts +1 -1
  54. package/dist/services/auth.service.js +35 -14
  55. package/dist/services/auth.service.js.map +1 -1
  56. package/dist/services/events.d.ts +33 -33
  57. package/dist/services/tunnel.service.js.map +1 -1
  58. package/dist/utils/detect-endpoint-type.utils.d.ts +1 -1
  59. package/dist/utils/detect-endpoint-type.utils.js +11 -4
  60. package/dist/utils/detect-endpoint-type.utils.js.map +1 -1
  61. package/dist/utils/trpc.js.map +1 -1
  62. package/dist/utils/version.d.ts +1 -1
  63. package/dist/utils/version.js +1 -1
  64. package/dist/utils/version.js.map +1 -1
  65. package/oclif.manifest.json +6 -163
  66. package/package.json +8 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/create.ts","../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/utils/trpc.ts"],"sourcesContent":["import {Config, Flags, Args} from '@oclif/core'\nimport inquirer from 'inquirer'\nimport chalk from 'chalk'\nimport fs from 'fs-extra'\nimport path from 'path'\nimport {promisify} from 'util'\nimport {pipeline} from 'stream'\nimport {createWriteStream} from 'fs'\nimport {extract} from 'tar'\nimport ora from 'ora'\n\nimport {BaseCommand} from './base-command.js'\n\nconst streamPipeline = promisify(pipeline)\n\nconst theme = {\n primary: chalk.magenta,\n secondary: chalk.gray,\n tertiary: chalk.gray,\n error: chalk.red,\n command: chalk.blue,\n success: chalk.green,\n warning: chalk.yellow,\n divider: chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),\n bottomPadding: '',\n}\n\ninterface CreateOptions {\n projectName: string\n agentFramework: AgentFramework\n}\n\ntype AgentFramework =\n | 'langgraph-py'\n | 'langgraph-js'\n | 'flows'\n | 'mastra'\n | 'pydantic-ai'\n | 'llamaindex'\n | 'agno'\n | 'ag2'\n | 'adk'\n | 'aws-strands-py'\n | 'a2a'\n | 'microsoft-agent-framework-dotnet'\n | 'microsoft-agent-framework-py'\n\nconst TEMPLATE_REPOS: Record<AgentFramework, string> = {\n 'langgraph-py': 'copilotkit/with-langgraph-python',\n 'langgraph-js': 'copilotkit/with-langgraph-js',\n mastra: 'copilotkit/with-mastra',\n flows: 'copilotkit/with-crewai-flows',\n llamaindex: 'copilotkit/with-llamaindex',\n agno: 'copilotkit/with-agno',\n 'pydantic-ai': 'copilotkit/with-pydantic-ai',\n ag2: 'ag2ai/ag2-copilotkit-starter',\n adk: 'copilotkit/with-adk',\n 'aws-strands-py': 'copilotkit/with-strands-python',\n a2a: 'copilotkit/with-a2a-middleware',\n 'microsoft-agent-framework-dotnet': 'copilotkit/with-microsoft-agent-framework-dotnet',\n 'microsoft-agent-framework-py': 'copilotkit/with-microsoft-agent-framework-python',\n}\n\nconst FRAMEWORK_DOCUMENTATION: Record<AgentFramework, string> = {\n 'langgraph-py': 'https://langchain-ai.github.io/langgraph/concepts/why-langgraph',\n 'langgraph-js': 'https://langchain-ai.github.io/langgraphjs',\n flows: 'https://docs.crewai.com/guides/flows/first-flow',\n mastra: 'https://mastra.ai/en/docs',\n 'pydantic-ai': 'https://ai.pydantic.dev/ag-ui/',\n llamaindex: 'https://docs.llamaindex.ai/en/stable',\n agno: 'https://docs.agno.com/',\n ag2: 'https://docs.ag2.ai/latest/docs/user-guide/basic-concepts/overview',\n adk: 'https://google.github.io/adk-docs/',\n 'aws-strands-py': 'https://strandsagents.com/latest/documentation/docs/',\n a2a: 'https://a2a-protocol.org/latest/',\n 'microsoft-agent-framework-dotnet': 'https://learn.microsoft.com/en-us/agent-framework/',\n 'microsoft-agent-framework-py': 'https://learn.microsoft.com/en-us/agent-framework/',\n}\n\nconst FRAMEWORK_EMOJI: Record<AgentFramework, string> = {\n 'langgraph-js': '🦜',\n 'langgraph-py': '🦜',\n flows: '👥',\n mastra: '🌑',\n 'pydantic-ai': '🔼',\n llamaindex: '🦙',\n ag2: '🤖',\n agno: '🅰️',\n adk: '🤖',\n a2a: '🤖',\n 'aws-strands-py': '🧬',\n 'microsoft-agent-framework-dotnet': '🟦',\n 'microsoft-agent-framework-py': '🟦',\n}\n\nconst KITE = `\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠙⣿⡛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠀⠀⠈⢿⡄⠀⠀⠀⠈⠉⠙⣻⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠈⢿⡄⠀⢀⣠⣴⠾⠋⢸⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⢀⣀⣀⣀⣀⣤⣤⡾⢿⡟⠛⠉⠀⠀⠀⠀⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⠛⠛⠛⠉⠉⠉⠁⠀⢠⡿⣿⡀⠀⠀⠀⠀⠀⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⣰⡟⠀⠸⣧⠀⠀⠀⠀⢠⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⢀⣼⠏⠀⠀⠀⣿⡀⠀⠀⠀⢸⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠂⣠⡿⠁⠀⠀⠀⠀⢸⡇⠀⠀⠀⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣡⣾⣿⣄⠀⠀⠀⠀⠀⢸⡇⠀⠀⢰⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⡟⠛⡿⠋⣡⣾⣿⣿⣿⣿⣦⡀⠀⠀⠀⢸⡇⠀⠀⣿⣿⣿⣿\n⣿⣿⣿⣿⡿⠿⣿⠷⠂⡀⠘⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⢸⡇⠀⣼⣿⣿⣿⣿\n⣿⣿⠻⢿⡷⠀⠁⠴⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⣾⠇⣴⣿⣿⣿⣿⣿\n⡿⠛⠀⠀⢴⣾⣷⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⣿⣾⣿⣿⣿⣿⣿⣿\n⣷⣾⣿⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n`\n\nexport default class Create extends BaseCommand {\n static description = 'Create a new CopilotKit project'\n\n static examples = [\n '$ copilotkit create my-app',\n '$ copilotkit create my-app --framework langgraph-js',\n '$ copilotkit create -n my-app -f langgraph-js',\n ]\n\n static flags = {\n ...BaseCommand.flags,\n framework: Flags.string({\n char: 'f',\n description: 'Agent framework to use',\n options: Object.keys(TEMPLATE_REPOS),\n required: false,\n }),\n name: Flags.string({\n char: 'n',\n description: 'Name of the project',\n required: false,\n }),\n 'no-banner': Flags.boolean({\n char: 'q',\n description: 'Removes the banner',\n default: false,\n required: false,\n }),\n project: Flags.string({\n description: 'project ID (deprecated, kept for backwards compatibility)',\n }),\n }\n\n static args = {\n projectName: Args.string({\n description: 'Name of the project',\n required: false,\n }),\n }\n\n constructor(argv: string[], config: Config) {\n super(argv, config)\n }\n\n async run() {\n const {args, flags} = await this.parse(Create)\n\n if (!flags['no-banner']) {\n this.log(theme.primary(KITE))\n this.log(theme.primary('~ Welcome to CopilotKit! ~\\n'))\n this.log(theme.divider)\n\n if ((!flags.name || flags.projectName) && !flags.framework) {\n this.log('\\n' + theme.secondary('Just a few questions to get started!\\n'))\n }\n }\n\n const projectNameInput = flags.name || args.projectName || (await this.promptProjectName())\n const projectName = projectNameInput.trim()\n const usingCurrentDir = projectName === '.' || projectName === './'\n const agentFramework = flags.framework || (await this.promptAgentFramework())\n\n const projectDir = usingCurrentDir ? process.cwd() : path.resolve(process.cwd(), projectName)\n\n if (usingCurrentDir) {\n const allowedEntries = new Set(['.git', '.gitignore', '.DS_Store'])\n const existingEntries = await fs.readdir(projectDir)\n const blockingEntries = existingEntries.filter((entry) => !allowedEntries.has(entry))\n\n if (blockingEntries.length > 0) {\n this.log(theme.error('\\nCurrent directory is not empty.'))\n this.log(theme.secondary('\\nPlease run create in an empty directory or specify a new project name.'))\n this.exit(1)\n }\n } else if (await fs.pathExists(projectDir)) {\n this.log(theme.error(`\\nDirectory \"${projectName}\" already exists.`))\n this.log(theme.secondary('\\nYou can:'))\n this.log(theme.secondary(' 1. Choose a different project name'))\n this.log(theme.secondary(' 2. Remove the existing directory manually if you want to use this name\\n'))\n this.exit(1)\n }\n\n const options: CreateOptions = {\n projectName,\n agentFramework: agentFramework as AgentFramework,\n }\n\n const spinner = ora({\n text: theme.secondary.bold('Creating your project...'),\n color: 'cyan',\n spinner: 'dots',\n }).start()\n\n try {\n await fs.ensureDir(projectDir)\n\n spinner.text = theme.secondary.bold('Downloading template...')\n await this.downloadTemplate(projectDir, options.agentFramework)\n\n const displayName = usingCurrentDir ? 'current directory' : `\"${projectName}\"`\n spinner.succeed(theme.secondary.bold(`Project ${displayName} created successfully!`))\n } catch (error: any) {\n spinner.fail(theme.error(`Failed to create project: ${error.message}`))\n this.exit(1)\n }\n\n this.log('\\n' + theme.divider)\n this.log(\n '\\n' +\n theme.secondary.bold(\n `🪁🤝${FRAMEWORK_EMOJI[options.agentFramework]} All set! \\n\\nYour project is ready to explore CopilotKit locally.`,\n ),\n )\n this.log('\\n' + theme.secondary('Next steps:'))\n if (usingCurrentDir) {\n this.log(theme.secondary(' • You are already inside your new project directory'))\n } else {\n this.log(theme.secondary(` • ${theme.command(`cd ${projectName}`)}`))\n }\n this.log(theme.secondary(' • Follow the setup instructions in the README.md'))\n this.log('\\n' + theme.secondary('Documentation:'))\n this.log(theme.secondary(' • ') + theme.command('https://docs.copilotkit.ai'))\n this.log(theme.secondary(' • ') + theme.command(FRAMEWORK_DOCUMENTATION[options.agentFramework]))\n this.log(theme.bottomPadding)\n }\n\n private async promptProjectName(): Promise<string> {\n const {projectName} = await inquirer.prompt([\n {\n type: 'input',\n name: 'projectName',\n message: theme.secondary('What is your project named?'),\n validate: (input: string) => {\n if (!input) return theme.error('Project name is required')\n if (!/^[a-z0-9-]+$/.test(input)) {\n return theme.error('Project name can only contain lowercase letters, numbers, and hyphens')\n }\n if (input.length > 30) {\n return theme.error('Project name must be less than 30 characters')\n }\n return true\n },\n },\n ])\n return projectName\n }\n\n private async promptAgentFramework(): Promise<string> {\n const {framework} = await inquirer.prompt([\n {\n type: 'list',\n name: 'framework',\n message: theme.secondary('Which agent framework would you like to use?'),\n choices: [\n {name: `${FRAMEWORK_EMOJI['langgraph-py']} LangGraph (Python)`, value: 'langgraph-py'},\n {name: `${FRAMEWORK_EMOJI['langgraph-js']} LangGraph (JavaScript)`, value: 'langgraph-js'},\n {name: `${FRAMEWORK_EMOJI.mastra} Mastra`, value: 'mastra'},\n {name: `${FRAMEWORK_EMOJI['pydantic-ai']} Pydantic AI`, value: 'pydantic-ai'},\n {name: `${FRAMEWORK_EMOJI['aws-strands-py']} AWS Strands (Python)`, value: 'aws-strands-py'},\n {name: `${FRAMEWORK_EMOJI.adk} ADK`, value: 'adk'},\n {\n name: `${FRAMEWORK_EMOJI['microsoft-agent-framework-dotnet']} Microsoft Agent Framework (.NET)`,\n value: 'microsoft-agent-framework-dotnet',\n },\n {\n name: `${FRAMEWORK_EMOJI['microsoft-agent-framework-py']} Microsoft Agent Framework (Python)`,\n value: 'microsoft-agent-framework-py',\n },\n {name: `${FRAMEWORK_EMOJI.flows} CrewAI Flows`, value: 'flows'},\n {name: `${FRAMEWORK_EMOJI.llamaindex} LlamaIndex`, value: 'llamaindex'},\n {name: `${FRAMEWORK_EMOJI.agno} Agno`, value: 'agno'},\n {name: `${FRAMEWORK_EMOJI.ag2} AG2`, value: 'ag2'},\n {name: `${FRAMEWORK_EMOJI.a2a} A2A`, value: 'a2a'},\n ],\n },\n ])\n return framework\n }\n\n private async downloadTemplate(projectDir: string, framework: AgentFramework): Promise<void> {\n const repo = TEMPLATE_REPOS[framework]\n const url = `https://github.com/${repo}/archive/refs/heads/main.tar.gz`\n\n try {\n const response = await fetch(url)\n if (!response.ok) throw new Error(`Failed to download template: ${response.statusText}`)\n\n const tempFile = path.join(projectDir, 'template.tar.gz')\n const fileStream = createWriteStream(tempFile)\n\n if (!response.body) throw new Error('Failed to get response body')\n await streamPipeline(response.body as any, fileStream)\n\n await extract({\n file: tempFile,\n cwd: projectDir,\n strip: 1,\n })\n\n await fs.remove(tempFile)\n } catch (error: any) {\n throw new Error(`Failed to download template: ${error.message}`)\n }\n }\n}\n","import {Command} from '@oclif/core'\nimport Sentry, {consoleIntegration} from '@sentry/node'\nimport {LIB_VERSION} from '../utils/version.js'\nimport {COPILOT_CLOUD_BASE_URL} from '../utils/trpc.js'\nimport chalk from 'chalk'\n\nexport class BaseCommand extends Command {\n async init() {\n await this.checkCLIVersion()\n\n if (process.env.SENTRY_DISABLED === 'true') {\n return\n }\n\n Sentry.init({\n dsn:\n process.env.SENTRY_DSN ||\n 'https://1eea15d32e2eacb0456a77db5e39aeeb@o4507288195170304.ingest.us.sentry.io/4508581448581120',\n integrations: [consoleIntegration()],\n // Tracing\n tracesSampleRate: 1.0, // Capture 100% of the transactions\n })\n }\n\n async catch(err: any) {\n if (process.env.SENTRY_DISABLED !== 'true') {\n Sentry.captureException(err)\n }\n\n const message = err?.message ?? 'Unknown error'\n\n this.log('\\n' + chalk.red(message) + '\\n')\n\n const exitCode = err?.oclif?.exit ?? 1\n this.exit(exitCode)\n }\n\n async finally() {\n if (process.env.SENTRY_DISABLED === 'true') {\n return\n }\n\n Sentry.close()\n }\n\n async run() {}\n\n async checkCLIVersion() {\n const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`)\n\n const data = await response.json()\n const cloudVersion = data.cliVersion\n\n if (!cloudVersion || cloudVersion === LIB_VERSION) {\n return\n }\n\n // TODO: add this back in, removed for crew ai launch since we don't want to keep releasing cloud\n // this.log(chalk.yellow('================ New version available! =================\\n'))\n // this.log(`You are using CopilotKit CLI v${LIB_VERSION}.`)\n // this.log(`A new CopilotKit CLI version is available (v${cloudVersion}).\\n`)\n // this.log('Please update your CLI to the latest version:\\n\\n')\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('npm:')))}\\t npm install -g copilotkit@${cloudVersion}\\n`)\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('pnpm:')))}\\t pnpm install -g copilotkit@${cloudVersion}\\n`)\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('yarn:')))}\\t yarn global add copilotkit@${cloudVersion}\\n`)\n // this.log(chalk.yellow('============================================================\\n\\n'))\n }\n\n async gracefulError(message: string) {\n this.log('\\n' + chalk.red(message))\n process.exit(1)\n }\n}\n","// This is auto generated!\nexport const LIB_VERSION = \"0.0.57\";\n","import {createTRPCClient as trpcClient, httpBatchLink} from '@trpc/client'\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): any {\n return trpcClient({\n links: [\n httpBatchLink({\n url: `${COPILOT_CLOUD_BASE_URL}/api/trpc-cli`,\n transformer: superjson,\n headers: () => {\n return {\n 'x-trpc-source': 'cli',\n 'x-cli-token': cliToken,\n }\n },\n }),\n ],\n })\n}\n"],"mappings":";AAAA,SAAgB,OAAO,YAAW;AAClC,OAAO,cAAc;AACrB,OAAOA,YAAW;AAClB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAQ,iBAAgB;AACxB,SAAQ,gBAAe;AACvB,SAAQ,yBAAwB;AAChC,SAAQ,eAAc;AACtB,OAAO,SAAS;;;ACThB,SAAQ,eAAc;AACtB,OAAO,UAAS,0BAAyB;;;ACAlC,IAAM,cAAc;;;ACD3B,SAAQ,oBAAoB,YAAY,qBAAoB;AAC5D,OAAO,eAAe;AAEf,IAAM,yBAAyB,QAAQ,IAAI,0BAA0B;;;AFC5E,OAAO,WAAW;AAEX,IAAM,cAAN,cAA0B,QAAQ;AAAA,EACvC,MAAM,OAAO;AACX,UAAM,KAAK,gBAAgB;AAE3B,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,KAAK;AAAA,MACV,KACE,QAAQ,IAAI,cACZ;AAAA,MACF,cAAc,CAAC,mBAAmB,CAAC;AAAA;AAAA,MAEnC,kBAAkB;AAAA;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAM,KAAU;AACpB,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C,aAAO,iBAAiB,GAAG;AAAA,IAC7B;AAEA,UAAM,UAAU,KAAK,WAAW;AAEhC,SAAK,IAAI,OAAO,MAAM,IAAI,OAAO,IAAI,IAAI;AAEzC,UAAM,WAAW,KAAK,OAAO,QAAQ;AACrC,SAAK,KAAK,QA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,kCAAkC,CAAC;AAAA,YAC5D,OAAO;AAAA,UACT;AAAA,UACA;AAAA,YACE,MAAM,GAAG,gBAAgB,8BAA8B,CAAC;AAAA,YACxD,OAAO;AAAA,UACT;AAAA,UACA,EAAC,MAAM,GAAG,gBAAgB,KAAK,iBAAiB,OAAO,QAAO;AAAA,UAC9D,EAAC,MAAM,GAAG,gBAAgB,UAAU,eAAe,OAAO,aAAY;AAAA,UACtE,EAAC,MAAM,GAAG,gBAAgB,IAAI,UAAU,OAAO,OAAM;AAAA,UACrD,EAAC,MAAM,GAAG,gBAAgB,GAAG,QAAQ,OAAO,MAAK;AAAA,UACjD,EAAC,MAAM,GAAG,gBAAgB,GAAG,QAAQ,OAAO,MAAK;AAAA,QACnD;AAAA,MACF;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,iBAAiB,YAAoB,WAA0C;AAC3F,UAAM,OAAO,eAAe,SAAS;AACrC,UAAM,MAAM,sBAAsB,IAAI;AAEtC,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,UAAI,CAAC,SAAS,GAAI,OAAM,IAAI,MAAM,gCAAgC,SAAS,UAAU,EAAE;AAEvF,YAAM,WAAW,KAAK,KAAK,YAAY,iBAAiB;AACxD,YAAM,aAAa,kBAAkB,QAAQ;AAE7C,UAAI,CAAC,SAAS,KAAM,OAAM,IAAI,MAAM,6BAA6B;AACjE,YAAM,eAAe,SAAS,MAAa,UAAU;AAErD,YAAM,QAAQ;AAAA,QACZ,MAAM;AAAA,QACN,KAAK;AAAA,QACL,OAAO;AAAA,MACT,CAAC;AAED,YAAM,GAAG,OAAO,QAAQ;AAAA,IAC1B,SAAS,OAAY;AACnB,YAAM,IAAI,MAAM,gCAAgC,MAAM,OAAO,EAAE;AAAA,IACjE;AAAA,EACF;AACF;","names":["chalk","chalk"]}
1
+ {"version":3,"sources":["../../src/commands/create.ts","../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/utils/trpc.ts","../../src/lib/init/scaffold/github.ts"],"sourcesContent":["import { Config, Flags, Args } from \"@oclif/core\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { promisify } from \"util\";\nimport { pipeline } from \"stream\";\nimport { createWriteStream } from \"fs\";\nimport { extract } from \"tar\";\nimport ora, { Ora } from \"ora\";\n\nimport { BaseCommand } from \"./base-command.js\";\nimport {\n cloneGitHubSubdirectory,\n isValidGitHubUrl,\n} from \"../lib/init/scaffold/github.js\";\n\nconst streamPipeline = promisify(pipeline);\n\nconst theme = {\n primary: chalk.magenta,\n secondary: chalk.gray,\n tertiary: chalk.gray,\n error: chalk.red,\n command: chalk.blue,\n success: chalk.green,\n warning: chalk.yellow,\n divider: chalk.gray(\"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\"),\n bottomPadding: \"\",\n};\n\ninterface CreateOptions {\n projectName: string;\n agentFramework: AgentFramework;\n}\n\ntype AgentFramework =\n | \"langgraph-py\"\n | \"langgraph-js\"\n | \"flows\"\n | \"mastra\"\n | \"pydantic-ai\"\n | \"llamaindex\"\n | \"agno\"\n | \"ag2\"\n | \"adk\"\n | \"aws-strands-py\"\n | \"a2a\"\n | \"microsoft-agent-framework-dotnet\"\n | \"microsoft-agent-framework-py\"\n | \"mcp-apps\";\n\nconst TEMPLATE_REPOS: Record<AgentFramework, string> = {\n \"langgraph-py\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-python\",\n \"langgraph-js\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-js\",\n mastra:\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/mastra\",\n flows:\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/crewai-flows\",\n llamaindex:\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/llamaindex\",\n agno: \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/agno\",\n \"pydantic-ai\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/pydantic-ai\",\n ag2: \"ag2ai/ag2-copilotkit-starter\",\n adk: \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/adk\",\n \"aws-strands-py\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/strands-python\",\n a2a: \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/a2a-middleware\",\n \"microsoft-agent-framework-dotnet\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/ms-agent-framework-dotnet\",\n \"microsoft-agent-framework-py\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/ms-agent-framework-python\",\n \"mcp-apps\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/mcp-apps\",\n};\n\nconst FRAMEWORK_DOCUMENTATION: Record<AgentFramework, string> = {\n \"langgraph-py\":\n \"https://langchain-ai.github.io/langgraph/concepts/why-langgraph\",\n \"langgraph-js\": \"https://langchain-ai.github.io/langgraphjs\",\n flows: \"https://docs.crewai.com/guides/flows/first-flow\",\n mastra: \"https://mastra.ai/en/docs\",\n \"pydantic-ai\": \"https://ai.pydantic.dev/ag-ui/\",\n llamaindex: \"https://docs.llamaindex.ai/en/stable\",\n agno: \"https://docs.agno.com/\",\n ag2: \"https://docs.ag2.ai/latest/docs/user-guide/basic-concepts/overview\",\n adk: \"https://google.github.io/adk-docs/\",\n \"aws-strands-py\": \"https://strandsagents.com/latest/documentation/docs/\",\n a2a: \"https://a2a-protocol.org/latest/\",\n \"microsoft-agent-framework-dotnet\":\n \"https://learn.microsoft.com/en-us/agent-framework/\",\n \"microsoft-agent-framework-py\":\n \"https://learn.microsoft.com/en-us/agent-framework/\",\n \"mcp-apps\": \"https://modelcontextprotocol.github.io/ext-apps\",\n};\n\nconst FRAMEWORK_EMOJI: Record<AgentFramework, string> = {\n \"langgraph-js\": \"🦜\",\n \"langgraph-py\": \"🦜\",\n flows: \"👥\",\n mastra: \"🌑\",\n \"pydantic-ai\": \"🔼\",\n llamaindex: \"🦙\",\n ag2: \"🤖\",\n agno: \"🅰️\",\n adk: \"🤖\",\n a2a: \"🤖\",\n \"aws-strands-py\": \"🧬\",\n \"microsoft-agent-framework-dotnet\": \"🟦\",\n \"microsoft-agent-framework-py\": \"🟦\",\n \"mcp-apps\": \"♍\",\n};\n\nconst KITE = `\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠙⣿⡛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠀⠀⠈⢿⡄⠀⠀⠀⠈⠉⠙⣻⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠈⢿⡄⠀⢀⣠⣴⠾⠋⢸⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⢀⣀⣀⣀⣀⣤⣤⡾⢿⡟⠛⠉⠀⠀⠀⠀⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⠛⠛⠛⠉⠉⠉⠁⠀⢠⡿⣿⡀⠀⠀⠀⠀⠀⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⣰⡟⠀⠸⣧⠀⠀⠀⠀⢠⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⢀⣼⠏⠀⠀⠀⣿⡀⠀⠀⠀⢸⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠂⣠⡿⠁⠀⠀⠀⠀⢸⡇⠀⠀⠀⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣡⣾⣿⣄⠀⠀⠀⠀⠀⢸⡇⠀⠀⢰⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⡟⠛⡿⠋⣡⣾⣿⣿⣿⣿⣦⡀⠀⠀⠀⢸⡇⠀⠀⣿⣿⣿⣿\n⣿⣿⣿⣿⡿⠿⣿⠷⠂⡀⠘⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⢸⡇⠀⣼⣿⣿⣿⣿\n⣿⣿⠻⢿⡷⠀⠁⠴⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⣾⠇⣴⣿⣿⣿⣿⣿\n⡿⠛⠀⠀⢴⣾⣷⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⣿⣾⣿⣿⣿⣿⣿⣿\n⣷⣾⣿⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n`;\n\nexport default class Create extends BaseCommand {\n static description = \"Create a new CopilotKit project\";\n\n static examples = [\n \"$ copilotkit create my-app\",\n \"$ copilotkit create my-app --framework langgraph-js\",\n \"$ copilotkit create -n my-app -f langgraph-js\",\n ];\n\n static flags = {\n ...BaseCommand.flags,\n framework: Flags.string({\n char: \"f\",\n description: \"Agent framework to use\",\n options: Object.keys(TEMPLATE_REPOS),\n required: false,\n }),\n name: Flags.string({\n char: \"n\",\n description: \"Name of the project\",\n required: false,\n }),\n \"no-banner\": Flags.boolean({\n char: \"q\",\n description: \"Removes the banner\",\n default: false,\n required: false,\n }),\n project: Flags.string({\n description: \"project ID (deprecated, kept for backwards compatibility)\",\n }),\n };\n\n static args = {\n projectName: Args.string({\n description: \"Name of the project\",\n required: false,\n }),\n };\n\n constructor(argv: string[], config: Config) {\n super(argv, config);\n }\n\n async run() {\n const { args, flags } = await this.parse(Create);\n\n if (!flags[\"no-banner\"]) {\n this.log(theme.primary(KITE));\n this.log(theme.primary(\"~ Welcome to CopilotKit! ~\\n\"));\n this.log(theme.divider);\n\n if (!flags.name && !args.projectName && !flags.framework) {\n this.log(\n \"\\n\" + theme.secondary(\"Just a few questions to get started!\\n\"),\n );\n }\n }\n\n const projectNameInput =\n flags.name || args.projectName || (await this.promptProjectName());\n const projectName = projectNameInput.trim();\n const usingCurrentDir = projectName === \".\" || projectName === \"./\";\n const agentFramework =\n flags.framework || (await this.promptAgentFramework());\n\n const projectDir = usingCurrentDir\n ? process.cwd()\n : path.resolve(process.cwd(), projectName);\n\n if (usingCurrentDir) {\n const allowedEntries = new Set([\".git\", \".gitignore\", \".DS_Store\"]);\n const existingEntries = await fs.readdir(projectDir);\n const blockingEntries = existingEntries.filter(\n (entry) => !allowedEntries.has(entry),\n );\n\n if (blockingEntries.length > 0) {\n this.log(theme.error(\"\\nCurrent directory is not empty.\"));\n this.log(\n theme.secondary(\n \"\\nPlease run create in an empty directory or specify a new project name.\",\n ),\n );\n this.exit(1);\n }\n } else if (await fs.pathExists(projectDir)) {\n this.log(theme.error(`\\nDirectory \"${projectName}\" already exists.`));\n this.log(theme.secondary(\"\\nYou can:\"));\n this.log(theme.secondary(\" 1. Choose a different project name\"));\n this.log(\n theme.secondary(\n \" 2. Remove the existing directory manually if you want to use this name\\n\",\n ),\n );\n this.exit(1);\n }\n\n const options: CreateOptions = {\n projectName,\n agentFramework: agentFramework as AgentFramework,\n };\n\n const spinner = ora({\n text: theme.secondary.bold(\"Creating your project...\"),\n color: \"cyan\",\n spinner: \"dots\",\n }).start();\n\n try {\n await fs.ensureDir(projectDir);\n\n spinner.text = theme.secondary.bold(\"Downloading template...\");\n await this.downloadTemplate(projectDir, options.agentFramework, spinner);\n\n const displayName = usingCurrentDir\n ? \"current directory\"\n : `\"${projectName}\"`;\n spinner.succeed(\n theme.secondary.bold(`Project ${displayName} created successfully!`),\n );\n } catch (error: any) {\n spinner.fail(theme.error(`Failed to create project: ${error.message}`));\n this.exit(1);\n }\n\n this.log(\"\\n\" + theme.divider);\n this.log(\n \"\\n\" +\n theme.secondary.bold(\n `🪁🤝${FRAMEWORK_EMOJI[options.agentFramework]} All set! \\n\\nYour project is ready to explore CopilotKit locally.`,\n ),\n );\n this.log(\"\\n\" + theme.secondary(\"Next steps:\"));\n if (usingCurrentDir) {\n this.log(\n theme.secondary(\n \" • You are already inside your new project directory\",\n ),\n );\n } else {\n this.log(theme.secondary(` • ${theme.command(`cd ${projectName}`)}`));\n }\n this.log(\n theme.secondary(\" • Follow the setup instructions in the README.md\"),\n );\n this.log(\"\\n\" + theme.secondary(\"Documentation:\"));\n this.log(\n theme.secondary(\" • \") + theme.command(\"https://docs.copilotkit.ai\"),\n );\n this.log(\n theme.secondary(\" • \") +\n theme.command(FRAMEWORK_DOCUMENTATION[options.agentFramework]),\n );\n this.log(theme.bottomPadding);\n }\n\n private async promptProjectName(): Promise<string> {\n const { projectName } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"projectName\",\n message: theme.secondary(\"What is your project named?\"),\n validate: (input: string) => {\n if (!input) return theme.error(\"Project name is required\");\n if (!/^[a-z0-9-]+$/.test(input)) {\n return theme.error(\n \"Project name can only contain lowercase letters, numbers, and hyphens\",\n );\n }\n if (input.length > 30) {\n return theme.error(\"Project name must be less than 30 characters\");\n }\n return true;\n },\n },\n ]);\n return projectName;\n }\n\n private async promptAgentFramework(): Promise<string> {\n const { framework } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"framework\",\n message: theme.secondary(\n \"Which agent framework would you like to use?\",\n ),\n choices: [\n {\n name: `${FRAMEWORK_EMOJI[\"langgraph-py\"]} LangGraph (Python)`,\n value: \"langgraph-py\",\n },\n {\n name: `${FRAMEWORK_EMOJI[\"langgraph-js\"]} LangGraph (JavaScript)`,\n value: \"langgraph-js\",\n },\n { name: `${FRAMEWORK_EMOJI.mastra} Mastra`, value: \"mastra\" },\n {\n name: `${FRAMEWORK_EMOJI[\"pydantic-ai\"]} Pydantic AI`,\n value: \"pydantic-ai\",\n },\n {\n name: `${FRAMEWORK_EMOJI[\"aws-strands-py\"]} AWS Strands (Python)`,\n value: \"aws-strands-py\",\n },\n { name: `${FRAMEWORK_EMOJI.adk} ADK`, value: \"adk\" },\n {\n name: `${FRAMEWORK_EMOJI[\"microsoft-agent-framework-dotnet\"]} Microsoft Agent Framework (.NET)`,\n value: \"microsoft-agent-framework-dotnet\",\n },\n {\n name: `${FRAMEWORK_EMOJI[\"microsoft-agent-framework-py\"]} Microsoft Agent Framework (Python)`,\n value: \"microsoft-agent-framework-py\",\n },\n {\n name: `${FRAMEWORK_EMOJI[\"mcp-apps\"]} MCP Apps`,\n value: \"mcp-apps\",\n },\n { name: `${FRAMEWORK_EMOJI.flows} CrewAI Flows`, value: \"flows\" },\n {\n name: `${FRAMEWORK_EMOJI.llamaindex} LlamaIndex`,\n value: \"llamaindex\",\n },\n { name: `${FRAMEWORK_EMOJI.agno} Agno`, value: \"agno\" },\n { name: `${FRAMEWORK_EMOJI.ag2} AG2`, value: \"ag2\" },\n { name: `${FRAMEWORK_EMOJI.a2a} A2A`, value: \"a2a\" },\n ],\n },\n ]);\n return framework;\n }\n\n private async downloadTemplate(\n projectDir: string,\n framework: AgentFramework,\n spinner: Ora,\n ): Promise<void> {\n const templateRef = TEMPLATE_REPOS[framework];\n\n // Monorepo subdirectory URLs use sparse checkout; standalone repos use tarball download\n if (isValidGitHubUrl(templateRef)) {\n const success = await cloneGitHubSubdirectory(\n templateRef,\n projectDir,\n spinner,\n );\n if (!success) {\n throw new Error(`Failed to clone template from ${templateRef}`);\n }\n return;\n }\n\n // Fallback: standalone repo tarball (e.g. ag2ai/ag2-copilotkit-starter)\n const url = `https://github.com/${templateRef}/archive/refs/heads/main.tar.gz`;\n\n try {\n const response = await fetch(url);\n if (!response.ok)\n throw new Error(`Failed to download template: ${response.statusText}`);\n\n const tempFile = path.join(projectDir, \"template.tar.gz\");\n const fileStream = createWriteStream(tempFile);\n\n if (!response.body) throw new Error(\"Failed to get response body\");\n await streamPipeline(response.body as any, fileStream);\n\n await extract({\n file: tempFile,\n cwd: projectDir,\n strip: 1,\n });\n\n await fs.remove(tempFile);\n } catch (error: any) {\n throw new Error(`Failed to download template: ${error.message}`);\n }\n }\n}\n","import { Command } from \"@oclif/core\";\nimport Sentry, { consoleIntegration } from \"@sentry/node\";\nimport { LIB_VERSION } from \"../utils/version.js\";\nimport { COPILOT_CLOUD_BASE_URL } from \"../utils/trpc.js\";\nimport chalk from \"chalk\";\n\nexport class BaseCommand extends Command {\n async init() {\n await this.checkCLIVersion();\n\n if (process.env.SENTRY_DISABLED === \"true\") {\n return;\n }\n\n Sentry.init({\n dsn:\n process.env.SENTRY_DSN ||\n \"https://1eea15d32e2eacb0456a77db5e39aeeb@o4507288195170304.ingest.us.sentry.io/4508581448581120\",\n integrations: [consoleIntegration()],\n // Tracing\n tracesSampleRate: 1.0, // Capture 100% of the transactions\n });\n }\n\n async catch(err: any) {\n if (process.env.SENTRY_DISABLED !== \"true\") {\n Sentry.captureException(err);\n }\n\n const message = err?.message ?? \"Unknown error\";\n\n this.log(\"\\n\" + chalk.red(message) + \"\\n\");\n\n const exitCode = err?.oclif?.exit ?? 1;\n this.exit(exitCode);\n }\n\n async finally() {\n if (process.env.SENTRY_DISABLED === \"true\") {\n return;\n }\n\n Sentry.close();\n }\n\n async run() {}\n\n async checkCLIVersion() {\n try {\n const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`);\n\n const data = await response.json();\n const cloudVersion = data.cliVersion;\n\n if (!cloudVersion || cloudVersion === LIB_VERSION) {\n return;\n }\n\n // TODO: add this back in, removed for crew ai launch since we don't want to keep releasing cloud\n // this.log(chalk.yellow('================ New version available! =================\\n'))\n // this.log(`You are using CopilotKit CLI v${LIB_VERSION}.`)\n // this.log(`A new CopilotKit CLI version is available (v${cloudVersion}).\\n`)\n // this.log('Please update your CLI to the latest version:\\n\\n')\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('npm:')))}\\t npm install -g copilotkit@${cloudVersion}\\n`)\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('pnpm:')))}\\t pnpm install -g copilotkit@${cloudVersion}\\n`)\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('yarn:')))}\\t yarn global add copilotkit@${cloudVersion}\\n`)\n // this.log(chalk.yellow('============================================================\\n\\n'))\n } catch {\n // Version check is non-critical — don't crash the CLI when offline\n }\n }\n\n async gracefulError(message: string) {\n this.log(\"\\n\" + chalk.red(message));\n process.exit(1);\n }\n}\n","// This is auto generated!\nexport const LIB_VERSION = \"0.0.59\";\n","import { createTRPCClient as trpcClient, httpBatchLink } from \"@trpc/client\";\nimport superjson from \"superjson\";\n\nexport const COPILOT_CLOUD_BASE_URL =\n process.env.COPILOT_CLOUD_BASE_URL || \"https://cloud.copilotkit.ai\";\n\nexport function createTRPCClient(cliToken: string): any {\n return trpcClient({\n links: [\n httpBatchLink({\n url: `${COPILOT_CLOUD_BASE_URL}/api/trpc-cli`,\n transformer: superjson,\n headers: () => {\n return {\n \"x-trpc-source\": \"cli\",\n \"x-cli-token\": cliToken,\n };\n },\n }),\n ],\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\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(\n owner,\n repo,\n branch,\n subdirectoryPath,\n destinationPath,\n spinner,\n );\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`, {\n cwd: tempDir,\n stdio: \"pipe\",\n });\n\n // Enable sparse checkout\n execSync(\"git config core.sparseCheckout true\", {\n cwd: tempDir,\n stdio: \"pipe\",\n });\n\n // Specify which subdirectory to checkout\n fs.writeFileSync(\n path.join(tempDir, \".git/info/sparse-checkout\"),\n subdirectoryPath,\n );\n\n spinner.text = chalk.cyan(\"Downloading agent files...\");\n\n // Pull only the specified branch\n execSync(`git pull origin ${branch} --depth=1`, {\n cwd: tempDir,\n stdio: \"pipe\",\n });\n\n // Copy the subdirectory to the destination\n const sourcePath = path.join(tempDir, subdirectoryPath);\n if (!fs.existsSync(sourcePath)) {\n throw new Error(\n `Subdirectory '${subdirectoryPath}' not found in the repository.`,\n );\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(\n source: string,\n destination: string,\n): 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 (\n pathParts.length > 3 &&\n (pathParts[2] === \"tree\" || pathParts[2] === \"blob\")\n ) {\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 (\n parsedUrl.hostname === \"github.com\" &&\n parsedUrl.pathname.split(\"/\").filter(Boolean).length >= 2\n );\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA,SAAiB,OAAO,YAAY;AACpC,OAAO,cAAc;AACrB,OAAOA,YAAW;AA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M,WAAW,MAAM,MAAM,GAAG;AAChC,UAAI,CAAC,SAAS;AACZ,cAAM,IAAI,MAAM,gCAAgC,SAAS,UAAU,EAAE;AAEvE,YAAM,WAAWD,MAAK,KAAK,YAAY,iBAAiB;AACxD,YAAM,aAAa,kBAAkB,QAAQ;AAE7C,UAAI,CAAC,SAAS,KAAM,OAAM,IAAI,MAAM,6BAA6B;AACjE,YAAM,eAAe,SAAS,MAAa,UAAU;AAErD,YAAM,QAAQ;AAAA,QACZ,MAAM;AAAA,QACN,KAAK;AAAA,QACL,OAAO;AAAA,MACT,CAAC;AAED,YAAMC,IAAG,OAAO,QAAQ;AAAA,IAC1B,SAAS,OAAY;AACnB,YAAM,IAAI,MAAM,gCAAgC,MAAM,OAAO,EAAE;AAAA,IACjE;AAAA,EACF;AACF;","names":["chalk","fs","path","chalk","chalk","path","fs"]}
@@ -9,7 +9,7 @@ import chalk3 from "chalk";
9
9
  import Conf2 from "conf";
10
10
  import cors from "cors";
11
11
  import express from "express";
12
- import crypto2 from "node:crypto";
12
+ import crypto2 from "crypto";
13
13
  import open from "open";
14
14
  import getPort from "get-port";
15
15
  import ora from "ora";
@@ -148,7 +148,10 @@ var AnalyticsService = class {
148
148
  }
149
149
  try {
150
150
  const distinctId = this.userId || this.getAnonymousId();
151
- const payload = await this.posthog.getFeatureFlagPayload(flagKey, distinctId);
151
+ const payload = await this.posthog.getFeatureFlagPayload(
152
+ flagKey,
153
+ distinctId
154
+ );
152
155
  return payload;
153
156
  } catch (error) {
154
157
  console.warn(`Failed to get feature flag payload ${flagKey}:`, error);
@@ -197,7 +200,9 @@ var AuthService = class {
197
200
  }
198
201
  if (shouldLogin) {
199
202
  if (context === "cloud-features") {
200
- cmd.log(chalk.cyan("\n\u{1F680} Setting up Copilot Cloud authentication...\n"));
203
+ cmd.log(
204
+ chalk.cyan("\n\u{1F680} Setting up Copilot Cloud authentication...\n")
205
+ );
201
206
  }
202
207
  const loginResult = await this.login({ exitAfterLogin: false });
203
208
  cliToken = loginResult.cliToken;
@@ -217,12 +222,18 @@ var AuthService = class {
217
222
  try {
218
223
  me = await trpcClient2.me.query();
219
224
  } catch (error) {
220
- cmd.log(chalk.yellow("Your authentication has expired. Re-authenticating..."));
225
+ cmd.log(
226
+ chalk.yellow("Your authentication has expired. Re-authenticating...")
227
+ );
221
228
  try {
222
229
  const loginResult = await this.login({ exitAfterLogin: false });
223
230
  return loginResult;
224
231
  } catch (loginError) {
225
- cmd.log(chalk.red("Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login"));
232
+ cmd.log(
233
+ chalk.red(
234
+ "Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login"
235
+ )
236
+ );
226
237
  process.exit(1);
227
238
  }
228
239
  }
@@ -241,7 +252,7 @@ var AuthService = class {
241
252
  app.use(express.json());
242
253
  const port = await getPort();
243
254
  const state = crypto2.randomBytes(16).toString("hex");
244
- return new Promise(async (resolve) => {
255
+ return new Promise(async (resolve, reject) => {
245
256
  const server = app.listen(port, () => {
246
257
  });
247
258
  await analytics.track({
@@ -251,7 +262,18 @@ var AuthService = class {
251
262
  spinner.text = "\u{1FA81} Waiting for browser authentication to complete...";
252
263
  app.post("/callback", async (req, res) => {
253
264
  const { cliToken, user, organization } = req.body;
254
- analytics = new AnalyticsService({ userId: user.id, organizationId: organization.id, email: user.email });
265
+ if (state !== req.query.state) {
266
+ res.status(401).json({ message: "Invalid state" });
267
+ spinner.fail("Invalid state");
268
+ server.close();
269
+ reject(new Error("OAuth state mismatch"));
270
+ return;
271
+ }
272
+ analytics = new AnalyticsService({
273
+ userId: user.id,
274
+ organizationId: organization.id,
275
+ email: user.email
276
+ });
255
277
  await analytics.track({
256
278
  event: "cli.login.success",
257
279
  properties: {
@@ -260,14 +282,11 @@ var AuthService = class {
260
282
  email: user.email
261
283
  }
262
284
  });
263
- if (state !== req.query.state) {
264
- res.status(401).json({ message: "Invalid state" });
265
- spinner.fail("Invalid state");
266
- return;
267
- }
268
285
  this.config.set("cliToken", cliToken);
269
286
  res.status(200).json({ message: "Callback called" });
270
- spinner.succeed(`\u{1FA81} Successfully logged in as ${chalk.hex("#7553fc")(user.email)}`);
287
+ spinner.succeed(
288
+ `\u{1FA81} Successfully logged in as ${chalk.hex("#7553fc")(user.email)}`
289
+ );
271
290
  if (exitAfterLogin) {
272
291
  process.exit(0);
273
292
  } else {
@@ -275,7 +294,9 @@ var AuthService = class {
275
294
  resolve({ cliToken, user, organization });
276
295
  }
277
296
  });
278
- open(`${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`);
297
+ open(
298
+ `${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`
299
+ );
279
300
  });
280
301
  }
281
302
  };
@@ -297,14 +318,14 @@ var getHumanReadableEndpointType = (type) => {
297
318
  }
298
319
  };
299
320
  async function detectRemoteEndpointType(url) {
300
- const [isLangGraph, isCopilot, isCrewAI, isMCP] = await Promise.all([
321
+ const [isLangGraph, isLangGraphFastAPI, isCopilot, isCrewAI, isMCP] = await Promise.all([
301
322
  isLangGraphPlatformEndpoint(url),
302
323
  isLangGraphFastAPIEndpoint(url),
303
324
  isCopilotKitEndpoint(url),
304
325
  isCrewAIEndpoint(url),
305
326
  isMCPEndpoint(url)
306
327
  ]);
307
- if (isLangGraph) {
328
+ if (isLangGraph || isLangGraphFastAPI) {
308
329
  return {
309
330
  url,
310
331
  type: "LangGraphPlatform" /* LangGraphPlatform */,
@@ -325,6 +346,13 @@ async function detectRemoteEndpointType(url) {
325
346
  humanReadableType: "CrewAI"
326
347
  };
327
348
  }
349
+ if (isMCP) {
350
+ return {
351
+ url,
352
+ type: "MCP" /* MCP */,
353
+ humanReadableType: "MCP"
354
+ };
355
+ }
328
356
  if (!url.endsWith("/copilotkit")) {
329
357
  const copilotKitUrl = `${removeTrailingSlash(url)}/copilotkit`;
330
358
  const isCopilotWithPath = await isCopilotKitEndpoint(copilotKitUrl);
@@ -374,7 +402,7 @@ async function isLangGraphPlatformEndpoint(url, retries = 0) {
374
402
  }
375
403
  return false;
376
404
  }
377
- async function isLangGraphFastAPIEndpoint(url, retries = 0) {
405
+ async function isLangGraphFastAPIEndpoint(url) {
378
406
  let response;
379
407
  try {
380
408
  response = await fetch(`${url}/health`, {
@@ -413,7 +441,7 @@ async function isCopilotKitEndpoint(url, retries = 0) {
413
441
  async function isCrewAIEndpoint(url) {
414
442
  return url.toLowerCase().includes("crew");
415
443
  }
416
- async function isMCPEndpoint(url) {
444
+ async function isMCPEndpoint(_url) {
417
445
  return true;
418
446
  }
419
447
 
@@ -440,7 +468,7 @@ import { Command } from "@oclif/core";
440
468
  import Sentry, { consoleIntegration } from "@sentry/node";
441
469
 
442
470
  // src/utils/version.ts
443
- var LIB_VERSION = "0.0.57";
471
+ var LIB_VERSION = "0.0.59";
444
472
 
445
473
  // src/commands/base-command.ts
446
474
  import chalk2 from "chalk";
@@ -476,11 +504,14 @@ var BaseCommand = class extends Command {
476
504
  async run() {
477
505
  }
478
506
  async checkCLIVersion() {
479
- const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`);
480
- const data = await response.json();
481
- const cloudVersion = data.cliVersion;
482
- if (!cloudVersion || cloudVersion === LIB_VERSION) {
483
- return;
507
+ try {
508
+ const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`);
509
+ const data = await response.json();
510
+ const cloudVersion = data.cliVersion;
511
+ if (!cloudVersion || cloudVersion === LIB_VERSION) {
512
+ return;
513
+ }
514
+ } catch {
484
515
  }
485
516
  }
486
517
  async gracefulError(message) {
@@ -500,10 +531,14 @@ var Dev = class _Dev extends BaseCommand {
500
531
  }
501
532
  static flags = {
502
533
  port: Flags.string({ description: "port", required: true }),
503
- project: Flags.string({ description: "project ID (can be found in the Copilot Cloud dashboard)" })
534
+ project: Flags.string({
535
+ description: "project ID (can be found in the Copilot Cloud dashboard)"
536
+ })
504
537
  };
505
538
  static description = "Start local development for a CopilotKit project";
506
- static examples = ["<%= config.bin %> <%= command.id %> --port 8000 --project proj_mv3laowus0lz11kklo57bdr6"];
539
+ static examples = [
540
+ "<%= config.bin %> <%= command.id %> --port 8000 --project proj_mv3laowus0lz11kklo57bdr6"
541
+ ];
507
542
  trpcClient = null;
508
543
  copilotCloudTunnelId = null;
509
544
  async pingTunnelRecursively() {
@@ -518,7 +553,9 @@ var Dev = class _Dev extends BaseCommand {
518
553
  if (error?.data?.code === "NOT_FOUND") {
519
554
  this.gracefulError(error.message);
520
555
  } else {
521
- this.gracefulError("Failed to ping tunnel. The connection may have been lost.");
556
+ this.gracefulError(
557
+ "Failed to ping tunnel. The connection may have been lost."
558
+ );
522
559
  }
523
560
  }
524
561
  await new Promise((resolve) => setTimeout(resolve, 5e3));
@@ -527,9 +564,15 @@ var Dev = class _Dev extends BaseCommand {
527
564
  async run() {
528
565
  const { flags } = await this.parse(_Dev);
529
566
  const { cliToken, organization, user } = await this.authService.requireLogin(this, "general");
530
- const analytics = new AnalyticsService({ userId: user.id, organizationId: organization.id, email: user.email });
567
+ const analytics = new AnalyticsService({
568
+ userId: user.id,
569
+ organizationId: organization.id,
570
+ email: user.email
571
+ });
531
572
  this.trpcClient = createTRPCClient(cliToken);
532
- const availableProjects = await this.trpcClient.listOrgProjects.query({ orgId: organization.id });
573
+ const availableProjects = await this.trpcClient.listOrgProjects.query({
574
+ orgId: organization.id
575
+ });
533
576
  let selectedProjectId = null;
534
577
  if (flags.project) {
535
578
  if (!availableProjects.some((project) => project.id === flags.project)) {
@@ -552,7 +595,9 @@ var Dev = class _Dev extends BaseCommand {
552
595
  ]);
553
596
  selectedProjectId = projectId;
554
597
  }
555
- const { type: remoteEndpointType } = await detectRemoteEndpointType(`http://localhost:${flags.port}`);
598
+ const { type: remoteEndpointType } = await detectRemoteEndpointType(
599
+ `http://localhost:${flags.port}`
600
+ );
556
601
  if (remoteEndpointType === "Invalid" /* Invalid */) {
557
602
  return this.gracefulError(
558
603
  `Invalid remote endpoint. Please ensure you are running a compatible endpoint at port ${flags.port} and try again.`
@@ -567,7 +612,9 @@ var Dev = class _Dev extends BaseCommand {
567
612
  endpointType: remoteEndpointType
568
613
  }
569
614
  });
570
- this.log(chalk3.green(`\u2705 ${humanReadableRemoteEndpointType} endpoint detected`));
615
+ this.log(
616
+ chalk3.green(`\u2705 ${humanReadableRemoteEndpointType} endpoint detected`)
617
+ );
571
618
  const spinner = ora2("Creating tunnel...\n").start();
572
619
  const tunnelId = createId();
573
620
  const setupTunnel = this.setupTunnel({
@@ -577,7 +624,9 @@ var Dev = class _Dev extends BaseCommand {
577
624
  onSuccess: async ({ url, id }) => {
578
625
  this.log("\nTunnel Information:\n");
579
626
  this.log(`${chalk3.bold.cyan("\u2022 Tunnel URL: ")} ${chalk3.white(url)}`);
580
- this.log(`${chalk3.bold.cyan("\u2022 Endpoint Type: ")} ${chalk3.white(humanReadableRemoteEndpointType)}`);
627
+ this.log(
628
+ `${chalk3.bold.cyan("\u2022 Endpoint Type: ")} ${chalk3.white(humanReadableRemoteEndpointType)}`
629
+ );
581
630
  this.log(
582
631
  `${chalk3.bold.cyan("\u2022 Project: ")} ${chalk3.white(`${CLOUD_BASE_URL}/projects/${selectedProjectId}`)}`
583
632
  );
@@ -638,7 +687,12 @@ var Dev = class _Dev extends BaseCommand {
638
687
  try {
639
688
  const testResponse = await Promise.race([
640
689
  fetch(`http://localhost:${port}`, { method: "HEAD" }),
641
- new Promise((_, reject) => setTimeout(() => reject(new Error("Connection timeout")), CONNECTION_TEST_TIMEOUT))
690
+ new Promise(
691
+ (_, reject) => setTimeout(
692
+ () => reject(new Error("Connection timeout")),
693
+ CONNECTION_TEST_TIMEOUT
694
+ )
695
+ )
642
696
  ]);
643
697
  } catch (error) {
644
698
  spinner.fail();
@@ -654,11 +708,16 @@ var Dev = class _Dev extends BaseCommand {
654
708
  subdomain: tunnelId
655
709
  }),
656
710
  new Promise(
657
- (_, reject) => setTimeout(() => reject(new Error("Tunnel creation timeout")), TUNNEL_TIMEOUT)
711
+ (_, reject) => setTimeout(
712
+ () => reject(new Error("Tunnel creation timeout")),
713
+ TUNNEL_TIMEOUT
714
+ )
658
715
  )
659
716
  ]);
660
717
  tunnel.on("request", (info) => {
661
- this.log(`${chalk3.green("\u279C")} ${chalk3.white((/* @__PURE__ */ new Date()).toISOString())} - ${info.method} ${info.path}`);
718
+ this.log(
719
+ `${chalk3.green("\u279C")} ${chalk3.white((/* @__PURE__ */ new Date()).toISOString())} - ${info.method} ${info.path}`
720
+ );
662
721
  });
663
722
  tunnel.on("error", (err) => {
664
723
  this.gracefulError(chalk3.red(`Tunnel error: ${err.message}`));