copilotkit 0.0.31 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +8 -7
  2. package/dist/commands/base-command.js +2 -4
  3. package/dist/commands/base-command.js.map +1 -1
  4. package/dist/commands/dev.js +2 -4
  5. package/dist/commands/dev.js.map +1 -1
  6. package/dist/commands/init.d.ts +13 -14
  7. package/dist/commands/init.js +155 -135
  8. package/dist/commands/init.js.map +1 -1
  9. package/dist/commands/login.js +2 -4
  10. package/dist/commands/login.js.map +1 -1
  11. package/dist/commands/logout.js +2 -4
  12. package/dist/commands/logout.js.map +1 -1
  13. package/dist/lib/init/index.d.ts +1 -1
  14. package/dist/lib/init/index.js +92 -112
  15. package/dist/lib/init/index.js.map +1 -1
  16. package/dist/lib/init/questions.js +56 -83
  17. package/dist/lib/init/questions.js.map +1 -1
  18. package/dist/lib/init/scaffold/agent.js +19 -9
  19. package/dist/lib/init/scaffold/agent.js.map +1 -1
  20. package/dist/lib/init/scaffold/crew-inputs.js.map +1 -1
  21. package/dist/lib/init/scaffold/env.js +11 -14
  22. package/dist/lib/init/scaffold/env.js.map +1 -1
  23. package/dist/lib/init/scaffold/github.js.map +1 -1
  24. package/dist/lib/init/scaffold/index.js +72 -71
  25. package/dist/lib/init/scaffold/index.js.map +1 -1
  26. package/dist/lib/init/scaffold/langgraph-assistants.js +11 -14
  27. package/dist/lib/init/scaffold/langgraph-assistants.js.map +1 -1
  28. package/dist/lib/init/scaffold/packages.js.map +1 -1
  29. package/dist/lib/init/scaffold/shadcn.d.ts +1 -1
  30. package/dist/lib/init/scaffold/shadcn.js +42 -48
  31. package/dist/lib/init/scaffold/shadcn.js.map +1 -1
  32. package/dist/lib/init/types/index.d.ts +1 -1
  33. package/dist/lib/init/types/index.js +40 -46
  34. package/dist/lib/init/types/index.js.map +1 -1
  35. package/dist/lib/init/types/questions.d.ts +22 -24
  36. package/dist/lib/init/types/questions.js +30 -31
  37. package/dist/lib/init/types/questions.js.map +1 -1
  38. package/dist/lib/init/types/templates.d.ts +2 -2
  39. package/dist/lib/init/types/templates.js +10 -15
  40. package/dist/lib/init/types/templates.js.map +1 -1
  41. package/dist/lib/init/utils.d.ts +3 -0
  42. package/dist/lib/init/utils.js +8 -0
  43. package/dist/lib/init/utils.js.map +1 -0
  44. package/dist/services/analytics.service.js.map +1 -1
  45. package/dist/services/auth.service.js.map +1 -1
  46. package/dist/services/tunnel.service.js.map +1 -1
  47. package/dist/utils/detect-endpoint-type.utils.d.ts +1 -1
  48. package/dist/utils/version.d.ts +1 -1
  49. package/dist/utils/version.js +1 -1
  50. package/dist/utils/version.js.map +1 -1
  51. package/oclif.manifest.json +33 -56
  52. package/package.json +1 -1
@@ -222,7 +222,7 @@ import { Command } from "@oclif/core";
222
222
  import Sentry, { consoleIntegration } from "@sentry/node";
223
223
 
224
224
  // src/utils/version.ts
225
- var LIB_VERSION = "0.0.31";
225
+ var LIB_VERSION = "0.0.33";
226
226
 
227
227
  // src/commands/base-command.ts
228
228
  import chalk2 from "chalk";
@@ -234,9 +234,7 @@ var BaseCommand = class extends Command {
234
234
  }
235
235
  Sentry.init({
236
236
  dsn: process.env.SENTRY_DSN || "https://1eea15d32e2eacb0456a77db5e39aeeb@o4507288195170304.ingest.us.sentry.io/4508581448581120",
237
- integrations: [
238
- consoleIntegration()
239
- ],
237
+ integrations: [consoleIntegration()],
240
238
  // Tracing
241
239
  tracesSampleRate: 1
242
240
  // Capture 100% of the transactions
@@ -275,7 +273,14 @@ var BaseCommand = class extends Command {
275
273
  // src/lib/init/types/questions.ts
276
274
  import { z } from "zod";
277
275
  import { Flags } from "@oclif/core";
278
- var AGENT_FRAMEWORKS = ["CrewAI", "LangGraph", "MCP", "None"];
276
+
277
+ // src/lib/init/utils.ts
278
+ var isLocalhost = (url) => {
279
+ return url.includes("localhost") || url.includes("127.0.0.1") || url.includes("0.0.0.0");
280
+ };
281
+
282
+ // src/lib/init/types/questions.ts
283
+ var MODES = ["CrewAI", "LangGraph", "MCP", "Standard"];
279
284
  var CREW_TYPES = ["Crews", "Flows"];
280
285
  var CHAT_COMPONENTS = ["CopilotChat", "CopilotSidebar", "Headless", "CopilotPopup"];
281
286
  var LANGGRAPH_AGENTS = ["Python Starter", "TypeScript Starter"];
@@ -303,7 +308,7 @@ var sanitizers = {
303
308
  return value.trim().replace(/\s/g, "");
304
309
  }
305
310
  };
306
- var AgentFrameworkSchema = z.enum(AGENT_FRAMEWORKS);
311
+ var ModeSchema = z.enum(MODES);
307
312
  var CrewTypeSchema = z.enum(CREW_TYPES);
308
313
  var ChatComponentSchema = z.enum(CHAT_COMPONENTS);
309
314
  var LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS);
@@ -313,28 +318,22 @@ var UrlSchema = z.preprocess(
313
318
  (val) => sanitizers.url(String(val)),
314
319
  z.string().url("Please enter a valid URL").min(1, "URL is required")
315
320
  );
316
- var TokenSchema = z.preprocess(
317
- (val) => sanitizers.trim(String(val)),
318
- z.string().min(1, "Token is required")
319
- );
321
+ var TokenSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, "Token is required"));
320
322
  var ApiKeySchema = z.preprocess(
321
323
  (val) => sanitizers.apiKey(String(val)),
322
324
  z.string().min(1, "API key is required")
323
325
  );
324
- var NameSchema = z.preprocess(
325
- (val) => sanitizers.trim(String(val)),
326
- z.string().min(1, "Name is required")
327
- );
326
+ var NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, "Name is required"));
328
327
  var ConfigSchema = z.object({
329
328
  // Core fields
330
329
  copilotKitVersion: z.string().optional(),
331
- agentFramework: AgentFrameworkSchema,
330
+ mode: ModeSchema,
332
331
  chatUi: ChatComponentSchema.optional(),
333
332
  // Yes/No fields
334
333
  alreadyDeployed: YesNoSchema.optional(),
335
334
  fastApiEnabled: YesNoSchema.optional(),
336
335
  useCopilotCloud: YesNoSchema.optional(),
337
- // LangGraph specific fields
336
+ // LangGraph specific fields
338
337
  langGraphAgent: LangGraphAgentSchema.optional(),
339
338
  langGraphPlatform: YesNoSchema.optional(),
340
339
  langGraphPlatformUrl: UrlSchema.optional(),
@@ -351,7 +350,7 @@ var ConfigSchema = z.object({
351
350
  llmToken: ApiKeySchema.optional()
352
351
  }).refine(
353
352
  (data) => {
354
- if (data.agentFramework === "CrewAI" && data.crewType === "Crews") {
353
+ if (data.mode === "CrewAI" && data.crewType === "Crews") {
355
354
  return !!data.crewUrl && !!data.crewBearerToken;
356
355
  }
357
356
  return true;
@@ -362,8 +361,8 @@ var ConfigSchema = z.object({
362
361
  }
363
362
  ).refine(
364
363
  (data) => {
365
- if (data.agentFramework === "LangGraph" && data.alreadyDeployed === "Yes" && data.langGraphPlatform === "Yes") {
366
- return !!data.langGraphPlatformUrl && !!data.langSmithApiKey;
364
+ if (data.mode === "LangGraph" && data.alreadyDeployed === "Yes" && data.langGraphPlatform === "Yes") {
365
+ return !!data.langGraphPlatformUrl && !!data.langSmithApiKey || isLocalhost(data.langGraphPlatformUrl || "");
367
366
  }
368
367
  return true;
369
368
  },
@@ -373,49 +372,42 @@ var ConfigSchema = z.object({
373
372
  }
374
373
  );
375
374
  var ConfigFlags = {
376
- mcp: Flags.string({ description: "Scaffold a CopilotKit project with MCP" }),
377
- copilotKitVersion: Flags.string({ description: "CopilotKit version to use (e.g. 1.7.0)" }),
378
- agentFramework: Flags.string({ description: "Agent framework to power your copilot", options: AGENT_FRAMEWORKS }),
379
- fastApiEnabled: Flags.string({ description: "Use FastAPI to serve your agent locally", options: YES_NO }),
380
- useCopilotCloud: Flags.string({ description: "Use Copilot Cloud for production-ready hosting", options: YES_NO }),
381
- chatUi: Flags.string({ description: "Chat UI component to add to your app", options: CHAT_COMPONENTS }),
382
- langGraphAgent: Flags.string({ description: "LangGraph agent template to use", options: LANGGRAPH_AGENTS }),
383
- crewType: Flags.string({ description: "CrewAI implementation type", options: CREW_TYPES }),
384
- crewName: Flags.string({ description: "Name for your CrewAI agent" }),
385
- crewUrl: Flags.string({ description: "URL endpoint for your CrewAI agent" }),
386
- crewBearerToken: Flags.string({ description: "Bearer token for CrewAI authentication" }),
387
- langSmithApiKey: Flags.string({ description: "LangSmith API key for LangGraph observability" }),
388
- llmToken: Flags.string({ description: "API key for your preferred LLM provider" }),
389
- crewFlowAgent: Flags.string({ description: "CrewAI Flow template to use", options: CREW_FLOW_TEMPLATES })
375
+ booth: Flags.boolean({ description: "Use CopilotKit in booth mode", default: false, char: "b" }),
376
+ mode: Flags.string({ description: "How you will be interacting with AI", options: MODES, char: "m" }),
377
+ "copilotkit-version": Flags.string({ description: "CopilotKit version to use (e.g. 1.7.0)" }),
378
+ "use-copilot-cloud": Flags.string({ description: "Use Copilot Cloud for production-ready hosting", options: YES_NO }),
379
+ "langgraph-agent": Flags.string({ description: "LangGraph agent template to use", options: LANGGRAPH_AGENTS }),
380
+ "crew-type": Flags.string({ description: "CrewAI implementation type", options: CREW_TYPES }),
381
+ "crew-name": Flags.string({ description: "Name for your CrewAI agent" }),
382
+ "crew-url": Flags.string({ description: "URL endpoint for your CrewAI agent" }),
383
+ "crew-bearer-token": Flags.string({ description: "Bearer token for CrewAI authentication" }),
384
+ "langsmith-api-key": Flags.string({ description: "LangSmith API key for LangGraph observability" }),
385
+ "llm-token": Flags.string({ description: "API key for your preferred LLM provider" }),
386
+ "crew-flow-agent": Flags.string({ description: "CrewAI Flow template to use", options: CREW_FLOW_TEMPLATES })
390
387
  };
391
388
 
392
389
  // src/lib/init/types/templates.ts
393
390
  var BASE_URL = "https://registry.copilotkit.ai/r";
394
391
  var templateMapping = {
395
392
  // Runtimes
396
- "RemoteEndpoint": `${BASE_URL}/remote-endpoint-starter.json`,
397
- "LangGraphPlatformRuntime": `${BASE_URL}/langgraph-platform-starter.json`,
393
+ RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,
394
+ LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,
398
395
  // CrewAI
399
- "CrewEnterprise": [
400
- `${BASE_URL}/coagents-crew-starter.json`
401
- ],
402
- "CrewFlowsStarter": [
396
+ CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],
397
+ CrewFlowsStarter: [
403
398
  `${BASE_URL}/coagents-starter-ui.json`,
404
399
  `${BASE_URL}/agent-layout.json`,
405
400
  `${BASE_URL}/remote-endpoint.json`
406
401
  ],
407
402
  // LangGraph
408
- "LangGraphGeneric": `${BASE_URL}/generic-lg-starter.json`,
409
- "LangGraphStarter": [
410
- `${BASE_URL}/langgraph-platform-starter.json`,
411
- `${BASE_URL}/coagents-starter-ui.json`
412
- ],
403
+ LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,
404
+ LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],
413
405
  // No Agent
414
- "StandardStarter": `${BASE_URL}/standard-starter.json`,
415
- "StandardRuntime": `${BASE_URL}/standard-runtime.json`,
406
+ StandardStarter: `${BASE_URL}/standard-starter.json`,
407
+ StandardRuntime: `${BASE_URL}/standard-runtime.json`,
416
408
  // MCP
417
- "McpStarter": `${BASE_URL}/mcp-starter.json`,
418
- "McpRuntime": `${BASE_URL}/mcp-starter-runtime.json`
409
+ McpStarter: `${BASE_URL}/mcp-starter.json`,
410
+ McpRuntime: `${BASE_URL}/mcp-starter-runtime.json`
419
411
  };
420
412
 
421
413
  // src/lib/init/questions.ts
@@ -436,15 +428,15 @@ var questions = [
436
428
  // Core setup questions - always shown first
437
429
  {
438
430
  type: "select",
439
- name: "agentFramework",
440
- message: "\u{1F916} Choose your AI framework:",
441
- choices: Array.from(AGENT_FRAMEWORKS),
431
+ name: "mode",
432
+ message: "\u{1F916} How will you be interacting with AI?",
433
+ choices: Array.from(MODES),
442
434
  validate: (input) => {
443
435
  try {
444
- AgentFrameworkSchema.parse(input);
436
+ ModeSchema.parse(input);
445
437
  return true;
446
438
  } catch (error) {
447
- return "Please select a valid framework";
439
+ return "Please select a valid mode";
448
440
  }
449
441
  }
450
442
  },
@@ -454,7 +446,7 @@ var questions = [
454
446
  name: "crewType",
455
447
  message: "\u{1F465} What kind of CrewAI implementation would you like to use?",
456
448
  choices: Array.from(CREW_TYPES),
457
- when: (answers) => answers.agentFramework === "CrewAI",
449
+ when: (answers) => answers.mode === "CrewAI",
458
450
  validate: (input) => {
459
451
  try {
460
452
  CrewTypeSchema.parse(input);
@@ -469,7 +461,7 @@ var questions = [
469
461
  type: "input",
470
462
  name: "crewName",
471
463
  message: "\u{1F465} What would you like to name your crew? (can be anything)",
472
- when: (answers) => answers.agentFramework === "CrewAI" && answers.crewType === "Crews",
464
+ when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
473
465
  default: "MyCopilotCrew",
474
466
  validate: validateRequired,
475
467
  sanitize: sanitizers.trim
@@ -478,7 +470,7 @@ var questions = [
478
470
  type: "input",
479
471
  name: "crewUrl",
480
472
  message: "\u{1F517} Enter your Crew's Enterprise URL (more info at https://app.crewai.com):",
481
- when: (answers) => answers.agentFramework === "CrewAI" && answers.crewType === "Crews",
473
+ when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
482
474
  validate: validateUrl,
483
475
  sanitize: sanitizers.url
484
476
  },
@@ -486,7 +478,7 @@ var questions = [
486
478
  type: "input",
487
479
  name: "crewBearerToken",
488
480
  message: "\u{1F511} Enter your Crew's bearer token:",
489
- when: (answers) => answers.agentFramework === "CrewAI" && answers.crewType === "Crews",
481
+ when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
490
482
  sensitive: true,
491
483
  validate: validateRequired,
492
484
  sanitize: sanitizers.trim
@@ -497,14 +489,14 @@ var questions = [
497
489
  name: "crewFlowAgent",
498
490
  message: "\u{1F4E6} Choose a CrewAI Flow Template",
499
491
  choices: Array.from(CREW_FLOW_TEMPLATES),
500
- when: (answers) => answers.agentFramework === "CrewAI" && answers.crewType === "Flows"
492
+ when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Flows"
501
493
  },
502
494
  // LangGraph specific questions - shown when LangGraph selected
503
495
  {
504
496
  type: "yes/no",
505
497
  name: "alreadyDeployed",
506
498
  message: "\u{1F99C}\u{1F517} Do you have an existing LangGraph agent?",
507
- when: (answers) => answers.agentFramework === "LangGraph",
499
+ when: (answers) => answers.mode === "LangGraph",
508
500
  validate: (input) => {
509
501
  try {
510
502
  YesNoSchema.parse(input);
@@ -518,7 +510,7 @@ var questions = [
518
510
  type: "yes/no",
519
511
  name: "langGraphPlatform",
520
512
  message: "\u{1F99C}\u{1F517} Do you already have a LangGraph Agent URL? (remote or localhost)",
521
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "Yes",
513
+ when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "Yes",
522
514
  validate: (input) => {
523
515
  try {
524
516
  YesNoSchema.parse(input);
@@ -532,33 +524,22 @@ var questions = [
532
524
  type: "input",
533
525
  name: "langGraphPlatformUrl",
534
526
  message: "\u{1F99C}\u{1F517} Enter your LangGraph Agent URL (remote or localhost)",
535
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "Yes" && answers.langGraphPlatform === "Yes",
527
+ when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "Yes" && answers.langGraphPlatform === "Yes",
536
528
  validate: validateUrl,
537
529
  sanitize: sanitizers.url
538
530
  },
539
- // {
540
- // type: 'input',
541
- // name: 'langGraphRemoteEndpointURL',
542
- // message: '🔌 Enter your LangGraph endpoint URL:',
543
- // when: (answers) =>
544
- // answers.agentFramework === 'LangGraph' &&
545
- // answers.alreadyDeployed === 'Yes' &&
546
- // answers.langGraphPlatform === 'No',
547
- // validate: validateUrl,
548
- // sanitize: sanitizers.url
549
- // },
550
531
  {
551
532
  type: "select",
552
533
  name: "langGraphAgent",
553
534
  message: "\u{1F4E6} Choose a LangGraph starter template:",
554
535
  choices: Array.from(LANGGRAPH_AGENTS),
555
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "No"
536
+ when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No"
556
537
  },
557
538
  {
558
539
  type: "input",
559
540
  name: "langSmithApiKey",
560
541
  message: "\u{1F99C}\u{1F517} Enter your LangSmith API key (required by LangGraph Platform) :",
561
- when: (answers) => answers.agentFramework === "LangGraph" && answers.langGraphPlatform === "Yes",
542
+ when: (answers) => answers.mode === "LangGraph" && answers.langGraphPlatform === "Yes" && !(answers.langGraphPlatformUrl && isLocalhost(answers.langGraphPlatformUrl)),
562
543
  sensitive: true,
563
544
  validate: validateRequired,
564
545
  sanitize: sanitizers.apiKey
@@ -568,8 +549,8 @@ var questions = [
568
549
  type: "yes/no",
569
550
  name: "useCopilotCloud",
570
551
  message: "\u{1FA81} Deploy with Copilot Cloud? (recommended for production)",
571
- when: (answers) => answers.agentFramework === "None" || answers.agentFramework === "MCP" || answers.agentFramework !== "CrewAI" && // Crews only cloud, flows are self-hosted
572
- answers.alreadyDeployed === "Yes" && answers.langGraphPlatform !== "No",
552
+ when: (answers) => answers.mode === "Standard" || answers.mode === "MCP" || answers.mode !== "CrewAI" && // Crews only cloud, flows are self-hosted
553
+ answers.alreadyDeployed === "Yes" && answers.langGraphPlatform !== "No" && !isLocalhost(answers.langGraphPlatformUrl || ""),
573
554
  validate: (input) => {
574
555
  try {
575
556
  YesNoSchema.parse(input);
@@ -579,21 +560,11 @@ var questions = [
579
560
  }
580
561
  }
581
562
  },
582
- // {
583
- // type: 'yes/no',
584
- // name: 'fastApiEnabled',
585
- // message: '⚡ Set up a FastAPI server for local development?',
586
- // when: (answers) =>
587
- // answers.agentFramework === 'LangGraph' &&
588
- // answers.alreadyDeployed === 'No' &&
589
- // answers.langGraphAgent === 'Python Starter' &&
590
- // answers.useCopilotCloud !== 'Yes',
591
- // },
592
563
  {
593
564
  type: "input",
594
565
  name: "llmToken",
595
566
  message: "\u{1F511} Enter your OpenAI API key (required for LLM interfacing):",
596
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "No" || answers.agentFramework === "CrewAI" && answers.crewType === "Flows" || answers.agentFramework === "None" && answers.useCopilotCloud !== "Yes" || answers.agentFramework === "MCP" && answers.useCopilotCloud !== "Yes",
567
+ when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No" || answers.mode === "CrewAI" && answers.crewType === "Flows" || answers.mode === "Standard" && answers.useCopilotCloud !== "Yes" || answers.mode === "MCP" && answers.useCopilotCloud !== "Yes",
597
568
  sensitive: true,
598
569
  validate: validateRequired,
599
570
  sanitize: sanitizers.apiKey
@@ -602,12 +573,12 @@ var questions = [
602
573
 
603
574
  // src/lib/init/scaffold/shadcn.ts
604
575
  import spawn from "cross-spawn";
605
- async function scaffoldShadCN(userAnswers) {
576
+ async function scaffoldShadCN(flags, userAnswers) {
606
577
  try {
607
578
  const components = [];
608
- switch (userAnswers.agentFramework) {
579
+ switch (userAnswers.mode) {
609
580
  case "LangGraph":
610
- if (userAnswers.langGraphAgent) {
581
+ if (userAnswers.langGraphAgent || flags.booth) {
611
582
  components.push(...templateMapping.LangGraphStarter);
612
583
  } else {
613
584
  components.push(templateMapping.LangGraphGeneric);
@@ -635,7 +606,7 @@ async function scaffoldShadCN(userAnswers) {
635
606
  components.push(templateMapping.McpRuntime);
636
607
  }
637
608
  break;
638
- case "None":
609
+ case "Standard":
639
610
  components.push(templateMapping.StandardStarter);
640
611
  if (userAnswers.useCopilotCloud !== "Yes") {
641
612
  components.push(templateMapping.StandardRuntime);
@@ -669,20 +640,17 @@ import fs from "fs";
669
640
  // src/lib/init/scaffold/langgraph-assistants.ts
670
641
  async function getLangGraphAgents(url, langSmithApiKey) {
671
642
  try {
672
- const response = await fetch(
673
- `${url.trim().replace(/\/$/, "")}/assistants/search`,
674
- {
675
- method: "POST",
676
- headers: {
677
- "Content-Type": "application/json",
678
- "X-Api-Key": langSmithApiKey
679
- },
680
- body: JSON.stringify({
681
- limit: 10,
682
- offset: 0
683
- })
684
- }
685
- );
643
+ const response = await fetch(`${url.trim().replace(/\/$/, "")}/assistants/search`, {
644
+ method: "POST",
645
+ headers: {
646
+ "Content-Type": "application/json",
647
+ "X-Api-Key": langSmithApiKey
648
+ },
649
+ body: JSON.stringify({
650
+ limit: 10,
651
+ offset: 0
652
+ })
653
+ });
686
654
  return await response.json();
687
655
  } catch (error) {
688
656
  throw new Error(`Failed to get LangGraph agents: ${error}`);
@@ -862,7 +830,7 @@ import chalk5 from "chalk";
862
830
  import path3 from "path";
863
831
  import fs3 from "fs";
864
832
  async function scaffoldAgent(userAnswers) {
865
- if (userAnswers.agentFramework === "CrewAI" && userAnswers.crewType === "Crews" || userAnswers.agentFramework === "LangGraph" && !userAnswers.langGraphAgent || userAnswers.agentFramework === "None" || userAnswers.agentFramework === "MCP") {
833
+ if (userAnswers.mode === "CrewAI" && userAnswers.crewType === "Crews" || userAnswers.mode === "LangGraph" && !userAnswers.langGraphAgent || userAnswers.mode === "Standard" || userAnswers.mode === "MCP") {
866
834
  return;
867
835
  }
868
836
  const spinner = ora3({
@@ -870,7 +838,7 @@ async function scaffoldAgent(userAnswers) {
870
838
  color: "cyan"
871
839
  }).start();
872
840
  let template = "";
873
- switch (userAnswers.agentFramework) {
841
+ switch (userAnswers.mode) {
874
842
  case "LangGraph":
875
843
  if (userAnswers.langGraphAgent === "Python Starter") {
876
844
  template = AgentTemplates.LangGraph.Starter.Python;
@@ -890,18 +858,14 @@ async function scaffoldAgent(userAnswers) {
890
858
  }
891
859
  const agentDir = path3.join(process.cwd(), "agent");
892
860
  try {
893
- await cloneGitHubSubdirectory(
894
- template,
895
- agentDir,
896
- spinner
897
- );
861
+ await cloneGitHubSubdirectory(template, agentDir, spinner);
898
862
  spinner.text = chalk5.cyan("Creating agent environment variables...");
899
863
  let envContent = "";
900
864
  if (userAnswers.llmToken) {
901
865
  envContent += `OPENAI_API_KEY=${userAnswers.llmToken}
902
866
  `;
903
867
  }
904
- if (userAnswers.agentFramework === "LangGraph" && userAnswers.langSmithApiKey) {
868
+ if (userAnswers.mode === "LangGraph" && userAnswers.langSmithApiKey) {
905
869
  envContent += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}
906
870
  `;
907
871
  }
@@ -910,11 +874,25 @@ async function scaffoldAgent(userAnswers) {
910
874
  fs3.writeFileSync(agentEnvFile, envContent, "utf8");
911
875
  spinner.text = chalk5.cyan("Added API keys to agent .env file");
912
876
  }
877
+ if (userAnswers.mode === "LangGraph" && userAnswers.langSmithApiKey) {
878
+ envContent += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}
879
+ `;
880
+ }
881
+ if (envContent) {
882
+ const agentEnvFile = path3.join(agentDir, ".env");
883
+ fs3.writeFileSync(agentEnvFile, envContent, "utf8");
884
+ spinner.text = chalk5.cyan("Added API keys to agent .env file");
885
+ }
886
+ if (envContent) {
887
+ const agentEnvFile = path3.join(agentDir, ".env");
888
+ fs3.writeFileSync(agentEnvFile, envContent, "utf8");
889
+ spinner.text = chalk5.cyan("Added API keys to agent .env file");
890
+ }
913
891
  } catch (error) {
914
892
  spinner.fail(chalk5.red("Failed to clone agent template"));
915
893
  throw error;
916
894
  }
917
- spinner.succeed(`${userAnswers.agentFramework} agent cloned successfully`);
895
+ spinner.succeed(`${userAnswers.mode} agent cloned successfully`);
918
896
  }
919
897
  var AgentTemplates = {
920
898
  LangGraph: {
@@ -983,9 +961,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
983
961
  }
984
962
  trpcClient = null;
985
963
  static description = "Set up CopilotKit in your Next.js project";
986
- static examples = [
987
- "<%= config.bin %> init"
988
- ];
964
+ static examples = ["<%= config.bin %> init"];
989
965
  static flags = {
990
966
  ...BaseCommand.flags,
991
967
  ...ConfigFlags,
@@ -997,29 +973,68 @@ var CloudInit = class _CloudInit extends BaseCommand {
997
973
  const { flags } = await this.parse(_CloudInit);
998
974
  try {
999
975
  this.log(chalk6.magenta("\n\u{1FA81} Welcome to CopilotKit"));
1000
- this.log(chalk6.gray("Let's power up your Next.js project with AI capabilities\n"));
976
+ if (flags.booth) {
977
+ this.log(chalk6.gray("Thanks for giving CopilotKit a try! Now, let's try to impress you \u{1F4AA}\n"));
978
+ } else {
979
+ this.log(chalk6.gray("Let's power up your Next.js project with AI capabilities\n"));
980
+ }
1001
981
  this.validateProjectCompatibility(flags);
1002
- const userAnswers = await this.getUserAnswers(flags);
1003
- const needsCloudSetup = userAnswers.useCopilotCloud === "Yes" || userAnswers.agentFramework === "CrewAI" && userAnswers.crewType === "Crews";
982
+ let userAnswers;
983
+ if (flags.booth) {
984
+ userAnswers = await this.getBoothAnswers();
985
+ } else {
986
+ userAnswers = await this.getUserAnswers(flags);
987
+ }
988
+ const needsCloudSetup = userAnswers.useCopilotCloud === "Yes" || userAnswers.mode === "CrewAI" && userAnswers.crewType === "Crews";
1004
989
  if (needsCloudSetup) await this.setupCloud(flags, userAnswers);
1005
990
  await scaffoldEnv(flags, userAnswers);
1006
- await scaffoldShadCN(userAnswers);
1007
- await scaffoldAgent(userAnswers);
991
+ await scaffoldShadCN(flags, userAnswers);
992
+ if (!flags.booth) await scaffoldAgent(userAnswers);
1008
993
  if (userAnswers.crewType === "Crews" && userAnswers.crewUrl && userAnswers.crewBearerToken)
1009
994
  await addCrewInputs(userAnswers.crewUrl, userAnswers.crewBearerToken);
1010
- this.finalSummary(userAnswers);
995
+ if (flags.booth) {
996
+ this.log("\n-----\n");
997
+ this.log(chalk6.magenta("\u{1F389} Your CopilotKit setup is complete! \u{1F389}\n"));
998
+ this.log(chalk6.bold("\n\u{1F680} Next steps:"));
999
+ this.log(` - Start the Next.js app: ${chalk6.gray("$")} ${chalk6.cyan("npm run dev")}`);
1000
+ this.log(` - Navigate to ${chalk6.blue("http://localhost:3000/copilotkit")}`);
1001
+ this.log(` - Talk to your agent.`);
1002
+ this.log(chalk6.magenta("\nThanks for giving CopilotKit a try! \u{1FA81}\n"));
1003
+ } else {
1004
+ this.finalSummary(userAnswers);
1005
+ }
1011
1006
  } catch (error) {
1012
1007
  this.gracefulError(error.message);
1013
1008
  }
1014
1009
  }
1010
+ async getBoothAnswers() {
1011
+ const url = await inquirer3.prompt({
1012
+ type: "input",
1013
+ message: "\u{1F99C}\u{1F517} What is the LangGraph's agent URL?",
1014
+ name: "agentURL",
1015
+ validate: (value) => {
1016
+ if (!value) return "You need a URL to continue, it should be present on the screen. If you need help, feel free to ask!";
1017
+ if (!value.includes("http") || !value.includes("://")) return "Please provide a valid URL";
1018
+ return true;
1019
+ }
1020
+ });
1021
+ return {
1022
+ mode: "LangGraph",
1023
+ langGraphPlatformUrl: url.agentURL,
1024
+ useCopilotCloud: "No",
1025
+ alreadyDeployed: "Yes",
1026
+ langGraphPlatform: "Yes"
1027
+ };
1028
+ }
1015
1029
  async getUserAnswers(flags) {
1016
1030
  const initialAnswers = {};
1017
1031
  Object.keys(flags).forEach((flagName) => {
1018
1032
  if (flagName in ConfigFlags && flags[flagName] !== void 0) {
1033
+ const camelCaseFlagName = flagName.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
1019
1034
  if (YES_NO.includes(flags[flagName])) {
1020
- initialAnswers[flagName] = flags[flagName];
1035
+ initialAnswers[camelCaseFlagName] = flags[flagName];
1021
1036
  } else if (flags[flagName]) {
1022
- initialAnswers[flagName] = flags[flagName];
1037
+ initialAnswers[camelCaseFlagName] = flags[flagName];
1023
1038
  }
1024
1039
  }
1025
1040
  });
@@ -1071,7 +1086,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
1071
1086
  const promptAnswers = await inquirer3.prompt(inquirerQuestions);
1072
1087
  const answers = { ...initialAnswers, ...promptAnswers };
1073
1088
  if (answers.langGraphPlatform === "No") {
1074
- this.log("\nCurrently the CLI only supports scaffolding LangGraph Platform agents. Use our quickstart guide to get started:\n");
1089
+ this.log(
1090
+ "\nCurrently the CLI only supports scaffolding LangGraph Platform agents. Use our quickstart guide to get started:\n"
1091
+ );
1075
1092
  this.log(chalk6.blue("https://docs.copilotkit.ai/coagents/quickstart/langgraph"));
1076
1093
  process.exit(0);
1077
1094
  }
@@ -1083,9 +1100,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
1083
1100
  } catch (error) {
1084
1101
  const spinner = ora5({ text: "Validation failed...", color: "red" }).start();
1085
1102
  if (error.errors) {
1086
- const formattedErrors = error.errors.map(
1087
- (err) => `- ${err.path.join(".")}: ${err.message}`
1088
- ).join("\n");
1103
+ const formattedErrors = error.errors.map((err) => `- ${err.path.join(".")}: ${err.message}`).join("\n");
1089
1104
  spinner.fail(chalk6.red("Configuration validation failed:"));
1090
1105
  console.error(chalk6.red(formattedErrors));
1091
1106
  process.exit(1);
@@ -1121,7 +1136,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
1121
1136
  ]);
1122
1137
  selectedProjectId = projectId;
1123
1138
  }
1124
- const copilotCloudPublicApiKey = await this.trpcClient.getCopilotCloudPublicApiKey.query({ projectId: selectedProjectId });
1139
+ const copilotCloudPublicApiKey = await this.trpcClient.getCopilotCloudPublicApiKey.query({
1140
+ projectId: selectedProjectId
1141
+ });
1125
1142
  try {
1126
1143
  const sanitizedConfig = {
1127
1144
  ...userAnswers,
@@ -1163,7 +1180,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
1163
1180
  process.exit(1);
1164
1181
  }
1165
1182
  }
1166
- if (userAnswers.agentFramework === "LangGraph" && userAnswers.useCopilotCloud === "Yes" && userAnswers.alreadyDeployed === "Yes") {
1183
+ if (userAnswers.mode === "LangGraph" && userAnswers.useCopilotCloud === "Yes" && userAnswers.alreadyDeployed === "Yes") {
1167
1184
  const langGraphSpinner = ora5({
1168
1185
  text: chalk6("\u{1F99C}\u{1F517} Adding LangGraph to Copilot Cloud..."),
1169
1186
  color: "cyan"
@@ -1224,7 +1241,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
1224
1241
  const packageJson = JSON.parse(fs5.readFileSync(packageJsonPath, "utf8"));
1225
1242
  if (!packageJson.dependencies?.next && !packageJson.devDependencies?.next) {
1226
1243
  spinner.fail(`Not a Next.js project`);
1227
- throw new Error(`Directory ${projectPath} does not appear to be a Next.js project. Make sure it has next in dependencies.`);
1244
+ throw new Error(
1245
+ `Directory ${projectPath} does not appear to be a Next.js project. Make sure it has next in dependencies.`
1246
+ );
1228
1247
  }
1229
1248
  spinner.succeed(`\u{1F53C} Valid Next.js project detected at ${projectPath}`);
1230
1249
  return true;
@@ -1241,7 +1260,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
1241
1260
  let agentDevInstructions = "";
1242
1261
  let agentType = "";
1243
1262
  let agentSetupMessage = "";
1244
- if (userAnswers.agentFramework === "CrewAI") {
1263
+ if (userAnswers.mode === "CrewAI") {
1245
1264
  agentType = "CrewAI";
1246
1265
  if (userAnswers.crewType === "Crews") {
1247
1266
  agentSetupMessage = `Using your Crew from ${chalk6.cyan(userAnswers.crewUrl || "the provided URL")}.`;
@@ -1249,7 +1268,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
1249
1268
  agentSetupMessage = `We've scaffolded a ${chalk6.cyan(userAnswers.crewFlowAgent || "CrewAI")} agent in the ${chalk6.cyan("./agent")} directory.`;
1250
1269
  }
1251
1270
  }
1252
- switch (userAnswers.agentFramework) {
1271
+ switch (userAnswers.mode) {
1253
1272
  case "LangGraph":
1254
1273
  switch (userAnswers.langGraphAgent) {
1255
1274
  case "Python Starter":
@@ -1284,7 +1303,8 @@ var CloudInit = class _CloudInit extends BaseCommand {
1284
1303
  if (userAnswers.useCopilotCloud || userAnswers.crewType === "Crews") this.log(` - With Copilot Cloud.`);
1285
1304
  this.log(chalk6.bold("\n\u{1F680} Next steps:"));
1286
1305
  this.log(` - Start your Next.js app: ${chalk6.gray("$")} ${chalk6.cyan("npm run dev")}`);
1287
- if (agentDevInstructions) this.log(` - Start your agent: ${chalk6.gray("$")} ${chalk6.cyan(`cd agent && ${agentDevInstructions}`)}`);
1306
+ if (agentDevInstructions)
1307
+ this.log(` - Start your agent: ${chalk6.gray("$")} ${chalk6.cyan(`cd agent && ${agentDevInstructions}`)}`);
1288
1308
  this.log(` - Navigate to ${chalk6.blue("http://localhost:3000/copilotkit")}`);
1289
1309
  this.log(` - Talk to your agent.`);
1290
1310
  this.log(` - Read the docs: ${chalk6.blue("https://docs.copilotkit.ai")}`);