copilotkit 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +89779 -0
- package/package.json +4 -108
- package/src/commands/docs.d.ts +17 -0
- package/src/commands/docs.d.ts.map +1 -0
- package/src/commands/init.d.ts +103 -0
- package/src/commands/init.d.ts.map +1 -0
- package/src/commands/kite.d.ts +8 -0
- package/src/commands/kite.d.ts.map +1 -0
- package/src/commands/license.d.ts +17 -0
- package/src/commands/license.d.ts.map +1 -0
- package/src/commands/login.d.ts +13 -0
- package/src/commands/login.d.ts.map +1 -0
- package/src/commands/logs.d.ts +32 -0
- package/src/commands/logs.d.ts.map +1 -0
- package/src/commands/version.d.ts +8 -0
- package/src/commands/version.d.ts.map +1 -0
- package/src/config.d.ts +31 -0
- package/src/config.d.ts.map +1 -0
- package/src/index.d.ts +21 -0
- package/src/index.d.ts.map +1 -0
- package/src/services/api-client.d.ts +106 -0
- package/src/services/api-client.d.ts.map +1 -0
- package/src/services/auth.service.d.ts +107 -0
- package/src/services/auth.service.d.ts.map +1 -0
- package/src/services/cli-auth-diagnostics.d.ts +71 -0
- package/src/services/cli-auth-diagnostics.d.ts.map +1 -0
- package/src/services/cli-logs.d.ts +45 -0
- package/src/services/cli-logs.d.ts.map +1 -0
- package/src/services/config.service.d.ts +53 -0
- package/src/services/config.service.d.ts.map +1 -0
- package/src/services/feature-flags.d.ts +14 -0
- package/src/services/feature-flags.d.ts.map +1 -0
- package/src/services/kite-game-engine.d.ts +99 -0
- package/src/services/kite-game-engine.d.ts.map +1 -0
- package/src/services/kite-game-score.d.ts +33 -0
- package/src/services/kite-game-score.d.ts.map +1 -0
- package/src/services/project-scaffold.d.ts +49 -0
- package/src/services/project-scaffold.d.ts.map +1 -0
- package/src/types.d.ts +205 -0
- package/src/types.d.ts.map +1 -0
- package/src/ui/banner.d.ts +3 -0
- package/src/ui/banner.d.ts.map +1 -0
- package/src/ui/browser-login.d.ts +71 -0
- package/src/ui/browser-login.d.ts.map +1 -0
- package/src/ui/init-flow.d.ts +35 -0
- package/src/ui/init-flow.d.ts.map +1 -0
- package/src/ui/kite-game.d.ts +26 -0
- package/src/ui/kite-game.d.ts.map +1 -0
- package/src/ui/login-flow.d.ts +22 -0
- package/src/ui/login-flow.d.ts.map +1 -0
- package/src/ui/spinner.d.ts +9 -0
- package/src/ui/spinner.d.ts.map +1 -0
- package/LICENSE +0 -21
- package/README.md +0 -83
- package/bin/dev.cmd +0 -3
- package/bin/dev.js +0 -8
- package/bin/run.cmd +0 -3
- package/bin/run.js +0 -17
- package/dist/commands/base-command.d.ts +0 -12
- package/dist/commands/base-command.js +0 -65
- package/dist/commands/base-command.js.map +0 -1
- package/dist/commands/create.d.ts +0 -27
- package/dist/commands/create.js +0 -710
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -25
- package/dist/commands/dev.js +0 -776
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/init.d.ts +0 -11
- package/dist/commands/init.js +0 -726
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/login.d.ts +0 -13
- package/dist/commands/login.js +0 -374
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -13
- package/dist/commands/logout.js +0 -375
- package/dist/commands/logout.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/lib/init/ide-docs.d.ts +0 -25
- package/dist/lib/init/ide-docs.js +0 -170
- package/dist/lib/init/ide-docs.js.map +0 -1
- package/dist/lib/init/index.d.ts +0 -14
- package/dist/lib/init/index.js +0 -1106
- package/dist/lib/init/index.js.map +0 -1
- package/dist/lib/init/questions.d.ts +0 -9
- package/dist/lib/init/questions.js +0 -508
- package/dist/lib/init/questions.js.map +0 -1
- package/dist/lib/init/scaffold/agent.d.ts +0 -20
- package/dist/lib/init/scaffold/agent.js +0 -173
- package/dist/lib/init/scaffold/agent.js.map +0 -1
- package/dist/lib/init/scaffold/crew-inputs.d.ts +0 -3
- package/dist/lib/init/scaffold/crew-inputs.js +0 -59
- package/dist/lib/init/scaffold/crew-inputs.js.map +0 -1
- package/dist/lib/init/scaffold/env.d.ts +0 -7
- package/dist/lib/init/scaffold/env.js +0 -126
- package/dist/lib/init/scaffold/env.js.map +0 -1
- package/dist/lib/init/scaffold/github.d.ts +0 -17
- package/dist/lib/init/scaffold/github.js +0 -114
- package/dist/lib/init/scaffold/github.js.map +0 -1
- package/dist/lib/init/scaffold/index.d.ts +0 -10
- package/dist/lib/init/scaffold/index.js +0 -692
- package/dist/lib/init/scaffold/index.js.map +0 -1
- package/dist/lib/init/scaffold/langgraph-assistants.d.ts +0 -18
- package/dist/lib/init/scaffold/langgraph-assistants.js +0 -28
- package/dist/lib/init/scaffold/langgraph-assistants.js.map +0 -1
- package/dist/lib/init/scaffold/packages.d.ts +0 -7
- package/dist/lib/init/scaffold/packages.js +0 -62
- package/dist/lib/init/scaffold/packages.js.map +0 -1
- package/dist/lib/init/scaffold/shadcn.d.ts +0 -7
- package/dist/lib/init/scaffold/shadcn.js +0 -279
- package/dist/lib/init/scaffold/shadcn.js.map +0 -1
- package/dist/lib/init/types/index.d.ts +0 -4
- package/dist/lib/init/types/index.js +0 -238
- package/dist/lib/init/types/index.js.map +0 -1
- package/dist/lib/init/types/questions.d.ts +0 -209
- package/dist/lib/init/types/questions.js +0 -214
- package/dist/lib/init/types/questions.js.map +0 -1
- package/dist/lib/init/types/templates.d.ts +0 -17
- package/dist/lib/init/types/templates.js +0 -26
- package/dist/lib/init/types/templates.js.map +0 -1
- package/dist/lib/init/utils.d.ts +0 -3
- package/dist/lib/init/utils.js +0 -8
- package/dist/lib/init/utils.js.map +0 -1
- package/dist/services/analytics.service.d.ts +0 -38
- package/dist/services/analytics.service.js +0 -134
- package/dist/services/analytics.service.js.map +0 -1
- package/dist/services/auth.service.d.ts +0 -26
- package/dist/services/auth.service.js +0 -299
- package/dist/services/auth.service.js.map +0 -1
- package/dist/services/events.d.ts +0 -119
- package/dist/services/events.js +0 -1
- package/dist/services/events.js.map +0 -1
- package/dist/services/tunnel.service.d.ts +0 -15
- package/dist/services/tunnel.service.js +0 -21
- package/dist/services/tunnel.service.js.map +0 -1
- package/dist/utils/detect-endpoint-type.utils.d.ts +0 -15
- package/dist/utils/detect-endpoint-type.utils.js +0 -157
- package/dist/utils/detect-endpoint-type.utils.js.map +0 -1
- package/dist/utils/trpc.d.ts +0 -4
- package/dist/utils/trpc.js +0 -25
- package/dist/utils/trpc.js.map +0 -1
- package/dist/utils/version.d.ts +0 -3
- package/dist/utils/version.js +0 -6
- package/dist/utils/version.js.map +0 -1
- package/oclif.manifest.json +0 -216
package/dist/commands/create.js
DELETED
|
@@ -1,710 +0,0 @@
|
|
|
1
|
-
// src/commands/create.ts
|
|
2
|
-
import { Flags, Args } from "@oclif/core";
|
|
3
|
-
import inquirer from "inquirer";
|
|
4
|
-
import chalk3 from "chalk";
|
|
5
|
-
import fs2 from "fs-extra";
|
|
6
|
-
import path2 from "path";
|
|
7
|
-
import { promisify } from "util";
|
|
8
|
-
import { pipeline } from "stream";
|
|
9
|
-
import { createWriteStream } from "fs";
|
|
10
|
-
import { extract } from "tar";
|
|
11
|
-
import ora from "ora";
|
|
12
|
-
|
|
13
|
-
// src/commands/base-command.ts
|
|
14
|
-
import { Command } from "@oclif/core";
|
|
15
|
-
import Sentry, { consoleIntegration } from "@sentry/node";
|
|
16
|
-
|
|
17
|
-
// src/utils/version.ts
|
|
18
|
-
var LIB_VERSION = "1.0.2";
|
|
19
|
-
|
|
20
|
-
// src/utils/trpc.ts
|
|
21
|
-
import { createTRPCClient as trpcClient, httpBatchLink } from "@trpc/client";
|
|
22
|
-
import superjson from "superjson";
|
|
23
|
-
var COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || "https://cloud.copilotkit.ai";
|
|
24
|
-
|
|
25
|
-
// src/commands/base-command.ts
|
|
26
|
-
import chalk from "chalk";
|
|
27
|
-
var BaseCommand = class extends Command {
|
|
28
|
-
async init() {
|
|
29
|
-
await this.checkCLIVersion();
|
|
30
|
-
if (process.env.SENTRY_DISABLED === "true") {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
Sentry.init({
|
|
34
|
-
dsn: process.env.SENTRY_DSN || "https://1eea15d32e2eacb0456a77db5e39aeeb@o4507288195170304.ingest.us.sentry.io/4508581448581120",
|
|
35
|
-
integrations: [consoleIntegration()],
|
|
36
|
-
// Tracing
|
|
37
|
-
tracesSampleRate: 1
|
|
38
|
-
// Capture 100% of the transactions
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async catch(err) {
|
|
42
|
-
if (process.env.SENTRY_DISABLED !== "true") {
|
|
43
|
-
Sentry.captureException(err);
|
|
44
|
-
}
|
|
45
|
-
const message = err?.message ?? "Unknown error";
|
|
46
|
-
this.log("\n" + chalk.red(message) + "\n");
|
|
47
|
-
const exitCode = err?.oclif?.exit ?? 1;
|
|
48
|
-
this.exit(exitCode);
|
|
49
|
-
}
|
|
50
|
-
async finally() {
|
|
51
|
-
if (process.env.SENTRY_DISABLED === "true") {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
Sentry.close();
|
|
55
|
-
}
|
|
56
|
-
async run() {
|
|
57
|
-
}
|
|
58
|
-
async checkCLIVersion() {
|
|
59
|
-
try {
|
|
60
|
-
const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`);
|
|
61
|
-
const data = await response.json();
|
|
62
|
-
const cloudVersion = data.cliVersion;
|
|
63
|
-
if (!cloudVersion || cloudVersion === LIB_VERSION) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
} catch {
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async gracefulError(message) {
|
|
70
|
-
this.log("\n" + chalk.red(message));
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// src/lib/init/scaffold/github.ts
|
|
76
|
-
import { execSync } from "child_process";
|
|
77
|
-
import * as fs from "fs";
|
|
78
|
-
import * as path from "path";
|
|
79
|
-
import * as os from "os";
|
|
80
|
-
import chalk2 from "chalk";
|
|
81
|
-
async function cloneGitHubSubdirectory(githubUrl, destinationPath, spinner) {
|
|
82
|
-
try {
|
|
83
|
-
const { owner, repo, branch, subdirectoryPath } = parseGitHubUrl(githubUrl);
|
|
84
|
-
spinner.text = chalk2.cyan(`Cloning from ${owner}/${repo}...`);
|
|
85
|
-
return await sparseCheckout(
|
|
86
|
-
owner,
|
|
87
|
-
repo,
|
|
88
|
-
branch,
|
|
89
|
-
subdirectoryPath,
|
|
90
|
-
destinationPath,
|
|
91
|
-
spinner
|
|
92
|
-
);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
spinner.text = chalk2.red(`Failed to clone from GitHub: ${error}`);
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
async function sparseCheckout(owner, repo, branch, subdirectoryPath, destinationPath, spinner) {
|
|
99
|
-
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "copilotkit-sparse-"));
|
|
100
|
-
try {
|
|
101
|
-
spinner.text = chalk2.cyan("Creating temporary workspace...");
|
|
102
|
-
execSync("git init", { cwd: tempDir, stdio: "pipe" });
|
|
103
|
-
spinner.text = chalk2.cyan("Connecting to repository...");
|
|
104
|
-
execSync(`git remote add origin https://github.com/${owner}/${repo}.git`, {
|
|
105
|
-
cwd: tempDir,
|
|
106
|
-
stdio: "pipe"
|
|
107
|
-
});
|
|
108
|
-
execSync("git config core.sparseCheckout true", {
|
|
109
|
-
cwd: tempDir,
|
|
110
|
-
stdio: "pipe"
|
|
111
|
-
});
|
|
112
|
-
fs.writeFileSync(
|
|
113
|
-
path.join(tempDir, ".git/info/sparse-checkout"),
|
|
114
|
-
subdirectoryPath
|
|
115
|
-
);
|
|
116
|
-
spinner.text = chalk2.cyan("Downloading agent files...");
|
|
117
|
-
execSync(`git pull origin ${branch} --depth=1`, {
|
|
118
|
-
cwd: tempDir,
|
|
119
|
-
stdio: "pipe"
|
|
120
|
-
});
|
|
121
|
-
const sourcePath = path.join(tempDir, subdirectoryPath);
|
|
122
|
-
if (!fs.existsSync(sourcePath)) {
|
|
123
|
-
throw new Error(
|
|
124
|
-
`Subdirectory '${subdirectoryPath}' not found in the repository.`
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
fs.mkdirSync(destinationPath, { recursive: true });
|
|
128
|
-
spinner.text = chalk2.cyan("Installing agent files...");
|
|
129
|
-
await copyDirectoryAsync(sourcePath, destinationPath);
|
|
130
|
-
return true;
|
|
131
|
-
} finally {
|
|
132
|
-
try {
|
|
133
|
-
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
134
|
-
} catch (error) {
|
|
135
|
-
console.warn(`Failed to clean up temporary directory: ${error}`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
async function copyDirectoryAsync(source, destination) {
|
|
140
|
-
if (!fs.existsSync(destination)) {
|
|
141
|
-
fs.mkdirSync(destination, { recursive: true });
|
|
142
|
-
}
|
|
143
|
-
const entries = fs.readdirSync(source, { withFileTypes: true });
|
|
144
|
-
for (const entry of entries) {
|
|
145
|
-
const srcPath = path.join(source, entry.name);
|
|
146
|
-
const destPath = path.join(destination, entry.name);
|
|
147
|
-
if (entry.isDirectory()) {
|
|
148
|
-
await copyDirectoryAsync(srcPath, destPath);
|
|
149
|
-
} else {
|
|
150
|
-
fs.copyFileSync(srcPath, destPath);
|
|
151
|
-
}
|
|
152
|
-
if (entries.length > 10) {
|
|
153
|
-
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function parseGitHubUrl(githubUrl) {
|
|
158
|
-
const url = new URL(githubUrl);
|
|
159
|
-
if (url.hostname !== "github.com") {
|
|
160
|
-
throw new Error("Only GitHub URLs are supported");
|
|
161
|
-
}
|
|
162
|
-
const pathParts = url.pathname.split("/").filter(Boolean);
|
|
163
|
-
if (pathParts.length < 2) {
|
|
164
|
-
throw new Error("Invalid GitHub URL format");
|
|
165
|
-
}
|
|
166
|
-
const owner = pathParts[0];
|
|
167
|
-
const repo = pathParts[1];
|
|
168
|
-
let branch = "main";
|
|
169
|
-
let subdirectoryPath = "";
|
|
170
|
-
if (pathParts.length > 3 && (pathParts[2] === "tree" || pathParts[2] === "blob")) {
|
|
171
|
-
branch = pathParts[3];
|
|
172
|
-
subdirectoryPath = pathParts.slice(4).join("/");
|
|
173
|
-
}
|
|
174
|
-
return { owner, repo, branch, subdirectoryPath };
|
|
175
|
-
}
|
|
176
|
-
function isValidGitHubUrl(url) {
|
|
177
|
-
try {
|
|
178
|
-
const parsedUrl = new URL(url);
|
|
179
|
-
return parsedUrl.hostname === "github.com" && parsedUrl.pathname.split("/").filter(Boolean).length >= 2;
|
|
180
|
-
} catch {
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// src/commands/create.ts
|
|
186
|
-
var streamPipeline = promisify(pipeline);
|
|
187
|
-
var theme = {
|
|
188
|
-
primary: chalk3.magenta,
|
|
189
|
-
secondary: chalk3.gray,
|
|
190
|
-
tertiary: chalk3.gray,
|
|
191
|
-
error: chalk3.red,
|
|
192
|
-
command: chalk3.blue,
|
|
193
|
-
success: chalk3.green,
|
|
194
|
-
warning: chalk3.yellow,
|
|
195
|
-
divider: chalk3.gray("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),
|
|
196
|
-
bottomPadding: ""
|
|
197
|
-
};
|
|
198
|
-
var TEMPLATE_REPOS = {
|
|
199
|
-
"langgraph-py": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-python",
|
|
200
|
-
"langgraph-js": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-js",
|
|
201
|
-
mastra: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/mastra",
|
|
202
|
-
flows: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/crewai-flows",
|
|
203
|
-
llamaindex: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/llamaindex",
|
|
204
|
-
agno: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/agno",
|
|
205
|
-
"pydantic-ai": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/pydantic-ai",
|
|
206
|
-
ag2: "ag2ai/ag2-copilotkit-starter",
|
|
207
|
-
adk: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/adk",
|
|
208
|
-
"aws-strands-py": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/strands-python",
|
|
209
|
-
a2a: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/a2a-middleware",
|
|
210
|
-
"microsoft-agent-framework-dotnet": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/ms-agent-framework-dotnet",
|
|
211
|
-
"microsoft-agent-framework-py": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/ms-agent-framework-python",
|
|
212
|
-
"mcp-apps": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/mcp-apps",
|
|
213
|
-
"agentcore-langgraph": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/agentcore",
|
|
214
|
-
"agentcore-strands": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/agentcore",
|
|
215
|
-
a2ui: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-python",
|
|
216
|
-
opengenui: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-python"
|
|
217
|
-
};
|
|
218
|
-
var FRAMEWORK_DOCUMENTATION = {
|
|
219
|
-
"langgraph-py": "https://langchain-ai.github.io/langgraph/concepts/why-langgraph",
|
|
220
|
-
"langgraph-js": "https://langchain-ai.github.io/langgraphjs",
|
|
221
|
-
flows: "https://docs.crewai.com/guides/flows/first-flow",
|
|
222
|
-
mastra: "https://mastra.ai/en/docs",
|
|
223
|
-
"pydantic-ai": "https://ai.pydantic.dev/ag-ui/",
|
|
224
|
-
llamaindex: "https://docs.llamaindex.ai/en/stable",
|
|
225
|
-
agno: "https://docs.agno.com/",
|
|
226
|
-
ag2: "https://docs.ag2.ai/latest/docs/user-guide/basic-concepts/overview",
|
|
227
|
-
adk: "https://google.github.io/adk-docs/",
|
|
228
|
-
"aws-strands-py": "https://strandsagents.com/latest/documentation/docs/",
|
|
229
|
-
a2a: "https://a2a-protocol.org/latest/",
|
|
230
|
-
"microsoft-agent-framework-dotnet": "https://learn.microsoft.com/en-us/agent-framework/",
|
|
231
|
-
"microsoft-agent-framework-py": "https://learn.microsoft.com/en-us/agent-framework/",
|
|
232
|
-
"mcp-apps": "https://modelcontextprotocol.github.io/ext-apps",
|
|
233
|
-
"agentcore-langgraph": "https://docs.copilotkit.ai/agentcore/quickstart",
|
|
234
|
-
"agentcore-strands": "https://docs.copilotkit.ai/agentcore/quickstart",
|
|
235
|
-
a2ui: "https://a2ui.org/specification/",
|
|
236
|
-
opengenui: "https://docs.copilotkit.ai"
|
|
237
|
-
};
|
|
238
|
-
var FRAMEWORK_EMOJI = {
|
|
239
|
-
"langgraph-js": "\u{1F99C}",
|
|
240
|
-
"langgraph-py": "\u{1F99C}",
|
|
241
|
-
flows: "\u{1F465}",
|
|
242
|
-
mastra: "\u{1F311}",
|
|
243
|
-
"pydantic-ai": "\u{1F53C}",
|
|
244
|
-
llamaindex: "\u{1F999}",
|
|
245
|
-
ag2: "\u{1F916}",
|
|
246
|
-
agno: "\u{1F170}\uFE0F",
|
|
247
|
-
adk: "\u{1F916}",
|
|
248
|
-
a2a: "\u{1F916}",
|
|
249
|
-
"aws-strands-py": "\u{1F9EC}",
|
|
250
|
-
"microsoft-agent-framework-dotnet": "\u{1F7E6}",
|
|
251
|
-
"microsoft-agent-framework-py": "\u{1F7E6}",
|
|
252
|
-
"mcp-apps": "\u264D",
|
|
253
|
-
"agentcore-langgraph": "\u2601\uFE0F",
|
|
254
|
-
"agentcore-strands": "\u2601\uFE0F",
|
|
255
|
-
a2ui: "\u{1F3A8}",
|
|
256
|
-
opengenui: "\u{1F5BC}\uFE0F"
|
|
257
|
-
};
|
|
258
|
-
var KITE = `
|
|
259
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
260
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u281F\u2819\u28FF\u285B\u283B\u283F\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
261
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u280B\u2800\u2800\u2808\u28BF\u2844\u2800\u2800\u2800\u2808\u2809\u2819\u28FB\u28FF\u28FF\u28FF
|
|
262
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u281F\u2801\u2800\u2800\u2800\u2800\u2808\u28BF\u2844\u2800\u2880\u28E0\u28F4\u283E\u280B\u28B8\u28FF\u28FF
|
|
263
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u285F\u2801\u2880\u28C0\u28C0\u28C0\u28C0\u28E4\u28E4\u287E\u28BF\u285F\u281B\u2809\u2800\u2800\u2800\u2800\u28FF\u28FF
|
|
264
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u285B\u281B\u281B\u281B\u2809\u2809\u2809\u2801\u2800\u28A0\u287F\u28FF\u2840\u2800\u2800\u2800\u2800\u2800\u28FF\u28FF
|
|
265
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28C6\u2800\u2800\u2800\u2800\u2800\u2800\u28F0\u285F\u2800\u2838\u28E7\u2800\u2800\u2800\u2800\u28A0\u28FF\u28FF
|
|
266
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28F7\u28C4\u2800\u2800\u2880\u28FC\u280F\u2800\u2800\u2800\u28FF\u2840\u2800\u2800\u2800\u28B8\u28FF\u28FF
|
|
267
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u2802\u28E0\u287F\u2801\u2800\u2800\u2800\u2800\u28B8\u2847\u2800\u2800\u2800\u28FF\u28FF\u28FF
|
|
268
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u281F\u28E1\u28FE\u28FF\u28C4\u2800\u2800\u2800\u2800\u2800\u28B8\u2847\u2800\u2800\u28B0\u28FF\u28FF\u28FF
|
|
269
|
-
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u285F\u281B\u287F\u280B\u28E1\u28FE\u28FF\u28FF\u28FF\u28FF\u28E6\u2840\u2800\u2800\u2800\u28B8\u2847\u2800\u2800\u28FF\u28FF\u28FF\u28FF
|
|
270
|
-
\u28FF\u28FF\u28FF\u28FF\u287F\u283F\u28FF\u2837\u2802\u2840\u2818\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28F7\u2840\u2800\u2800\u28B8\u2847\u2800\u28FC\u28FF\u28FF\u28FF\u28FF
|
|
271
|
-
\u28FF\u28FF\u283B\u28BF\u2877\u2800\u2801\u2834\u28FF\u28F7\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u2844\u2800\u28FE\u2807\u28F4\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
272
|
-
\u287F\u281B\u2800\u2800\u28B4\u28FE\u28F7\u28F6\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28E4\u28FF\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
273
|
-
\u28F7\u28FE\u28FF\u28E4\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
274
|
-
`;
|
|
275
|
-
var Create = class _Create extends BaseCommand {
|
|
276
|
-
static description = "Create a new CopilotKit project";
|
|
277
|
-
static examples = [
|
|
278
|
-
"$ copilotkit create my-app",
|
|
279
|
-
"$ copilotkit create my-app --framework langgraph-js",
|
|
280
|
-
"$ copilotkit create -n my-app -f langgraph-js"
|
|
281
|
-
];
|
|
282
|
-
static flags = {
|
|
283
|
-
...BaseCommand.flags,
|
|
284
|
-
framework: Flags.string({
|
|
285
|
-
char: "f",
|
|
286
|
-
description: "Agent framework to use",
|
|
287
|
-
options: Object.keys(TEMPLATE_REPOS),
|
|
288
|
-
required: false
|
|
289
|
-
}),
|
|
290
|
-
name: Flags.string({
|
|
291
|
-
char: "n",
|
|
292
|
-
description: "Name of the project",
|
|
293
|
-
required: false
|
|
294
|
-
}),
|
|
295
|
-
"no-banner": Flags.boolean({
|
|
296
|
-
char: "q",
|
|
297
|
-
description: "Removes the banner",
|
|
298
|
-
default: false,
|
|
299
|
-
required: false
|
|
300
|
-
}),
|
|
301
|
-
project: Flags.string({
|
|
302
|
-
description: "project ID (deprecated, kept for backwards compatibility)"
|
|
303
|
-
})
|
|
304
|
-
};
|
|
305
|
-
static args = {
|
|
306
|
-
projectName: Args.string({
|
|
307
|
-
description: "Name of the project",
|
|
308
|
-
required: false
|
|
309
|
-
})
|
|
310
|
-
};
|
|
311
|
-
constructor(argv, config) {
|
|
312
|
-
super(argv, config);
|
|
313
|
-
}
|
|
314
|
-
async run() {
|
|
315
|
-
const { args, flags } = await this.parse(_Create);
|
|
316
|
-
if (!flags["no-banner"]) {
|
|
317
|
-
this.log(theme.primary(KITE));
|
|
318
|
-
this.log(theme.primary("~ Welcome to CopilotKit! ~\n"));
|
|
319
|
-
this.log(theme.divider);
|
|
320
|
-
if (!flags.name && !args.projectName && !flags.framework) {
|
|
321
|
-
this.log(
|
|
322
|
-
"\n" + theme.secondary("Just a few questions to get started!\n")
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
const projectNameInput = flags.name || args.projectName || await this.promptProjectName();
|
|
327
|
-
const projectName = projectNameInput.trim();
|
|
328
|
-
const usingCurrentDir = projectName === "." || projectName === "./";
|
|
329
|
-
const agentFramework = flags.framework || await this.promptAgentFramework();
|
|
330
|
-
const projectDir = usingCurrentDir ? process.cwd() : path2.resolve(process.cwd(), projectName);
|
|
331
|
-
if (usingCurrentDir) {
|
|
332
|
-
const allowedEntries = /* @__PURE__ */ new Set([".git", ".gitignore", ".DS_Store"]);
|
|
333
|
-
const existingEntries = await fs2.readdir(projectDir);
|
|
334
|
-
const blockingEntries = existingEntries.filter(
|
|
335
|
-
(entry) => !allowedEntries.has(entry)
|
|
336
|
-
);
|
|
337
|
-
if (blockingEntries.length > 0) {
|
|
338
|
-
this.log(theme.error("\nCurrent directory is not empty."));
|
|
339
|
-
this.log(
|
|
340
|
-
theme.secondary(
|
|
341
|
-
"\nPlease run create in an empty directory or specify a new project name."
|
|
342
|
-
)
|
|
343
|
-
);
|
|
344
|
-
this.exit(1);
|
|
345
|
-
}
|
|
346
|
-
} else if (await fs2.pathExists(projectDir)) {
|
|
347
|
-
this.log(theme.error(`
|
|
348
|
-
Directory "${projectName}" already exists.`));
|
|
349
|
-
this.log(theme.secondary("\nYou can:"));
|
|
350
|
-
this.log(theme.secondary(" 1. Choose a different project name"));
|
|
351
|
-
this.log(
|
|
352
|
-
theme.secondary(
|
|
353
|
-
" 2. Remove the existing directory manually if you want to use this name\n"
|
|
354
|
-
)
|
|
355
|
-
);
|
|
356
|
-
this.exit(1);
|
|
357
|
-
}
|
|
358
|
-
const options = {
|
|
359
|
-
projectName,
|
|
360
|
-
agentFramework
|
|
361
|
-
};
|
|
362
|
-
const spinner = ora({
|
|
363
|
-
text: theme.secondary.bold("Creating your project..."),
|
|
364
|
-
color: "cyan",
|
|
365
|
-
spinner: "dots"
|
|
366
|
-
}).start();
|
|
367
|
-
try {
|
|
368
|
-
await fs2.ensureDir(projectDir);
|
|
369
|
-
spinner.text = theme.secondary.bold("Downloading template...");
|
|
370
|
-
await this.downloadTemplate(projectDir, options.agentFramework, spinner);
|
|
371
|
-
await this.applyShowcaseConfig(projectDir, options.agentFramework);
|
|
372
|
-
if (options.agentFramework === "agentcore-langgraph" || options.agentFramework === "agentcore-strands") {
|
|
373
|
-
spinner.text = theme.secondary.bold("Configuring AgentCore...");
|
|
374
|
-
await this.configureAgentCore(projectDir, options.agentFramework);
|
|
375
|
-
}
|
|
376
|
-
const displayName = usingCurrentDir ? "current directory" : `"${projectName}"`;
|
|
377
|
-
spinner.succeed(
|
|
378
|
-
theme.secondary.bold(`Project ${displayName} created successfully!`)
|
|
379
|
-
);
|
|
380
|
-
} catch (error) {
|
|
381
|
-
spinner.fail(theme.error(`Failed to create project: ${error.message}`));
|
|
382
|
-
this.exit(1);
|
|
383
|
-
}
|
|
384
|
-
this.log("\n" + theme.divider);
|
|
385
|
-
this.log(
|
|
386
|
-
"\n" + theme.secondary.bold(
|
|
387
|
-
`\u{1FA81}\u{1F91D}${FRAMEWORK_EMOJI[options.agentFramework]} All set!
|
|
388
|
-
|
|
389
|
-
Your project is ready to explore CopilotKit locally.`
|
|
390
|
-
)
|
|
391
|
-
);
|
|
392
|
-
this.log("\n" + theme.secondary("Next steps:"));
|
|
393
|
-
if (usingCurrentDir) {
|
|
394
|
-
this.log(
|
|
395
|
-
theme.secondary(
|
|
396
|
-
" \u2022 You are already inside your new project directory"
|
|
397
|
-
)
|
|
398
|
-
);
|
|
399
|
-
} else {
|
|
400
|
-
this.log(theme.secondary(` \u2022 ${theme.command(`cd ${projectName}`)}`));
|
|
401
|
-
}
|
|
402
|
-
this.log(
|
|
403
|
-
theme.secondary(" \u2022 Follow the setup instructions in the README.md")
|
|
404
|
-
);
|
|
405
|
-
this.log("\n" + theme.secondary("Documentation:"));
|
|
406
|
-
this.log(
|
|
407
|
-
theme.secondary(" \u2022 ") + theme.command("https://docs.copilotkit.ai")
|
|
408
|
-
);
|
|
409
|
-
this.log(
|
|
410
|
-
theme.secondary(" \u2022 ") + theme.command(FRAMEWORK_DOCUMENTATION[options.agentFramework])
|
|
411
|
-
);
|
|
412
|
-
this.log(theme.bottomPadding);
|
|
413
|
-
}
|
|
414
|
-
async promptProjectName() {
|
|
415
|
-
const { projectName } = await inquirer.prompt([
|
|
416
|
-
{
|
|
417
|
-
type: "input",
|
|
418
|
-
name: "projectName",
|
|
419
|
-
message: theme.secondary("What is your project named?"),
|
|
420
|
-
validate: (input) => {
|
|
421
|
-
if (!input) return theme.error("Project name is required");
|
|
422
|
-
if (!/^[a-z0-9-]+$/.test(input)) {
|
|
423
|
-
return theme.error(
|
|
424
|
-
"Project name can only contain lowercase letters, numbers, and hyphens"
|
|
425
|
-
);
|
|
426
|
-
}
|
|
427
|
-
if (input.length > 30) {
|
|
428
|
-
return theme.error("Project name must be less than 30 characters");
|
|
429
|
-
}
|
|
430
|
-
return true;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
]);
|
|
434
|
-
return projectName;
|
|
435
|
-
}
|
|
436
|
-
async promptAgentFramework() {
|
|
437
|
-
const { framework } = await inquirer.prompt([
|
|
438
|
-
{
|
|
439
|
-
type: "list",
|
|
440
|
-
name: "framework",
|
|
441
|
-
message: theme.secondary(
|
|
442
|
-
"Which agent framework would you like to use?"
|
|
443
|
-
),
|
|
444
|
-
choices: [
|
|
445
|
-
{
|
|
446
|
-
name: `${FRAMEWORK_EMOJI["langgraph-py"]} LangGraph (Python)`,
|
|
447
|
-
value: "langgraph-py"
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
name: `${FRAMEWORK_EMOJI["langgraph-js"]} LangGraph (JavaScript)`,
|
|
451
|
-
value: "langgraph-js"
|
|
452
|
-
},
|
|
453
|
-
{ name: `${FRAMEWORK_EMOJI.mastra} Mastra`, value: "mastra" },
|
|
454
|
-
{
|
|
455
|
-
name: `${FRAMEWORK_EMOJI["pydantic-ai"]} Pydantic AI`,
|
|
456
|
-
value: "pydantic-ai"
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
name: `${FRAMEWORK_EMOJI["aws-strands-py"]} AWS Strands (Python)`,
|
|
460
|
-
value: "aws-strands-py"
|
|
461
|
-
},
|
|
462
|
-
{ name: `${FRAMEWORK_EMOJI.adk} ADK`, value: "adk" },
|
|
463
|
-
{
|
|
464
|
-
name: `${FRAMEWORK_EMOJI["microsoft-agent-framework-dotnet"]} Microsoft Agent Framework (.NET)`,
|
|
465
|
-
value: "microsoft-agent-framework-dotnet"
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
name: `${FRAMEWORK_EMOJI["microsoft-agent-framework-py"]} Microsoft Agent Framework (Python)`,
|
|
469
|
-
value: "microsoft-agent-framework-py"
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
name: `${FRAMEWORK_EMOJI["mcp-apps"]} MCP Apps`,
|
|
473
|
-
value: "mcp-apps"
|
|
474
|
-
},
|
|
475
|
-
{ name: `${FRAMEWORK_EMOJI.flows} CrewAI Flows`, value: "flows" },
|
|
476
|
-
{
|
|
477
|
-
name: `${FRAMEWORK_EMOJI.llamaindex} LlamaIndex`,
|
|
478
|
-
value: "llamaindex"
|
|
479
|
-
},
|
|
480
|
-
{ name: `${FRAMEWORK_EMOJI.agno} Agno`, value: "agno" },
|
|
481
|
-
{ name: `${FRAMEWORK_EMOJI.ag2} AG2`, value: "ag2" },
|
|
482
|
-
{ name: `${FRAMEWORK_EMOJI.a2a} A2A`, value: "a2a" },
|
|
483
|
-
{
|
|
484
|
-
name: `${FRAMEWORK_EMOJI["agentcore-langgraph"]} AgentCore + LangGraph`,
|
|
485
|
-
value: "agentcore-langgraph"
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
name: `${FRAMEWORK_EMOJI["agentcore-strands"]} AgentCore + Strands`,
|
|
489
|
-
value: "agentcore-strands"
|
|
490
|
-
},
|
|
491
|
-
{ name: `${FRAMEWORK_EMOJI.a2ui} A2UI`, value: "a2ui" },
|
|
492
|
-
{
|
|
493
|
-
name: `${FRAMEWORK_EMOJI.opengenui} Open Generative UI`,
|
|
494
|
-
value: "opengenui"
|
|
495
|
-
}
|
|
496
|
-
]
|
|
497
|
-
}
|
|
498
|
-
]);
|
|
499
|
-
return framework;
|
|
500
|
-
}
|
|
501
|
-
async configureAgentCore(projectDir, framework) {
|
|
502
|
-
const pattern = framework === "agentcore-langgraph" ? "langgraph-single-agent" : "strands-single-agent";
|
|
503
|
-
const suffix = framework === "agentcore-langgraph" ? "-lg" : "-st";
|
|
504
|
-
const examplePath = path2.join(projectDir, "config.yaml.example");
|
|
505
|
-
const configPath = path2.join(projectDir, "config.yaml");
|
|
506
|
-
if (!await fs2.pathExists(examplePath)) {
|
|
507
|
-
throw new Error(
|
|
508
|
-
`config.yaml.example not found in the AgentCore template at "${projectDir}". The downloaded template may be incomplete. Please try again.`
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
let content = await fs2.readFile(examplePath, "utf-8");
|
|
512
|
-
const patternRegex = /^(\s*pattern:\s*)\S+(.*)$/m;
|
|
513
|
-
const stackRegex = /^(\s*stack_name_base:\s*)\S+(.*)$/m;
|
|
514
|
-
if (!patternRegex.test(content) || !stackRegex.test(content)) {
|
|
515
|
-
throw new Error(
|
|
516
|
-
`Unexpected config.yaml.example format in the AgentCore template. Expected "pattern:" and "stack_name_base:" keys. Please try again or report this issue at https://github.com/CopilotKit/CopilotKit/issues`
|
|
517
|
-
);
|
|
518
|
-
}
|
|
519
|
-
content = content.replace(patternRegex, `$1${pattern}$2`);
|
|
520
|
-
content = content.replace(
|
|
521
|
-
stackRegex,
|
|
522
|
-
`$1my-copilotkit-agentcore${suffix}$2`
|
|
523
|
-
);
|
|
524
|
-
await fs2.writeFile(configPath, content, "utf-8");
|
|
525
|
-
const isLanggraph = framework === "agentcore-langgraph";
|
|
526
|
-
const removeAgent = isLanggraph ? "strands-single-agent" : "langgraph-single-agent";
|
|
527
|
-
const removeScript = isLanggraph ? "deploy-strands.sh" : "deploy-langgraph.sh";
|
|
528
|
-
const keepScript = isLanggraph ? "deploy-langgraph.sh" : "deploy-strands.sh";
|
|
529
|
-
await Promise.all([
|
|
530
|
-
fs2.remove(path2.join(projectDir, "agents", removeAgent)),
|
|
531
|
-
fs2.remove(path2.join(projectDir, removeScript)),
|
|
532
|
-
fs2.remove(path2.join(projectDir, "infra-terraform"))
|
|
533
|
-
]);
|
|
534
|
-
const keepScriptPath = path2.join(projectDir, keepScript);
|
|
535
|
-
if (await fs2.pathExists(keepScriptPath)) {
|
|
536
|
-
await fs2.move(keepScriptPath, path2.join(projectDir, "deploy.sh"));
|
|
537
|
-
}
|
|
538
|
-
const deployShPath = path2.join(projectDir, "deploy.sh");
|
|
539
|
-
if (await fs2.pathExists(deployShPath)) {
|
|
540
|
-
let deployContent = await fs2.readFile(deployShPath, "utf-8");
|
|
541
|
-
deployContent = deployContent.replace(/\(isolated from deploy-(?:langgraph|strands)\.sh\)\s*/g, "").replace(/# Using Terraform instead\?.*\n/g, "");
|
|
542
|
-
await fs2.writeFile(deployShPath, deployContent, "utf-8");
|
|
543
|
-
}
|
|
544
|
-
const configYamlPath = path2.join(projectDir, "config.yaml");
|
|
545
|
-
if (await fs2.pathExists(configYamlPath)) {
|
|
546
|
-
let configContent = await fs2.readFile(configYamlPath, "utf-8");
|
|
547
|
-
configContent = configContent.replace(
|
|
548
|
-
/# overwritten by deploy-langgraph\.sh \/ deploy-strands\.sh/g,
|
|
549
|
-
"# set by the CLI \u2014 do not change"
|
|
550
|
-
);
|
|
551
|
-
await fs2.writeFile(configYamlPath, configContent, "utf-8");
|
|
552
|
-
}
|
|
553
|
-
const agentShortName = isLanggraph ? "langgraph" : "strands";
|
|
554
|
-
const otherShortName = isLanggraph ? "strands" : "langgraph";
|
|
555
|
-
for (const relPath of ["docker/docker-compose.yml", "docker/up.sh"]) {
|
|
556
|
-
const filePath = path2.join(projectDir, relPath);
|
|
557
|
-
if (await fs2.pathExists(filePath)) {
|
|
558
|
-
let fileContent = await fs2.readFile(filePath, "utf-8");
|
|
559
|
-
fileContent = fileContent.replaceAll(
|
|
560
|
-
`AGENT:-${otherShortName}`,
|
|
561
|
-
`AGENT:-${agentShortName}`
|
|
562
|
-
);
|
|
563
|
-
fileContent = fileContent.replaceAll(
|
|
564
|
-
`echo "${otherShortName}"`,
|
|
565
|
-
`echo "${agentShortName}"`
|
|
566
|
-
);
|
|
567
|
-
await fs2.writeFile(filePath, fileContent, "utf-8");
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
const resolveEnvPath = path2.join(projectDir, "docker/resolve-env.py");
|
|
571
|
-
if (await fs2.pathExists(resolveEnvPath)) {
|
|
572
|
-
let resolveContent = await fs2.readFile(resolveEnvPath, "utf-8");
|
|
573
|
-
resolveContent = resolveContent.replaceAll(
|
|
574
|
-
`os.environ.get("AGENT", "${otherShortName}")`,
|
|
575
|
-
`os.environ.get("AGENT", "${agentShortName}")`
|
|
576
|
-
);
|
|
577
|
-
await fs2.writeFile(resolveEnvPath, resolveContent, "utf-8");
|
|
578
|
-
}
|
|
579
|
-
const frameworkLabel = isLanggraph ? "LangGraph" : "Strands";
|
|
580
|
-
const stackSuffix = isLanggraph ? "lg" : "st";
|
|
581
|
-
const agentFolder = isLanggraph ? "langgraph-single-agent" : "strands-single-agent";
|
|
582
|
-
const readme = `# CopilotKit + AWS AgentCore (${frameworkLabel})
|
|
583
|
-
|
|
584
|
-
Chat UI with generative charts, shared-state todo canvas, and inline tool rendering \u2014 deployed on AWS Bedrock AgentCore.
|
|
585
|
-
|
|
586
|
-
## Prerequisites
|
|
587
|
-
|
|
588
|
-
| Tool | Version |
|
|
589
|
-
| ------- | ---------------------------- |
|
|
590
|
-
| AWS CLI | configured (\`aws configure\`) |
|
|
591
|
-
| Node.js | 18+ |
|
|
592
|
-
| Python | 3.8+ |
|
|
593
|
-
| Docker | running |
|
|
594
|
-
|
|
595
|
-
## Deploy
|
|
596
|
-
|
|
597
|
-
1. **Edit \`config.yaml\`** \u2014 set \`stack_name_base\` and \`admin_user_email\`
|
|
598
|
-
|
|
599
|
-
2. **Deploy:**
|
|
600
|
-
|
|
601
|
-
\`\`\`bash
|
|
602
|
-
./deploy.sh # full deploy (infra + frontend)
|
|
603
|
-
./deploy.sh --skip-frontend # infra/agent only
|
|
604
|
-
./deploy.sh --skip-backend # frontend only
|
|
605
|
-
\`\`\`
|
|
606
|
-
|
|
607
|
-
3. **Open** the Amplify URL printed at the end. Sign in with your email.
|
|
608
|
-
|
|
609
|
-
## Local Development
|
|
610
|
-
|
|
611
|
-
\`\`\`bash
|
|
612
|
-
cd docker
|
|
613
|
-
cp .env.example .env
|
|
614
|
-
# Fill in AWS creds \u2014 STACK_NAME, MEMORY_ID, and aws-exports.json are auto-resolved
|
|
615
|
-
./up.sh --build
|
|
616
|
-
\`\`\`
|
|
617
|
-
|
|
618
|
-
- **Frontend** \u2192 hot reloads on save
|
|
619
|
-
- **Agent** \u2192 rebuild on changes: \`docker compose up --build agent\`
|
|
620
|
-
- **Browser** \u2192 \`http://localhost:3000\`
|
|
621
|
-
|
|
622
|
-
The full chain runs locally: \`browser:3000 \u2192 bridge:3001 \u2192 agent:8080\`. AWS is only used for Memory and Gateway.
|
|
623
|
-
|
|
624
|
-
## What's inside
|
|
625
|
-
|
|
626
|
-
| Piece | What it does |
|
|
627
|
-
| ------------------------------ | ---------------------------------------------------------- |
|
|
628
|
-
| \`frontend/\` | Vite + React with CopilotKit chat, charts, todo canvas |
|
|
629
|
-
| \`agents/${agentFolder}/\` | ${frameworkLabel} agent with tools + shared todo state |
|
|
630
|
-
| \`infra-cdk/\` | CDK: Cognito, AgentCore, CopilotKit Lambda, Amplify |
|
|
631
|
-
| \`docker/\` | Local dev via Docker Compose |
|
|
632
|
-
|
|
633
|
-
## Tear down
|
|
634
|
-
|
|
635
|
-
\`\`\`bash
|
|
636
|
-
cd infra-cdk && npx cdk@latest destroy --all --output ../cdk.out-${stackSuffix}
|
|
637
|
-
\`\`\`
|
|
638
|
-
|
|
639
|
-
## Docs
|
|
640
|
-
|
|
641
|
-
- [CopilotKit](https://docs.copilotkit.ai)
|
|
642
|
-
- [AWS Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/)
|
|
643
|
-
- [AgentCore + CopilotKit Guide](https://docs.copilotkit.ai/agentcore/quickstart)
|
|
644
|
-
`;
|
|
645
|
-
await fs2.writeFile(path2.join(projectDir, "README.md"), readme, "utf-8");
|
|
646
|
-
}
|
|
647
|
-
async downloadTemplate(projectDir, framework, spinner) {
|
|
648
|
-
const templateRef = TEMPLATE_REPOS[framework];
|
|
649
|
-
if (templateRef.startsWith("/")) {
|
|
650
|
-
const EXCLUDE = [
|
|
651
|
-
"node_modules",
|
|
652
|
-
"cdk.out",
|
|
653
|
-
".git",
|
|
654
|
-
"__pycache__",
|
|
655
|
-
".venv"
|
|
656
|
-
];
|
|
657
|
-
await fs2.copy(templateRef, projectDir, {
|
|
658
|
-
filter: (src) => !EXCLUDE.some(
|
|
659
|
-
(ex) => src.split("/").includes(ex) || src.includes(`/${ex}`)
|
|
660
|
-
)
|
|
661
|
-
});
|
|
662
|
-
return;
|
|
663
|
-
}
|
|
664
|
-
if (isValidGitHubUrl(templateRef)) {
|
|
665
|
-
const success = await cloneGitHubSubdirectory(
|
|
666
|
-
templateRef,
|
|
667
|
-
projectDir,
|
|
668
|
-
spinner
|
|
669
|
-
);
|
|
670
|
-
if (!success) {
|
|
671
|
-
throw new Error(`Failed to clone template from ${templateRef}`);
|
|
672
|
-
}
|
|
673
|
-
return;
|
|
674
|
-
}
|
|
675
|
-
const url = `https://github.com/${templateRef}/archive/refs/heads/main.tar.gz`;
|
|
676
|
-
try {
|
|
677
|
-
const response = await fetch(url);
|
|
678
|
-
if (!response.ok)
|
|
679
|
-
throw new Error(`Failed to download template: ${response.statusText}`);
|
|
680
|
-
const tempFile = path2.join(projectDir, "template.tar.gz");
|
|
681
|
-
const fileStream = createWriteStream(tempFile);
|
|
682
|
-
if (!response.body) throw new Error("Failed to get response body");
|
|
683
|
-
await streamPipeline(response.body, fileStream);
|
|
684
|
-
await extract({
|
|
685
|
-
file: tempFile,
|
|
686
|
-
cwd: projectDir,
|
|
687
|
-
strip: 1
|
|
688
|
-
});
|
|
689
|
-
await fs2.remove(tempFile);
|
|
690
|
-
} catch (error) {
|
|
691
|
-
throw new Error(`Failed to download template: ${error.message}`, {
|
|
692
|
-
cause: error
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
static SHOWCASE_FRAMEWORKS = {
|
|
697
|
-
a2ui: "a2ui",
|
|
698
|
-
opengenui: "opengenui"
|
|
699
|
-
};
|
|
700
|
-
async applyShowcaseConfig(projectDir, framework) {
|
|
701
|
-
const showcase = _Create.SHOWCASE_FRAMEWORKS[framework];
|
|
702
|
-
if (!showcase) return;
|
|
703
|
-
const configPath = path2.join(projectDir, "showcase.json");
|
|
704
|
-
await fs2.writeJSON(configPath, { showcase });
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
|
-
export {
|
|
708
|
-
Create as default
|
|
709
|
-
};
|
|
710
|
-
//# sourceMappingURL=create.js.map
|