copilotkit 0.0.35 → 0.0.36
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 +78 -33
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +26 -47
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +1 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/lib/init/index.js +13 -36
- package/dist/lib/init/index.js.map +1 -1
- package/dist/lib/init/questions.js +9 -23
- package/dist/lib/init/questions.js.map +1 -1
- package/dist/lib/init/scaffold/agent.js +1 -6
- package/dist/lib/init/scaffold/agent.js.map +1 -1
- package/dist/lib/init/scaffold/env.js +1 -5
- package/dist/lib/init/scaffold/env.js.map +1 -1
- package/dist/lib/init/scaffold/index.js +8 -23
- package/dist/lib/init/scaffold/index.js.map +1 -1
- package/dist/lib/init/scaffold/shadcn.js +6 -12
- package/dist/lib/init/scaffold/shadcn.js.map +1 -1
- package/dist/lib/init/types/index.js +4 -10
- package/dist/lib/init/types/index.js.map +1 -1
- package/dist/lib/init/types/questions.d.ts +0 -8
- package/dist/lib/init/types/questions.js +3 -5
- package/dist/lib/init/types/questions.js.map +1 -1
- package/dist/lib/init/types/templates.d.ts +1 -1
- package/dist/lib/init/types/templates.js +1 -5
- package/dist/lib/init/types/templates.js.map +1 -1
- package/dist/lib/init/utils.js.map +1 -1
- package/dist/utils/detect-endpoint-type.utils.d.ts +1 -1
- 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 +1 -11
- package/package.json +6 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/init/scaffold/shadcn.ts","../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/utils.ts","../../../../src/lib/init/types/templates.ts"],"sourcesContent":["import spawn from 'cross-spawn'\nimport {templateMapping, Config} from '../types/index.js'\n\nexport async function scaffoldShadCN(flags: any, userAnswers: Config) {\n try {\n // Determine which components to install based on user choices\n const components: string[] = []\n \n // Add additional components based on agent framework\n switch (userAnswers.mode) {\n case 'LangGraph':\n if (userAnswers.langGraphAgent || flags.booth) {\n components.push(...templateMapping.LangGraphStarter)\n } else {\n components.push(templateMapping.LangGraphGeneric)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n if (userAnswers.langGraphPlatform === 'Yes') {\n components.push(templateMapping.LangGraphPlatformRuntime)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n }\n }\n break\n case 'CrewAI':\n if (userAnswers.crewType === 'Crews') {\n components.push(...templateMapping.CrewEnterprise)\n } else if (userAnswers.crewFlowAgent) {\n components.push(...templateMapping.CrewFlowsStarter)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n break\n case 'MCP':\n components.push(templateMapping.McpStarter)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n components.push(templateMapping.McpRuntime)\n }\n break\n case 'Standard':\n components.push(templateMapping.StandardStarter)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n components.push(templateMapping.StandardRuntime)\n }\n break\n default:\n return\n }\n\n // Small pause before running shadcn\n await new Promise((resolve) => setTimeout(resolve, 100))\n\n try {\n // Run shadcn with inherited stdio for all streams to allow for user input\n const result = spawn.sync('npx', ['shadcn@latest', 'add', ...components], {\n stdio: 'inherit', // This ensures stdin/stdout/stderr are all passed through\n })\n\n if (result.status !== 0) {\n throw new Error(`The shadcn installation process exited with code ${result.status}`)\n }\n } catch (error) {\n throw error\n }\n } catch (error) {\n throw error\n }\n}\n","import {z} from 'zod'\nimport { Flags } from \"@oclif/core\"\nimport { isLocalhost } from \"../utils.js\"\n\n// ===== Core Constants =====\nexport const MODES = ['LangGraph', 'CrewAI', 'Mastra', 'AG2', 'MCP', 'Standard'] as const\nexport const CREW_TYPES = ['Crews', 'Flows'] as const\nexport const CHAT_COMPONENTS = ['CopilotChat', 'CopilotSidebar', 'Headless', 'CopilotPopup'] as const\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter'] as const\nexport const CREW_FLOW_TEMPLATES = ['Starter'] as const\nexport const YES_NO = ['Yes', 'No'] as const\n\n// ===== Sanitizers =====\nexport const sanitizers = {\n // Remove trailing slash from URLs\n url: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\/+$/, '')\n },\n\n // Trim whitespace from strings\n trim: (value: string): string => {\n if (!value) return value\n return value.trim()\n },\n\n // Lowercase strings\n lowercase: (value: string): string => {\n if (!value) return value\n return value.toLowerCase().trim()\n },\n\n // Clean API keys (remove whitespace)\n apiKey: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\s/g, '')\n },\n}\n\n// ===== Zod Schemas =====\n\n// Basic schemas\nexport const ModeSchema = z.enum(MODES)\nexport const CrewTypeSchema = z.enum(CREW_TYPES)\nexport const ChatComponentSchema = z.enum(CHAT_COMPONENTS)\nexport const LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS)\nexport const CrewFlowTemplateSchema = z.enum(CREW_FLOW_TEMPLATES)\nexport const YesNoSchema = z.enum(YES_NO)\n\n// URL validation schema with preprocessing to remove trailing slash\nexport const UrlSchema = z.preprocess(\n (val) => sanitizers.url(String(val)),\n z.string().url('Please enter a valid URL').min(1, 'URL is required'),\n)\n\n// Token validation schema with preprocessing to trim\nexport const TokenSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Token is required'))\n\n// API key validation schema with preprocessing to remove whitespace\nexport const ApiKeySchema = z.preprocess(\n (val) => sanitizers.apiKey(String(val)),\n z.string().min(1, 'API key is required'),\n)\n\n// Name validation schema with preprocessing to trim\nexport const NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Name is required'))\n\n// Config schema\nexport const ConfigSchema = z\n .object({\n // Core fields\n copilotKitVersion: z.string().optional(),\n mode: ModeSchema,\n chatUi: ChatComponentSchema.optional(),\n\n // Yes/No fields\n alreadyDeployed: YesNoSchema.optional(),\n fastApiEnabled: YesNoSchema.optional(),\n useCopilotCloud: YesNoSchema.optional(),\n\n // LangGraph specific fields\n langGraphAgent: LangGraphAgentSchema.optional(),\n langGraphPlatform: YesNoSchema.optional(),\n langGraphPlatformUrl: UrlSchema.optional(),\n langGraphRemoteEndpointURL: UrlSchema.optional(),\n\n // CrewAI specific fields\n crewType: CrewTypeSchema.optional(),\n crewName: NameSchema.optional(),\n crewUrl: UrlSchema.optional(),\n crewBearerToken: TokenSchema.optional(),\n crewFlowAgent: CrewFlowTemplateSchema.optional(),\n\n // API keys and tokens\n copilotCloudPublicApiKey: z.string().optional(),\n langSmithApiKey: ApiKeySchema.optional(),\n llmToken: ApiKeySchema.optional(),\n })\n .refine(\n (data) => {\n // If CrewAI is selected with Crews type, require crew URL and bearer token\n if (data.mode === 'CrewAI' && data.crewType === 'Crews') {\n return !!data.crewUrl && !!data.crewBearerToken\n }\n return true\n },\n {\n message: 'Crew URL and bearer token are required for CrewAI Crews',\n path: ['crewUrl', 'crewBearerToken'],\n },\n )\n .refine(\n (data) => {\n // If LangGraph is selected with LangGraph Platform, require platform URL and LangSmith API key\n if (data.mode === 'LangGraph' && data.alreadyDeployed === 'Yes' && data.langGraphPlatform === 'Yes') {\n return (!!data.langGraphPlatformUrl && !!data.langSmithApiKey) || isLocalhost(data.langGraphPlatformUrl || '');\n }\n return true\n },\n {\n message: 'LangGraph Platform URL and LangSmith API key are required',\n path: ['langGraphPlatformUrl', 'langSmithApiKey'],\n },\n )\n\n// Export the inferred type from the schema\nexport type Config = z.infer<typeof ConfigSchema>\n\n// Question type definition with improved validation and sanitization\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: keyof Config\n message: string\n choices?: readonly string[]\n default?: string\n when?: (answers: Partial<Config>) => boolean\n sensitive?: boolean\n validate?: (input: string) => true | string // Return true if valid, error message string if invalid\n sanitize?: (input: string) => string // Function to sanitize input before validation\n}\n\n// CLI flags definition with descriptions\nexport const ConfigFlags = {\n booth: Flags.boolean({description: 'Use CopilotKit in booth mode', default: false, char: 'b'}),\n mode: Flags.string({description: 'How you will be interacting with AI', options: MODES, char: 'm'}),\n 'copilotkit-version': Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n 'use-copilot-cloud': Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: YES_NO}),\n 'langgraph-agent': Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n 'crew-type': Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n 'crew-name': Flags.string({description: 'Name for your CrewAI agent'}),\n 'crew-url': Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n 'crew-bearer-token': Flags.string({description: 'Bearer token for CrewAI authentication'}),\n 'langsmith-api-key': Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n 'llm-token': Flags.string({description: 'API key for your preferred LLM provider'}),\n 'crew-flow-agent': Flags.string({description: 'CrewAI Flow template to use', options: CREW_FLOW_TEMPLATES}),\n}\n","export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0');\n}","export type ChatTemplate = 'CopilotChat' | 'CopilotPopup' | 'CopilotSidebar'\n\nexport type StarterTemplate =\n | 'LangGraphPlatform'\n | 'RemoteEndpoint'\n | 'Standard'\n | 'CrewEnterprise'\n | 'CrewFlowsStarter'\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = 'https://registry.copilotkit.ai/r'\n\nexport const templateMapping = {\n // Runtimes\n RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,\n LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,\n\n // CrewAI\n CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],\n CrewFlowsStarter: [\n `${BASE_URL}/coagents-starter-ui.json`,\n `${BASE_URL}/agent-layout.json`,\n `${BASE_URL}/remote-endpoint.json`,\n ],\n\n // LangGraph\n LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,\n LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],\n\n // No Agent\n StandardStarter: `${BASE_URL}/standard-starter.json`,\n StandardRuntime: `${BASE_URL}/standard-runtime.json`,\n\n // MCP\n McpStarter: `${BASE_URL}/mcp-starter.json`,\n McpRuntime: `${BASE_URL}/mcp-starter-runtime.json`,\n}\n"],"mappings":";AAAA,OAAO,WAAW;;;ACAlB,SAAQ,SAAQ;AAChB,SAAS,aAAa;;;ACDf,IAAM,cAAc,CAAC,QAAyB;AACnD,SAAO,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,SAAS;AACzF;;;ADGO,IAAM,QAAQ,CAAC,aAAa,UAAU,UAAU,OAAO,OAAO,UAAU;AACxE,IAAM,aAAa,CAAC,SAAS,OAAO;AACpC,IAAM,kBAAkB,CAAC,eAAe,kBAAkB,YAAY,cAAc;AACpF,IAAM,mBAAmB,CAAC,kBAAkB,oBAAoB;AAChE,IAAM,sBAAsB,CAAC,SAAS;AACtC,IAAM,SAAS,CAAC,OAAO,IAAI;AAG3B,IAAM,aAAa;AAAA;AAAA,EAExB,KAAK,CAAC,UAA0B;AAC9B,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK,EAAE,QAAQ,QAAQ,EAAE;AAAA,EACxC;AAAA;AAAA,EAGA,MAAM,CAAC,UAA0B;AAC/B,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA;AAAA,EAGA,WAAW,CAAC,UAA0B;AACpC,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,YAAY,EAAE,KAAK;AAAA,EAClC;AAAA;AAAA,EAGA,QAAQ,CAAC,UAA0B;AACjC,QAAI,CAAC,M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AAChD,cAAI,YAAY,oBAAoB,OAAO;AACzC,gBAAI,YAAY,sBAAsB,OAAO;AAC3C,yBAAW,KAAK,gBAAgB,wBAAwB;AAAA,YAC1D,OAAO;AACL,yBAAW,KAAK,gBAAgB,cAAc;AAAA,YAChD;AAAA,UACF;AAAA,QACF;AACA;AAAA,MACF,KAAK;AACH,YAAI,YAAY,aAAa,SAAS;AACpC,qBAAW,KAAK,GAAG,gBAAgB,cAAc;AAAA,QACnD,WAAW,YAAY,eAAe;AACpC,qBAAW,KAAK,GAAG,gBAAgB,gBAAgB;AAAA,QACrD,OAAO;AACL,qBAAW,KAAK,gBAAgB,cAAc;AAAA,QAChD;AACA;AAAA,MACF,KAAK;AACH,mBAAW,KAAK,gBAAgB,UAAU;AAC1C,YAAI,YAAY,oBAAoB,OAAO;AACzC,qBAAW,KAAK,gBAAgB,UAAU;AAAA,QAC5C;AACA;AAAA,MACF,KAAK;AACH,mBAAW,KAAK,gBAAgB,eAAe;AAC/C,YAAI,YAAY,oBAAoB,OAAO;AACzC,qBAAW,KAAK,gBAAgB,eAAe;AAAA,QACjD;AACA;AAAA,MACF;AACE;AAAA,IACJ;AAGA,UAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG,CAAC;AAEvD,QAAI;AAEF,YAAM,SAAS,MAAM,KAAK,OAAO,CAAC,iBAAiB,OAAO,GAAG,UAAU,GAAG;AAAA,QACxE,OAAO;AAAA;AAAA,MACT,CAAC;AAED,UAAI,OAAO,WAAW,GAAG;AACvB,cAAM,IAAI,MAAM,oDAAoD,OAAO,MAAM,EAAE;AAAA,MACrF;AAAA,IACF,SAAS,OAAO;AACd,YAAM;AAAA,IACR;AAAA,EACF,SAAS,OAAO;AACd,UAAM;AAAA,EACR;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/scaffold/shadcn.ts","../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/utils.ts","../../../../src/lib/init/types/templates.ts"],"sourcesContent":["import spawn from 'cross-spawn'\nimport {templateMapping, Config} from '../types/index.js'\n\nexport async function scaffoldShadCN(flags: any, userAnswers: Config) {\n try {\n // Determine which components to install based on user choices\n const components: string[] = []\n\n // Add additional components based on agent framework\n switch (userAnswers.mode) {\n case 'LangGraph':\n if (userAnswers.langGraphAgent || flags.booth) {\n components.push(...templateMapping.LangGraphStarter)\n } else {\n components.push(templateMapping.LangGraphGeneric)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n if (userAnswers.langGraphPlatform === 'Yes') {\n components.push(templateMapping.LangGraphPlatformRuntime)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n }\n }\n break\n case 'CrewAI':\n if (userAnswers.crewType === 'Crews') {\n components.push(...templateMapping.CrewEnterprise)\n } else if (userAnswers.crewType === 'Flows') {\n components.push(...templateMapping.CrewFlowsEnterprise)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n break\n case 'MCP':\n components.push(templateMapping.McpStarter)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n components.push(templateMapping.McpRuntime)\n }\n break\n case 'Standard':\n components.push(templateMapping.StandardStarter)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n components.push(templateMapping.StandardRuntime)\n }\n break\n default:\n return\n }\n\n // Small pause before running shadcn\n await new Promise((resolve) => setTimeout(resolve, 100))\n\n try {\n // Run shadcn with inherited stdio for all streams to allow for user input\n const result = spawn.sync('npx', ['shadcn@latest', 'add', ...components], {\n stdio: 'inherit', // This ensures stdin/stdout/stderr are all passed through\n })\n\n if (result.status !== 0) {\n throw new Error(`The shadcn installation process exited with code ${result.status}`)\n }\n } catch (error) {\n throw error\n }\n } catch (error) {\n throw error\n }\n}\n","import {z} from 'zod'\nimport {Flags} from '@oclif/core'\nimport {isLocalhost} from '../utils.js'\n\n// ===== Core Constants =====\nexport const MODES = ['LangGraph', 'CrewAI', 'Mastra', 'AG2', 'MCP', 'Standard'] as const\nexport const CREW_TYPES = ['Crews', 'Flows'] as const\nexport const CHAT_COMPONENTS = ['CopilotChat', 'CopilotSidebar', 'Headless', 'CopilotPopup'] as const\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter'] as const\nexport const CREW_FLOW_TEMPLATES = ['Starter'] as const\nexport const YES_NO = ['Yes', 'No'] as const\n\n// ===== Sanitizers =====\nexport const sanitizers = {\n // Remove trailing slash from URLs\n url: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\/+$/, '')\n },\n\n // Trim whitespace from strings\n trim: (value: string): string => {\n if (!value) return value\n return value.trim()\n },\n\n // Lowercase strings\n lowercase: (value: string): string => {\n if (!value) return value\n return value.toLowerCase().trim()\n },\n\n // Clean API keys (remove whitespace)\n apiKey: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\s/g, '')\n },\n}\n\n// ===== Zod Schemas =====\n\n// Basic schemas\nexport const ModeSchema = z.enum(MODES)\nexport const CrewTypeSchema = z.enum(CREW_TYPES)\nexport const ChatComponentSchema = z.enum(CHAT_COMPONENTS)\nexport const LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS)\nexport const CrewFlowTemplateSchema = z.enum(CREW_FLOW_TEMPLATES)\nexport const YesNoSchema = z.enum(YES_NO)\n\n// URL validation schema with preprocessing to remove trailing slash\nexport const UrlSchema = z.preprocess(\n (val) => sanitizers.url(String(val)),\n z.string().url('Please enter a valid URL').min(1, 'URL is required'),\n)\n\n// Token validation schema with preprocessing to trim\nexport const TokenSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Token is required'))\n\n// API key validation schema with preprocessing to remove whitespace\nexport const ApiKeySchema = z.preprocess(\n (val) => sanitizers.apiKey(String(val)),\n z.string().min(1, 'API key is required'),\n)\n\n// Name validation schema with preprocessing to trim\nexport const NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Name is required'))\n\n// Config schema\nexport const ConfigSchema = z\n .object({\n // Core fields\n copilotKitVersion: z.string().optional(),\n mode: ModeSchema,\n chatUi: ChatComponentSchema.optional(),\n\n // Yes/No fields\n alreadyDeployed: YesNoSchema.optional(),\n fastApiEnabled: YesNoSchema.optional(),\n useCopilotCloud: YesNoSchema.optional(),\n\n // LangGraph specific fields\n langGraphAgent: LangGraphAgentSchema.optional(),\n langGraphPlatform: YesNoSchema.optional(),\n langGraphPlatformUrl: UrlSchema.optional(),\n langGraphRemoteEndpointURL: UrlSchema.optional(),\n\n // CrewAI specific fields\n crewType: CrewTypeSchema.optional(),\n crewName: NameSchema.optional(),\n crewUrl: UrlSchema.optional(),\n crewBearerToken: TokenSchema.optional(),\n\n // API keys and tokens\n copilotCloudPublicApiKey: z.string().optional(),\n langSmithApiKey: ApiKeySchema.optional(),\n llmToken: ApiKeySchema.optional(),\n })\n .refine(\n (data) => {\n // If CrewAI is selected, require crew URL and bearer token\n if (data.mode === 'CrewAI') {\n return !!data.crewUrl && !!data.crewBearerToken\n }\n return true\n },\n {\n message: 'Crew URL and bearer token are required for CrewAI',\n path: ['crewUrl', 'crewBearerToken'],\n },\n )\n .refine(\n (data) => {\n // If LangGraph is selected with LangGraph Platform, require platform URL and LangSmith API key\n if (data.mode === 'LangGraph' && data.alreadyDeployed === 'Yes' && data.langGraphPlatform === 'Yes') {\n return (!!data.langGraphPlatformUrl && !!data.langSmithApiKey) || isLocalhost(data.langGraphPlatformUrl || '')\n }\n return true\n },\n {\n message: 'LangGraph Platform URL and LangSmith API key are required',\n path: ['langGraphPlatformUrl', 'langSmithApiKey'],\n },\n )\n\n// Export the inferred type from the schema\nexport type Config = z.infer<typeof ConfigSchema>\n\n// Question type definition with improved validation and sanitization\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: keyof Config\n message: string\n choices?: readonly string[]\n default?: string\n when?: (answers: Partial<Config>) => boolean\n sensitive?: boolean\n validate?: (input: string) => true | string // Return true if valid, error message string if invalid\n sanitize?: (input: string) => string // Function to sanitize input before validation\n}\n\n// CLI flags definition with descriptions\nexport const ConfigFlags = {\n booth: Flags.boolean({description: 'Use CopilotKit in booth mode', default: false, char: 'b'}),\n mode: Flags.string({description: 'How you will be interacting with AI', options: MODES, char: 'm'}),\n 'copilotkit-version': Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n 'use-copilot-cloud': Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: YES_NO}),\n 'langgraph-agent': Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n 'crew-type': Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n 'crew-name': Flags.string({description: 'Name for your CrewAI agent'}),\n 'crew-url': Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n 'crew-bearer-token': Flags.string({description: 'Bearer token for CrewAI authentication'}),\n 'langsmith-api-key': Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n 'llm-token': Flags.string({description: 'API key for your preferred LLM provider'}),\n}\n","export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0')\n}\n","export type ChatTemplate = 'CopilotChat' | 'CopilotPopup' | 'CopilotSidebar'\n\nexport type StarterTemplate =\n | 'LangGraphPlatform'\n | 'RemoteEndpoint'\n | 'Standard'\n | 'CrewEnterprise'\n | 'CrewFlowsStarter'\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = 'https://registry.copilotkit.ai/r'\n\nexport const templateMapping = {\n // Runtimes\n RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,\n LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,\n\n // CrewAI\n CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],\n CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],\n\n // LangGraph\n LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,\n LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],\n\n // No Agent\n StandardStarter: `${BASE_URL}/standard-starter.json`,\n StandardRuntime: `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ChD;AACA;AAAA,MACF,KAAK;AACH,mBAAW,KAAK,gBAAgB,UAAU;AAC1C,YAAI,YAAY,oBAAoB,OAAO;AACzC,qBAAW,KAAK,gBAAgB,UAAU;AAAA,QAC5C;AACA;AAAA,MACF,KAAK;AACH,mBAAW,KAAK,gBAAgB,eAAe;AAC/C,YAAI,YAAY,oBAAoB,OAAO;AACzC,qBAAW,KAAK,gBAAgB,eAAe;AAAA,QACjD;AACA;AAAA,MACF;AACE;AAAA,IACJ;AAGA,UAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG,CAAC;AAEvD,QAAI;AAEF,YAAM,SAAS,MAAM,KAAK,OAAO,CAAC,iBAAiB,OAAO,GAAG,UAAU,GAAG;AAAA,QACxE,OAAO;AAAA;AAAA,MACT,CAAC;AAED,UAAI,OAAO,WAAW,GAAG;AACvB,cAAM,IAAI,MAAM,oDAAoD,OAAO,MAAM,EAAE;AAAA,MACrF;AAAA,IACF,SAAS,OAAO;AACd,YAAM;AAAA,IACR;AAAA,EACF,SAAS,OAAO;AACd,UAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -71,20 +71,19 @@ var ConfigSchema = z.object({
|
|
|
71
71
|
crewName: NameSchema.optional(),
|
|
72
72
|
crewUrl: UrlSchema.optional(),
|
|
73
73
|
crewBearerToken: TokenSchema.optional(),
|
|
74
|
-
crewFlowAgent: CrewFlowTemplateSchema.optional(),
|
|
75
74
|
// API keys and tokens
|
|
76
75
|
copilotCloudPublicApiKey: z.string().optional(),
|
|
77
76
|
langSmithApiKey: ApiKeySchema.optional(),
|
|
78
77
|
llmToken: ApiKeySchema.optional()
|
|
79
78
|
}).refine(
|
|
80
79
|
(data) => {
|
|
81
|
-
if (data.mode === "CrewAI"
|
|
80
|
+
if (data.mode === "CrewAI") {
|
|
82
81
|
return !!data.crewUrl && !!data.crewBearerToken;
|
|
83
82
|
}
|
|
84
83
|
return true;
|
|
85
84
|
},
|
|
86
85
|
{
|
|
87
|
-
message: "Crew URL and bearer token are required for CrewAI
|
|
86
|
+
message: "Crew URL and bearer token are required for CrewAI",
|
|
88
87
|
path: ["crewUrl", "crewBearerToken"]
|
|
89
88
|
}
|
|
90
89
|
).refine(
|
|
@@ -110,8 +109,7 @@ var ConfigFlags = {
|
|
|
110
109
|
"crew-url": Flags.string({ description: "URL endpoint for your CrewAI agent" }),
|
|
111
110
|
"crew-bearer-token": Flags.string({ description: "Bearer token for CrewAI authentication" }),
|
|
112
111
|
"langsmith-api-key": Flags.string({ description: "LangSmith API key for LangGraph observability" }),
|
|
113
|
-
"llm-token": Flags.string({ description: "API key for your preferred LLM provider" })
|
|
114
|
-
"crew-flow-agent": Flags.string({ description: "CrewAI Flow template to use", options: CREW_FLOW_TEMPLATES })
|
|
112
|
+
"llm-token": Flags.string({ description: "API key for your preferred LLM provider" })
|
|
115
113
|
};
|
|
116
114
|
|
|
117
115
|
// src/lib/init/types/templates.ts
|
|
@@ -122,11 +120,7 @@ var templateMapping = {
|
|
|
122
120
|
LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,
|
|
123
121
|
// CrewAI
|
|
124
122
|
CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],
|
|
125
|
-
|
|
126
|
-
`${BASE_URL}/coagents-starter-ui.json`,
|
|
127
|
-
`${BASE_URL}/agent-layout.json`,
|
|
128
|
-
`${BASE_URL}/remote-endpoint.json`
|
|
129
|
-
],
|
|
123
|
+
CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],
|
|
130
124
|
// LangGraph
|
|
131
125
|
LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,
|
|
132
126
|
LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/utils.ts","../../../../src/lib/init/types/templates.ts"],"sourcesContent":["import {z} from 'zod'\nimport { Flags } from \"@oclif/core\"\nimport { isLocalhost } from \"../utils.js\"\n\n// ===== Core Constants =====\nexport const MODES = ['LangGraph', 'CrewAI', 'Mastra', 'AG2', 'MCP', 'Standard'] as const\nexport const CREW_TYPES = ['Crews', 'Flows'] as const\nexport const CHAT_COMPONENTS = ['CopilotChat', 'CopilotSidebar', 'Headless', 'CopilotPopup'] as const\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter'] as const\nexport const CREW_FLOW_TEMPLATES = ['Starter'] as const\nexport const YES_NO = ['Yes', 'No'] as const\n\n// ===== Sanitizers =====\nexport const sanitizers = {\n // Remove trailing slash from URLs\n url: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\/+$/, '')\n },\n\n // Trim whitespace from strings\n trim: (value: string): string => {\n if (!value) return value\n return value.trim()\n },\n\n // Lowercase strings\n lowercase: (value: string): string => {\n if (!value) return value\n return value.toLowerCase().trim()\n },\n\n // Clean API keys (remove whitespace)\n apiKey: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\s/g, '')\n },\n}\n\n// ===== Zod Schemas =====\n\n// Basic schemas\nexport const ModeSchema = z.enum(MODES)\nexport const CrewTypeSchema = z.enum(CREW_TYPES)\nexport const ChatComponentSchema = z.enum(CHAT_COMPONENTS)\nexport const LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS)\nexport const CrewFlowTemplateSchema = z.enum(CREW_FLOW_TEMPLATES)\nexport const YesNoSchema = z.enum(YES_NO)\n\n// URL validation schema with preprocessing to remove trailing slash\nexport const UrlSchema = z.preprocess(\n (val) => sanitizers.url(String(val)),\n z.string().url('Please enter a valid URL').min(1, 'URL is required'),\n)\n\n// Token validation schema with preprocessing to trim\nexport const TokenSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Token is required'))\n\n// API key validation schema with preprocessing to remove whitespace\nexport const ApiKeySchema = z.preprocess(\n (val) => sanitizers.apiKey(String(val)),\n z.string().min(1, 'API key is required'),\n)\n\n// Name validation schema with preprocessing to trim\nexport const NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Name is required'))\n\n// Config schema\nexport const ConfigSchema = z\n .object({\n // Core fields\n copilotKitVersion: z.string().optional(),\n mode: ModeSchema,\n chatUi: ChatComponentSchema.optional(),\n\n // Yes/No fields\n alreadyDeployed: YesNoSchema.optional(),\n fastApiEnabled: YesNoSchema.optional(),\n useCopilotCloud: YesNoSchema.optional(),\n\n // LangGraph specific fields\n langGraphAgent: LangGraphAgentSchema.optional(),\n langGraphPlatform: YesNoSchema.optional(),\n langGraphPlatformUrl: UrlSchema.optional(),\n langGraphRemoteEndpointURL: UrlSchema.optional(),\n\n // CrewAI specific fields\n crewType: CrewTypeSchema.optional(),\n crewName: NameSchema.optional(),\n crewUrl: UrlSchema.optional(),\n crewBearerToken: TokenSchema.optional(),\n crewFlowAgent: CrewFlowTemplateSchema.optional(),\n\n // API keys and tokens\n copilotCloudPublicApiKey: z.string().optional(),\n langSmithApiKey: ApiKeySchema.optional(),\n llmToken: ApiKeySchema.optional(),\n })\n .refine(\n (data) => {\n // If CrewAI is selected with Crews type, require crew URL and bearer token\n if (data.mode === 'CrewAI' && data.crewType === 'Crews') {\n return !!data.crewUrl && !!data.crewBearerToken\n }\n return true\n },\n {\n message: 'Crew URL and bearer token are required for CrewAI Crews',\n path: ['crewUrl', 'crewBearerToken'],\n },\n )\n .refine(\n (data) => {\n // If LangGraph is selected with LangGraph Platform, require platform URL and LangSmith API key\n if (data.mode === 'LangGraph' && data.alreadyDeployed === 'Yes' && data.langGraphPlatform === 'Yes') {\n return (!!data.langGraphPlatformUrl && !!data.langSmithApiKey) || isLocalhost(data.langGraphPlatformUrl || '');\n }\n return true\n },\n {\n message: 'LangGraph Platform URL and LangSmith API key are required',\n path: ['langGraphPlatformUrl', 'langSmithApiKey'],\n },\n )\n\n// Export the inferred type from the schema\nexport type Config = z.infer<typeof ConfigSchema>\n\n// Question type definition with improved validation and sanitization\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: keyof Config\n message: string\n choices?: readonly string[]\n default?: string\n when?: (answers: Partial<Config>) => boolean\n sensitive?: boolean\n validate?: (input: string) => true | string // Return true if valid, error message string if invalid\n sanitize?: (input: string) => string // Function to sanitize input before validation\n}\n\n// CLI flags definition with descriptions\nexport const ConfigFlags = {\n booth: Flags.boolean({description: 'Use CopilotKit in booth mode', default: false, char: 'b'}),\n mode: Flags.string({description: 'How you will be interacting with AI', options: MODES, char: 'm'}),\n 'copilotkit-version': Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n 'use-copilot-cloud': Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: YES_NO}),\n 'langgraph-agent': Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n 'crew-type': Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n 'crew-name': Flags.string({description: 'Name for your CrewAI agent'}),\n 'crew-url': Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n 'crew-bearer-token': Flags.string({description: 'Bearer token for CrewAI authentication'}),\n 'langsmith-api-key': Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n 'llm-token': Flags.string({description: 'API key for your preferred LLM provider'}),\n 'crew-flow-agent': Flags.string({description: 'CrewAI Flow template to use', options: CREW_FLOW_TEMPLATES}),\n}\n","export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0');\n}","export type ChatTemplate = 'CopilotChat' | 'CopilotPopup' | 'CopilotSidebar'\n\nexport type StarterTemplate =\n | 'LangGraphPlatform'\n | 'RemoteEndpoint'\n | 'Standard'\n | 'CrewEnterprise'\n | 'CrewFlowsStarter'\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = 'https://registry.copilotkit.ai/r'\n\nexport const templateMapping = {\n // Runtimes\n RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,\n LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,\n\n // CrewAI\n CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],\n CrewFlowsStarter: [\n `${BASE_URL}/coagents-starter-ui.json`,\n `${BASE_URL}/agent-layout.json`,\n `${BASE_URL}/remote-endpoint.json`,\n ],\n\n // LangGraph\n LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,\n LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],\n\n // No Agent\n StandardStarter: `${BASE_URL}/standard-starter.json`,\n StandardRuntime: `${BASE_URL}/standard-runtime.json`,\n\n // MCP\n McpStarter: `${BASE_URL}/mcp-starter.json`,\n McpRuntime: `${BASE_URL}/mcp-starter-runtime.json`,\n}\n"],"mappings":";AAAA,SAAQ,SAAQ;AAChB,SAAS,aAAa;;;ACDf,IAAM,cAAc,CAAC,QAAyB;AACnD,SAAO,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,SAAS;AACzF;;;ADGO,IAAM,QAAQ,CAAC,aAAa,UAAU,UAAU,OAAO,OAAO,UAAU;AACxE,IAAM,aAAa,CAAC,SAAS,OAAO;AACpC,IAAM,kBAAkB,CAAC,eAAe,kBAAkB,YAAY,cAAc;AACpF,IAAM,mBAAmB,CAAC,kBAAkB,oBAAoB;AAChE,IAAM,sBAAsB,CAAC,SAAS;AACtC,IAAM,SAAS,CAAC,OAAO,IAAI;AAG3B,IAAM,aAAa;AAAA;AAAA,EAExB,KAAK,CAAC,UAA0B;AAC9B,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK,EAAE,QAAQ,QAAQ,EAAE;AAAA,EACxC;AAAA;AAAA,EAGA,MAAM,CAAC,UAA0B;AAC/B,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA;AAAA,EAGA,WAAW,CAAC,UAA0B;AACpC,QAAI,CAAC,MAAO,QAAO;AACnB,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kDAAkD,SAAS,OAAM,CAAC;AAAA,EAClH,mBAAmB,MAAM,OAAO,EAAC,aAAa,mCAAmC,SAAS,iBAAgB,CAAC;AAAA,EAC3G,aAAa,MAAM,OAAO,EAAC,aAAa,8BAA8B,SAAS,WAAU,CAAC;AAAA,EAC1F,aAAa,MAAM,OAAO,EAAC,aAAa,6BAA4B,CAAC;AAAA,EACrE,YAAY,MAAM,OAAO,EAAC,aAAa,qCAAoC,CAAC;AAAA,EAC5E,qBAAqB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACzF,qBAAqB,MAAM,OAAO,EAAC,aAAa,gDAA+C,CAAC;AAAA,EAChG,aAAa,MAAM,OAAO,EAAC,aAAa,0CAAyC,CAAC;AAAA,EAClF,mBAAmB,MAAM,OAAO,EAAC,aAAa,+BAA+B,SAAS,oBAAmB,CAAC;AAC5G;;;AEhJA,IAAM,WAAW;AAEV,IAAM,kBAAkB;AAAA;AAAA,EAE7B,gBAAgB,GAAG,QAAQ;AAAA,EAC3B,0BAA0B,GAAG,QAAQ;AAAA;AAAA,EAGrC,gBAAgB,CAAC,GAAG,QAAQ,6BAA6B;AAAA,EACzD,kBAAkB;AAAA,IAChB,GAAG,QAAQ;AAAA,IACX,GAAG,QAAQ;AAAA,IACX,GAAG,QAAQ;AAAA,EACb;AAAA;AAAA,EAGA,kBAAkB,GAAG,QAAQ;AAAA,EAC7B,kBAAkB,CAAC,GAAG,QAAQ,oCAAoC,GAAG,QAAQ,2BAA2B;AAAA;AAAA,EAGxG,iBAAiB,GAAG,QAAQ;AAAA,EAC5B,iBAAiB,GAAG,QAAQ;AAAA;AAAA,EAG5B,YAAY,GAAG,QAAQ;AAAA,EACvB,YAAY,GAAG,QAAQ;AACzB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/utils.ts","../../../../src/lib/init/types/templates.ts"],"sourcesContent":["import {z} from 'zod'\nimport {Flags} from '@oclif/core'\nimport {isLocalhost} from '../utils.js'\n\n// ===== Core Constants =====\nexport const MODES = ['LangGraph', 'CrewAI', 'Mastra', 'AG2', 'MCP', 'Standard'] as const\nexport const CREW_TYPES = ['Crews', 'Flows'] as const\nexport const CHAT_COMPONENTS = ['CopilotChat', 'CopilotSidebar', 'Headless', 'CopilotPopup'] as const\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter'] as const\nexport const CREW_FLOW_TEMPLATES = ['Starter'] as const\nexport const YES_NO = ['Yes', 'No'] as const\n\n// ===== Sanitizers =====\nexport const sanitizers = {\n // Remove trailing slash from URLs\n url: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\/+$/, '')\n },\n\n // Trim whitespace from strings\n trim: (value: string): string => {\n if (!value) return value\n return value.trim()\n },\n\n // Lowercase strings\n lowercase: (value: string): string => {\n if (!value) return value\n return value.toLowerCase().trim()\n },\n\n // Clean API keys (remove whitespace)\n apiKey: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\s/g, '')\n },\n}\n\n// ===== Zod Schemas =====\n\n// Basic schemas\nexport const ModeSchema = z.enum(MODES)\nexport const CrewTypeSchema = z.enum(CREW_TYPES)\nexport const ChatComponentSchema = z.enum(CHAT_COMPONENTS)\nexport const LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS)\nexport const CrewFlowTemplateSchema = z.enum(CREW_FLOW_TEMPLATES)\nexport const YesNoSchema = z.enum(YES_NO)\n\n// URL validation schema with preprocessing to remove trailing slash\nexport const UrlSchema = z.preprocess(\n (val) => sanitizers.url(String(val)),\n z.string().url('Please enter a valid URL').min(1, 'URL is required'),\n)\n\n// Token validation schema with preprocessing to trim\nexport const TokenSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Token is required'))\n\n// API key validation schema with preprocessing to remove whitespace\nexport const ApiKeySchema = z.preprocess(\n (val) => sanitizers.apiKey(String(val)),\n z.string().min(1, 'API key is required'),\n)\n\n// Name validation schema with preprocessing to trim\nexport const NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Name is required'))\n\n// Config schema\nexport const ConfigSchema = z\n .object({\n // Core fields\n copilotKitVersion: z.string().optional(),\n mode: ModeSchema,\n chatUi: ChatComponentSchema.optional(),\n\n // Yes/No fields\n alreadyDeployed: YesNoSchema.optional(),\n fastApiEnabled: YesNoSchema.optional(),\n useCopilotCloud: YesNoSchema.optional(),\n\n // LangGraph specific fields\n langGraphAgent: LangGraphAgentSchema.optional(),\n langGraphPlatform: YesNoSchema.optional(),\n langGraphPlatformUrl: UrlSchema.optional(),\n langGraphRemoteEndpointURL: UrlSchema.optional(),\n\n // CrewAI specific fields\n crewType: CrewTypeSchema.optional(),\n crewName: NameSchema.optional(),\n crewUrl: UrlSchema.optional(),\n crewBearerToken: TokenSchema.optional(),\n\n // API keys and tokens\n copilotCloudPublicApiKey: z.string().optional(),\n langSmithApiKey: ApiKeySchema.optional(),\n llmToken: ApiKeySchema.optional(),\n })\n .refine(\n (data) => {\n // If CrewAI is selected, require crew URL and bearer token\n if (data.mode === 'CrewAI') {\n return !!data.crewUrl && !!data.crewBearerToken\n }\n return true\n },\n {\n message: 'Crew URL and bearer token are required for CrewAI',\n path: ['crewUrl', 'crewBearerToken'],\n },\n )\n .refine(\n (data) => {\n // If LangGraph is selected with LangGraph Platform, require platform URL and LangSmith API key\n if (data.mode === 'LangGraph' && data.alreadyDeployed === 'Yes' && data.langGraphPlatform === 'Yes') {\n return (!!data.langGraphPlatformUrl && !!data.langSmithApiKey) || isLocalhost(data.langGraphPlatformUrl || '')\n }\n return true\n },\n {\n message: 'LangGraph Platform URL and LangSmith API key are required',\n path: ['langGraphPlatformUrl', 'langSmithApiKey'],\n },\n )\n\n// Export the inferred type from the schema\nexport type Config = z.infer<typeof ConfigSchema>\n\n// Question type definition with improved validation and sanitization\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: keyof Config\n message: string\n choices?: readonly string[]\n default?: string\n when?: (answers: Partial<Config>) => boolean\n sensitive?: boolean\n validate?: (input: string) => true | string // Return true if valid, error message string if invalid\n sanitize?: (input: string) => string // Function to sanitize input before validation\n}\n\n// CLI flags definition with descriptions\nexport const ConfigFlags = {\n booth: Flags.boolean({description: 'Use CopilotKit in booth mode', default: false, char: 'b'}),\n mode: Flags.string({description: 'How you will be interacting with AI', options: MODES, char: 'm'}),\n 'copilotkit-version': Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n 'use-copilot-cloud': Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: YES_NO}),\n 'langgraph-agent': Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n 'crew-type': Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n 'crew-name': Flags.string({description: 'Name for your CrewAI agent'}),\n 'crew-url': Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n 'crew-bearer-token': Flags.string({description: 'Bearer token for CrewAI authentication'}),\n 'langsmith-api-key': Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n 'llm-token': Flags.string({description: 'API key for your preferred LLM provider'}),\n}\n","export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0')\n}\n","export type ChatTemplate = 'CopilotChat' | 'CopilotPopup' | 'CopilotSidebar'\n\nexport type StarterTemplate =\n | 'LangGraphPlatform'\n | 'RemoteEndpoint'\n | 'Standard'\n | 'CrewEnterprise'\n | 'CrewFlowsStarter'\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = 'https://registry.copilotkit.ai/r'\n\nexport const templateMapping = {\n // Runtimes\n RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,\n LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,\n\n // CrewAI\n CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],\n CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],\n\n // LangGraph\n LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,\n LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],\n\n // No Agent\n StandardStarter: `${BASE_URL}/standard-starter.json`,\n StandardRuntime: `${BASE_URL}/standard-runtime.json`,\n\n // MCP\n McpStarter: `${BASE_URL}/mcp-starter.json`,\n McpRuntime: `${BASE_URL}/mcp-starter-runtime.json`,\n}\n"],"mappings":";AAAA,SAAQ,SAAQ;AAChB,SAAQ,aAAY;;;ACDb,IAAM,cAAc,CAAC,QAAyB;AACnD,SAAO,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,SAAS;AACzF;;;ADGO,IAAM,QAAQ,CAAC,aAAa,UAAU,UAAU,OAAO,OAAO,UAAU;AACxE,IAAM,aAAa,CAAC,SAAS,OAAO;AACpC,IAAM,kBAAkB,CAAC,eAAe,kBAAkB,YAAY,cAAc;AACpF,IAAM,mBAAmB,CAAC,kBAAkB,oBAAoB;AAChE,IAAM,sBAAsB,CAAC,SAAS;AACtC,IAAM,SAAS,CAAC,OAAO,IAAI;AAG3B,IAAM,aAAa;AAAA;AAAA,EAExB,KAAK,CAAC,UAA0B;AAC9B,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK,EAAE,QAAQ,QAAQ,EAAE;AAAA,EACxC;AAAA;AAAA,EAGA,MAAM,CAAC,UAA0B;AAC/B,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA;AAAA,EAGA,WAAW,CAAC,UAA0B;AACpC,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,YAAY,EAAE,KAAK;AAAA,EAClC;AAAA;AAAA,EAGA,QAAQ,CAAC,UAA0B;AACjC,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK,EAAE,QAAQ,OAAO,EAAE;AAAA,EACvC;AACF;AAKO,IAAM,aAAa,EAAE,KAAK,KAAK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C,aAAa,qCAAoC,CAAC;AAAA,EAC5E,qBAAqB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACzF,qBAAqB,MAAM,OAAO,EAAC,aAAa,gDAA+C,CAAC;AAAA,EAChG,aAAa,MAAM,OAAO,EAAC,aAAa,0CAAyC,CAAC;AACpF;;;AE9IA,IAAM,WAAW;AAEV,IAAM,kBAAkB;AAAA;AAAA,EAE7B,gBAAgB,GAAG,QAAQ;AAAA,EAC3B,0BAA0B,GAAG,QAAQ;AAAA;AAAA,EAGrC,gBAAgB,CAAC,GAAG,QAAQ,6BAA6B;AAAA,EACzD,qBAAqB,CAAC,GAAG,QAAQ,qCAAqC;AAAA;AAAA,EAGtE,kBAAkB,GAAG,QAAQ;AAAA,EAC7B,kBAAkB,CAAC,GAAG,QAAQ,oCAAoC,GAAG,QAAQ,2BAA2B;AAAA;AAAA,EAGxG,iBAAiB,GAAG,QAAQ;AAAA,EAC5B,iBAAiB,GAAG,QAAQ;AAAA;AAAA,EAG5B,YAAY,GAAG,QAAQ;AAAA,EACvB,YAAY,GAAG,QAAQ;AACzB;","names":[]}
|
|
@@ -38,7 +38,6 @@ declare const ConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
38
38
|
crewName: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
39
39
|
crewUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
40
40
|
crewBearerToken: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
41
|
-
crewFlowAgent: z.ZodOptional<z.ZodEnum<["Starter"]>>;
|
|
42
41
|
copilotCloudPublicApiKey: z.ZodOptional<z.ZodString>;
|
|
43
42
|
langSmithApiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
44
43
|
llmToken: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
@@ -57,7 +56,6 @@ declare const ConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
57
56
|
crewName?: string | undefined;
|
|
58
57
|
crewUrl?: string | undefined;
|
|
59
58
|
crewBearerToken?: string | undefined;
|
|
60
|
-
crewFlowAgent?: "Starter" | undefined;
|
|
61
59
|
copilotCloudPublicApiKey?: string | undefined;
|
|
62
60
|
langSmithApiKey?: string | undefined;
|
|
63
61
|
llmToken?: string | undefined;
|
|
@@ -76,7 +74,6 @@ declare const ConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
76
74
|
crewName?: unknown;
|
|
77
75
|
crewUrl?: unknown;
|
|
78
76
|
crewBearerToken?: unknown;
|
|
79
|
-
crewFlowAgent?: "Starter" | undefined;
|
|
80
77
|
copilotCloudPublicApiKey?: string | undefined;
|
|
81
78
|
langSmithApiKey?: unknown;
|
|
82
79
|
llmToken?: unknown;
|
|
@@ -95,7 +92,6 @@ declare const ConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
95
92
|
crewName?: string | undefined;
|
|
96
93
|
crewUrl?: string | undefined;
|
|
97
94
|
crewBearerToken?: string | undefined;
|
|
98
|
-
crewFlowAgent?: "Starter" | undefined;
|
|
99
95
|
copilotCloudPublicApiKey?: string | undefined;
|
|
100
96
|
langSmithApiKey?: string | undefined;
|
|
101
97
|
llmToken?: string | undefined;
|
|
@@ -114,7 +110,6 @@ declare const ConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
114
110
|
crewName?: unknown;
|
|
115
111
|
crewUrl?: unknown;
|
|
116
112
|
crewBearerToken?: unknown;
|
|
117
|
-
crewFlowAgent?: "Starter" | undefined;
|
|
118
113
|
copilotCloudPublicApiKey?: string | undefined;
|
|
119
114
|
langSmithApiKey?: unknown;
|
|
120
115
|
llmToken?: unknown;
|
|
@@ -133,7 +128,6 @@ declare const ConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
133
128
|
crewName?: string | undefined;
|
|
134
129
|
crewUrl?: string | undefined;
|
|
135
130
|
crewBearerToken?: string | undefined;
|
|
136
|
-
crewFlowAgent?: "Starter" | undefined;
|
|
137
131
|
copilotCloudPublicApiKey?: string | undefined;
|
|
138
132
|
langSmithApiKey?: string | undefined;
|
|
139
133
|
llmToken?: string | undefined;
|
|
@@ -152,7 +146,6 @@ declare const ConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
152
146
|
crewName?: unknown;
|
|
153
147
|
crewUrl?: unknown;
|
|
154
148
|
crewBearerToken?: unknown;
|
|
155
|
-
crewFlowAgent?: "Starter" | undefined;
|
|
156
149
|
copilotCloudPublicApiKey?: string | undefined;
|
|
157
150
|
langSmithApiKey?: unknown;
|
|
158
151
|
llmToken?: unknown;
|
|
@@ -181,7 +174,6 @@ declare const ConfigFlags: {
|
|
|
181
174
|
'crew-bearer-token': _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
182
175
|
'langsmith-api-key': _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
183
176
|
'llm-token': _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
184
|
-
'crew-flow-agent': _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
185
177
|
};
|
|
186
178
|
|
|
187
179
|
export { ApiKeySchema, CHAT_COMPONENTS, CREW_FLOW_TEMPLATES, CREW_TYPES, ChatComponentSchema, type Config, ConfigFlags, ConfigSchema, CrewFlowTemplateSchema, CrewTypeSchema, LANGGRAPH_AGENTS, LangGraphAgentSchema, MODES, ModeSchema, NameSchema, type Question, TokenSchema, UrlSchema, YES_NO, YesNoSchema, sanitizers };
|
|
@@ -71,20 +71,19 @@ var ConfigSchema = z.object({
|
|
|
71
71
|
crewName: NameSchema.optional(),
|
|
72
72
|
crewUrl: UrlSchema.optional(),
|
|
73
73
|
crewBearerToken: TokenSchema.optional(),
|
|
74
|
-
crewFlowAgent: CrewFlowTemplateSchema.optional(),
|
|
75
74
|
// API keys and tokens
|
|
76
75
|
copilotCloudPublicApiKey: z.string().optional(),
|
|
77
76
|
langSmithApiKey: ApiKeySchema.optional(),
|
|
78
77
|
llmToken: ApiKeySchema.optional()
|
|
79
78
|
}).refine(
|
|
80
79
|
(data) => {
|
|
81
|
-
if (data.mode === "CrewAI"
|
|
80
|
+
if (data.mode === "CrewAI") {
|
|
82
81
|
return !!data.crewUrl && !!data.crewBearerToken;
|
|
83
82
|
}
|
|
84
83
|
return true;
|
|
85
84
|
},
|
|
86
85
|
{
|
|
87
|
-
message: "Crew URL and bearer token are required for CrewAI
|
|
86
|
+
message: "Crew URL and bearer token are required for CrewAI",
|
|
88
87
|
path: ["crewUrl", "crewBearerToken"]
|
|
89
88
|
}
|
|
90
89
|
).refine(
|
|
@@ -110,8 +109,7 @@ var ConfigFlags = {
|
|
|
110
109
|
"crew-url": Flags.string({ description: "URL endpoint for your CrewAI agent" }),
|
|
111
110
|
"crew-bearer-token": Flags.string({ description: "Bearer token for CrewAI authentication" }),
|
|
112
111
|
"langsmith-api-key": Flags.string({ description: "LangSmith API key for LangGraph observability" }),
|
|
113
|
-
"llm-token": Flags.string({ description: "API key for your preferred LLM provider" })
|
|
114
|
-
"crew-flow-agent": Flags.string({ description: "CrewAI Flow template to use", options: CREW_FLOW_TEMPLATES })
|
|
112
|
+
"llm-token": Flags.string({ description: "API key for your preferred LLM provider" })
|
|
115
113
|
};
|
|
116
114
|
export {
|
|
117
115
|
ApiKeySchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/utils.ts"],"sourcesContent":["import {z} from 'zod'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/types/questions.ts","../../../../src/lib/init/utils.ts"],"sourcesContent":["import {z} from 'zod'\nimport {Flags} from '@oclif/core'\nimport {isLocalhost} from '../utils.js'\n\n// ===== Core Constants =====\nexport const MODES = ['LangGraph', 'CrewAI', 'Mastra', 'AG2', 'MCP', 'Standard'] as const\nexport const CREW_TYPES = ['Crews', 'Flows'] as const\nexport const CHAT_COMPONENTS = ['CopilotChat', 'CopilotSidebar', 'Headless', 'CopilotPopup'] as const\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter'] as const\nexport const CREW_FLOW_TEMPLATES = ['Starter'] as const\nexport const YES_NO = ['Yes', 'No'] as const\n\n// ===== Sanitizers =====\nexport const sanitizers = {\n // Remove trailing slash from URLs\n url: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\/+$/, '')\n },\n\n // Trim whitespace from strings\n trim: (value: string): string => {\n if (!value) return value\n return value.trim()\n },\n\n // Lowercase strings\n lowercase: (value: string): string => {\n if (!value) return value\n return value.toLowerCase().trim()\n },\n\n // Clean API keys (remove whitespace)\n apiKey: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\s/g, '')\n },\n}\n\n// ===== Zod Schemas =====\n\n// Basic schemas\nexport const ModeSchema = z.enum(MODES)\nexport const CrewTypeSchema = z.enum(CREW_TYPES)\nexport const ChatComponentSchema = z.enum(CHAT_COMPONENTS)\nexport const LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS)\nexport const CrewFlowTemplateSchema = z.enum(CREW_FLOW_TEMPLATES)\nexport const YesNoSchema = z.enum(YES_NO)\n\n// URL validation schema with preprocessing to remove trailing slash\nexport const UrlSchema = z.preprocess(\n (val) => sanitizers.url(String(val)),\n z.string().url('Please enter a valid URL').min(1, 'URL is required'),\n)\n\n// Token validation schema with preprocessing to trim\nexport const TokenSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Token is required'))\n\n// API key validation schema with preprocessing to remove whitespace\nexport const ApiKeySchema = z.preprocess(\n (val) => sanitizers.apiKey(String(val)),\n z.string().min(1, 'API key is required'),\n)\n\n// Name validation schema with preprocessing to trim\nexport const NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Name is required'))\n\n// Config schema\nexport const ConfigSchema = z\n .object({\n // Core fields\n copilotKitVersion: z.string().optional(),\n mode: ModeSchema,\n chatUi: ChatComponentSchema.optional(),\n\n // Yes/No fields\n alreadyDeployed: YesNoSchema.optional(),\n fastApiEnabled: YesNoSchema.optional(),\n useCopilotCloud: YesNoSchema.optional(),\n\n // LangGraph specific fields\n langGraphAgent: LangGraphAgentSchema.optional(),\n langGraphPlatform: YesNoSchema.optional(),\n langGraphPlatformUrl: UrlSchema.optional(),\n langGraphRemoteEndpointURL: UrlSchema.optional(),\n\n // CrewAI specific fields\n crewType: CrewTypeSchema.optional(),\n crewName: NameSchema.optional(),\n crewUrl: UrlSchema.optional(),\n crewBearerToken: TokenSchema.optional(),\n\n // API keys and tokens\n copilotCloudPublicApiKey: z.string().optional(),\n langSmithApiKey: ApiKeySchema.optional(),\n llmToken: ApiKeySchema.optional(),\n })\n .refine(\n (data) => {\n // If CrewAI is selected, require crew URL and bearer token\n if (data.mode === 'CrewAI') {\n return !!data.crewUrl && !!data.crewBearerToken\n }\n return true\n },\n {\n message: 'Crew URL and bearer token are required for CrewAI',\n path: ['crewUrl', 'crewBearerToken'],\n },\n )\n .refine(\n (data) => {\n // If LangGraph is selected with LangGraph Platform, require platform URL and LangSmith API key\n if (data.mode === 'LangGraph' && data.alreadyDeployed === 'Yes' && data.langGraphPlatform === 'Yes') {\n return (!!data.langGraphPlatformUrl && !!data.langSmithApiKey) || isLocalhost(data.langGraphPlatformUrl || '')\n }\n return true\n },\n {\n message: 'LangGraph Platform URL and LangSmith API key are required',\n path: ['langGraphPlatformUrl', 'langSmithApiKey'],\n },\n )\n\n// Export the inferred type from the schema\nexport type Config = z.infer<typeof ConfigSchema>\n\n// Question type definition with improved validation and sanitization\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: keyof Config\n message: string\n choices?: readonly string[]\n default?: string\n when?: (answers: Partial<Config>) => boolean\n sensitive?: boolean\n validate?: (input: string) => true | string // Return true if valid, error message string if invalid\n sanitize?: (input: string) => string // Function to sanitize input before validation\n}\n\n// CLI flags definition with descriptions\nexport const ConfigFlags = {\n booth: Flags.boolean({description: 'Use CopilotKit in booth mode', default: false, char: 'b'}),\n mode: Flags.string({description: 'How you will be interacting with AI', options: MODES, char: 'm'}),\n 'copilotkit-version': Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n 'use-copilot-cloud': Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: YES_NO}),\n 'langgraph-agent': Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n 'crew-type': Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n 'crew-name': Flags.string({description: 'Name for your CrewAI agent'}),\n 'crew-url': Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n 'crew-bearer-token': Flags.string({description: 'Bearer token for CrewAI authentication'}),\n 'langsmith-api-key': Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n 'llm-token': Flags.string({description: 'API key for your preferred LLM provider'}),\n}\n","export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0')\n}\n"],"mappings":";AAAA,SAAQ,SAAQ;AAChB,SAAQ,aAAY;;;ACDb,IAAM,cAAc,CAAC,QAAyB;AACnD,SAAO,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,SAAS;AACzF;;;ADGO,IAAM,QAAQ,CAAC,aAAa,UAAU,UAAU,OAAO,OAAO,UAAU;AACxE,IAAM,aAAa,CAAC,SAAS,OAAO;AACpC,IAAM,kBAAkB,CAAC,eAAe,kBAAkB,YAAY,cAAc;AACpF,IAAM,mBAAmB,CAAC,kBAAkB,oBAAoB;AAChE,IAAM,sBAAsB,CAAC,SAAS;AACtC,IAAM,SAAS,CAAC,OAAO,IAAI;AAG3B,IAAM,aAAa;AAAA;AAAA,EAExB,KAAK,CAAC,UAA0B;AAC9B,QAAI,CAAC,MAAO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IAAG,CAAC;AAAA,EAC7F,MAAM,MAAM,OAAO,EAAC,aAAa,uCAAuC,SAAS,OAAO,MAAM,IAAG,CAAC;AAAA,EAClG,sBAAsB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EAC1F,qBAAqB,MAAM,OAAO,EAAC,aAAa,kDAAkD,SAAS,OAAM,CAAC;AAAA,EAClH,mBAAmB,MAAM,OAAO,EAAC,aAAa,mCAAmC,SAAS,iBAAgB,CAAC;AAAA,EAC3G,aAAa,MAAM,OAAO,EAAC,aAAa,8BAA8B,SAAS,WAAU,CAAC;AAAA,EAC1F,aAAa,MAAM,OAAO,EAAC,aAAa,6BAA4B,CAAC;AAAA,EACrE,YAAY,MAAM,OAAO,EAAC,aAAa,qCAAoC,CAAC;AAAA,EAC5E,qBAAqB,MAAM,OAAO,EAAC,aAAa,yCAAwC,CAAC;AAAA,EACzF,qBAAqB,MAAM,OAAO,EAAC,aAAa,gDAA+C,CAAC;AAAA,EAChG,aAAa,MAAM,OAAO,EAAC,aAAa,0CAAyC,CAAC;AACpF;","names":[]}
|
|
@@ -5,7 +5,7 @@ declare const templateMapping: {
|
|
|
5
5
|
RemoteEndpoint: string;
|
|
6
6
|
LangGraphPlatformRuntime: string;
|
|
7
7
|
CrewEnterprise: string[];
|
|
8
|
-
|
|
8
|
+
CrewFlowsEnterprise: string[];
|
|
9
9
|
LangGraphGeneric: string;
|
|
10
10
|
LangGraphStarter: string[];
|
|
11
11
|
StandardStarter: string;
|
|
@@ -6,11 +6,7 @@ var templateMapping = {
|
|
|
6
6
|
LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,
|
|
7
7
|
// CrewAI
|
|
8
8
|
CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],
|
|
9
|
-
|
|
10
|
-
`${BASE_URL}/coagents-starter-ui.json`,
|
|
11
|
-
`${BASE_URL}/agent-layout.json`,
|
|
12
|
-
`${BASE_URL}/remote-endpoint.json`
|
|
13
|
-
],
|
|
9
|
+
CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],
|
|
14
10
|
// LangGraph
|
|
15
11
|
LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,
|
|
16
12
|
LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/init/types/templates.ts"],"sourcesContent":["export type ChatTemplate = 'CopilotChat' | 'CopilotPopup' | 'CopilotSidebar'\n\nexport type StarterTemplate =\n | 'LangGraphPlatform'\n | 'RemoteEndpoint'\n | 'Standard'\n | 'CrewEnterprise'\n | 'CrewFlowsStarter'\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = 'https://registry.copilotkit.ai/r'\n\nexport const templateMapping = {\n // Runtimes\n RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,\n LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,\n\n // CrewAI\n CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/init/types/templates.ts"],"sourcesContent":["export type ChatTemplate = 'CopilotChat' | 'CopilotPopup' | 'CopilotSidebar'\n\nexport type StarterTemplate =\n | 'LangGraphPlatform'\n | 'RemoteEndpoint'\n | 'Standard'\n | 'CrewEnterprise'\n | 'CrewFlowsStarter'\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = 'https://registry.copilotkit.ai/r'\n\nexport const templateMapping = {\n // Runtimes\n RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,\n LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,\n\n // CrewAI\n CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],\n CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],\n\n // LangGraph\n LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,\n LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],\n\n // No Agent\n StandardStarter: `${BASE_URL}/standard-starter.json`,\n StandardRuntime: `${BASE_URL}/standard-runtime.json`,\n\n // MCP\n McpStarter: `${BASE_URL}/mcp-starter.json`,\n McpRuntime: `${BASE_URL}/mcp-starter-runtime.json`,\n}\n"],"mappings":";AAWA,IAAM,WAAW;AAEV,IAAM,kBAAkB;AAAA;AAAA,EAE7B,gBAAgB,GAAG,QAAQ;AAAA,EAC3B,0BAA0B,GAAG,QAAQ;AAAA;AAAA,EAGrC,gBAAgB,CAAC,GAAG,QAAQ,6BAA6B;AAAA,EACzD,qBAAqB,CAAC,GAAG,QAAQ,qCAAqC;AAAA;AAAA,EAGtE,kBAAkB,GAAG,QAAQ;AAAA,EAC7B,kBAAkB,CAAC,GAAG,QAAQ,oCAAoC,GAAG,QAAQ,2BAA2B;AAAA;AAAA,EAGxG,iBAAiB,GAAG,QAAQ;AAAA,EAC5B,iBAAiB,GAAG,QAAQ;AAAA;AAAA,EAG5B,YAAY,GAAG,QAAQ;AAAA,EACvB,YAAY,GAAG,QAAQ;AACzB;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/init/utils.ts"],"sourcesContent":["export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0')
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/init/utils.ts"],"sourcesContent":["export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0')\n}\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,QAAyB;AACnD,SAAO,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,SAAS;AACzF;","names":[]}
|
|
@@ -5,7 +5,7 @@ declare enum RemoteEndpointType {
|
|
|
5
5
|
MCP = "MCP",
|
|
6
6
|
Invalid = "Invalid"
|
|
7
7
|
}
|
|
8
|
-
declare const getHumanReadableEndpointType: (type: RemoteEndpointType) => "
|
|
8
|
+
declare const getHumanReadableEndpointType: (type: RemoteEndpointType) => "CopilotKit" | "CrewAI" | "MCP" | "Invalid" | "LangGraph Platform";
|
|
9
9
|
declare function detectRemoteEndpointType(url: string): Promise<{
|
|
10
10
|
url: string;
|
|
11
11
|
type: RemoteEndpointType;
|
package/dist/utils/version.d.ts
CHANGED
package/dist/utils/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/version.ts"],"sourcesContent":["// This is auto generated!\nexport const LIB_VERSION = \"0.0.
|
|
1
|
+
{"version":3,"sources":["../../src/utils/version.ts"],"sourcesContent":["// This is auto generated!\nexport const LIB_VERSION = \"0.0.36\";\n"],"mappings":";AACO,IAAM,cAAc;","names":[]}
|
package/oclif.manifest.json
CHANGED
|
@@ -163,16 +163,6 @@
|
|
|
163
163
|
"multiple": false,
|
|
164
164
|
"type": "option"
|
|
165
165
|
},
|
|
166
|
-
"crew-flow-agent": {
|
|
167
|
-
"description": "CrewAI Flow template to use",
|
|
168
|
-
"name": "crew-flow-agent",
|
|
169
|
-
"hasDynamicHelp": false,
|
|
170
|
-
"multiple": false,
|
|
171
|
-
"options": [
|
|
172
|
-
"Starter"
|
|
173
|
-
],
|
|
174
|
-
"type": "option"
|
|
175
|
-
},
|
|
176
166
|
"runtimeUrl": {
|
|
177
167
|
"description": "runtime URL",
|
|
178
168
|
"name": "runtimeUrl",
|
|
@@ -255,5 +245,5 @@
|
|
|
255
245
|
]
|
|
256
246
|
}
|
|
257
247
|
},
|
|
258
|
-
"version": "0.0.
|
|
248
|
+
"version": "0.0.36"
|
|
259
249
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copilotkit",
|
|
3
3
|
"description": "CopilotKit CLI",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.36",
|
|
5
5
|
"author": "CopilotKit",
|
|
6
6
|
"bin": {
|
|
7
7
|
"copilotkit": "./bin/run.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"generate-manifest": "oclif manifest",
|
|
18
18
|
"prepare": "pnpm run build && pnpm run generate-manifest",
|
|
19
19
|
"prepublishOnly": "pnpm run build && pnpm run generate-manifest",
|
|
20
|
-
"test": "
|
|
20
|
+
"test": "jest",
|
|
21
21
|
"version": "oclif readme && git add README.md",
|
|
22
22
|
"validate": "node validate-package.js"
|
|
23
23
|
},
|
|
@@ -44,12 +44,14 @@
|
|
|
44
44
|
"zod": "^3.22.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
+
"@jest/globals": "30.0.0-beta.3",
|
|
47
48
|
"@oclif/prettier-config": "^0.2.1",
|
|
48
49
|
"@oclif/test": "^4",
|
|
49
50
|
"@types/chai": "^4.3.20",
|
|
50
51
|
"@types/cors": "^2.8.17",
|
|
51
52
|
"@types/cross-spawn": "^6.0.6",
|
|
52
53
|
"@types/express": "^5.0.0",
|
|
54
|
+
"@types/jest": "^29.5.2",
|
|
53
55
|
"@types/localtunnel": "^2.0.4",
|
|
54
56
|
"@types/mocha": "^10",
|
|
55
57
|
"@types/node": "^18",
|
|
@@ -60,11 +62,13 @@
|
|
|
60
62
|
"eslint-config-oclif": "^5",
|
|
61
63
|
"eslint-config-oclif-typescript": "^3",
|
|
62
64
|
"eslint-config-prettier": "^9",
|
|
65
|
+
"jest": "^29.5.0",
|
|
63
66
|
"mocha": "^10",
|
|
64
67
|
"oclif": "^4",
|
|
65
68
|
"shx": "^0.3.3",
|
|
66
69
|
"sinon": "^19.0.2",
|
|
67
70
|
"sinon-chai": "^4.0.0",
|
|
71
|
+
"ts-jest": "^29.1.0",
|
|
68
72
|
"ts-node": "^10",
|
|
69
73
|
"tsup": "^8.0.2",
|
|
70
74
|
"typescript": "^5"
|