copilotkit 0.0.59 → 1.54.0

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.
@@ -3,7 +3,7 @@ import { Command } from "@oclif/core";
3
3
  import Sentry, { consoleIntegration } from "@sentry/node";
4
4
 
5
5
  // src/utils/version.ts
6
- var LIB_VERSION = "0.0.59";
6
+ var LIB_VERSION = "1.54.0";
7
7
 
8
8
  // src/utils/trpc.ts
9
9
  import { createTRPCClient as trpcClient, httpBatchLink } from "@trpc/client";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/utils/trpc.ts"],"sourcesContent":["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"],"mappings":";AAAA,SAAS,eAAe;AACxB,OAAO,UAAU,0BAA0B;;;ACApC,IAAM,cAAc;;;ACD3B,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;;;AFAxC,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,QAAQ;AAAA,EACpB;AAAA,EAEA,MAAM,UAAU;AACd,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,MAAM,MAAM;AAAA,EAAC;AAAA,EAEb,MAAM,kBAAkB;AACtB,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,GAAG,sBAAsB,cAAc;AAEpE,YAAM,OAAO,MAAM,SAAS,KAAK;AACjC,YAAM,eAAe,KAAK;AAE1B,UAAI,CAAC,gBAAgB,iBAAiB,aAAa;AACjD;AAAA,MACF;AAAA,IAWF,QAAQ;AAAA,IAER;AAAA,EACF;AAAA,EAEA,MAAM,cAAc,SAAiB;AACnC,SAAK,IAAI,OAAO,MAAM,IAAI,OAAO,CAAC;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/utils/trpc.ts"],"sourcesContent":["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 = \"1.54.0\";\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"],"mappings":";AAAA,SAAS,eAAe;AACxB,OAAO,UAAU,0BAA0B;;;ACApC,IAAM,cAAc;;;ACD3B,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;;;AFAxC,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,QAAQ;AAAA,EACpB;AAAA,EAEA,MAAM,UAAU;AACd,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,MAAM,MAAM;AAAA,EAAC;AAAA,EAEb,MAAM,kBAAkB;AACtB,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,GAAG,sBAAsB,cAAc;AAEpE,YAAM,OAAO,MAAM,SAAS,KAAK;AACjC,YAAM,eAAe,KAAK;AAE1B,UAAI,CAAC,gBAAgB,iBAAiB,aAAa;AACjD;AAAA,MACF;AAAA,IAWF,QAAQ;AAAA,IAER;AAAA,EACF;AAAA,EAEA,MAAM,cAAc,SAAiB;AACnC,SAAK,IAAI,OAAO,MAAM,IAAI,OAAO,CAAC;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
@@ -15,7 +15,7 @@ import { Command } from "@oclif/core";
15
15
  import Sentry, { consoleIntegration } from "@sentry/node";
16
16
 
17
17
  // src/utils/version.ts
18
- var LIB_VERSION = "0.0.59";
18
+ var LIB_VERSION = "1.54.0";
19
19
 
20
20
  // src/utils/trpc.ts
21
21
  import { createTRPCClient as trpcClient, httpBatchLink } from "@trpc/client";
@@ -1 +1 @@
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;AAClB,OAAOC,SAAQ;AACf,OAAOC,WAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,OAAO,SAAkB;;;ACTzB,SAAS,eAAe;AACxB,OAAO,UAAU,0BAA0B;;;ACApC,IAAM,cAAc;;;ACD3B,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;;;AFAxC,OAAO,WAAW;AAEX,IAAM,cAAN,cAA0B,QAAQ;AAAA,EACvC,MAAM,OAAO;AACX,UAAM,KAAK,gBAAgB;AAE3B,QAAI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Y;AACnB,YAAM,IAAI,MAAM,gCAAgC,MAAM,OAAO,EAAE;AAAA,IACjE;AAAA,EACF;AACF;","names":["chalk","fs","path","chalk","chalk","path","fs"]}
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 = \"1.54.0\";\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;AAClB,OAAOC,SAAQ;AACf,OAAOC,WAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,OAAO,SAAkB;;;ACTzB,SAAS,eAAe;AACxB,OAAO,UAAU,0BAA0B;;;ACApC,IAAM,cAAc;;;ACD3B,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;;;AFAxC,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,QAAQ;AAAA,EACpB;AAAA,EAEA,MAAM,UAAU;AACd,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,MAAM,MAAM;AAAA,EA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AM;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA,UAAI,CAAC,SAAS;AACZ,cAAM,IAAI,MAAM,iCAAiC,WAAW,EAAE;AAAA,MAChE;AACA;AAAA,IACF;AAGA,UAAM,MAAM,sBAAsB,WAAW;AAE7C,QAAI;AACF,YAAM,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"]}
@@ -468,7 +468,7 @@ import { Command } from "@oclif/core";
468
468
  import Sentry, { consoleIntegration } from "@sentry/node";
469
469
 
470
470
  // src/utils/version.ts
471
- var LIB_VERSION = "0.0.59";
471
+ var LIB_VERSION = "1.54.0";
472
472
 
473
473
  // src/commands/base-command.ts
474
474
  import chalk2 from "chalk";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/dev.ts","../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts","../../src/utils/detect-endpoint-type.utils.ts","../../src/services/tunnel.service.ts","../../src/commands/base-command.ts","../../src/utils/version.ts"],"sourcesContent":["import { Config, Flags } from \"@oclif/core\";\nimport inquirer from \"inquirer\";\nimport { createId } from \"@paralleldrive/cuid2\";\nimport ora, { Ora } from \"ora\";\nimport chalk from \"chalk\";\n\nimport { AuthService } from \"../services/auth.service.js\";\nimport { createTRPCClient } from \"../utils/trpc.js\";\nimport {\n detectRemoteEndpointType,\n getHumanReadableEndpointType,\n RemoteEndpointType,\n} from \"../utils/detect-endpoint-type.utils.js\";\nimport { TunnelService } from \"../services/tunnel.service.js\";\nimport { AnalyticsService } from \"../services/analytics.service.js\";\nimport { BaseCommand } from \"./base-command.js\";\n\nconst DEFAULT_CLOUD_BASE_URL = \"https://cloud.copilotkit.ai\";\nconst CLOUD_BASE_URL =\n process.env.COPILOT_CLOUD_BASE_URL ?? DEFAULT_CLOUD_BASE_URL;\n\nexport default class Dev extends BaseCommand {\n static override flags = {\n port: Flags.string({ description: \"port\", required: true }),\n project: Flags.string({\n description: \"project ID (can be found in the Copilot Cloud dashboard)\",\n }),\n };\n\n static override description =\n \"Start local development for a CopilotKit project\";\n static override examples = [\n \"<%= config.bin %> <%= command.id %> --port 8000 --project proj_mv3laowus0lz11kklo57bdr6\",\n ];\n\n private trpcClient: ReturnType<typeof createTRPCClient> | null = null;\n private copilotCloudTunnelId: string | null = null;\n\n constructor(\n argv: string[],\n config: Config,\n private authService = new AuthService(),\n private tunnelService = new TunnelService(),\n ) {\n super(argv, config);\n }\n\n private async pingTunnelRecursively(): Promise<void> {\n if (!this.copilotCloudTunnelId) {\n return;\n }\n\n try {\n await this.trpcClient!.pingLocalTunnel.query({\n localTunnelId: this.copilotCloudTunnelId!,\n });\n } catch (error: any) {\n if (error?.data?.code === \"NOT_FOUND\") {\n this.gracefulError(error.message);\n } else {\n this.gracefulError(\n \"Failed to ping tunnel. The connection may have been lost.\",\n );\n }\n }\n\n await new Promise((resolve) => setTimeout(resolve, 5000));\n await this.pingTunnelRecursively();\n }\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(Dev);\n\n // Check authentication\n const { cliToken, organization, user } =\n await this.authService.requireLogin(this, \"general\");\n const analytics = new AnalyticsService({\n userId: user.id,\n organizationId: organization.id,\n email: user.email,\n });\n\n this.trpcClient = createTRPCClient(cliToken);\n\n const availableProjects = await this.trpcClient.listOrgProjects.query({\n orgId: organization.id,\n });\n let selectedProjectId: string | null = null;\n\n // Get project ID\n if (flags.project) {\n if (\n !availableProjects.some((project: any) => project.id === flags.project)\n ) {\n this.log(chalk.red(`Project with ID ${flags.project} not found`));\n process.exit(1);\n }\n\n selectedProjectId = flags.project;\n this.log(chalk.green(`✅ Selected project ${selectedProjectId}`));\n } else {\n const { projectId } = await inquirer.prompt([\n {\n name: \"projectId\",\n type: \"list\",\n message: \"Select a project\",\n choices: availableProjects.map((project: any) => ({\n value: project.id,\n name: `${project.name} (ID: ${project.id})${availableProjects.length === 1 ? \" (press Enter to confirm)\" : \"\"}`,\n })),\n },\n ]);\n\n selectedProjectId = projectId;\n }\n\n // Remote endpoint type detection\n const { type: remoteEndpointType } = await detectRemoteEndpointType(\n `http://localhost:${flags.port}`,\n );\n\n if (remoteEndpointType === RemoteEndpointType.Invalid) {\n return this.gracefulError(\n `Invalid remote endpoint. Please ensure you are running a compatible endpoint at port ${flags.port} and try again.`,\n );\n }\n\n const humanReadableRemoteEndpointType =\n getHumanReadableEndpointType(remoteEndpointType);\n\n await analytics.track({\n event: \"cli.dev.initiatied\",\n properties: {\n port: flags.port,\n projectId: selectedProjectId!,\n endpointType: remoteEndpointType,\n },\n });\n\n this.log(\n chalk.green(`✅ ${humanReadableRemoteEndpointType} endpoint detected`),\n );\n const spinner = ora(\"Creating tunnel...\\n\").start();\n\n const tunnelId = createId();\n\n // Starting tunnel\n const setupTunnel = this.setupTunnel({\n tunnelId,\n port: parseInt(flags.port),\n subdomain: createId(),\n onSuccess: async ({ url, id }) => {\n // Print tunnel info\n this.log(\"\\nTunnel Information:\\n\");\n this.log(`${chalk.bold.cyan(\"• Tunnel URL:\\t\\t\")} ${chalk.white(url)}`);\n this.log(\n `${chalk.bold.cyan(\"• Endpoint Type:\\t\")} ${chalk.white(humanReadableRemoteEndpointType)}`,\n );\n this.log(\n `${chalk.bold.cyan(\"• Project:\\t\\t\")} ${chalk.white(`${CLOUD_BASE_URL}/projects/${selectedProjectId!}`)}`,\n );\n this.log(chalk.yellow(\"\\nPress Ctrl+C to stop the tunnel\"));\n this.log(\"\\n\");\n\n spinner.text = \"Linking local tunnel to Copilot Cloud...\";\n\n // Report to Cloud\n const { localTunnelId } =\n await this.trpcClient!.reportRemoteEndpointLocalTunnel.mutate({\n tunnelId: id,\n projectId: selectedProjectId!,\n endpointType:\n remoteEndpointType === RemoteEndpointType.CopilotKit\n ? \"CopilotKit\"\n : \"LangGraphCloud\",\n tunnelUrl: url,\n port: parseInt(flags.port),\n });\n\n this.copilotCloudTunnelId = localTunnelId;\n\n await analytics.track({\n event: \"cli.dev.tunnel.created\",\n properties: {\n tunnelId: localTunnelId,\n port: flags.port,\n projectId: selectedProjectId!,\n endpointType: remoteEndpointType,\n },\n });\n\n spinner.color = \"green\";\n spinner.text = \"🚀 Local tunnel is live and linked to Copilot Cloud!\\n\";\n spinner.succeed();\n\n await this.pingTunnelRecursively();\n },\n onTunnelClose: async ({ id }) => {\n if (this.copilotCloudTunnelId) {\n await analytics.track({\n event: \"cli.dev.tunnel.closed\",\n properties: {\n tunnelId: id,\n },\n });\n\n await this.trpcClient!.deleteLocalTunnel.mutate({\n localTunnelId: this.copilotCloudTunnelId!,\n });\n this.copilotCloudTunnelId = null;\n }\n },\n spinner,\n });\n\n await Promise.all([setupTunnel]);\n }\n\n private async setupTunnel({\n port,\n subdomain,\n onSuccess,\n onTunnelClose,\n spinner,\n tunnelId,\n }: {\n port: number;\n subdomain?: string;\n onSuccess: (params: { url: string; id: string }) => Promise<void>;\n onTunnelClose: (params: { id: string }) => Promise<void>;\n spinner: Ora;\n tunnelId: string;\n }) {\n const TUNNEL_TIMEOUT = 15000; // 15 seconds\n const CONNECTION_TEST_TIMEOUT = 5000; // 5 seconds\n\n // First, test if the local port is accessible\n spinner.text = `Testing connection to localhost:${port}...`;\n try {\n const testResponse = await Promise.race([\n fetch(`http://localhost:${port}`, { method: \"HEAD\" }),\n new Promise((_, reject) =>\n setTimeout(\n () => reject(new Error(\"Connection timeout\")),\n CONNECTION_TEST_TIMEOUT,\n ),\n ),\n ]);\n } catch (error) {\n spinner.fail();\n return this.gracefulError(\n `Cannot connect to localhost:${port}. Please ensure your application is running on port ${port} and try again.`,\n );\n }\n\n spinner.text = \"Creating tunnel...\";\n\n try {\n // Create the tunnel with timeout\n const tunnel = await Promise.race([\n this.tunnelService.create({\n port,\n subdomain: tunnelId,\n }),\n new Promise<never>((_, reject) =>\n setTimeout(\n () => reject(new Error(\"Tunnel creation timeout\")),\n TUNNEL_TIMEOUT,\n ),\n ),\n ]);\n\n // Handle tunnel events\n tunnel.on(\"request\", (info: any) => {\n this.log(\n `${chalk.green(\"➜\")} ${chalk.white(new Date().toISOString())} - ${info.method} ${info.path}`,\n );\n });\n\n tunnel.on(\"error\", (err: any) => {\n this.gracefulError(chalk.red(`Tunnel error: ${err.message}`));\n });\n\n tunnel.on(\"close\", async () => {\n this.log(chalk.yellow(\"\\nTunnel closed\"));\n await onTunnelClose({ id: tunnelId });\n process.exit(0);\n });\n\n // Keep the process alive until Ctrl+C\n await Promise.all([\n new Promise<void>(() => {\n process.on(\"SIGINT\", async () => {\n this.log(\"\\nShutting down tunnel...\");\n await onTunnelClose({ id: tunnelId });\n tunnel.close();\n process.exit(0);\n });\n\n process.on(\"SIGTERM\", async () => {\n this.log(\"\\nShutting down tunnel...\");\n await onTunnelClose({ id: tunnelId });\n tunnel.close();\n process.exit(0);\n });\n }),\n onSuccess({ url: tunnel.url, id: tunnelId }),\n ]);\n } catch (error: any) {\n spinner.fail();\n if (error.message === \"Tunnel creation timeout\") {\n return this.gracefulError(\n `Unable to establish tunnel connection after ${TUNNEL_TIMEOUT / 1000} seconds.\\n\\n` +\n `This usually means:\\n` +\n `• Network connectivity issues\\n` +\n `• Tunnel service is temporarily unavailable\\n` +\n `• Firewall blocking outbound connections\\n\\n` +\n `Please try:\\n` +\n `1. Check your internet connection\\n` +\n `2. Try again in a few moments\\n`,\n );\n } else if (error.message === \"Connection timeout\") {\n return this.gracefulError(\n `Cannot connect to localhost:${port}. Please ensure your application is running on port ${port} and try again.`,\n );\n } else {\n return this.gracefulError(`Failed to create tunnel: ${error.message}`);\n }\n }\n }\n}\n","// @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 =\n 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(\n cmd: Command,\n context?: \"cloud-features\" | \"general\",\n ): Promise<LoginResponse> {\n let cliToken = this.getCLIToken();\n // Check authentication\n if (!cliToken) {\n try {\n let shouldLogin = true;\n\n // For cloud features, automatically proceed with login\n // For general usage, ask for confirmation\n if (context !== \"cloud-features\") {\n const response = await inquirer.prompt([\n {\n name: \"shouldLogin\",\n type: \"confirm\",\n message:\n \"🪁 You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)\",\n default: true,\n },\n ]);\n shouldLogin = response.shouldLogin;\n }\n\n if (shouldLogin) {\n // Show different message for cloud features vs general usage\n if (context === \"cloud-features\") {\n cmd.log(\n chalk.cyan(\"\\n🚀 Setting up Copilot Cloud authentication...\\n\"),\n );\n }\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 // Token is invalid/expired, trigger new login\n cmd.log(\n chalk.yellow(\"Your authentication has expired. Re-authenticating...\"),\n );\n try {\n const loginResult = await this.login({ exitAfterLogin: false });\n return loginResult;\n } catch (loginError) {\n cmd.log(\n chalk.red(\n \"Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login\",\n ),\n );\n process.exit(1);\n }\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(\n { exitAfterLogin }: { exitAfterLogin?: boolean } = { exitAfterLogin: true },\n ): Promise<LoginResponse> {\n const spinner = ora(\"🪁 Opening browser for authentication...\").start();\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, reject) => {\n const server = app.listen(port, () => {});\n\n await analytics.track({\n event: \"cli.login.initiated\",\n properties: {},\n });\n\n spinner.text = \"🪁 Waiting for browser authentication to complete...\";\n\n app.post(\"/callback\", async (req, res) => {\n const { cliToken, user, organization } = req.body;\n\n if (state !== req.query.state) {\n res.status(401).json({ message: \"Invalid state\" });\n spinner.fail(\"Invalid state\");\n server.close();\n reject(new Error(\"OAuth state mismatch\"));\n return;\n }\n\n analytics = new AnalyticsService({\n userId: user.id,\n organizationId: organization.id,\n email: user.email,\n });\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 this.config.set(\"cliToken\", cliToken);\n res.status(200).json({ message: \"Callback called\" });\n spinner.succeed(\n `🪁 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(\n `${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`,\n );\n });\n }\n}\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 { Analytics } from \"@segment/analytics-node\";\nimport { PostHog } from \"posthog-node\";\nimport { AnalyticsEvents } from \"./events.js\";\nimport Conf from \"conf\";\n\nexport class AnalyticsService {\n private segment: Analytics | undefined;\n private posthog: PostHog | 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(\n private readonly authData?: {\n userId: string;\n email: string;\n organizationId: string;\n },\n ) {\n if (process.env.SEGMENT_DISABLED === \"true\") {\n return;\n }\n\n const segmentWriteKey =\n process.env.SEGMENT_WRITE_KEY || \"9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf\";\n\n this.globalProperties = {\n service: \"cli\",\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 // Initialize PostHog for feature flags\n if (process.env.POSTHOG_DISABLED !== \"true\") {\n const posthogKey =\n process.env.POSTHOG_KEY ||\n \"phc_XZdymVYjrph9Mi0xZYGNyCKexxgblXRR1jMENCtdz5Q\"; // Default key\n const posthogHost =\n process.env.POSTHOG_HOST || \"https://eu.i.posthog.com\";\n\n this.posthog = new PostHog(posthogKey, {\n host: posthogHost,\n });\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 ? {\n segment_group: this.organizationId,\n }\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 /**\n * Check if a feature flag is enabled\n */\n public async isFeatureEnabled(flagKey: string): Promise<boolean> {\n if (!this.posthog) {\n return false;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const flag = await this.posthog.isFeatureEnabled(flagKey, distinctId);\n return Boolean(flag);\n } catch (error) {\n // If there's an error checking the flag, return false (flag disabled)\n console.warn(`Failed to check feature flag ${flagKey}:`, error);\n return false;\n }\n }\n\n /**\n * Get feature flag payload\n */\n public async getFeatureFlagPayload(flagKey: string): Promise<any> {\n if (!this.posthog) {\n return null;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const payload = await this.posthog.getFeatureFlagPayload(\n flagKey,\n distinctId,\n );\n return payload;\n } catch (error) {\n // If there's an error getting the payload, return null\n console.warn(`Failed to get feature flag payload ${flagKey}:`, error);\n return null;\n }\n }\n\n /**\n * Shutdown analytics services\n */\n public async shutdown(): Promise<void> {\n if (this.posthog) {\n await this.posthog.shutdown();\n }\n }\n}\n","export enum RemoteEndpointType {\n LangGraphPlatform = \"LangGraphPlatform\",\n CopilotKit = \"CopilotKit\",\n CrewAI = \"CrewAI\",\n MCP = \"MCP\",\n Invalid = \"Invalid\",\n}\n\nconst removeTrailingSlash = (url: string) => url.replace(/\\/$/, \"\");\n\nexport const getHumanReadableEndpointType = (type: RemoteEndpointType) => {\n switch (type) {\n case RemoteEndpointType.LangGraphPlatform:\n return \"LangGraph Platform\";\n case RemoteEndpointType.CopilotKit:\n return \"CopilotKit\";\n case RemoteEndpointType.CrewAI:\n return \"CrewAI\";\n case RemoteEndpointType.MCP:\n return \"MCP\";\n default:\n return \"Invalid\";\n }\n};\n\nexport async function detectRemoteEndpointType(url: string): Promise<{\n url: string;\n type: RemoteEndpointType;\n humanReadableType: string;\n}> {\n // First check base URL\n const [isLangGraph, isLangGraphFastAPI, isCopilot, isCrewAI, isMCP] =\n await Promise.all([\n isLangGraphPlatformEndpoint(url),\n isLangGraphFastAPIEndpoint(url),\n isCopilotKitEndpoint(url),\n isCrewAIEndpoint(url),\n isMCPEndpoint(url),\n ]);\n\n // Check base endpoints first\n if (isLangGraph || isLangGraphFastAPI) {\n return {\n url,\n type: RemoteEndpointType.LangGraphPlatform,\n humanReadableType: \"LangGraph Platform\",\n };\n }\n\n if (isCopilot) {\n return {\n url,\n type: RemoteEndpointType.CopilotKit,\n humanReadableType: \"CopilotKit\",\n };\n }\n\n if (isCrewAI) {\n return {\n url,\n type: RemoteEndpointType.CrewAI,\n humanReadableType: \"CrewAI\",\n };\n }\n\n if (isMCP) {\n return {\n url,\n type: RemoteEndpointType.MCP,\n humanReadableType: \"MCP\",\n };\n }\n\n // If no match and URL doesn't already end with /copilotkit, try that path\n if (!url.endsWith(\"/copilotkit\")) {\n const copilotKitUrl = `${removeTrailingSlash(url)}/copilotkit`;\n const isCopilotWithPath = await isCopilotKitEndpoint(copilotKitUrl);\n\n if (isCopilotWithPath) {\n return {\n url: copilotKitUrl,\n type: RemoteEndpointType.CopilotKit,\n humanReadableType: \"CopilotKit\",\n };\n }\n }\n\n return {\n url,\n type: RemoteEndpointType.Invalid,\n humanReadableType: \"Invalid\",\n };\n}\n\nasync function isLangGraphPlatformEndpoint(\n url: string,\n retries: number = 0,\n): Promise<boolean> {\n let response;\n\n try {\n response = await fetch(`${url}/assistants/search`, {\n method: \"POST\",\n\n body: JSON.stringify({\n metadata: {},\n limit: 99,\n offset: 0,\n }),\n });\n } catch (error) {\n return false;\n }\n\n if (!response.ok) {\n if (response.status === 502) {\n if (retries < 3) {\n console.log(\"RETRYING LGC\", retries + 1);\n return isLangGraphPlatformEndpoint(url, retries + 1);\n }\n }\n\n if (response.status === 403) {\n return true;\n }\n\n return false;\n }\n\n const data = await response.json();\n\n if (data[0].assistant_id) {\n return true;\n }\n\n return false;\n}\n\nasync function isLangGraphFastAPIEndpoint(url: string): Promise<boolean> {\n let response;\n\n try {\n response = await fetch(`${url}/health`, {\n method: \"GET\",\n });\n } catch (error) {\n return false;\n }\n\n return response.ok;\n}\n\nasync function isCopilotKitEndpoint(\n url: string,\n retries: number = 0,\n): Promise<boolean> {\n let response;\n\n try {\n response = await fetch(`${url}/info`, {\n method: \"POST\",\n body: JSON.stringify({}),\n });\n } catch (error) {\n return false;\n }\n\n if (!response.ok) {\n if (response.status === 502) {\n if (retries < 3) {\n console.log(\"RETRYING CK\", retries + 1);\n return isCopilotKitEndpoint(url, retries + 1);\n }\n }\n\n return false;\n }\n\n const data = await response.json();\n\n if (data.agents && data.actions) {\n return true;\n }\n\n return false;\n}\n\nasync function isCrewAIEndpoint(url: string): Promise<boolean> {\n return url.toLowerCase().includes(\"crew\");\n}\n\nasync function isMCPEndpoint(_url: string): Promise<boolean> {\n return true;\n}\n","import type { Tunnel } from \"localtunnel\";\n\nimport axios from \"axios\";\nimport localtunnel from \"localtunnel\";\n\nexport interface TunnelOptions {\n port: number;\n subdomain?: string;\n}\n\nexport class TunnelService {\n private readonly META_DATA_URL =\n \"https://metadata-cdn.copilotkit.ai/cloud.config.json\";\n\n async create(options: TunnelOptions): Promise<Tunnel> {\n const metadata = await this.getMetaData();\n\n return localtunnel({\n ...options,\n host: metadata.tunnelHost,\n });\n }\n\n async getMetaData() {\n const response = await axios.get<{\n tunnelHost: string;\n }>(this.META_DATA_URL);\n return response.data;\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"],"mappings":";AAAA,SAAiB,aAAa;AAC9B,OAAOA,eAAc;AACrB,SAAS,gBAAgB;AACzB,OAAOC,UAAkB;AACzB,OAAOC,YAAW;;;ACHlB,OAAOC,WAAU;AACjB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAOC,aAAY;AACnB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,SAAS;AAChB,OAAO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AAA,MAC9D,CAAC;AAED,aAAO,GAAG,SAAS,YAAY;AAC7B,aAAK,IAAIA,OAAM,OAAO,iBAAiB,CAAC;AACxC,cAAM,cAAc,EAAE,IAAI,SAAS,CAAC;AACpC,gBAAQ,KAAK,CAAC;AAAA,MAChB,CAAC;AAGD,YAAM,QAAQ,IAAI;AAAA,QAChB,IAAI,QAAc,MAAM;AACtB,kBAAQ,GAAG,UAAU,YAAY;AAC/B,iBAAK,IAAI,2BAA2B;AACpC,kBAAM,cAAc,EAAE,IAAI,SAAS,CAAC;AACpC,mBAAO,MAAM;AACb,oBAAQ,KAAK,CAAC;AAAA,UAChB,CAAC;AAED,kBAAQ,GAAG,WAAW,YAAY;AAChC,iBAAK,IAAI,2BAA2B;AACpC,kBAAM,cAAc,EAAE,IAAI,SAAS,CAAC;AACpC,mBAAO,MAAM;AACb,oBAAQ,KAAK,CAAC;AAAA,UAChB,CAAC;AAAA,QACH,CAAC;AAAA,QACD,UAAU,EAAE,KAAK,OAAO,KAAK,IAAI,SAAS,CAAC;AAAA,MAC7C,CAAC;AAAA,IACH,SAAS,OAAY;AACnB,cAAQ,KAAK;AACb,UAAI,MAAM,YAAY,2BAA2B;AAC/C,eAAO,KAAK;AAAA,UACV,+CAA+C,iBAAiB,GAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQtE;AAAA,MACF,WAAW,MAAM,YAAY,sBAAsB;AACjD,eAAO,KAAK;AAAA,UACV,+BAA+B,IAAI,uDAAuD,IAAI;AAAA,QAChG;AAAA,MACF,OAAO;AACL,eAAO,KAAK,cAAc,4BAA4B,MAAM,OAAO,EAAE;AAAA,MACvE;AAAA,IACF;AAAA,EACF;AACF;","names":["inquirer","ora","chalk","Conf","crypto","anonymousId","Conf","trpcClient","crypto","chalk","chalk","inquirer","ora"]}
1
+ {"version":3,"sources":["../../src/commands/dev.ts","../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts","../../src/utils/detect-endpoint-type.utils.ts","../../src/services/tunnel.service.ts","../../src/commands/base-command.ts","../../src/utils/version.ts"],"sourcesContent":["import { Config, Flags } from \"@oclif/core\";\nimport inquirer from \"inquirer\";\nimport { createId } from \"@paralleldrive/cuid2\";\nimport ora, { Ora } from \"ora\";\nimport chalk from \"chalk\";\n\nimport { AuthService } from \"../services/auth.service.js\";\nimport { createTRPCClient } from \"../utils/trpc.js\";\nimport {\n detectRemoteEndpointType,\n getHumanReadableEndpointType,\n RemoteEndpointType,\n} from \"../utils/detect-endpoint-type.utils.js\";\nimport { TunnelService } from \"../services/tunnel.service.js\";\nimport { AnalyticsService } from \"../services/analytics.service.js\";\nimport { BaseCommand } from \"./base-command.js\";\n\nconst DEFAULT_CLOUD_BASE_URL = \"https://cloud.copilotkit.ai\";\nconst CLOUD_BASE_URL =\n process.env.COPILOT_CLOUD_BASE_URL ?? DEFAULT_CLOUD_BASE_URL;\n\nexport default class Dev extends BaseCommand {\n static override flags = {\n port: Flags.string({ description: \"port\", required: true }),\n project: Flags.string({\n description: \"project ID (can be found in the Copilot Cloud dashboard)\",\n }),\n };\n\n static override description =\n \"Start local development for a CopilotKit project\";\n static override examples = [\n \"<%= config.bin %> <%= command.id %> --port 8000 --project proj_mv3laowus0lz11kklo57bdr6\",\n ];\n\n private trpcClient: ReturnType<typeof createTRPCClient> | null = null;\n private copilotCloudTunnelId: string | null = null;\n\n constructor(\n argv: string[],\n config: Config,\n private authService = new AuthService(),\n private tunnelService = new TunnelService(),\n ) {\n super(argv, config);\n }\n\n private async pingTunnelRecursively(): Promise<void> {\n if (!this.copilotCloudTunnelId) {\n return;\n }\n\n try {\n await this.trpcClient!.pingLocalTunnel.query({\n localTunnelId: this.copilotCloudTunnelId!,\n });\n } catch (error: any) {\n if (error?.data?.code === \"NOT_FOUND\") {\n this.gracefulError(error.message);\n } else {\n this.gracefulError(\n \"Failed to ping tunnel. The connection may have been lost.\",\n );\n }\n }\n\n await new Promise((resolve) => setTimeout(resolve, 5000));\n await this.pingTunnelRecursively();\n }\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(Dev);\n\n // Check authentication\n const { cliToken, organization, user } =\n await this.authService.requireLogin(this, \"general\");\n const analytics = new AnalyticsService({\n userId: user.id,\n organizationId: organization.id,\n email: user.email,\n });\n\n this.trpcClient = createTRPCClient(cliToken);\n\n const availableProjects = await this.trpcClient.listOrgProjects.query({\n orgId: organization.id,\n });\n let selectedProjectId: string | null = null;\n\n // Get project ID\n if (flags.project) {\n if (\n !availableProjects.some((project: any) => project.id === flags.project)\n ) {\n this.log(chalk.red(`Project with ID ${flags.project} not found`));\n process.exit(1);\n }\n\n selectedProjectId = flags.project;\n this.log(chalk.green(`✅ Selected project ${selectedProjectId}`));\n } else {\n const { projectId } = await inquirer.prompt([\n {\n name: \"projectId\",\n type: \"list\",\n message: \"Select a project\",\n choices: availableProjects.map((project: any) => ({\n value: project.id,\n name: `${project.name} (ID: ${project.id})${availableProjects.length === 1 ? \" (press Enter to confirm)\" : \"\"}`,\n })),\n },\n ]);\n\n selectedProjectId = projectId;\n }\n\n // Remote endpoint type detection\n const { type: remoteEndpointType } = await detectRemoteEndpointType(\n `http://localhost:${flags.port}`,\n );\n\n if (remoteEndpointType === RemoteEndpointType.Invalid) {\n return this.gracefulError(\n `Invalid remote endpoint. Please ensure you are running a compatible endpoint at port ${flags.port} and try again.`,\n );\n }\n\n const humanReadableRemoteEndpointType =\n getHumanReadableEndpointType(remoteEndpointType);\n\n await analytics.track({\n event: \"cli.dev.initiatied\",\n properties: {\n port: flags.port,\n projectId: selectedProjectId!,\n endpointType: remoteEndpointType,\n },\n });\n\n this.log(\n chalk.green(`✅ ${humanReadableRemoteEndpointType} endpoint detected`),\n );\n const spinner = ora(\"Creating tunnel...\\n\").start();\n\n const tunnelId = createId();\n\n // Starting tunnel\n const setupTunnel = this.setupTunnel({\n tunnelId,\n port: parseInt(flags.port),\n subdomain: createId(),\n onSuccess: async ({ url, id }) => {\n // Print tunnel info\n this.log(\"\\nTunnel Information:\\n\");\n this.log(`${chalk.bold.cyan(\"• Tunnel URL:\\t\\t\")} ${chalk.white(url)}`);\n this.log(\n `${chalk.bold.cyan(\"• Endpoint Type:\\t\")} ${chalk.white(humanReadableRemoteEndpointType)}`,\n );\n this.log(\n `${chalk.bold.cyan(\"• Project:\\t\\t\")} ${chalk.white(`${CLOUD_BASE_URL}/projects/${selectedProjectId!}`)}`,\n );\n this.log(chalk.yellow(\"\\nPress Ctrl+C to stop the tunnel\"));\n this.log(\"\\n\");\n\n spinner.text = \"Linking local tunnel to Copilot Cloud...\";\n\n // Report to Cloud\n const { localTunnelId } =\n await this.trpcClient!.reportRemoteEndpointLocalTunnel.mutate({\n tunnelId: id,\n projectId: selectedProjectId!,\n endpointType:\n remoteEndpointType === RemoteEndpointType.CopilotKit\n ? \"CopilotKit\"\n : \"LangGraphCloud\",\n tunnelUrl: url,\n port: parseInt(flags.port),\n });\n\n this.copilotCloudTunnelId = localTunnelId;\n\n await analytics.track({\n event: \"cli.dev.tunnel.created\",\n properties: {\n tunnelId: localTunnelId,\n port: flags.port,\n projectId: selectedProjectId!,\n endpointType: remoteEndpointType,\n },\n });\n\n spinner.color = \"green\";\n spinner.text = \"🚀 Local tunnel is live and linked to Copilot Cloud!\\n\";\n spinner.succeed();\n\n await this.pingTunnelRecursively();\n },\n onTunnelClose: async ({ id }) => {\n if (this.copilotCloudTunnelId) {\n await analytics.track({\n event: \"cli.dev.tunnel.closed\",\n properties: {\n tunnelId: id,\n },\n });\n\n await this.trpcClient!.deleteLocalTunnel.mutate({\n localTunnelId: this.copilotCloudTunnelId!,\n });\n this.copilotCloudTunnelId = null;\n }\n },\n spinner,\n });\n\n await Promise.all([setupTunnel]);\n }\n\n private async setupTunnel({\n port,\n subdomain,\n onSuccess,\n onTunnelClose,\n spinner,\n tunnelId,\n }: {\n port: number;\n subdomain?: string;\n onSuccess: (params: { url: string; id: string }) => Promise<void>;\n onTunnelClose: (params: { id: string }) => Promise<void>;\n spinner: Ora;\n tunnelId: string;\n }) {\n const TUNNEL_TIMEOUT = 15000; // 15 seconds\n const CONNECTION_TEST_TIMEOUT = 5000; // 5 seconds\n\n // First, test if the local port is accessible\n spinner.text = `Testing connection to localhost:${port}...`;\n try {\n const testResponse = await Promise.race([\n fetch(`http://localhost:${port}`, { method: \"HEAD\" }),\n new Promise((_, reject) =>\n setTimeout(\n () => reject(new Error(\"Connection timeout\")),\n CONNECTION_TEST_TIMEOUT,\n ),\n ),\n ]);\n } catch (error) {\n spinner.fail();\n return this.gracefulError(\n `Cannot connect to localhost:${port}. Please ensure your application is running on port ${port} and try again.`,\n );\n }\n\n spinner.text = \"Creating tunnel...\";\n\n try {\n // Create the tunnel with timeout\n const tunnel = await Promise.race([\n this.tunnelService.create({\n port,\n subdomain: tunnelId,\n }),\n new Promise<never>((_, reject) =>\n setTimeout(\n () => reject(new Error(\"Tunnel creation timeout\")),\n TUNNEL_TIMEOUT,\n ),\n ),\n ]);\n\n // Handle tunnel events\n tunnel.on(\"request\", (info: any) => {\n this.log(\n `${chalk.green(\"➜\")} ${chalk.white(new Date().toISOString())} - ${info.method} ${info.path}`,\n );\n });\n\n tunnel.on(\"error\", (err: any) => {\n this.gracefulError(chalk.red(`Tunnel error: ${err.message}`));\n });\n\n tunnel.on(\"close\", async () => {\n this.log(chalk.yellow(\"\\nTunnel closed\"));\n await onTunnelClose({ id: tunnelId });\n process.exit(0);\n });\n\n // Keep the process alive until Ctrl+C\n await Promise.all([\n new Promise<void>(() => {\n process.on(\"SIGINT\", async () => {\n this.log(\"\\nShutting down tunnel...\");\n await onTunnelClose({ id: tunnelId });\n tunnel.close();\n process.exit(0);\n });\n\n process.on(\"SIGTERM\", async () => {\n this.log(\"\\nShutting down tunnel...\");\n await onTunnelClose({ id: tunnelId });\n tunnel.close();\n process.exit(0);\n });\n }),\n onSuccess({ url: tunnel.url, id: tunnelId }),\n ]);\n } catch (error: any) {\n spinner.fail();\n if (error.message === \"Tunnel creation timeout\") {\n return this.gracefulError(\n `Unable to establish tunnel connection after ${TUNNEL_TIMEOUT / 1000} seconds.\\n\\n` +\n `This usually means:\\n` +\n `• Network connectivity issues\\n` +\n `• Tunnel service is temporarily unavailable\\n` +\n `• Firewall blocking outbound connections\\n\\n` +\n `Please try:\\n` +\n `1. Check your internet connection\\n` +\n `2. Try again in a few moments\\n`,\n );\n } else if (error.message === \"Connection timeout\") {\n return this.gracefulError(\n `Cannot connect to localhost:${port}. Please ensure your application is running on port ${port} and try again.`,\n );\n } else {\n return this.gracefulError(`Failed to create tunnel: ${error.message}`);\n }\n }\n }\n}\n","// @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 =\n 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(\n cmd: Command,\n context?: \"cloud-features\" | \"general\",\n ): Promise<LoginResponse> {\n let cliToken = this.getCLIToken();\n // Check authentication\n if (!cliToken) {\n try {\n let shouldLogin = true;\n\n // For cloud features, automatically proceed with login\n // For general usage, ask for confirmation\n if (context !== \"cloud-features\") {\n const response = await inquirer.prompt([\n {\n name: \"shouldLogin\",\n type: \"confirm\",\n message:\n \"🪁 You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)\",\n default: true,\n },\n ]);\n shouldLogin = response.shouldLogin;\n }\n\n if (shouldLogin) {\n // Show different message for cloud features vs general usage\n if (context === \"cloud-features\") {\n cmd.log(\n chalk.cyan(\"\\n🚀 Setting up Copilot Cloud authentication...\\n\"),\n );\n }\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 // Token is invalid/expired, trigger new login\n cmd.log(\n chalk.yellow(\"Your authentication has expired. Re-authenticating...\"),\n );\n try {\n const loginResult = await this.login({ exitAfterLogin: false });\n return loginResult;\n } catch (loginError) {\n cmd.log(\n chalk.red(\n \"Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login\",\n ),\n );\n process.exit(1);\n }\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(\n { exitAfterLogin }: { exitAfterLogin?: boolean } = { exitAfterLogin: true },\n ): Promise<LoginResponse> {\n const spinner = ora(\"🪁 Opening browser for authentication...\").start();\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, reject) => {\n const server = app.listen(port, () => {});\n\n await analytics.track({\n event: \"cli.login.initiated\",\n properties: {},\n });\n\n spinner.text = \"🪁 Waiting for browser authentication to complete...\";\n\n app.post(\"/callback\", async (req, res) => {\n const { cliToken, user, organization } = req.body;\n\n if (state !== req.query.state) {\n res.status(401).json({ message: \"Invalid state\" });\n spinner.fail(\"Invalid state\");\n server.close();\n reject(new Error(\"OAuth state mismatch\"));\n return;\n }\n\n analytics = new AnalyticsService({\n userId: user.id,\n organizationId: organization.id,\n email: user.email,\n });\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 this.config.set(\"cliToken\", cliToken);\n res.status(200).json({ message: \"Callback called\" });\n spinner.succeed(\n `🪁 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(\n `${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`,\n );\n });\n }\n}\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 { Analytics } from \"@segment/analytics-node\";\nimport { PostHog } from \"posthog-node\";\nimport { AnalyticsEvents } from \"./events.js\";\nimport Conf from \"conf\";\n\nexport class AnalyticsService {\n private segment: Analytics | undefined;\n private posthog: PostHog | 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(\n private readonly authData?: {\n userId: string;\n email: string;\n organizationId: string;\n },\n ) {\n if (process.env.SEGMENT_DISABLED === \"true\") {\n return;\n }\n\n const segmentWriteKey =\n process.env.SEGMENT_WRITE_KEY || \"9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf\";\n\n this.globalProperties = {\n service: \"cli\",\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 // Initialize PostHog for feature flags\n if (process.env.POSTHOG_DISABLED !== \"true\") {\n const posthogKey =\n process.env.POSTHOG_KEY ||\n \"phc_XZdymVYjrph9Mi0xZYGNyCKexxgblXRR1jMENCtdz5Q\"; // Default key\n const posthogHost =\n process.env.POSTHOG_HOST || \"https://eu.i.posthog.com\";\n\n this.posthog = new PostHog(posthogKey, {\n host: posthogHost,\n });\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 ? {\n segment_group: this.organizationId,\n }\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 /**\n * Check if a feature flag is enabled\n */\n public async isFeatureEnabled(flagKey: string): Promise<boolean> {\n if (!this.posthog) {\n return false;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const flag = await this.posthog.isFeatureEnabled(flagKey, distinctId);\n return Boolean(flag);\n } catch (error) {\n // If there's an error checking the flag, return false (flag disabled)\n console.warn(`Failed to check feature flag ${flagKey}:`, error);\n return false;\n }\n }\n\n /**\n * Get feature flag payload\n */\n public async getFeatureFlagPayload(flagKey: string): Promise<any> {\n if (!this.posthog) {\n return null;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const payload = await this.posthog.getFeatureFlagPayload(\n flagKey,\n distinctId,\n );\n return payload;\n } catch (error) {\n // If there's an error getting the payload, return null\n console.warn(`Failed to get feature flag payload ${flagKey}:`, error);\n return null;\n }\n }\n\n /**\n * Shutdown analytics services\n */\n public async shutdown(): Promise<void> {\n if (this.posthog) {\n await this.posthog.shutdown();\n }\n }\n}\n","export enum RemoteEndpointType {\n LangGraphPlatform = \"LangGraphPlatform\",\n CopilotKit = \"CopilotKit\",\n CrewAI = \"CrewAI\",\n MCP = \"MCP\",\n Invalid = \"Invalid\",\n}\n\nconst removeTrailingSlash = (url: string) => url.replace(/\\/$/, \"\");\n\nexport const getHumanReadableEndpointType = (type: RemoteEndpointType) => {\n switch (type) {\n case RemoteEndpointType.LangGraphPlatform:\n return \"LangGraph Platform\";\n case RemoteEndpointType.CopilotKit:\n return \"CopilotKit\";\n case RemoteEndpointType.CrewAI:\n return \"CrewAI\";\n case RemoteEndpointType.MCP:\n return \"MCP\";\n default:\n return \"Invalid\";\n }\n};\n\nexport async function detectRemoteEndpointType(url: string): Promise<{\n url: string;\n type: RemoteEndpointType;\n humanReadableType: string;\n}> {\n // First check base URL\n const [isLangGraph, isLangGraphFastAPI, isCopilot, isCrewAI, isMCP] =\n await Promise.all([\n isLangGraphPlatformEndpoint(url),\n isLangGraphFastAPIEndpoint(url),\n isCopilotKitEndpoint(url),\n isCrewAIEndpoint(url),\n isMCPEndpoint(url),\n ]);\n\n // Check base endpoints first\n if (isLangGraph || isLangGraphFastAPI) {\n return {\n url,\n type: RemoteEndpointType.LangGraphPlatform,\n humanReadableType: \"LangGraph Platform\",\n };\n }\n\n if (isCopilot) {\n return {\n url,\n type: RemoteEndpointType.CopilotKit,\n humanReadableType: \"CopilotKit\",\n };\n }\n\n if (isCrewAI) {\n return {\n url,\n type: RemoteEndpointType.CrewAI,\n humanReadableType: \"CrewAI\",\n };\n }\n\n if (isMCP) {\n return {\n url,\n type: RemoteEndpointType.MCP,\n humanReadableType: \"MCP\",\n };\n }\n\n // If no match and URL doesn't already end with /copilotkit, try that path\n if (!url.endsWith(\"/copilotkit\")) {\n const copilotKitUrl = `${removeTrailingSlash(url)}/copilotkit`;\n const isCopilotWithPath = await isCopilotKitEndpoint(copilotKitUrl);\n\n if (isCopilotWithPath) {\n return {\n url: copilotKitUrl,\n type: RemoteEndpointType.CopilotKit,\n humanReadableType: \"CopilotKit\",\n };\n }\n }\n\n return {\n url,\n type: RemoteEndpointType.Invalid,\n humanReadableType: \"Invalid\",\n };\n}\n\nasync function isLangGraphPlatformEndpoint(\n url: string,\n retries: number = 0,\n): Promise<boolean> {\n let response;\n\n try {\n response = await fetch(`${url}/assistants/search`, {\n method: \"POST\",\n\n body: JSON.stringify({\n metadata: {},\n limit: 99,\n offset: 0,\n }),\n });\n } catch (error) {\n return false;\n }\n\n if (!response.ok) {\n if (response.status === 502) {\n if (retries < 3) {\n console.log(\"RETRYING LGC\", retries + 1);\n return isLangGraphPlatformEndpoint(url, retries + 1);\n }\n }\n\n if (response.status === 403) {\n return true;\n }\n\n return false;\n }\n\n const data = await response.json();\n\n if (data[0].assistant_id) {\n return true;\n }\n\n return false;\n}\n\nasync function isLangGraphFastAPIEndpoint(url: string): Promise<boolean> {\n let response;\n\n try {\n response = await fetch(`${url}/health`, {\n method: \"GET\",\n });\n } catch (error) {\n return false;\n }\n\n return response.ok;\n}\n\nasync function isCopilotKitEndpoint(\n url: string,\n retries: number = 0,\n): Promise<boolean> {\n let response;\n\n try {\n response = await fetch(`${url}/info`, {\n method: \"POST\",\n body: JSON.stringify({}),\n });\n } catch (error) {\n return false;\n }\n\n if (!response.ok) {\n if (response.status === 502) {\n if (retries < 3) {\n console.log(\"RETRYING CK\", retries + 1);\n return isCopilotKitEndpoint(url, retries + 1);\n }\n }\n\n return false;\n }\n\n const data = await response.json();\n\n if (data.agents && data.actions) {\n return true;\n }\n\n return false;\n}\n\nasync function isCrewAIEndpoint(url: string): Promise<boolean> {\n return url.toLowerCase().includes(\"crew\");\n}\n\nasync function isMCPEndpoint(_url: string): Promise<boolean> {\n return true;\n}\n","import type { Tunnel } from \"localtunnel\";\n\nimport axios from \"axios\";\nimport localtunnel from \"localtunnel\";\n\nexport interface TunnelOptions {\n port: number;\n subdomain?: string;\n}\n\nexport class TunnelService {\n private readonly META_DATA_URL =\n \"https://metadata-cdn.copilotkit.ai/cloud.config.json\";\n\n async create(options: TunnelOptions): Promise<Tunnel> {\n const metadata = await this.getMetaData();\n\n return localtunnel({\n ...options,\n host: metadata.tunnelHost,\n });\n }\n\n async getMetaData() {\n const response = await axios.get<{\n tunnelHost: string;\n }>(this.META_DATA_URL);\n return response.data;\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 = \"1.54.0\";\n"],"mappings":";AAAA,SAAiB,aAAa;AAC9B,OAAOA,eAAc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O,EAAE;AAAA,MACvE;AAAA,IACF;AAAA,EACF;AACF;","names":["inquirer","ora","chalk","Conf","crypto","anonymousId","Conf","trpcClient","crypto","chalk","chalk","inquirer","ora"]}
@@ -3,7 +3,7 @@ import { Command } from "@oclif/core";
3
3
  import Sentry, { consoleIntegration } from "@sentry/node";
4
4
 
5
5
  // src/utils/version.ts
6
- var LIB_VERSION = "0.0.59";
6
+ var LIB_VERSION = "1.54.0";
7
7
 
8
8
  // src/utils/trpc.ts
9
9
  import { createTRPCClient as trpcClient, httpBatchLink } from "@trpc/client";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/utils/trpc.ts","../../src/commands/create.ts","../../src/lib/init/scaffold/github.ts","../../src/commands/init.ts"],"sourcesContent":["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 { 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 { 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","import { Config } from \"@oclif/core\";\n\nimport { BaseCommand } from \"./base-command.js\";\nimport Create from \"./create.js\";\n\nexport default class CloudInit extends BaseCommand {\n static override description = \"`init` is deprecated — use `create` instead.\";\n\n static override examples = [\"<%= config.bin %> create\"];\n\n constructor(argv: string[], config: Config) {\n super(argv, config);\n }\n\n public async run(): Promise<void> {\n this.log(\n \"`copilotkit init` is deprecated. Redirecting to `copilotkit create`...\",\n );\n\n const createCommand = new Create(this.argv, this.config);\n await createCommand.run();\n }\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,OAAO,UAAU,0BAA0B;;;ACApC,IAAM,cAAc;;;ACD3B,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;;;AFAxC,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,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M,OAAO,EAAE;AAAA,IACjE;AAAA,EACF;AACF;;;AEvZA,IAAqB,YAArB,cAAuC,YAAY;AAAA,EACjD,OAAgB,cAAc;AAAA,EAE9B,OAAgB,WAAW,CAAC,0BAA0B;AAAA,EAEtD,YAAY,MAAgB,QAAgB;AAC1C,UAAM,MAAM,MAAM;AAAA,EACpB;AAAA,EAEA,MAAa,MAAqB;AAChC,SAAK;AAAA,MACH;AAAA,IACF;AAEA,UAAM,gBAAgB,IAAI,OAAO,KAAK,MAAM,KAAK,MAAM;AACvD,UAAM,cAAc,IAAI;AAAA,EAC1B;AACF;","names":["chalk","fs","path","chalk","chalk","path","fs"]}
1
+ {"version":3,"sources":["../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/utils/trpc.ts","../../src/commands/create.ts","../../src/lib/init/scaffold/github.ts","../../src/commands/init.ts"],"sourcesContent":["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 = \"1.54.0\";\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 { 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 { 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","import { Config } from \"@oclif/core\";\n\nimport { BaseCommand } from \"./base-command.js\";\nimport Create from \"./create.js\";\n\nexport default class CloudInit extends BaseCommand {\n static override description = \"`init` is deprecated — use `create` instead.\";\n\n static override examples = [\"<%= config.bin %> create\"];\n\n constructor(argv: string[], config: Config) {\n super(argv, config);\n }\n\n public async run(): Promise<void> {\n this.log(\n \"`copilotkit init` is deprecated. Redirecting to `copilotkit create`...\",\n );\n\n const createCommand = new Create(this.argv, this.config);\n await createCommand.run();\n }\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,OAAO,UAAU,0BAA0B;;;ACApC,IAAM,cAAc;;;ACD3B,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;;;AFAxC,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,EAC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S,OAAY;AACnB,YAAM,IAAI,MAAM,gCAAgC,MAAM,OAAO,EAAE;AAAA,IACjE;AAAA,EACF;AACF;;;AEvZA,IAAqB,YAArB,cAAuC,YAAY;AAAA,EACjD,OAAgB,cAAc;AAAA,EAE9B,OAAgB,WAAW,CAAC,0BAA0B;AAAA,EAEtD,YAAY,MAAgB,QAAgB;AAC1C,UAAM,MAAM,MAAM;AAAA,EACpB;AAAA,EAEA,MAAa,MAAqB;AAChC,SAAK;AAAA,MACH;AAAA,IACF;AAEA,UAAM,gBAAgB,IAAI,OAAO,KAAK,MAAM,KAAK,MAAM;AACvD,UAAM,cAAc,IAAI;AAAA,EAC1B;AACF;","names":["chalk","fs","path","chalk","chalk","path","fs"]}
@@ -299,7 +299,7 @@ import { Command } from "@oclif/core";
299
299
  import Sentry, { consoleIntegration } from "@sentry/node";
300
300
 
301
301
  // src/utils/version.ts
302
- var LIB_VERSION = "0.0.59";
302
+ var LIB_VERSION = "1.54.0";
303
303
 
304
304
  // src/commands/base-command.ts
305
305
  import chalk2 from "chalk";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts","../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/commands/login.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 =\n 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(\n cmd: Command,\n context?: \"cloud-features\" | \"general\",\n ): Promise<LoginResponse> {\n let cliToken = this.getCLIToken();\n // Check authentication\n if (!cliToken) {\n try {\n let shouldLogin = true;\n\n // For cloud features, automatically proceed with login\n // For general usage, ask for confirmation\n if (context !== \"cloud-features\") {\n const response = await inquirer.prompt([\n {\n name: \"shouldLogin\",\n type: \"confirm\",\n message:\n \"🪁 You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)\",\n default: true,\n },\n ]);\n shouldLogin = response.shouldLogin;\n }\n\n if (shouldLogin) {\n // Show different message for cloud features vs general usage\n if (context === \"cloud-features\") {\n cmd.log(\n chalk.cyan(\"\\n🚀 Setting up Copilot Cloud authentication...\\n\"),\n );\n }\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 // Token is invalid/expired, trigger new login\n cmd.log(\n chalk.yellow(\"Your authentication has expired. Re-authenticating...\"),\n );\n try {\n const loginResult = await this.login({ exitAfterLogin: false });\n return loginResult;\n } catch (loginError) {\n cmd.log(\n chalk.red(\n \"Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login\",\n ),\n );\n process.exit(1);\n }\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(\n { exitAfterLogin }: { exitAfterLogin?: boolean } = { exitAfterLogin: true },\n ): Promise<LoginResponse> {\n const spinner = ora(\"🪁 Opening browser for authentication...\").start();\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, reject) => {\n const server = app.listen(port, () => {});\n\n await analytics.track({\n event: \"cli.login.initiated\",\n properties: {},\n });\n\n spinner.text = \"🪁 Waiting for browser authentication to complete...\";\n\n app.post(\"/callback\", async (req, res) => {\n const { cliToken, user, organization } = req.body;\n\n if (state !== req.query.state) {\n res.status(401).json({ message: \"Invalid state\" });\n spinner.fail(\"Invalid state\");\n server.close();\n reject(new Error(\"OAuth state mismatch\"));\n return;\n }\n\n analytics = new AnalyticsService({\n userId: user.id,\n organizationId: organization.id,\n email: user.email,\n });\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 this.config.set(\"cliToken\", cliToken);\n res.status(200).json({ message: \"Callback called\" });\n spinner.succeed(\n `🪁 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(\n `${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`,\n );\n });\n }\n}\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 { Analytics } from \"@segment/analytics-node\";\nimport { PostHog } from \"posthog-node\";\nimport { AnalyticsEvents } from \"./events.js\";\nimport Conf from \"conf\";\n\nexport class AnalyticsService {\n private segment: Analytics | undefined;\n private posthog: PostHog | 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(\n private readonly authData?: {\n userId: string;\n email: string;\n organizationId: string;\n },\n ) {\n if (process.env.SEGMENT_DISABLED === \"true\") {\n return;\n }\n\n const segmentWriteKey =\n process.env.SEGMENT_WRITE_KEY || \"9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf\";\n\n this.globalProperties = {\n service: \"cli\",\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 // Initialize PostHog for feature flags\n if (process.env.POSTHOG_DISABLED !== \"true\") {\n const posthogKey =\n process.env.POSTHOG_KEY ||\n \"phc_XZdymVYjrph9Mi0xZYGNyCKexxgblXRR1jMENCtdz5Q\"; // Default key\n const posthogHost =\n process.env.POSTHOG_HOST || \"https://eu.i.posthog.com\";\n\n this.posthog = new PostHog(posthogKey, {\n host: posthogHost,\n });\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 ? {\n segment_group: this.organizationId,\n }\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 /**\n * Check if a feature flag is enabled\n */\n public async isFeatureEnabled(flagKey: string): Promise<boolean> {\n if (!this.posthog) {\n return false;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const flag = await this.posthog.isFeatureEnabled(flagKey, distinctId);\n return Boolean(flag);\n } catch (error) {\n // If there's an error checking the flag, return false (flag disabled)\n console.warn(`Failed to check feature flag ${flagKey}:`, error);\n return false;\n }\n }\n\n /**\n * Get feature flag payload\n */\n public async getFeatureFlagPayload(flagKey: string): Promise<any> {\n if (!this.posthog) {\n return null;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const payload = await this.posthog.getFeatureFlagPayload(\n flagKey,\n distinctId,\n );\n return payload;\n } catch (error) {\n // If there's an error getting the payload, return null\n console.warn(`Failed to get feature flag payload ${flagKey}:`, error);\n return null;\n }\n }\n\n /**\n * Shutdown analytics services\n */\n public async shutdown(): Promise<void> {\n if (this.posthog) {\n await this.posthog.shutdown();\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 { Config } from \"@oclif/core\";\n\nimport { AuthService } from \"../services/auth.service.js\";\nimport { BaseCommand } from \"./base-command.js\";\n\nexport default class CloudLogin extends BaseCommand {\n static override description = \"Login to Copilot Cloud\";\n\n static override examples = [\"<%= config.bin %> login\"];\n\n constructor(\n argv: string[],\n config: Config,\n private authService = new AuthService(),\n ) {\n super(argv, config);\n }\n\n public async run(): Promise<void> {\n await this.parse(CloudLogin);\n\n try {\n await this.authService.login();\n } catch (error: unknown) {\n this.gracefulError((error as Error).message);\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,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;AAEjC,SAAS,iBAAiB,UAAuB;AACtD,SAAO,WAAW;AAAA,IAChB,OAAO;AAAA,MACL,cAAc;AAAA,QACZ,KAAK,GAAG,sBAAsB;AAAA,QAC9B,aAAa;AAAA,QACb,SAAS,MAAM;AACb,iBAAO;AAAA,YACL,iBAAiB;AAAA,YACjB,eAAe;AAAA,UACjB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;;;ACrBA,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAExB,OAAO,UAAU;AAEV,IAAM,mBAAN,MAAuB;AAAA,EAS5B,YACmB,UAKjB;AALiB;AAMjB,QAAI,QAAQ,IAAI,qBAAqB,QAAQ;AA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K,MAAM,WAAU;AAE3B,QAAI;AACF,YAAM,KAAK,YAAY,MAAM;AAAA,IAC/B,SAAS,OAAgB;AACvB,WAAK,cAAe,MAAgB,OAAO;AAAA,IAC7C;AAAA,EACF;AACF;","names":["Conf","crypto","anonymousId","Conf","trpcClient","crypto","chalk"]}
1
+ {"version":3,"sources":["../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts","../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/commands/login.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 =\n 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(\n cmd: Command,\n context?: \"cloud-features\" | \"general\",\n ): Promise<LoginResponse> {\n let cliToken = this.getCLIToken();\n // Check authentication\n if (!cliToken) {\n try {\n let shouldLogin = true;\n\n // For cloud features, automatically proceed with login\n // For general usage, ask for confirmation\n if (context !== \"cloud-features\") {\n const response = await inquirer.prompt([\n {\n name: \"shouldLogin\",\n type: \"confirm\",\n message:\n \"🪁 You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)\",\n default: true,\n },\n ]);\n shouldLogin = response.shouldLogin;\n }\n\n if (shouldLogin) {\n // Show different message for cloud features vs general usage\n if (context === \"cloud-features\") {\n cmd.log(\n chalk.cyan(\"\\n🚀 Setting up Copilot Cloud authentication...\\n\"),\n );\n }\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 // Token is invalid/expired, trigger new login\n cmd.log(\n chalk.yellow(\"Your authentication has expired. Re-authenticating...\"),\n );\n try {\n const loginResult = await this.login({ exitAfterLogin: false });\n return loginResult;\n } catch (loginError) {\n cmd.log(\n chalk.red(\n \"Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login\",\n ),\n );\n process.exit(1);\n }\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(\n { exitAfterLogin }: { exitAfterLogin?: boolean } = { exitAfterLogin: true },\n ): Promise<LoginResponse> {\n const spinner = ora(\"🪁 Opening browser for authentication...\").start();\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, reject) => {\n const server = app.listen(port, () => {});\n\n await analytics.track({\n event: \"cli.login.initiated\",\n properties: {},\n });\n\n spinner.text = \"🪁 Waiting for browser authentication to complete...\";\n\n app.post(\"/callback\", async (req, res) => {\n const { cliToken, user, organization } = req.body;\n\n if (state !== req.query.state) {\n res.status(401).json({ message: \"Invalid state\" });\n spinner.fail(\"Invalid state\");\n server.close();\n reject(new Error(\"OAuth state mismatch\"));\n return;\n }\n\n analytics = new AnalyticsService({\n userId: user.id,\n organizationId: organization.id,\n email: user.email,\n });\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 this.config.set(\"cliToken\", cliToken);\n res.status(200).json({ message: \"Callback called\" });\n spinner.succeed(\n `🪁 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(\n `${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`,\n );\n });\n }\n}\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 { Analytics } from \"@segment/analytics-node\";\nimport { PostHog } from \"posthog-node\";\nimport { AnalyticsEvents } from \"./events.js\";\nimport Conf from \"conf\";\n\nexport class AnalyticsService {\n private segment: Analytics | undefined;\n private posthog: PostHog | 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(\n private readonly authData?: {\n userId: string;\n email: string;\n organizationId: string;\n },\n ) {\n if (process.env.SEGMENT_DISABLED === \"true\") {\n return;\n }\n\n const segmentWriteKey =\n process.env.SEGMENT_WRITE_KEY || \"9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf\";\n\n this.globalProperties = {\n service: \"cli\",\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 // Initialize PostHog for feature flags\n if (process.env.POSTHOG_DISABLED !== \"true\") {\n const posthogKey =\n process.env.POSTHOG_KEY ||\n \"phc_XZdymVYjrph9Mi0xZYGNyCKexxgblXRR1jMENCtdz5Q\"; // Default key\n const posthogHost =\n process.env.POSTHOG_HOST || \"https://eu.i.posthog.com\";\n\n this.posthog = new PostHog(posthogKey, {\n host: posthogHost,\n });\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 ? {\n segment_group: this.organizationId,\n }\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 /**\n * Check if a feature flag is enabled\n */\n public async isFeatureEnabled(flagKey: string): Promise<boolean> {\n if (!this.posthog) {\n return false;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const flag = await this.posthog.isFeatureEnabled(flagKey, distinctId);\n return Boolean(flag);\n } catch (error) {\n // If there's an error checking the flag, return false (flag disabled)\n console.warn(`Failed to check feature flag ${flagKey}:`, error);\n return false;\n }\n }\n\n /**\n * Get feature flag payload\n */\n public async getFeatureFlagPayload(flagKey: string): Promise<any> {\n if (!this.posthog) {\n return null;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const payload = await this.posthog.getFeatureFlagPayload(\n flagKey,\n distinctId,\n );\n return payload;\n } catch (error) {\n // If there's an error getting the payload, return null\n console.warn(`Failed to get feature flag payload ${flagKey}:`, error);\n return null;\n }\n }\n\n /**\n * Shutdown analytics services\n */\n public async shutdown(): Promise<void> {\n if (this.posthog) {\n await this.posthog.shutdown();\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 = \"1.54.0\";\n","import { Config } from \"@oclif/core\";\n\nimport { AuthService } from \"../services/auth.service.js\";\nimport { BaseCommand } from \"./base-command.js\";\n\nexport default class CloudLogin extends BaseCommand {\n static override description = \"Login to Copilot Cloud\";\n\n static override examples = [\"<%= config.bin %> login\"];\n\n constructor(\n argv: string[],\n config: Config,\n private authService = new AuthService(),\n ) {\n super(argv, config);\n }\n\n public async run(): Promise<void> {\n await this.parse(CloudLogin);\n\n try {\n await this.authService.login();\n } catch (error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,MAAM,UAAU;AACd,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,MAAM,MAAM;AAAA,EAAC;AAAA,EAEb,MAAM,kBAAkB;AACtB,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,GAAG,sBAAsB,cAAc;AAEpE,YAAM,OAAO,MAAM,SAAS,KAAK;AACjC,YAAM,eAAe,KAAK;AAE1B,UAAI,CAAC,gBAAgB,iBAAiB,aAAa;AACjD;AAAA,MACF;AAAA,IAWF,QAAQ;AAAA,IAER;AAAA,EACF;AAAA,EAEA,MAAM,cAAc,SAAiB;AACnC,SAAK,IAAI,OAAOA,OAAM,IAAI,OAAO,CAAC;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;;AEvEA,IAAqB,aAArB,MAAqB,oBAAmB,YAAY;AAAA,EAKlD,YACE,MACA,QACQ,cAAc,IAAI,YAAY,GACtC;AACA,UAAM,MAAM,MAAM;AAFV;AAAA,EAGV;AAAA,EAVA,OAAgB,cAAc;AAAA,EAE9B,OAAgB,WAAW,CAAC,yBAAyB;AAAA,EAUrD,MAAa,MAAqB;AAChC,UAAM,KAAK,MAAM,WAAU;AAE3B,QAAI;AACF,YAAM,KAAK,YAAY,MAAM;AAAA,IAC/B,SAAS,OAAgB;AACvB,WAAK,cAAe,MAAgB,OAAO;AAAA,IAC7C;AAAA,EACF;AACF;","names":["Conf","crypto","anonymousId","Conf","trpcClient","crypto","chalk"]}
@@ -302,7 +302,7 @@ import { Command } from "@oclif/core";
302
302
  import Sentry, { consoleIntegration } from "@sentry/node";
303
303
 
304
304
  // src/utils/version.ts
305
- var LIB_VERSION = "0.0.59";
305
+ var LIB_VERSION = "1.54.0";
306
306
 
307
307
  // src/commands/base-command.ts
308
308
  import chalk2 from "chalk";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/logout.ts","../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts","../../src/commands/base-command.ts","../../src/utils/version.ts"],"sourcesContent":["import { Config } from \"@oclif/core\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\n\nimport { AuthService } from \"../services/auth.service.js\";\nimport { BaseCommand } from \"./base-command.js\";\n\nexport default class CloudLogout extends BaseCommand {\n static override description = \"Logout from Copilot Cloud\";\n\n static override examples = [\"<%= config.bin %> logout\"];\n\n constructor(\n argv: string[],\n config: Config,\n private authService = new AuthService(),\n ) {\n super(argv, config);\n }\n\n public async run(): Promise<void> {\n await this.parse(CloudLogout);\n this.log(\"Logging out...\\n\");\n await this.authService.logout(this);\n this.log(chalk.green(\"Successfully logged out!\"));\n }\n}\n","// @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 =\n 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(\n cmd: Command,\n context?: \"cloud-features\" | \"general\",\n ): Promise<LoginResponse> {\n let cliToken = this.getCLIToken();\n // Check authentication\n if (!cliToken) {\n try {\n let shouldLogin = true;\n\n // For cloud features, automatically proceed with login\n // For general usage, ask for confirmation\n if (context !== \"cloud-features\") {\n const response = await inquirer.prompt([\n {\n name: \"shouldLogin\",\n type: \"confirm\",\n message:\n \"🪁 You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)\",\n default: true,\n },\n ]);\n shouldLogin = response.shouldLogin;\n }\n\n if (shouldLogin) {\n // Show different message for cloud features vs general usage\n if (context === \"cloud-features\") {\n cmd.log(\n chalk.cyan(\"\\n🚀 Setting up Copilot Cloud authentication...\\n\"),\n );\n }\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 // Token is invalid/expired, trigger new login\n cmd.log(\n chalk.yellow(\"Your authentication has expired. Re-authenticating...\"),\n );\n try {\n const loginResult = await this.login({ exitAfterLogin: false });\n return loginResult;\n } catch (loginError) {\n cmd.log(\n chalk.red(\n \"Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login\",\n ),\n );\n process.exit(1);\n }\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(\n { exitAfterLogin }: { exitAfterLogin?: boolean } = { exitAfterLogin: true },\n ): Promise<LoginResponse> {\n const spinner = ora(\"🪁 Opening browser for authentication...\").start();\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, reject) => {\n const server = app.listen(port, () => {});\n\n await analytics.track({\n event: \"cli.login.initiated\",\n properties: {},\n });\n\n spinner.text = \"🪁 Waiting for browser authentication to complete...\";\n\n app.post(\"/callback\", async (req, res) => {\n const { cliToken, user, organization } = req.body;\n\n if (state !== req.query.state) {\n res.status(401).json({ message: \"Invalid state\" });\n spinner.fail(\"Invalid state\");\n server.close();\n reject(new Error(\"OAuth state mismatch\"));\n return;\n }\n\n analytics = new AnalyticsService({\n userId: user.id,\n organizationId: organization.id,\n email: user.email,\n });\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 this.config.set(\"cliToken\", cliToken);\n res.status(200).json({ message: \"Callback called\" });\n spinner.succeed(\n `🪁 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(\n `${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`,\n );\n });\n }\n}\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 { Analytics } from \"@segment/analytics-node\";\nimport { PostHog } from \"posthog-node\";\nimport { AnalyticsEvents } from \"./events.js\";\nimport Conf from \"conf\";\n\nexport class AnalyticsService {\n private segment: Analytics | undefined;\n private posthog: PostHog | 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(\n private readonly authData?: {\n userId: string;\n email: string;\n organizationId: string;\n },\n ) {\n if (process.env.SEGMENT_DISABLED === \"true\") {\n return;\n }\n\n const segmentWriteKey =\n process.env.SEGMENT_WRITE_KEY || \"9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf\";\n\n this.globalProperties = {\n service: \"cli\",\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 // Initialize PostHog for feature flags\n if (process.env.POSTHOG_DISABLED !== \"true\") {\n const posthogKey =\n process.env.POSTHOG_KEY ||\n \"phc_XZdymVYjrph9Mi0xZYGNyCKexxgblXRR1jMENCtdz5Q\"; // Default key\n const posthogHost =\n process.env.POSTHOG_HOST || \"https://eu.i.posthog.com\";\n\n this.posthog = new PostHog(posthogKey, {\n host: posthogHost,\n });\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 ? {\n segment_group: this.organizationId,\n }\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 /**\n * Check if a feature flag is enabled\n */\n public async isFeatureEnabled(flagKey: string): Promise<boolean> {\n if (!this.posthog) {\n return false;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const flag = await this.posthog.isFeatureEnabled(flagKey, distinctId);\n return Boolean(flag);\n } catch (error) {\n // If there's an error checking the flag, return false (flag disabled)\n console.warn(`Failed to check feature flag ${flagKey}:`, error);\n return false;\n }\n }\n\n /**\n * Get feature flag payload\n */\n public async getFeatureFlagPayload(flagKey: string): Promise<any> {\n if (!this.posthog) {\n return null;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const payload = await this.posthog.getFeatureFlagPayload(\n flagKey,\n distinctId,\n );\n return payload;\n } catch (error) {\n // If there's an error getting the payload, return null\n console.warn(`Failed to get feature flag payload ${flagKey}:`, error);\n return null;\n }\n }\n\n /**\n * Shutdown analytics services\n */\n public async shutdown(): Promise<void> {\n if (this.posthog) {\n await this.posthog.shutdown();\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"],"mappings":";AACA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAU;AACjB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAOC,aAAY;AACnB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,SAAS;AAChB,OAAO,WAA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AM,MAAM,GAAG,sBAAsB,cAAc;AAEpE,YAAM,OAAO,MAAM,SAAS,KAAK;AACjC,YAAM,eAAe,KAAK;AAE1B,UAAI,CAAC,gBAAgB,iBAAiB,aAAa;AACjD;AAAA,MACF;AAAA,IAWF,QAAQ;AAAA,IAER;AAAA,EACF;AAAA,EAEA,MAAM,cAAc,SAAiB;AACnC,SAAK,IAAI,OAAOA,OAAM,IAAI,OAAO,CAAC;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;;AJrEA,IAAqB,cAArB,MAAqB,qBAAoB,YAAY;AAAA,EAKnD,YACE,MACA,QACQ,cAAc,IAAI,YAAY,GACtC;AACA,UAAM,MAAM,MAAM;AAFV;AAAA,EAGV;AAAA,EAVA,OAAgB,cAAc;AAAA,EAE9B,OAAgB,WAAW,CAAC,0BAA0B;AAAA,EAUtD,MAAa,MAAqB;AAChC,UAAM,KAAK,MAAM,YAAW;AAC5B,SAAK,IAAI,kBAAkB;AAC3B,UAAM,KAAK,YAAY,OAAO,IAAI;AAClC,SAAK,IAAIC,OAAM,MAAM,0BAA0B,CAAC;AAAA,EAClD;AACF;","names":["chalk","Conf","crypto","anonymousId","Conf","trpcClient","crypto","chalk","chalk"]}
1
+ {"version":3,"sources":["../../src/commands/logout.ts","../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts","../../src/commands/base-command.ts","../../src/utils/version.ts"],"sourcesContent":["import { Config } from \"@oclif/core\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\n\nimport { AuthService } from \"../services/auth.service.js\";\nimport { BaseCommand } from \"./base-command.js\";\n\nexport default class CloudLogout extends BaseCommand {\n static override description = \"Logout from Copilot Cloud\";\n\n static override examples = [\"<%= config.bin %> logout\"];\n\n constructor(\n argv: string[],\n config: Config,\n private authService = new AuthService(),\n ) {\n super(argv, config);\n }\n\n public async run(): Promise<void> {\n await this.parse(CloudLogout);\n this.log(\"Logging out...\\n\");\n await this.authService.logout(this);\n this.log(chalk.green(\"Successfully logged out!\"));\n }\n}\n","// @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 =\n 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(\n cmd: Command,\n context?: \"cloud-features\" | \"general\",\n ): Promise<LoginResponse> {\n let cliToken = this.getCLIToken();\n // Check authentication\n if (!cliToken) {\n try {\n let shouldLogin = true;\n\n // For cloud features, automatically proceed with login\n // For general usage, ask for confirmation\n if (context !== \"cloud-features\") {\n const response = await inquirer.prompt([\n {\n name: \"shouldLogin\",\n type: \"confirm\",\n message:\n \"🪁 You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)\",\n default: true,\n },\n ]);\n shouldLogin = response.shouldLogin;\n }\n\n if (shouldLogin) {\n // Show different message for cloud features vs general usage\n if (context === \"cloud-features\") {\n cmd.log(\n chalk.cyan(\"\\n🚀 Setting up Copilot Cloud authentication...\\n\"),\n );\n }\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 // Token is invalid/expired, trigger new login\n cmd.log(\n chalk.yellow(\"Your authentication has expired. Re-authenticating...\"),\n );\n try {\n const loginResult = await this.login({ exitAfterLogin: false });\n return loginResult;\n } catch (loginError) {\n cmd.log(\n chalk.red(\n \"Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login\",\n ),\n );\n process.exit(1);\n }\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(\n { exitAfterLogin }: { exitAfterLogin?: boolean } = { exitAfterLogin: true },\n ): Promise<LoginResponse> {\n const spinner = ora(\"🪁 Opening browser for authentication...\").start();\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, reject) => {\n const server = app.listen(port, () => {});\n\n await analytics.track({\n event: \"cli.login.initiated\",\n properties: {},\n });\n\n spinner.text = \"🪁 Waiting for browser authentication to complete...\";\n\n app.post(\"/callback\", async (req, res) => {\n const { cliToken, user, organization } = req.body;\n\n if (state !== req.query.state) {\n res.status(401).json({ message: \"Invalid state\" });\n spinner.fail(\"Invalid state\");\n server.close();\n reject(new Error(\"OAuth state mismatch\"));\n return;\n }\n\n analytics = new AnalyticsService({\n userId: user.id,\n organizationId: organization.id,\n email: user.email,\n });\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 this.config.set(\"cliToken\", cliToken);\n res.status(200).json({ message: \"Callback called\" });\n spinner.succeed(\n `🪁 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(\n `${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`,\n );\n });\n }\n}\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 { Analytics } from \"@segment/analytics-node\";\nimport { PostHog } from \"posthog-node\";\nimport { AnalyticsEvents } from \"./events.js\";\nimport Conf from \"conf\";\n\nexport class AnalyticsService {\n private segment: Analytics | undefined;\n private posthog: PostHog | 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(\n private readonly authData?: {\n userId: string;\n email: string;\n organizationId: string;\n },\n ) {\n if (process.env.SEGMENT_DISABLED === \"true\") {\n return;\n }\n\n const segmentWriteKey =\n process.env.SEGMENT_WRITE_KEY || \"9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf\";\n\n this.globalProperties = {\n service: \"cli\",\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 // Initialize PostHog for feature flags\n if (process.env.POSTHOG_DISABLED !== \"true\") {\n const posthogKey =\n process.env.POSTHOG_KEY ||\n \"phc_XZdymVYjrph9Mi0xZYGNyCKexxgblXRR1jMENCtdz5Q\"; // Default key\n const posthogHost =\n process.env.POSTHOG_HOST || \"https://eu.i.posthog.com\";\n\n this.posthog = new PostHog(posthogKey, {\n host: posthogHost,\n });\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 ? {\n segment_group: this.organizationId,\n }\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 /**\n * Check if a feature flag is enabled\n */\n public async isFeatureEnabled(flagKey: string): Promise<boolean> {\n if (!this.posthog) {\n return false;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const flag = await this.posthog.isFeatureEnabled(flagKey, distinctId);\n return Boolean(flag);\n } catch (error) {\n // If there's an error checking the flag, return false (flag disabled)\n console.warn(`Failed to check feature flag ${flagKey}:`, error);\n return false;\n }\n }\n\n /**\n * Get feature flag payload\n */\n public async getFeatureFlagPayload(flagKey: string): Promise<any> {\n if (!this.posthog) {\n return null;\n }\n\n try {\n // Use authenticated user ID if available, otherwise use anonymous ID\n const distinctId = this.userId || this.getAnonymousId();\n const payload = await this.posthog.getFeatureFlagPayload(\n flagKey,\n distinctId,\n );\n return payload;\n } catch (error) {\n // If there's an error getting the payload, return null\n console.warn(`Failed to get feature flag payload ${flagKey}:`, error);\n return null;\n }\n }\n\n /**\n * Shutdown analytics services\n */\n public async shutdown(): Promise<void> {\n if (this.posthog) {\n await this.posthog.shutdown();\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 = \"1.54.0\";\n"],"mappings":";AACA,OAAOA,YAAW;;;ACAlB,OAAOC,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,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;AAEjC,SAAS,iBAAiB,UAAuB;AACtD,SAAO,WAAW;AAAA,IAChB,OAAO;AAAA,MACL,cAAc;AAAA,QACZ,KAAK,GAAG,sBAAsB;AAAA,QAC9B,aAAa;AAAA,QACb,SAAS,MAAM;AACb,iBAAO;AAAA,YACL,iBAAiB;AAAA,YACjB,eAAe;AAAA,UACjB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;;;AC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AAY,GACtC;AACA,UAAM,MAAM,MAAM;AAFV;AAAA,EAGV;AAAA,EAVA,OAAgB,cAAc;AAAA,EAE9B,OAAgB,WAAW,CAAC,0BAA0B;AAAA,EAUtD,MAAa,MAAqB;AAChC,UAAM,KAAK,MAAM,YAAW;AAC5B,SAAK,IAAI,kBAAkB;AAC3B,UAAM,KAAK,YAAY,OAAO,IAAI;AAClC,SAAK,IAAIC,OAAM,MAAM,0BAA0B,CAAC;AAAA,EAClD;AACF;","names":["chalk","Conf","crypto","anonymousId","Conf","trpcClient","crypto","chalk","chalk"]}
@@ -1,3 +1,3 @@
1
- declare const LIB_VERSION = "0.0.59";
1
+ declare const LIB_VERSION = "1.54.0";
2
2
 
3
3
  export { LIB_VERSION };
@@ -1,5 +1,5 @@
1
1
  // src/utils/version.ts
2
- var LIB_VERSION = "0.0.59";
2
+ var LIB_VERSION = "1.54.0";
3
3
  export {
4
4
  LIB_VERSION
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/version.ts"],"sourcesContent":["// This is auto generated!\nexport const LIB_VERSION = \"0.0.59\";\n"],"mappings":";AACO,IAAM,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/version.ts"],"sourcesContent":["// This is auto generated!\nexport const LIB_VERSION = \"1.54.0\";\n"],"mappings":";AACO,IAAM,cAAc;","names":[]}
@@ -204,5 +204,5 @@
204
204
  ]
205
205
  }
206
206
  },
207
- "version": "0.0.59"
207
+ "version": "1.54.0"
208
208
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "copilotkit",
3
3
  "description": "CopilotKit CLI",
4
- "version": "0.0.59",
4
+ "version": "1.54.0",
5
5
  "author": "CopilotKit",
6
6
  "bin": {
7
7
  "copilotkit": "./bin/run.js",