copilotkit 0.0.44 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/base-command.js +1 -1
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/dev.js +17 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/init.d.ts +6 -2
- package/dist/commands/init.js +375 -299
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.js +17 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +17 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/lib/init/index.d.ts +2 -2
- package/dist/lib/init/index.js +232 -198
- package/dist/lib/init/index.js.map +1 -1
- package/dist/lib/init/questions.d.ts +3 -1
- package/dist/lib/init/questions.js +211 -183
- package/dist/lib/init/questions.js.map +1 -1
- package/dist/lib/init/scaffold/env.js +13 -3
- package/dist/lib/init/scaffold/env.js.map +1 -1
- package/dist/lib/init/scaffold/index.js +33 -24
- package/dist/lib/init/scaffold/index.js.map +1 -1
- package/dist/lib/init/scaffold/shadcn.js +20 -21
- package/dist/lib/init/scaffold/shadcn.js.map +1 -1
- package/dist/lib/init/types/index.d.ts +1 -1
- package/dist/lib/init/types/index.js +16 -9
- package/dist/lib/init/types/index.js.map +1 -1
- package/dist/lib/init/types/questions.d.ts +11 -9
- package/dist/lib/init/types/questions.js +14 -7
- package/dist/lib/init/types/questions.js.map +1 -1
- package/dist/lib/init/types/templates.js +2 -2
- package/dist/lib/init/types/templates.js.map +1 -1
- package/dist/services/analytics.service.d.ts +4 -0
- package/dist/services/analytics.service.js +16 -0
- package/dist/services/analytics.service.js.map +1 -1
- package/dist/services/auth.service.js +16 -0
- package/dist/services/auth.service.js.map +1 -1
- package/dist/services/events.d.ts +23 -15
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/utils/version.js.map +1 -1
- package/oclif.manifest.json +12 -12
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -138,6 +138,22 @@ var AnalyticsService = class {
|
|
|
138
138
|
return false;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Get feature flag payload
|
|
143
|
+
*/
|
|
144
|
+
async getFeatureFlagPayload(flagKey) {
|
|
145
|
+
if (!this.posthog) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
const distinctId = this.userId || this.getAnonymousId();
|
|
150
|
+
const payload = await this.posthog.getFeatureFlagPayload(flagKey, distinctId);
|
|
151
|
+
return payload;
|
|
152
|
+
} catch (error) {
|
|
153
|
+
console.warn(`Failed to get feature flag payload ${flagKey}:`, error);
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
141
157
|
/**
|
|
142
158
|
* Shutdown analytics services
|
|
143
159
|
*/
|
|
@@ -262,7 +278,7 @@ import { Command } from "@oclif/core";
|
|
|
262
278
|
import Sentry, { consoleIntegration } from "@sentry/node";
|
|
263
279
|
|
|
264
280
|
// src/utils/version.ts
|
|
265
|
-
var LIB_VERSION = "0.0.
|
|
281
|
+
var LIB_VERSION = "0.0.45";
|
|
266
282
|
|
|
267
283
|
// src/commands/base-command.ts
|
|
268
284
|
import chalk2 from "chalk";
|
|
@@ -326,6 +342,7 @@ var CHAT_COMPONENTS = ["CopilotChat", "CopilotSidebar", "Headless", "CopilotPopu
|
|
|
326
342
|
var LANGGRAPH_AGENTS = ["Python Starter", "TypeScript Starter"];
|
|
327
343
|
var CREW_FLOW_TEMPLATES = ["Starter"];
|
|
328
344
|
var YES_NO = ["Yes", "No"];
|
|
345
|
+
var DEPLOYMENT_CHOICES = ["Copilot Cloud", "Self-hosted"];
|
|
329
346
|
var sanitizers = {
|
|
330
347
|
// Remove trailing slash from URLs
|
|
331
348
|
url: (value) => {
|
|
@@ -354,6 +371,7 @@ var ChatComponentSchema = z.enum(CHAT_COMPONENTS);
|
|
|
354
371
|
var LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS);
|
|
355
372
|
var CrewFlowTemplateSchema = z.enum(CREW_FLOW_TEMPLATES);
|
|
356
373
|
var YesNoSchema = z.enum(YES_NO);
|
|
374
|
+
var DeploymentChoiceSchema = z.enum(DEPLOYMENT_CHOICES);
|
|
357
375
|
var UrlSchema = z.preprocess(
|
|
358
376
|
(val) => sanitizers.url(String(val)),
|
|
359
377
|
z.string().url("Please enter a valid URL").min(1, "URL is required")
|
|
@@ -366,8 +384,6 @@ var ApiKeySchema = z.preprocess(
|
|
|
366
384
|
var LLMApiKeySchema = z.preprocess((val) => sanitizers.apiKey(String(val)), z.string().optional());
|
|
367
385
|
var NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, "Name is required"));
|
|
368
386
|
var ConfigSchema = z.object({
|
|
369
|
-
// NEW: Early signup field
|
|
370
|
-
signupForCopilotCloud: YesNoSchema.optional(),
|
|
371
387
|
// Core fields
|
|
372
388
|
copilotKitVersion: z.string().optional(),
|
|
373
389
|
mode: ModeSchema,
|
|
@@ -375,6 +391,7 @@ var ConfigSchema = z.object({
|
|
|
375
391
|
// Yes/No fields
|
|
376
392
|
alreadyDeployed: YesNoSchema.optional(),
|
|
377
393
|
fastApiEnabled: YesNoSchema.optional(),
|
|
394
|
+
// DEPRECATED: useCopilotCloud - consolidated with signupForCopilotCloud
|
|
378
395
|
useCopilotCloud: YesNoSchema.optional(),
|
|
379
396
|
// LangGraph specific fields
|
|
380
397
|
langGraphAgent: LangGraphAgentSchema.optional(),
|
|
@@ -392,7 +409,10 @@ var ConfigSchema = z.object({
|
|
|
392
409
|
llmToken: LLMApiKeySchema.optional(),
|
|
393
410
|
// IDE Documentation setup fields
|
|
394
411
|
setupIDEDocs: YesNoSchema.optional(),
|
|
395
|
-
selectedIDE: z.union([z.enum(["cursor", "windsurf"]), z.literal("skip")]).optional()
|
|
412
|
+
selectedIDE: z.union([z.enum(["cursor", "windsurf"]), z.literal("skip")]).optional(),
|
|
413
|
+
// NEW: A/B/C test fields
|
|
414
|
+
deploymentChoice: DeploymentChoiceSchema.optional()
|
|
415
|
+
// For branch B only (Cloud vs Self-hosted)
|
|
396
416
|
}).refine(
|
|
397
417
|
(data) => {
|
|
398
418
|
if (data.mode === "CrewAI") {
|
|
@@ -418,10 +438,6 @@ var ConfigSchema = z.object({
|
|
|
418
438
|
);
|
|
419
439
|
var ConfigFlags = {
|
|
420
440
|
booth: Flags.boolean({ description: "Use CopilotKit in booth mode", default: false, char: "b" }),
|
|
421
|
-
"signup-for-copilot-cloud": Flags.string({
|
|
422
|
-
description: "Sign up for Copilot Cloud for error tracking and debugging insights",
|
|
423
|
-
options: YES_NO
|
|
424
|
-
}),
|
|
425
441
|
mode: Flags.string({ description: "How you will be interacting with AI", options: MODES, char: "m" }),
|
|
426
442
|
"copilotkit-version": Flags.string({ description: "CopilotKit version to use (e.g. 1.7.0)" }),
|
|
427
443
|
"use-copilot-cloud": Flags.string({ description: "Use Copilot Cloud for production-ready hosting", options: YES_NO }),
|
|
@@ -436,6 +452,11 @@ var ConfigFlags = {
|
|
|
436
452
|
"selected-ide": Flags.string({
|
|
437
453
|
description: "IDE to configure with documentation rules",
|
|
438
454
|
options: ["cursor", "windsurf", "skip"]
|
|
455
|
+
}),
|
|
456
|
+
// NEW: A/B/C test flags
|
|
457
|
+
"deployment-choice": Flags.string({
|
|
458
|
+
description: "Choose between Copilot Cloud or Self-hosted deployment",
|
|
459
|
+
options: DEPLOYMENT_CHOICES
|
|
439
460
|
})
|
|
440
461
|
};
|
|
441
462
|
|
|
@@ -443,8 +464,8 @@ var ConfigFlags = {
|
|
|
443
464
|
var BASE_URL = "https://registry.copilotkit.ai/r";
|
|
444
465
|
var templateMapping = {
|
|
445
466
|
// Runtimes
|
|
446
|
-
RemoteEndpoint: `${BASE_URL}/remote-endpoint
|
|
447
|
-
LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-
|
|
467
|
+
RemoteEndpoint: `${BASE_URL}/remote-endpoint.json`,
|
|
468
|
+
LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-runtime.json`,
|
|
448
469
|
// CrewAI
|
|
449
470
|
CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],
|
|
450
471
|
CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],
|
|
@@ -624,190 +645,212 @@ var validateUrl = (input) => {
|
|
|
624
645
|
var validateRequired = (input) => {
|
|
625
646
|
return sanitizers.trim(input) ? true : "This field is required";
|
|
626
647
|
};
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
{
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
648
|
+
function getQuestionsForBranch(branch) {
|
|
649
|
+
const baseQuestions = getBaseQuestions();
|
|
650
|
+
switch (branch) {
|
|
651
|
+
case "A":
|
|
652
|
+
return [...baseQuestions];
|
|
653
|
+
case "B":
|
|
654
|
+
return [...baseQuestions, ...getDeploymentChoiceQuestions()];
|
|
655
|
+
case "C":
|
|
656
|
+
default:
|
|
657
|
+
return [...baseQuestions, ...getCloudDeploymentQuestions()];
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function getBaseQuestions() {
|
|
661
|
+
return [
|
|
662
|
+
{
|
|
663
|
+
type: "select",
|
|
664
|
+
name: "mode",
|
|
665
|
+
message: "\u{1F916} How will you be interacting with AI?",
|
|
666
|
+
choices: Array.from(MODES),
|
|
667
|
+
validate: (input) => {
|
|
668
|
+
try {
|
|
669
|
+
ModeSchema.parse(input);
|
|
670
|
+
return true;
|
|
671
|
+
} catch (error) {
|
|
672
|
+
return "Please select a valid mode";
|
|
673
|
+
}
|
|
639
674
|
}
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
675
|
+
},
|
|
676
|
+
// CrewAI specific questions
|
|
677
|
+
{
|
|
678
|
+
type: "select",
|
|
679
|
+
name: "crewType",
|
|
680
|
+
message: "\u{1F465} What kind of CrewAI implementation would you like to use?",
|
|
681
|
+
choices: Array.from(CREW_TYPES),
|
|
682
|
+
when: (answers) => answers.mode === "CrewAI",
|
|
683
|
+
validate: (input) => {
|
|
684
|
+
try {
|
|
685
|
+
CrewTypeSchema.parse(input);
|
|
686
|
+
return true;
|
|
687
|
+
} catch (error) {
|
|
688
|
+
return "Please select a valid crew type";
|
|
689
|
+
}
|
|
654
690
|
}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
669
|
-
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
type: "input",
|
|
694
|
+
name: "crewName",
|
|
695
|
+
message: "\u{1F465} What would you like to name your crew? (can be anything)",
|
|
696
|
+
when: (answers) => answers.mode === "CrewAI",
|
|
697
|
+
default: "MyCopilotCrew",
|
|
698
|
+
validate: validateRequired,
|
|
699
|
+
sanitize: sanitizers.trim
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
type: "input",
|
|
703
|
+
name: "crewUrl",
|
|
704
|
+
message: "\u{1F517} Enter your Crew's Enterprise URL (more info at https://app.crewai.com):",
|
|
705
|
+
when: (answers) => answers.mode === "CrewAI",
|
|
706
|
+
validate: validateUrl,
|
|
707
|
+
sanitize: sanitizers.url
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
type: "input",
|
|
711
|
+
name: "crewBearerToken",
|
|
712
|
+
message: "\u{1F511} Enter your Crew's bearer token:",
|
|
713
|
+
when: (answers) => answers.mode === "CrewAI",
|
|
714
|
+
sensitive: true,
|
|
715
|
+
validate: validateRequired,
|
|
716
|
+
sanitize: sanitizers.trim
|
|
717
|
+
},
|
|
718
|
+
// LangGraph specific questions
|
|
719
|
+
{
|
|
720
|
+
type: "yes/no",
|
|
721
|
+
name: "alreadyDeployed",
|
|
722
|
+
message: "\u{1F99C}\u{1F517} Do you have an existing LangGraph agent?",
|
|
723
|
+
when: (answers) => answers.mode === "LangGraph",
|
|
724
|
+
validate: (input) => {
|
|
725
|
+
try {
|
|
726
|
+
YesNoSchema.parse(input);
|
|
727
|
+
return true;
|
|
728
|
+
} catch (error) {
|
|
729
|
+
return "Please select Yes or No";
|
|
730
|
+
}
|
|
670
731
|
}
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
type: "input",
|
|
685
|
-
name: "crewUrl",
|
|
686
|
-
message: "\u{1F517} Enter your Crew's Enterprise URL (more info at https://app.crewai.com):",
|
|
687
|
-
when: (answers) => answers.mode === "CrewAI",
|
|
688
|
-
validate: validateUrl,
|
|
689
|
-
sanitize: sanitizers.url
|
|
690
|
-
},
|
|
691
|
-
{
|
|
692
|
-
type: "input",
|
|
693
|
-
name: "crewBearerToken",
|
|
694
|
-
message: "\u{1F511} Enter your Crew's bearer token:",
|
|
695
|
-
when: (answers) => answers.mode === "CrewAI",
|
|
696
|
-
sensitive: true,
|
|
697
|
-
validate: validateRequired,
|
|
698
|
-
sanitize: sanitizers.trim
|
|
699
|
-
},
|
|
700
|
-
// LangGraph specific questions - shown when LangGraph selected
|
|
701
|
-
{
|
|
702
|
-
type: "yes/no",
|
|
703
|
-
name: "alreadyDeployed",
|
|
704
|
-
message: "\u{1F99C}\u{1F517} Do you have an existing LangGraph agent?",
|
|
705
|
-
when: (answers) => answers.mode === "LangGraph",
|
|
706
|
-
validate: (input) => {
|
|
707
|
-
try {
|
|
708
|
-
YesNoSchema.parse(input);
|
|
709
|
-
return true;
|
|
710
|
-
} catch (error) {
|
|
711
|
-
return "Please select Yes or No";
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
type: "yes/no",
|
|
735
|
+
name: "langGraphPlatform",
|
|
736
|
+
message: "\u{1F99C}\u{1F517} Do you already have a LangGraph Agent URL? (remote or localhost)",
|
|
737
|
+
when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "Yes",
|
|
738
|
+
validate: (input) => {
|
|
739
|
+
try {
|
|
740
|
+
YesNoSchema.parse(input);
|
|
741
|
+
return true;
|
|
742
|
+
} catch (error) {
|
|
743
|
+
return "Please select Yes or No";
|
|
744
|
+
}
|
|
712
745
|
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
type: "input",
|
|
749
|
+
name: "langGraphPlatformUrl",
|
|
750
|
+
message: "\u{1F99C}\u{1F517} Enter your LangGraph Agent URL (remote or localhost)",
|
|
751
|
+
when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "Yes" && answers.langGraphPlatform === "Yes",
|
|
752
|
+
validate: validateUrl,
|
|
753
|
+
sanitize: sanitizers.url
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
type: "select",
|
|
757
|
+
name: "langGraphAgent",
|
|
758
|
+
message: "\u{1F4E6} Choose a LangGraph starter template:",
|
|
759
|
+
choices: Array.from(LANGGRAPH_AGENTS),
|
|
760
|
+
when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No"
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
type: "input",
|
|
764
|
+
name: "langSmithApiKey",
|
|
765
|
+
message: "\u{1F99C}\u{1F517} Enter your LangSmith API key (required by LangGraph Platform) :",
|
|
766
|
+
when: (answers) => answers.mode === "LangGraph" && answers.langGraphPlatform === "Yes" && !(answers.langGraphPlatformUrl && isLocalhost(answers.langGraphPlatformUrl)),
|
|
767
|
+
sensitive: true,
|
|
768
|
+
validate: validateRequired,
|
|
769
|
+
sanitize: sanitizers.apiKey
|
|
770
|
+
},
|
|
771
|
+
// LLM Token for self-hosted setups
|
|
772
|
+
{
|
|
773
|
+
type: "input",
|
|
774
|
+
name: "llmToken",
|
|
775
|
+
message: "\u{1F511} Enter your OpenAI API key (optional - leave empty to configure your LLM later):",
|
|
776
|
+
when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No" || answers.mode === "Standard" && answers.deploymentChoice === "Self-hosted" || answers.mode === "MCP" && answers.deploymentChoice === "Self-hosted" || answers.mode === "Standard" && answers.useCopilotCloud !== "Yes" || answers.mode === "MCP" && answers.useCopilotCloud !== "Yes",
|
|
777
|
+
sensitive: true,
|
|
778
|
+
sanitize: sanitizers.apiKey
|
|
779
|
+
},
|
|
780
|
+
// IDE Documentation Setup Questions
|
|
781
|
+
{
|
|
782
|
+
type: "yes/no",
|
|
783
|
+
name: "setupIDEDocs",
|
|
784
|
+
message: "\u{1F4DA} Would you like to add CopilotKit documentation to your IDE? (Provides AI assistant with CopilotKit context)",
|
|
785
|
+
when: async () => {
|
|
786
|
+
const installedIDEs = await detectInstalledIDEs();
|
|
787
|
+
return installedIDEs.length > 0;
|
|
788
|
+
},
|
|
789
|
+
validate: (input) => {
|
|
790
|
+
try {
|
|
791
|
+
YesNoSchema.parse(input);
|
|
792
|
+
return true;
|
|
793
|
+
} catch (error) {
|
|
794
|
+
return "Please select Yes or No";
|
|
795
|
+
}
|
|
726
796
|
}
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
type: "select",
|
|
800
|
+
name: "selectedIDE",
|
|
801
|
+
message: "\u{1F4BB} Which IDE would you like to configure with CopilotKit documentation?",
|
|
802
|
+
choices: async () => {
|
|
803
|
+
const installedIDEs = await detectInstalledIDEs();
|
|
804
|
+
const choices = installedIDEs.map((ide) => ({
|
|
805
|
+
name: IDE_DOCS_CONFIGS[ide].displayName,
|
|
806
|
+
value: ide
|
|
807
|
+
}));
|
|
808
|
+
choices.push({ name: "Skip", value: "skip" });
|
|
809
|
+
return choices;
|
|
810
|
+
},
|
|
811
|
+
when: (answers) => answers.setupIDEDocs === "Yes"
|
|
727
812
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
{
|
|
745
|
-
type: "input",
|
|
746
|
-
name: "langSmithApiKey",
|
|
747
|
-
message: "\u{1F99C}\u{1F517} Enter your LangSmith API key (required by LangGraph Platform) :",
|
|
748
|
-
when: (answers) => answers.mode === "LangGraph" && answers.langGraphPlatform === "Yes" && !(answers.langGraphPlatformUrl && isLocalhost(answers.langGraphPlatformUrl)),
|
|
749
|
-
sensitive: true,
|
|
750
|
-
validate: validateRequired,
|
|
751
|
-
sanitize: sanitizers.apiKey
|
|
752
|
-
},
|
|
753
|
-
// Deployment options
|
|
754
|
-
{
|
|
755
|
-
type: "yes/no",
|
|
756
|
-
name: "useCopilotCloud",
|
|
757
|
-
message: "\u{1FA81} Deploy with Copilot Cloud? (recommended for production)",
|
|
758
|
-
when: (answers) => answers.mode === "Standard" || answers.mode === "MCP" || answers.mode !== "CrewAI" && // Crews only cloud, flows are self-hosted
|
|
759
|
-
answers.alreadyDeployed === "Yes" && answers.langGraphPlatform !== "No" && !linkToDocs.includes(answers.mode || "") && !isLocalhost(answers.langGraphPlatformUrl || ""),
|
|
760
|
-
validate: (input) => {
|
|
761
|
-
try {
|
|
762
|
-
YesNoSchema.parse(input);
|
|
763
|
-
return true;
|
|
764
|
-
} catch (error) {
|
|
765
|
-
return "Please select Yes or No";
|
|
813
|
+
];
|
|
814
|
+
}
|
|
815
|
+
function getDeploymentChoiceQuestions() {
|
|
816
|
+
return [
|
|
817
|
+
{
|
|
818
|
+
type: "select",
|
|
819
|
+
name: "deploymentChoice",
|
|
820
|
+
message: "\u{1F680} Use Copilot Cloud, or self-hosted?",
|
|
821
|
+
choices: Array.from(DEPLOYMENT_CHOICES),
|
|
822
|
+
validate: (input) => {
|
|
823
|
+
try {
|
|
824
|
+
DeploymentChoiceSchema.parse(input);
|
|
825
|
+
return true;
|
|
826
|
+
} catch (error) {
|
|
827
|
+
return "Please select a valid deployment option";
|
|
828
|
+
}
|
|
766
829
|
}
|
|
767
830
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
validate: (input) => {
|
|
787
|
-
try {
|
|
788
|
-
YesNoSchema.parse(input);
|
|
789
|
-
return true;
|
|
790
|
-
} catch (error) {
|
|
791
|
-
return "Please select Yes or No";
|
|
831
|
+
];
|
|
832
|
+
}
|
|
833
|
+
function getCloudDeploymentQuestions() {
|
|
834
|
+
return [
|
|
835
|
+
{
|
|
836
|
+
type: "yes/no",
|
|
837
|
+
name: "useCopilotCloud",
|
|
838
|
+
message: "\u{1FA81} Deploy with Copilot Cloud? (recommended for production)",
|
|
839
|
+
when: (answers) => answers.mode === "Standard" || answers.mode === "MCP" || answers.mode === "LangGraph" && answers.alreadyDeployed === "No" || // Include new LangGraph agents
|
|
840
|
+
answers.mode !== "CrewAI" && // Crews only cloud, flows are self-hosted
|
|
841
|
+
answers.alreadyDeployed === "Yes" && answers.langGraphPlatform !== "No" && !linkToDocs.includes(answers.mode || "") && !isLocalhost(answers.langGraphPlatformUrl || ""),
|
|
842
|
+
validate: (input) => {
|
|
843
|
+
try {
|
|
844
|
+
YesNoSchema.parse(input);
|
|
845
|
+
return true;
|
|
846
|
+
} catch (error) {
|
|
847
|
+
return "Please select Yes or No";
|
|
848
|
+
}
|
|
792
849
|
}
|
|
793
850
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
name: "selectedIDE",
|
|
798
|
-
message: "\u{1F4BB} Which IDE would you like to configure with CopilotKit documentation?",
|
|
799
|
-
choices: async () => {
|
|
800
|
-
const installedIDEs = await detectInstalledIDEs();
|
|
801
|
-
const choices = installedIDEs.map((ide) => ({
|
|
802
|
-
name: IDE_DOCS_CONFIGS[ide].displayName,
|
|
803
|
-
value: ide
|
|
804
|
-
}));
|
|
805
|
-
choices.push({ name: "Skip", value: "skip" });
|
|
806
|
-
return choices;
|
|
807
|
-
},
|
|
808
|
-
when: (answers) => answers.setupIDEDocs === "Yes"
|
|
809
|
-
}
|
|
810
|
-
];
|
|
851
|
+
];
|
|
852
|
+
}
|
|
853
|
+
var questions = getQuestionsForBranch("C");
|
|
811
854
|
|
|
812
855
|
// src/lib/init/scaffold/shadcn.ts
|
|
813
856
|
import spawn from "cross-spawn";
|
|
@@ -816,17 +859,11 @@ async function scaffoldShadCN(flags, userAnswers) {
|
|
|
816
859
|
const components = [];
|
|
817
860
|
switch (userAnswers.mode) {
|
|
818
861
|
case "LangGraph":
|
|
819
|
-
|
|
820
|
-
|
|
862
|
+
components.push(templateMapping.LangGraphGeneric);
|
|
863
|
+
if (userAnswers.langGraphPlatform === "Yes") {
|
|
864
|
+
components.push(templateMapping.LangGraphPlatformRuntime);
|
|
821
865
|
} else {
|
|
822
|
-
components.push(templateMapping.
|
|
823
|
-
if (userAnswers.useCopilotCloud !== "Yes") {
|
|
824
|
-
if (userAnswers.langGraphPlatform === "Yes") {
|
|
825
|
-
components.push(templateMapping.LangGraphPlatformRuntime);
|
|
826
|
-
} else {
|
|
827
|
-
components.push(templateMapping.RemoteEndpoint);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
866
|
+
components.push(templateMapping.RemoteEndpoint);
|
|
830
867
|
}
|
|
831
868
|
break;
|
|
832
869
|
case "CrewAI":
|
|
@@ -840,13 +877,13 @@ async function scaffoldShadCN(flags, userAnswers) {
|
|
|
840
877
|
break;
|
|
841
878
|
case "MCP":
|
|
842
879
|
components.push(templateMapping.McpStarter);
|
|
843
|
-
if (userAnswers.useCopilotCloud
|
|
880
|
+
if (userAnswers.deploymentChoice === "Self-hosted" || userAnswers.useCopilotCloud === "No") {
|
|
844
881
|
components.push(templateMapping.McpRuntime);
|
|
845
882
|
}
|
|
846
883
|
break;
|
|
847
884
|
case "Standard":
|
|
848
885
|
components.push(templateMapping.StandardStarter);
|
|
849
|
-
if (userAnswers.useCopilotCloud
|
|
886
|
+
if (userAnswers.deploymentChoice === "Self-hosted" || userAnswers.useCopilotCloud === "No") {
|
|
850
887
|
components.push(templateMapping.StandardRuntime);
|
|
851
888
|
}
|
|
852
889
|
break;
|
|
@@ -896,6 +933,12 @@ async function getLangGraphAgents(url, langSmithApiKey) {
|
|
|
896
933
|
|
|
897
934
|
// src/lib/init/scaffold/env.ts
|
|
898
935
|
import inquirer2 from "inquirer";
|
|
936
|
+
function needsCloudDeployment(userAnswers) {
|
|
937
|
+
return userAnswers.deploymentChoice === "Copilot Cloud" || // Branch B choice
|
|
938
|
+
userAnswers.useCopilotCloud === "Yes" || // Branch C choice
|
|
939
|
+
userAnswers.mode === "CrewAI" || // CrewAI always needs cloud
|
|
940
|
+
!userAnswers.deploymentChoice && !userAnswers.useCopilotCloud;
|
|
941
|
+
}
|
|
899
942
|
async function scaffoldEnv(flags, userAnswers) {
|
|
900
943
|
try {
|
|
901
944
|
const envFile = path2.join(process.cwd(), ".env");
|
|
@@ -904,6 +947,7 @@ async function scaffoldEnv(flags, userAnswers) {
|
|
|
904
947
|
} else {
|
|
905
948
|
}
|
|
906
949
|
let newEnvValues = "";
|
|
950
|
+
const isCloudDeployment = needsCloudDeployment(userAnswers);
|
|
907
951
|
if (userAnswers.copilotCloudPublicApiKey) {
|
|
908
952
|
newEnvValues += `NEXT_PUBLIC_COPILOT_API_KEY=${userAnswers.copilotCloudPublicApiKey}
|
|
909
953
|
`;
|
|
@@ -925,7 +969,7 @@ async function scaffoldEnv(flags, userAnswers) {
|
|
|
925
969
|
`;
|
|
926
970
|
newEnvValues += `LANGGRAPH_DEPLOYMENT_URL=http://localhost:8123
|
|
927
971
|
`;
|
|
928
|
-
} else if (userAnswers.langGraphPlatform === "Yes" &&
|
|
972
|
+
} else if (userAnswers.langGraphPlatform === "Yes" && !isCloudDeployment) {
|
|
929
973
|
newEnvValues += `LANGGRAPH_DEPLOYMENT_URL=${userAnswers.langGraphPlatformUrl}
|
|
930
974
|
`;
|
|
931
975
|
} else if (userAnswers.langGraphRemoteEndpointURL) {
|
|
@@ -935,12 +979,15 @@ async function scaffoldEnv(flags, userAnswers) {
|
|
|
935
979
|
if (flags.runtimeUrl) {
|
|
936
980
|
newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=${flags.runtimeUrl}
|
|
937
981
|
`;
|
|
938
|
-
} else if (
|
|
982
|
+
} else if (!isCloudDeployment && userAnswers.crewType !== "Crews" && userAnswers.crewType !== "Flows") {
|
|
939
983
|
newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=/api/copilotkit
|
|
940
984
|
`;
|
|
941
985
|
}
|
|
942
986
|
if (userAnswers.langGraphPlatformUrl && (userAnswers.langSmithApiKey || isLocalhost(userAnswers.langGraphPlatformUrl))) {
|
|
943
|
-
const langGraphAgents = await getLangGraphAgents(
|
|
987
|
+
const langGraphAgents = await getLangGraphAgents(
|
|
988
|
+
userAnswers.langGraphPlatformUrl,
|
|
989
|
+
userAnswers.langSmithApiKey || ""
|
|
990
|
+
);
|
|
944
991
|
let langGraphAgent = "";
|
|
945
992
|
if (langGraphAgents.length > 1) {
|
|
946
993
|
const { langGraphAgentChoice } = await inquirer2.prompt([
|
|
@@ -1226,7 +1273,8 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1226
1273
|
}
|
|
1227
1274
|
this.queueAnalytics("cli.init.mode_selected", {
|
|
1228
1275
|
mode: userAnswers.mode,
|
|
1229
|
-
|
|
1276
|
+
cloud_setup_completed: !!cloudSetupInfo,
|
|
1277
|
+
deployment_choice: userAnswers.deploymentChoice
|
|
1230
1278
|
});
|
|
1231
1279
|
if (userAnswers.mode === "Mastra") {
|
|
1232
1280
|
this.log(chalk7.magenta(`
|
|
@@ -1245,15 +1293,17 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1245
1293
|
\u{1F517} Please go to https://docs.copilotkit.ai/llamaindex/quickstart to get started.`));
|
|
1246
1294
|
process.exit(0);
|
|
1247
1295
|
}
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1296
|
+
const needsCloudDeployment2 = userAnswers.deploymentChoice === "Copilot Cloud" || // Branch B choice
|
|
1297
|
+
userAnswers.useCopilotCloud === "Yes" || // Branch C choice
|
|
1298
|
+
userAnswers.mode === "CrewAI" || // CrewAI always needs cloud
|
|
1299
|
+
!userAnswers.deploymentChoice && !userAnswers.useCopilotCloud;
|
|
1300
|
+
this.queueAnalytics("cli.init.cloud_deployment_selected", {
|
|
1301
|
+
deployment_choice: userAnswers.deploymentChoice,
|
|
1302
|
+
use_copilot_cloud: userAnswers.useCopilotCloud,
|
|
1303
|
+
needs_cloud_deployment: needsCloudDeployment2,
|
|
1304
|
+
mode: userAnswers.mode
|
|
1305
|
+
});
|
|
1306
|
+
if (needsCloudDeployment2) {
|
|
1257
1307
|
if (cloudSetupInfo) {
|
|
1258
1308
|
await this.completeCloudDeploymentSetup(flags, userAnswers, cloudSetupInfo);
|
|
1259
1309
|
} else {
|
|
@@ -1282,8 +1332,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1282
1332
|
}
|
|
1283
1333
|
this.queueAnalytics("cli.init.completed", {
|
|
1284
1334
|
mode: userAnswers.mode,
|
|
1285
|
-
|
|
1286
|
-
cloud_deployment:
|
|
1335
|
+
cloud_setup_completed: !!cloudSetupInfo,
|
|
1336
|
+
cloud_deployment: needsCloudDeployment2,
|
|
1337
|
+
deployment_choice: userAnswers.deploymentChoice,
|
|
1287
1338
|
agent_scaffolded: agentScaffolded,
|
|
1288
1339
|
api_key_in_env: !!userAnswers.copilotCloudPublicApiKey,
|
|
1289
1340
|
duration_ms: Date.now() - this.startTime
|
|
@@ -1298,7 +1349,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1298
1349
|
this.log(` - Talk to your agent.`);
|
|
1299
1350
|
this.log(chalk7.magenta("\nThanks for giving CopilotKit a try! \u{1FA81}\n"));
|
|
1300
1351
|
} else {
|
|
1301
|
-
this.finalSummary(userAnswers);
|
|
1352
|
+
this.finalSummary(userAnswers, cloudSetupInfo?.selectedProjectId);
|
|
1302
1353
|
}
|
|
1303
1354
|
} catch (error) {
|
|
1304
1355
|
this.queueAnalytics("cli.init.failed", {
|
|
@@ -1310,6 +1361,24 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1310
1361
|
this.gracefulError(error.message);
|
|
1311
1362
|
}
|
|
1312
1363
|
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Get A/B/C test branch from feature flags
|
|
1366
|
+
*/
|
|
1367
|
+
async getABCTestBranch() {
|
|
1368
|
+
const defaultBranch = "C";
|
|
1369
|
+
if (!this.analytics) {
|
|
1370
|
+
return defaultBranch;
|
|
1371
|
+
}
|
|
1372
|
+
try {
|
|
1373
|
+
const payload = await this.analytics.getFeatureFlagPayload("enterprise-by-default");
|
|
1374
|
+
if (payload && typeof payload === "object" && payload.branch) {
|
|
1375
|
+
return payload.branch;
|
|
1376
|
+
}
|
|
1377
|
+
return defaultBranch;
|
|
1378
|
+
} catch (error) {
|
|
1379
|
+
return defaultBranch;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1313
1382
|
/**
|
|
1314
1383
|
* Queue an analytics event to be sent later (non-blocking)
|
|
1315
1384
|
*/
|
|
@@ -1366,72 +1435,14 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1366
1435
|
}
|
|
1367
1436
|
}
|
|
1368
1437
|
});
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
}
|
|
1375
|
-
if (!signupAnswer) {
|
|
1376
|
-
if (isCloudByDefault) {
|
|
1377
|
-
this.queueAnalytics("cli.init.early_signup_prompt_shown", {});
|
|
1378
|
-
const signupResult = await inquirer3.prompt([
|
|
1379
|
-
{
|
|
1380
|
-
type: "list",
|
|
1381
|
-
name: "signupForCopilotCloud",
|
|
1382
|
-
message: "\u{1FA81} Sign up for Copilot Cloud to enable error tracking and get production-ready hosting? (Recommended)",
|
|
1383
|
-
choices: ["Yes", "No"]
|
|
1384
|
-
}
|
|
1385
|
-
]);
|
|
1386
|
-
signupAnswer = signupResult.signupForCopilotCloud;
|
|
1387
|
-
} else {
|
|
1388
|
-
signupAnswer = "No";
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
if (isCloudByDefault || initialAnswers.signupForCopilotCloud) {
|
|
1392
|
-
this.queueAnalytics("cli.init.early_signup_selected", {
|
|
1393
|
-
choice: signupAnswer,
|
|
1394
|
-
cloud_by_default_enabled: isCloudByDefault
|
|
1395
|
-
});
|
|
1396
|
-
}
|
|
1438
|
+
const abcBranch = await this.getABCTestBranch();
|
|
1439
|
+
this.queueAnalytics("cli.init.abc_branch_selected", {
|
|
1440
|
+
branch: abcBranch
|
|
1441
|
+
});
|
|
1442
|
+
const questionsForBranch = getQuestionsForBranch(abcBranch);
|
|
1397
1443
|
let cloudSetupInfo = null;
|
|
1398
1444
|
let earlyApiKey;
|
|
1399
|
-
|
|
1400
|
-
try {
|
|
1401
|
-
const tempConfig = { ...initialAnswers, signupForCopilotCloud: signupAnswer };
|
|
1402
|
-
const earlySignupResult = await this.handleEarlyCloudSignup(flags, tempConfig);
|
|
1403
|
-
cloudSetupInfo = earlySignupResult;
|
|
1404
|
-
earlyApiKey = earlySignupResult.apiKey;
|
|
1405
|
-
if (this.analytics && cloudSetupInfo.cliToken) {
|
|
1406
|
-
const trpcClient2 = createTRPCClient(cloudSetupInfo.cliToken);
|
|
1407
|
-
const me = await trpcClient2.me.query();
|
|
1408
|
-
if (me.user && me.organization) {
|
|
1409
|
-
this.analytics = new AnalyticsService({
|
|
1410
|
-
userId: me.user.id,
|
|
1411
|
-
organizationId: me.organization.id,
|
|
1412
|
-
email: me.user.email
|
|
1413
|
-
});
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
this.queueAnalytics("cli.init.early_signup_completed", {
|
|
1417
|
-
userId: cloudSetupInfo.organization?.id || "unknown",
|
|
1418
|
-
organizationId: cloudSetupInfo.organization?.id || "unknown",
|
|
1419
|
-
email: "unknown",
|
|
1420
|
-
// Will be updated when we get user info
|
|
1421
|
-
projectId: cloudSetupInfo.selectedProjectId || "unknown",
|
|
1422
|
-
api_key_retrieved: !!earlyApiKey
|
|
1423
|
-
});
|
|
1424
|
-
} catch (error) {
|
|
1425
|
-
this.queueAnalytics("cli.init.early_signup_failed", {
|
|
1426
|
-
error: error.message,
|
|
1427
|
-
step: "auth"
|
|
1428
|
-
// Could be more specific based on where it failed
|
|
1429
|
-
});
|
|
1430
|
-
throw error;
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
const remainingQuestions = questions.slice(1);
|
|
1434
|
-
const inquirerQuestions = remainingQuestions.map((q) => {
|
|
1445
|
+
const inquirerQuestions = questionsForBranch.map((q) => {
|
|
1435
1446
|
if (initialAnswers[q.name] !== void 0) {
|
|
1436
1447
|
return null;
|
|
1437
1448
|
}
|
|
@@ -1439,7 +1450,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1439
1450
|
name: q.name,
|
|
1440
1451
|
message: q.message,
|
|
1441
1452
|
when: (answers2) => {
|
|
1442
|
-
const combinedAnswers = { ...initialAnswers,
|
|
1453
|
+
const combinedAnswers = { ...initialAnswers, ...answers2 };
|
|
1443
1454
|
return q.when ? q.when(combinedAnswers) : true;
|
|
1444
1455
|
},
|
|
1445
1456
|
default: q.default,
|
|
@@ -1464,7 +1475,6 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1464
1475
|
...baseQuestion,
|
|
1465
1476
|
type: q.sensitive ? "password" : "input",
|
|
1466
1477
|
mask: q.sensitive ? "*" : void 0,
|
|
1467
|
-
// Add sanitization filter for input fields
|
|
1468
1478
|
filter: q.sanitize ? (input) => q.sanitize(input) : void 0
|
|
1469
1479
|
};
|
|
1470
1480
|
}
|
|
@@ -1472,11 +1482,73 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1472
1482
|
const promptAnswers = await inquirer3.prompt(inquirerQuestions);
|
|
1473
1483
|
const answers = {
|
|
1474
1484
|
...initialAnswers,
|
|
1475
|
-
signupForCopilotCloud: signupAnswer,
|
|
1476
1485
|
...promptAnswers,
|
|
1477
1486
|
...earlyApiKey && { copilotCloudPublicApiKey: earlyApiKey }
|
|
1478
|
-
// Add API key if we got one from early signup
|
|
1479
1487
|
};
|
|
1488
|
+
if (abcBranch === "B" && !cloudSetupInfo) {
|
|
1489
|
+
this.log(chalk7.cyan("\n\u{1F511} Now you will get an API key"));
|
|
1490
|
+
this.log(chalk7.gray("Setting up your cloud account and retrieving your API key...\n"));
|
|
1491
|
+
try {
|
|
1492
|
+
const tempConfig = { ...answers, signupForCopilotCloud: "Yes" };
|
|
1493
|
+
const cloudSignupResult = await this.setupApiKey(flags, tempConfig);
|
|
1494
|
+
cloudSetupInfo = cloudSignupResult;
|
|
1495
|
+
answers.copilotCloudPublicApiKey = cloudSignupResult.apiKey;
|
|
1496
|
+
if (this.analytics && cloudSetupInfo.cliToken) {
|
|
1497
|
+
const trpcClient2 = createTRPCClient(cloudSetupInfo.cliToken);
|
|
1498
|
+
const me = await trpcClient2.me.query();
|
|
1499
|
+
if (me.user && me.organization) {
|
|
1500
|
+
this.analytics = new AnalyticsService({
|
|
1501
|
+
userId: me.user.id,
|
|
1502
|
+
organizationId: me.organization.id,
|
|
1503
|
+
email: me.user.email
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
this.queueAnalytics("cli.init.branch_b_api_key_setup_completed", {
|
|
1508
|
+
branch: abcBranch,
|
|
1509
|
+
projectId: cloudSetupInfo.selectedProjectId || "unknown",
|
|
1510
|
+
api_key_retrieved: !!cloudSetupInfo.apiKey
|
|
1511
|
+
});
|
|
1512
|
+
} catch (error) {
|
|
1513
|
+
this.queueAnalytics("cli.init.branch_b_api_key_setup_failed", {
|
|
1514
|
+
error: error.message,
|
|
1515
|
+
branch: abcBranch
|
|
1516
|
+
});
|
|
1517
|
+
throw error;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
if (abcBranch === "A" && !cloudSetupInfo) {
|
|
1521
|
+
this.log(chalk7.cyan("\n\u{1F511} Now get your API key"));
|
|
1522
|
+
this.log(chalk7.gray("Setting up your cloud account and retrieving your API key...\n"));
|
|
1523
|
+
try {
|
|
1524
|
+
const tempConfig = { ...answers, signupForCopilotCloud: "Yes" };
|
|
1525
|
+
const cloudSignupResult = await this.setupApiKey(flags, tempConfig);
|
|
1526
|
+
cloudSetupInfo = cloudSignupResult;
|
|
1527
|
+
answers.copilotCloudPublicApiKey = cloudSignupResult.apiKey;
|
|
1528
|
+
if (this.analytics && cloudSetupInfo.cliToken) {
|
|
1529
|
+
const trpcClient2 = createTRPCClient(cloudSetupInfo.cliToken);
|
|
1530
|
+
const me = await trpcClient2.me.query();
|
|
1531
|
+
if (me.user && me.organization) {
|
|
1532
|
+
this.analytics = new AnalyticsService({
|
|
1533
|
+
userId: me.user.id,
|
|
1534
|
+
organizationId: me.organization.id,
|
|
1535
|
+
email: me.user.email
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
this.queueAnalytics("cli.init.branch_a_cloud_setup_completed", {
|
|
1540
|
+
branch: abcBranch,
|
|
1541
|
+
projectId: cloudSetupInfo.selectedProjectId || "unknown",
|
|
1542
|
+
api_key_retrieved: !!cloudSetupInfo.apiKey
|
|
1543
|
+
});
|
|
1544
|
+
} catch (error) {
|
|
1545
|
+
this.queueAnalytics("cli.init.branch_a_cloud_setup_failed", {
|
|
1546
|
+
error: error.message,
|
|
1547
|
+
branch: abcBranch
|
|
1548
|
+
});
|
|
1549
|
+
throw error;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1480
1552
|
if (answers.langGraphPlatform === "No") {
|
|
1481
1553
|
this.log(
|
|
1482
1554
|
"\nCurrently the CLI only supports scaffolding LangGraph Platform agents. Use our quickstart guide to get started:\n"
|
|
@@ -1618,8 +1690,8 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1618
1690
|
}
|
|
1619
1691
|
}
|
|
1620
1692
|
}
|
|
1621
|
-
async
|
|
1622
|
-
this.log(chalk7.cyan("\n\u{
|
|
1693
|
+
async setupApiKey(flags, userAnswers) {
|
|
1694
|
+
this.log(chalk7.cyan("\n\u{1F511} Setting up your API key...\n"));
|
|
1623
1695
|
const { cliToken, organization } = await this.authService.requireLogin(this, "cloud-features");
|
|
1624
1696
|
this.trpcClient = createTRPCClient(cliToken);
|
|
1625
1697
|
const availableProjects = await this.trpcClient.listOrgProjects.query({ orgId: organization.id });
|
|
@@ -1651,7 +1723,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1651
1723
|
let apiKey;
|
|
1652
1724
|
if (selectedProjectId) {
|
|
1653
1725
|
const spinner = ora5({
|
|
1654
|
-
text: "
|
|
1726
|
+
text: "Retrieving your API key...",
|
|
1655
1727
|
color: "cyan"
|
|
1656
1728
|
}).start();
|
|
1657
1729
|
try {
|
|
@@ -1659,13 +1731,13 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1659
1731
|
projectId: selectedProjectId
|
|
1660
1732
|
});
|
|
1661
1733
|
apiKey = copilotCloudPublicApiKey?.key;
|
|
1662
|
-
spinner.succeed("\u2705
|
|
1734
|
+
spinner.succeed("\u2705 API key retrieved successfully");
|
|
1663
1735
|
} catch (error) {
|
|
1664
|
-
spinner.fail("Failed to
|
|
1736
|
+
spinner.fail("Failed to retrieve API key, but continuing with setup");
|
|
1665
1737
|
console.error(error);
|
|
1666
1738
|
}
|
|
1667
1739
|
}
|
|
1668
|
-
this.log(chalk7.green("\u2705
|
|
1740
|
+
this.log(chalk7.green("\u2705 API key setup complete!\n"));
|
|
1669
1741
|
return { cliToken, organization, selectedProjectId, apiKey };
|
|
1670
1742
|
}
|
|
1671
1743
|
async completeCloudDeploymentSetup(flags, userAnswers, cloudSetupInfo) {
|
|
@@ -1772,7 +1844,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1772
1844
|
process.exit(1);
|
|
1773
1845
|
}
|
|
1774
1846
|
}
|
|
1775
|
-
finalSummary(userAnswers) {
|
|
1847
|
+
finalSummary(userAnswers, projectId) {
|
|
1776
1848
|
let agentDevInstructions = "";
|
|
1777
1849
|
let agentSetupMessage = "";
|
|
1778
1850
|
if (userAnswers.mode === "CrewAI") {
|
|
@@ -1788,7 +1860,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1788
1860
|
switch (userAnswers.langGraphAgent) {
|
|
1789
1861
|
case "Python Starter":
|
|
1790
1862
|
agentSetupMessage = `We've scaffolded a ${chalk7.cyan(userAnswers.langGraphAgent || "LangGraph")} agent in the ${chalk7.cyan("./agent")} directory.`;
|
|
1791
|
-
agentDevInstructions = "poetry lock && poetry install &&
|
|
1863
|
+
agentDevInstructions = "poetry lock && poetry install && poetry run demo";
|
|
1792
1864
|
break;
|
|
1793
1865
|
case "TypeScript Starter":
|
|
1794
1866
|
agentSetupMessage = `We've scaffolded a ${chalk7.cyan(userAnswers.langGraphAgent || "LangGraph")} agent in the ${chalk7.cyan("./agent")} directory.`;
|
|
@@ -1815,24 +1887,28 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1815
1887
|
this.log(chalk7.bold(`\u{1F4CB} Recap`));
|
|
1816
1888
|
this.log(` - CopilotKit has been added to your Next.js app.`);
|
|
1817
1889
|
if (agentSetupMessage) this.log(` - ${agentSetupMessage}`);
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
} else if (userAnswers.useCopilotCloud === "Yes" || userAnswers.crewType === "Crews") {
|
|
1890
|
+
const isCloudDeployment = userAnswers.deploymentChoice === "Copilot Cloud" || // Branch B choice
|
|
1891
|
+
userAnswers.useCopilotCloud === "Yes" || // Branch C choice
|
|
1892
|
+
userAnswers.mode === "CrewAI" || // CrewAI always needs cloud
|
|
1893
|
+
userAnswers.copilotCloudPublicApiKey;
|
|
1894
|
+
const isSelfHosted = userAnswers.deploymentChoice === "Self-hosted";
|
|
1895
|
+
if (isCloudDeployment) {
|
|
1825
1896
|
this.log(` - \u{1F680} Configured for Copilot Cloud deployment.`);
|
|
1897
|
+
} else if (isSelfHosted) {
|
|
1898
|
+
this.log(` - \u{1F3E0} Configured for self-hosted deployment.`);
|
|
1826
1899
|
}
|
|
1827
1900
|
this.log(chalk7.bold("\n\u{1F680} Next steps:"));
|
|
1828
1901
|
this.log(` - Start your Next.js app: ${chalk7.gray("$")} ${chalk7.cyan("npm run dev")}`);
|
|
1829
|
-
if (agentDevInstructions)
|
|
1902
|
+
if (agentDevInstructions) {
|
|
1830
1903
|
this.log(` - Start your agent: ${chalk7.gray("$")} ${chalk7.cyan(`cd agent && ${agentDevInstructions}`)}`);
|
|
1904
|
+
if (isCloudDeployment) {
|
|
1905
|
+
this.log(
|
|
1906
|
+
` - Create local tunnel for your agent: ${chalk7.gray("$")} ${chalk7.cyan(`npx copilotkit@latest dev --port <value>${projectId ? ` --project ${projectId}` : " [--project <value>]"}`)}`
|
|
1907
|
+
);
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1831
1910
|
this.log(` - Navigate to ${chalk7.blue("http://localhost:3000/copilotkit")}`);
|
|
1832
1911
|
this.log(` - Talk to your agent.`);
|
|
1833
|
-
if (userAnswers.copilotCloudPublicApiKey) {
|
|
1834
|
-
this.log(` - \u{1F41B} Errors and performance data will be visible in your Copilot Cloud dashboard.`);
|
|
1835
|
-
}
|
|
1836
1912
|
if (userAnswers.setupIDEDocs === "Yes" && userAnswers.selectedIDE !== "skip") {
|
|
1837
1913
|
this.log(` - Your IDE now has CopilotKit documentation context for better AI assistance.`);
|
|
1838
1914
|
}
|