copilotkit 0.0.42 → 0.0.43-alpha.1
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 +378 -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 +234 -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 +35 -24
- package/dist/lib/init/scaffold/index.js.map +1 -1
- package/dist/lib/init/scaffold/shadcn.js +22 -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.43-alpha.1";
|
|
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,16 +859,12 @@ async function scaffoldShadCN(flags, userAnswers) {
|
|
|
816
859
|
const components = [];
|
|
817
860
|
switch (userAnswers.mode) {
|
|
818
861
|
case "LangGraph":
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
components.push(templateMapping.LangGraphPlatformRuntime);
|
|
826
|
-
} else {
|
|
827
|
-
components.push(templateMapping.RemoteEndpoint);
|
|
828
|
-
}
|
|
862
|
+
components.push(templateMapping.LangGraphGeneric);
|
|
863
|
+
if (userAnswers.deploymentChoice === "Self-hosted" || userAnswers.useCopilotCloud === "No") {
|
|
864
|
+
if (userAnswers.langGraphPlatform === "Yes") {
|
|
865
|
+
components.push(templateMapping.LangGraphPlatformRuntime);
|
|
866
|
+
} else {
|
|
867
|
+
components.push(templateMapping.RemoteEndpoint);
|
|
829
868
|
}
|
|
830
869
|
}
|
|
831
870
|
break;
|
|
@@ -840,13 +879,13 @@ async function scaffoldShadCN(flags, userAnswers) {
|
|
|
840
879
|
break;
|
|
841
880
|
case "MCP":
|
|
842
881
|
components.push(templateMapping.McpStarter);
|
|
843
|
-
if (userAnswers.useCopilotCloud
|
|
882
|
+
if (userAnswers.deploymentChoice === "Self-hosted" || userAnswers.useCopilotCloud === "No") {
|
|
844
883
|
components.push(templateMapping.McpRuntime);
|
|
845
884
|
}
|
|
846
885
|
break;
|
|
847
886
|
case "Standard":
|
|
848
887
|
components.push(templateMapping.StandardStarter);
|
|
849
|
-
if (userAnswers.useCopilotCloud
|
|
888
|
+
if (userAnswers.deploymentChoice === "Self-hosted" || userAnswers.useCopilotCloud === "No") {
|
|
850
889
|
components.push(templateMapping.StandardRuntime);
|
|
851
890
|
}
|
|
852
891
|
break;
|
|
@@ -896,6 +935,12 @@ async function getLangGraphAgents(url, langSmithApiKey) {
|
|
|
896
935
|
|
|
897
936
|
// src/lib/init/scaffold/env.ts
|
|
898
937
|
import inquirer2 from "inquirer";
|
|
938
|
+
function needsCloudDeployment(userAnswers) {
|
|
939
|
+
return userAnswers.deploymentChoice === "Copilot Cloud" || // Branch B choice
|
|
940
|
+
userAnswers.useCopilotCloud === "Yes" || // Branch C choice
|
|
941
|
+
userAnswers.mode === "CrewAI" || // CrewAI always needs cloud
|
|
942
|
+
!userAnswers.deploymentChoice && !userAnswers.useCopilotCloud;
|
|
943
|
+
}
|
|
899
944
|
async function scaffoldEnv(flags, userAnswers) {
|
|
900
945
|
try {
|
|
901
946
|
const envFile = path2.join(process.cwd(), ".env");
|
|
@@ -904,6 +949,7 @@ async function scaffoldEnv(flags, userAnswers) {
|
|
|
904
949
|
} else {
|
|
905
950
|
}
|
|
906
951
|
let newEnvValues = "";
|
|
952
|
+
const isCloudDeployment = needsCloudDeployment(userAnswers);
|
|
907
953
|
if (userAnswers.copilotCloudPublicApiKey) {
|
|
908
954
|
newEnvValues += `NEXT_PUBLIC_COPILOT_API_KEY=${userAnswers.copilotCloudPublicApiKey}
|
|
909
955
|
`;
|
|
@@ -925,7 +971,7 @@ async function scaffoldEnv(flags, userAnswers) {
|
|
|
925
971
|
`;
|
|
926
972
|
newEnvValues += `LANGGRAPH_DEPLOYMENT_URL=http://localhost:8123
|
|
927
973
|
`;
|
|
928
|
-
} else if (userAnswers.langGraphPlatform === "Yes" &&
|
|
974
|
+
} else if (userAnswers.langGraphPlatform === "Yes" && !isCloudDeployment) {
|
|
929
975
|
newEnvValues += `LANGGRAPH_DEPLOYMENT_URL=${userAnswers.langGraphPlatformUrl}
|
|
930
976
|
`;
|
|
931
977
|
} else if (userAnswers.langGraphRemoteEndpointURL) {
|
|
@@ -935,12 +981,15 @@ async function scaffoldEnv(flags, userAnswers) {
|
|
|
935
981
|
if (flags.runtimeUrl) {
|
|
936
982
|
newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=${flags.runtimeUrl}
|
|
937
983
|
`;
|
|
938
|
-
} else if (
|
|
984
|
+
} else if (!isCloudDeployment && userAnswers.crewType !== "Crews" && userAnswers.crewType !== "Flows") {
|
|
939
985
|
newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=/api/copilotkit
|
|
940
986
|
`;
|
|
941
987
|
}
|
|
942
988
|
if (userAnswers.langGraphPlatformUrl && (userAnswers.langSmithApiKey || isLocalhost(userAnswers.langGraphPlatformUrl))) {
|
|
943
|
-
const langGraphAgents = await getLangGraphAgents(
|
|
989
|
+
const langGraphAgents = await getLangGraphAgents(
|
|
990
|
+
userAnswers.langGraphPlatformUrl,
|
|
991
|
+
userAnswers.langSmithApiKey || ""
|
|
992
|
+
);
|
|
944
993
|
let langGraphAgent = "";
|
|
945
994
|
if (langGraphAgents.length > 1) {
|
|
946
995
|
const { langGraphAgentChoice } = await inquirer2.prompt([
|
|
@@ -1226,7 +1275,8 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1226
1275
|
}
|
|
1227
1276
|
this.queueAnalytics("cli.init.mode_selected", {
|
|
1228
1277
|
mode: userAnswers.mode,
|
|
1229
|
-
|
|
1278
|
+
cloud_setup_completed: !!cloudSetupInfo,
|
|
1279
|
+
deployment_choice: userAnswers.deploymentChoice
|
|
1230
1280
|
});
|
|
1231
1281
|
if (userAnswers.mode === "Mastra") {
|
|
1232
1282
|
this.log(chalk7.magenta(`
|
|
@@ -1245,15 +1295,17 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1245
1295
|
\u{1F517} Please go to https://docs.copilotkit.ai/llamaindex/quickstart to get started.`));
|
|
1246
1296
|
process.exit(0);
|
|
1247
1297
|
}
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1298
|
+
const needsCloudDeployment2 = userAnswers.deploymentChoice === "Copilot Cloud" || // Branch B choice
|
|
1299
|
+
userAnswers.useCopilotCloud === "Yes" || // Branch C choice
|
|
1300
|
+
userAnswers.mode === "CrewAI" || // CrewAI always needs cloud
|
|
1301
|
+
!userAnswers.deploymentChoice && !userAnswers.useCopilotCloud;
|
|
1302
|
+
this.queueAnalytics("cli.init.cloud_deployment_selected", {
|
|
1303
|
+
deployment_choice: userAnswers.deploymentChoice,
|
|
1304
|
+
use_copilot_cloud: userAnswers.useCopilotCloud,
|
|
1305
|
+
needs_cloud_deployment: needsCloudDeployment2,
|
|
1306
|
+
mode: userAnswers.mode
|
|
1307
|
+
});
|
|
1308
|
+
if (needsCloudDeployment2) {
|
|
1257
1309
|
if (cloudSetupInfo) {
|
|
1258
1310
|
await this.completeCloudDeploymentSetup(flags, userAnswers, cloudSetupInfo);
|
|
1259
1311
|
} else {
|
|
@@ -1282,8 +1334,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1282
1334
|
}
|
|
1283
1335
|
this.queueAnalytics("cli.init.completed", {
|
|
1284
1336
|
mode: userAnswers.mode,
|
|
1285
|
-
|
|
1286
|
-
cloud_deployment:
|
|
1337
|
+
cloud_setup_completed: !!cloudSetupInfo,
|
|
1338
|
+
cloud_deployment: needsCloudDeployment2,
|
|
1339
|
+
deployment_choice: userAnswers.deploymentChoice,
|
|
1287
1340
|
agent_scaffolded: agentScaffolded,
|
|
1288
1341
|
api_key_in_env: !!userAnswers.copilotCloudPublicApiKey,
|
|
1289
1342
|
duration_ms: Date.now() - this.startTime
|
|
@@ -1298,7 +1351,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1298
1351
|
this.log(` - Talk to your agent.`);
|
|
1299
1352
|
this.log(chalk7.magenta("\nThanks for giving CopilotKit a try! \u{1FA81}\n"));
|
|
1300
1353
|
} else {
|
|
1301
|
-
this.finalSummary(userAnswers);
|
|
1354
|
+
this.finalSummary(userAnswers, cloudSetupInfo?.selectedProjectId);
|
|
1302
1355
|
}
|
|
1303
1356
|
} catch (error) {
|
|
1304
1357
|
this.queueAnalytics("cli.init.failed", {
|
|
@@ -1310,6 +1363,25 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1310
1363
|
this.gracefulError(error.message);
|
|
1311
1364
|
}
|
|
1312
1365
|
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Get A/B/C test branch from feature flags
|
|
1368
|
+
*/
|
|
1369
|
+
async getABCTestBranch() {
|
|
1370
|
+
const defaultBranch = "C";
|
|
1371
|
+
if (!this.analytics) {
|
|
1372
|
+
return defaultBranch;
|
|
1373
|
+
}
|
|
1374
|
+
try {
|
|
1375
|
+
const payload = await this.analytics.getFeatureFlagPayload("enterprise-by-default");
|
|
1376
|
+
if (payload && typeof payload === "object" && payload.branch) {
|
|
1377
|
+
console.log("Running variation", payload.branch);
|
|
1378
|
+
return payload.branch;
|
|
1379
|
+
}
|
|
1380
|
+
return defaultBranch;
|
|
1381
|
+
} catch (error) {
|
|
1382
|
+
return defaultBranch;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1313
1385
|
/**
|
|
1314
1386
|
* Queue an analytics event to be sent later (non-blocking)
|
|
1315
1387
|
*/
|
|
@@ -1366,72 +1438,14 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1366
1438
|
}
|
|
1367
1439
|
}
|
|
1368
1440
|
});
|
|
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
|
-
}
|
|
1441
|
+
const abcBranch = await this.getABCTestBranch();
|
|
1442
|
+
this.queueAnalytics("cli.init.abc_branch_selected", {
|
|
1443
|
+
branch: abcBranch
|
|
1444
|
+
});
|
|
1445
|
+
const questionsForBranch = getQuestionsForBranch(abcBranch);
|
|
1397
1446
|
let cloudSetupInfo = null;
|
|
1398
1447
|
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) => {
|
|
1448
|
+
const inquirerQuestions = questionsForBranch.map((q) => {
|
|
1435
1449
|
if (initialAnswers[q.name] !== void 0) {
|
|
1436
1450
|
return null;
|
|
1437
1451
|
}
|
|
@@ -1439,7 +1453,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1439
1453
|
name: q.name,
|
|
1440
1454
|
message: q.message,
|
|
1441
1455
|
when: (answers2) => {
|
|
1442
|
-
const combinedAnswers = { ...initialAnswers,
|
|
1456
|
+
const combinedAnswers = { ...initialAnswers, ...answers2 };
|
|
1443
1457
|
return q.when ? q.when(combinedAnswers) : true;
|
|
1444
1458
|
},
|
|
1445
1459
|
default: q.default,
|
|
@@ -1464,7 +1478,6 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1464
1478
|
...baseQuestion,
|
|
1465
1479
|
type: q.sensitive ? "password" : "input",
|
|
1466
1480
|
mask: q.sensitive ? "*" : void 0,
|
|
1467
|
-
// Add sanitization filter for input fields
|
|
1468
1481
|
filter: q.sanitize ? (input) => q.sanitize(input) : void 0
|
|
1469
1482
|
};
|
|
1470
1483
|
}
|
|
@@ -1472,11 +1485,73 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1472
1485
|
const promptAnswers = await inquirer3.prompt(inquirerQuestions);
|
|
1473
1486
|
const answers = {
|
|
1474
1487
|
...initialAnswers,
|
|
1475
|
-
signupForCopilotCloud: signupAnswer,
|
|
1476
1488
|
...promptAnswers,
|
|
1477
1489
|
...earlyApiKey && { copilotCloudPublicApiKey: earlyApiKey }
|
|
1478
|
-
// Add API key if we got one from early signup
|
|
1479
1490
|
};
|
|
1491
|
+
if (abcBranch === "B" && !cloudSetupInfo) {
|
|
1492
|
+
this.log(chalk7.cyan("\n\u{1F511} Now you will get an API key"));
|
|
1493
|
+
this.log(chalk7.gray("Setting up your cloud account and retrieving your API key...\n"));
|
|
1494
|
+
try {
|
|
1495
|
+
const tempConfig = { ...answers, signupForCopilotCloud: "Yes" };
|
|
1496
|
+
const cloudSignupResult = await this.setupApiKey(flags, tempConfig);
|
|
1497
|
+
cloudSetupInfo = cloudSignupResult;
|
|
1498
|
+
answers.copilotCloudPublicApiKey = cloudSignupResult.apiKey;
|
|
1499
|
+
if (this.analytics && cloudSetupInfo.cliToken) {
|
|
1500
|
+
const trpcClient2 = createTRPCClient(cloudSetupInfo.cliToken);
|
|
1501
|
+
const me = await trpcClient2.me.query();
|
|
1502
|
+
if (me.user && me.organization) {
|
|
1503
|
+
this.analytics = new AnalyticsService({
|
|
1504
|
+
userId: me.user.id,
|
|
1505
|
+
organizationId: me.organization.id,
|
|
1506
|
+
email: me.user.email
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
this.queueAnalytics("cli.init.branch_b_api_key_setup_completed", {
|
|
1511
|
+
branch: abcBranch,
|
|
1512
|
+
projectId: cloudSetupInfo.selectedProjectId || "unknown",
|
|
1513
|
+
api_key_retrieved: !!cloudSetupInfo.apiKey
|
|
1514
|
+
});
|
|
1515
|
+
} catch (error) {
|
|
1516
|
+
this.queueAnalytics("cli.init.branch_b_api_key_setup_failed", {
|
|
1517
|
+
error: error.message,
|
|
1518
|
+
branch: abcBranch
|
|
1519
|
+
});
|
|
1520
|
+
throw error;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
if (abcBranch === "A" && !cloudSetupInfo) {
|
|
1524
|
+
this.log(chalk7.cyan("\n\u{1F511} Now get your API key"));
|
|
1525
|
+
this.log(chalk7.gray("Setting up your cloud account and retrieving your API key...\n"));
|
|
1526
|
+
try {
|
|
1527
|
+
const tempConfig = { ...answers, signupForCopilotCloud: "Yes" };
|
|
1528
|
+
const cloudSignupResult = await this.setupApiKey(flags, tempConfig);
|
|
1529
|
+
cloudSetupInfo = cloudSignupResult;
|
|
1530
|
+
answers.copilotCloudPublicApiKey = cloudSignupResult.apiKey;
|
|
1531
|
+
if (this.analytics && cloudSetupInfo.cliToken) {
|
|
1532
|
+
const trpcClient2 = createTRPCClient(cloudSetupInfo.cliToken);
|
|
1533
|
+
const me = await trpcClient2.me.query();
|
|
1534
|
+
if (me.user && me.organization) {
|
|
1535
|
+
this.analytics = new AnalyticsService({
|
|
1536
|
+
userId: me.user.id,
|
|
1537
|
+
organizationId: me.organization.id,
|
|
1538
|
+
email: me.user.email
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
this.queueAnalytics("cli.init.branch_a_cloud_setup_completed", {
|
|
1543
|
+
branch: abcBranch,
|
|
1544
|
+
projectId: cloudSetupInfo.selectedProjectId || "unknown",
|
|
1545
|
+
api_key_retrieved: !!cloudSetupInfo.apiKey
|
|
1546
|
+
});
|
|
1547
|
+
} catch (error) {
|
|
1548
|
+
this.queueAnalytics("cli.init.branch_a_cloud_setup_failed", {
|
|
1549
|
+
error: error.message,
|
|
1550
|
+
branch: abcBranch
|
|
1551
|
+
});
|
|
1552
|
+
throw error;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1480
1555
|
if (answers.langGraphPlatform === "No") {
|
|
1481
1556
|
this.log(
|
|
1482
1557
|
"\nCurrently the CLI only supports scaffolding LangGraph Platform agents. Use our quickstart guide to get started:\n"
|
|
@@ -1618,8 +1693,8 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1618
1693
|
}
|
|
1619
1694
|
}
|
|
1620
1695
|
}
|
|
1621
|
-
async
|
|
1622
|
-
this.log(chalk7.cyan("\n\u{
|
|
1696
|
+
async setupApiKey(flags, userAnswers) {
|
|
1697
|
+
this.log(chalk7.cyan("\n\u{1F511} Setting up your API key...\n"));
|
|
1623
1698
|
const { cliToken, organization } = await this.authService.requireLogin(this, "cloud-features");
|
|
1624
1699
|
this.trpcClient = createTRPCClient(cliToken);
|
|
1625
1700
|
const availableProjects = await this.trpcClient.listOrgProjects.query({ orgId: organization.id });
|
|
@@ -1651,7 +1726,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1651
1726
|
let apiKey;
|
|
1652
1727
|
if (selectedProjectId) {
|
|
1653
1728
|
const spinner = ora5({
|
|
1654
|
-
text: "
|
|
1729
|
+
text: "Retrieving your API key...",
|
|
1655
1730
|
color: "cyan"
|
|
1656
1731
|
}).start();
|
|
1657
1732
|
try {
|
|
@@ -1659,13 +1734,13 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1659
1734
|
projectId: selectedProjectId
|
|
1660
1735
|
});
|
|
1661
1736
|
apiKey = copilotCloudPublicApiKey?.key;
|
|
1662
|
-
spinner.succeed("\u2705
|
|
1737
|
+
spinner.succeed("\u2705 API key retrieved successfully");
|
|
1663
1738
|
} catch (error) {
|
|
1664
|
-
spinner.fail("Failed to
|
|
1739
|
+
spinner.fail("Failed to retrieve API key, but continuing with setup");
|
|
1665
1740
|
console.error(error);
|
|
1666
1741
|
}
|
|
1667
1742
|
}
|
|
1668
|
-
this.log(chalk7.green("\u2705
|
|
1743
|
+
this.log(chalk7.green("\u2705 API key setup complete!\n"));
|
|
1669
1744
|
return { cliToken, organization, selectedProjectId, apiKey };
|
|
1670
1745
|
}
|
|
1671
1746
|
async completeCloudDeploymentSetup(flags, userAnswers, cloudSetupInfo) {
|
|
@@ -1772,7 +1847,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1772
1847
|
process.exit(1);
|
|
1773
1848
|
}
|
|
1774
1849
|
}
|
|
1775
|
-
finalSummary(userAnswers) {
|
|
1850
|
+
finalSummary(userAnswers, projectId) {
|
|
1776
1851
|
let agentDevInstructions = "";
|
|
1777
1852
|
let agentSetupMessage = "";
|
|
1778
1853
|
if (userAnswers.mode === "CrewAI") {
|
|
@@ -1788,7 +1863,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1788
1863
|
switch (userAnswers.langGraphAgent) {
|
|
1789
1864
|
case "Python Starter":
|
|
1790
1865
|
agentSetupMessage = `We've scaffolded a ${chalk7.cyan(userAnswers.langGraphAgent || "LangGraph")} agent in the ${chalk7.cyan("./agent")} directory.`;
|
|
1791
|
-
agentDevInstructions = "poetry lock && poetry install &&
|
|
1866
|
+
agentDevInstructions = "poetry lock && poetry install && poetry run demo";
|
|
1792
1867
|
break;
|
|
1793
1868
|
case "TypeScript Starter":
|
|
1794
1869
|
agentSetupMessage = `We've scaffolded a ${chalk7.cyan(userAnswers.langGraphAgent || "LangGraph")} agent in the ${chalk7.cyan("./agent")} directory.`;
|
|
@@ -1815,24 +1890,28 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1815
1890
|
this.log(chalk7.bold(`\u{1F4CB} Recap`));
|
|
1816
1891
|
this.log(` - CopilotKit has been added to your Next.js app.`);
|
|
1817
1892
|
if (agentSetupMessage) this.log(` - ${agentSetupMessage}`);
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
} else if (userAnswers.useCopilotCloud === "Yes" || userAnswers.crewType === "Crews") {
|
|
1893
|
+
const isCloudDeployment = userAnswers.deploymentChoice === "Copilot Cloud" || // Branch B choice
|
|
1894
|
+
userAnswers.useCopilotCloud === "Yes" || // Branch C choice
|
|
1895
|
+
userAnswers.mode === "CrewAI" || // CrewAI always needs cloud
|
|
1896
|
+
userAnswers.copilotCloudPublicApiKey;
|
|
1897
|
+
const isSelfHosted = userAnswers.deploymentChoice === "Self-hosted";
|
|
1898
|
+
if (isCloudDeployment) {
|
|
1825
1899
|
this.log(` - \u{1F680} Configured for Copilot Cloud deployment.`);
|
|
1900
|
+
} else if (isSelfHosted) {
|
|
1901
|
+
this.log(` - \u{1F3E0} Configured for self-hosted deployment.`);
|
|
1826
1902
|
}
|
|
1827
1903
|
this.log(chalk7.bold("\n\u{1F680} Next steps:"));
|
|
1828
1904
|
this.log(` - Start your Next.js app: ${chalk7.gray("$")} ${chalk7.cyan("npm run dev")}`);
|
|
1829
|
-
if (agentDevInstructions)
|
|
1905
|
+
if (agentDevInstructions) {
|
|
1830
1906
|
this.log(` - Start your agent: ${chalk7.gray("$")} ${chalk7.cyan(`cd agent && ${agentDevInstructions}`)}`);
|
|
1907
|
+
if (isCloudDeployment) {
|
|
1908
|
+
this.log(
|
|
1909
|
+
` - Create local tunnel for your agent: ${chalk7.gray("$")} ${chalk7.cyan(`npx copilotkit@latest dev --port <value>${projectId ? ` --project ${projectId}` : " [--project <value>]"}`)}`
|
|
1910
|
+
);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1831
1913
|
this.log(` - Navigate to ${chalk7.blue("http://localhost:3000/copilotkit")}`);
|
|
1832
1914
|
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
1915
|
if (userAnswers.setupIDEDocs === "Yes" && userAnswers.selectedIDE !== "skip") {
|
|
1837
1916
|
this.log(` - Your IDE now has CopilotKit documentation context for better AI assistance.`);
|
|
1838
1917
|
}
|