@elizaos/cli 1.2.4 → 1.2.7
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/bun-exec-KJOLGZOL.js +21 -0
- package/dist/{chunk-2XI6N7KN.js → chunk-2ZF5OAMV.js} +322 -69
- package/dist/chunk-3YTIOEFK.js +202 -0
- package/dist/chunk-AQ6OMR2A.js +14 -0
- package/dist/{chunk-JZG5QBNT.js → chunk-E54G6FI7.js} +32 -6
- package/dist/{chunk-PSSTO76B.js → chunk-KKAK7OQA.js} +100 -104
- package/dist/chunk-Y5IA2UZ2.js +154 -0
- package/dist/commands/agent/actions/index.js +4 -3
- package/dist/commands/agent/index.js +4 -3
- package/dist/commands/create/actions/index.d.ts +6 -2
- package/dist/commands/create/actions/index.js +8 -7
- package/dist/commands/create/index.js +6 -6
- package/dist/commands/shared/index.js +1 -1
- package/dist/index.js +323 -258
- package/dist/{plugin-creator-5CER524N.js → plugin-creator-Y2NWASXI.js} +16 -15
- package/dist/{registry-SN5V2VXR.js → registry-K2OCCRXO.js} +4 -3
- package/dist/templates/plugin-quick-starter/README.md +214 -0
- package/dist/templates/plugin-quick-starter/bunfig.toml +10 -0
- package/dist/templates/plugin-quick-starter/package.json +76 -0
- package/dist/templates/plugin-quick-starter/scripts/install-test-deps.js +53 -0
- package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +209 -0
- package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +162 -0
- package/dist/templates/plugin-quick-starter/src/index.ts +4 -0
- package/dist/templates/plugin-quick-starter/src/plugin.ts +272 -0
- package/dist/templates/plugin-quick-starter/tsconfig.build.json +11 -0
- package/dist/templates/plugin-quick-starter/tsconfig.json +28 -0
- package/dist/templates/plugin-quick-starter/tsup.config.ts +20 -0
- package/dist/templates/plugin-starter/package.json +2 -2
- package/dist/templates/plugin-starter/scripts/install-test-deps.js +7 -3
- package/dist/templates/plugin-starter/src/__tests__/build-order.test.ts +51 -0
- package/dist/templates/plugin-starter/src/__tests__/vite-config-utils.ts +33 -0
- package/dist/templates/plugin-starter/src/plugin.ts +13 -15
- package/dist/templates/plugin-starter/tsup.config.ts +1 -1
- package/dist/templates/plugin-starter/vite.config.ts +1 -1
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-starter/scripts/install-test-deps.js +7 -3
- package/dist/templates/project-starter/src/__tests__/build-order.test.ts +59 -0
- package/dist/templates/project-starter/src/__tests__/character-plugin-ordering.test.ts +11 -110
- package/dist/templates/project-starter/src/__tests__/vite-config-utils.ts +33 -0
- package/dist/templates/project-starter/src/character.ts +14 -17
- package/dist/templates/project-starter/tsup.config.ts +1 -1
- package/dist/templates/project-tee-starter/package.json +3 -3
- package/dist/templates/project-tee-starter/src/character.ts +3 -0
- package/dist/{utils-DTW3XU6O.js → utils-QSRUVLAT.js} +4 -3
- package/package.json +6 -6
- package/templates/plugin-quick-starter/README.md +214 -0
- package/templates/plugin-quick-starter/bunfig.toml +10 -0
- package/templates/plugin-quick-starter/package.json +76 -0
- package/templates/plugin-quick-starter/scripts/install-test-deps.js +53 -0
- package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +209 -0
- package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +162 -0
- package/templates/plugin-quick-starter/src/index.ts +4 -0
- package/templates/plugin-quick-starter/src/plugin.ts +272 -0
- package/templates/plugin-quick-starter/tsconfig.build.json +11 -0
- package/templates/plugin-quick-starter/tsconfig.json +28 -0
- package/templates/plugin-quick-starter/tsup.config.ts +20 -0
- package/templates/plugin-starter/package.json +2 -2
- package/templates/plugin-starter/scripts/install-test-deps.js +7 -3
- package/templates/plugin-starter/src/__tests__/build-order.test.ts +51 -0
- package/templates/plugin-starter/src/__tests__/vite-config-utils.ts +33 -0
- package/templates/plugin-starter/src/plugin.ts +13 -15
- package/templates/plugin-starter/tsup.config.ts +1 -1
- package/templates/plugin-starter/vite.config.ts +1 -1
- package/templates/project-starter/package.json +4 -4
- package/templates/project-starter/scripts/install-test-deps.js +7 -3
- package/templates/project-starter/src/__tests__/build-order.test.ts +59 -0
- package/templates/project-starter/src/__tests__/character-plugin-ordering.test.ts +11 -110
- package/templates/project-starter/src/__tests__/vite-config-utils.ts +33 -0
- package/templates/project-starter/src/character.ts +14 -17
- package/templates/project-starter/tsup.config.ts +1 -1
- package/templates/project-tee-starter/package.json +3 -3
- package/templates/project-tee-starter/src/character.ts +3 -0
- package/dist/chunk-5DYKNYEY.js +0 -2262
- package/dist/chunk-XB5JBFO6.js +0 -41
- package/dist/chunk-ZWDXDKSA.js +0 -281
- package/dist/setup-UQOWDHFN.js +0 -20
- package/dist/templates/plugin-starter/dist/index.js +0 -391
- package/dist/templates/plugin-starter/dist/index.js.map +0 -1
- package/templates/plugin-starter/dist/.vite/manifest.json +0 -11
- package/templates/plugin-starter/dist/index.d.ts +0 -14
- package/templates/plugin-starter/dist/index.js +0 -391
- package/templates/plugin-starter/dist/index.js.map +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// src/utils/bun-exec.ts
|
|
7
|
+
import { logger } from "@elizaos/core";
|
|
8
|
+
var COMMAND_EXISTS_TIMEOUT_MS = 5e3;
|
|
9
|
+
function ensureBunInPath(env = {}) {
|
|
10
|
+
const enhancedEnv = { ...process.env, ...env };
|
|
11
|
+
if (enhancedEnv.PATH) {
|
|
12
|
+
const pathSeparator = process.platform === "win32" ? ";" : ":";
|
|
13
|
+
const currentPaths = enhancedEnv.PATH.split(pathSeparator);
|
|
14
|
+
const bunPaths = [
|
|
15
|
+
process.env.HOME ? `${process.env.HOME}/.bun/bin` : null,
|
|
16
|
+
"/opt/homebrew/bin",
|
|
17
|
+
"/usr/local/bin"
|
|
18
|
+
].filter(Boolean);
|
|
19
|
+
for (const bunPath of bunPaths) {
|
|
20
|
+
if (bunPath && !currentPaths.some((p) => p === bunPath || p.endsWith("/.bun/bin"))) {
|
|
21
|
+
enhancedEnv.PATH = `${bunPath}${pathSeparator}${enhancedEnv.PATH}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return enhancedEnv;
|
|
26
|
+
}
|
|
27
|
+
var ProcessExecutionError = class extends Error {
|
|
28
|
+
constructor(message, exitCode, stderr, command) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.exitCode = exitCode;
|
|
31
|
+
this.stderr = stderr;
|
|
32
|
+
this.command = command;
|
|
33
|
+
this.name = "ProcessExecutionError";
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var ProcessTimeoutError = class extends Error {
|
|
37
|
+
constructor(message, command, timeout) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.command = command;
|
|
40
|
+
this.timeout = timeout;
|
|
41
|
+
this.name = "ProcessTimeoutError";
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
function escapeShellArg(arg) {
|
|
45
|
+
if (arg === "") {
|
|
46
|
+
return '""';
|
|
47
|
+
}
|
|
48
|
+
const escaped = JSON.stringify(arg);
|
|
49
|
+
return escaped;
|
|
50
|
+
}
|
|
51
|
+
async function readStreamSafe(stream, streamName) {
|
|
52
|
+
if (!stream || typeof stream === "number") {
|
|
53
|
+
return "";
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const text = await new Response(stream).text();
|
|
57
|
+
return text;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
logger.debug(`[bunExec] Error reading ${streamName}:`, error);
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function bunExec(command, args = [], options = {}) {
|
|
64
|
+
let proc = null;
|
|
65
|
+
let timeoutId = null;
|
|
66
|
+
try {
|
|
67
|
+
const escapedArgs = args.map(escapeShellArg);
|
|
68
|
+
const fullCommand = [command, ...escapedArgs].join(" ");
|
|
69
|
+
logger.debug(`[bunExec] Executing: ${fullCommand}`);
|
|
70
|
+
const enhancedEnv = ensureBunInPath(options.env);
|
|
71
|
+
proc = Bun.spawn([command, ...args], {
|
|
72
|
+
cwd: options.cwd,
|
|
73
|
+
env: enhancedEnv,
|
|
74
|
+
stdout: options.stdout || options.stdio || "pipe",
|
|
75
|
+
stderr: options.stderr || options.stdio || "pipe"
|
|
76
|
+
});
|
|
77
|
+
if (options.signal) {
|
|
78
|
+
options.signal.addEventListener("abort", () => {
|
|
79
|
+
if (proc && proc.exitCode === null) {
|
|
80
|
+
proc.kill();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
85
|
+
if (options.timeout && options.timeout > 0) {
|
|
86
|
+
const timeoutMs = options.timeout;
|
|
87
|
+
timeoutId = setTimeout(() => {
|
|
88
|
+
if (proc && proc.exitCode === null) {
|
|
89
|
+
proc.kill();
|
|
90
|
+
}
|
|
91
|
+
reject(
|
|
92
|
+
new ProcessTimeoutError(
|
|
93
|
+
`Command timed out after ${timeoutMs}ms`,
|
|
94
|
+
fullCommand,
|
|
95
|
+
timeoutMs
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
}, timeoutMs);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const [stdout, stderr, exitCode] = await Promise.race([
|
|
102
|
+
// Normal execution path - all operations run concurrently
|
|
103
|
+
Promise.all([
|
|
104
|
+
readStreamSafe(proc.stdout, "stdout"),
|
|
105
|
+
readStreamSafe(proc.stderr, "stderr"),
|
|
106
|
+
proc.exited
|
|
107
|
+
]),
|
|
108
|
+
// Timeout path
|
|
109
|
+
timeoutPromise
|
|
110
|
+
]);
|
|
111
|
+
if (timeoutId) {
|
|
112
|
+
clearTimeout(timeoutId);
|
|
113
|
+
}
|
|
114
|
+
const success = exitCode === 0;
|
|
115
|
+
if (!success && options.stdio !== "ignore") {
|
|
116
|
+
logger.debug(`[bunExec] Command failed with exit code ${exitCode}`);
|
|
117
|
+
if (stderr) {
|
|
118
|
+
logger.debug(`[bunExec] stderr: ${stderr}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
stdout: stdout.trim(),
|
|
123
|
+
stderr: stderr.trim(),
|
|
124
|
+
exitCode,
|
|
125
|
+
success
|
|
126
|
+
};
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (timeoutId) {
|
|
129
|
+
clearTimeout(timeoutId);
|
|
130
|
+
}
|
|
131
|
+
if (error instanceof ProcessTimeoutError) {
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
if (error instanceof Error) {
|
|
135
|
+
throw new ProcessExecutionError(
|
|
136
|
+
`Command execution failed: ${error.message}`,
|
|
137
|
+
null,
|
|
138
|
+
"",
|
|
139
|
+
command
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
throw error;
|
|
143
|
+
} finally {
|
|
144
|
+
if (proc && proc.exitCode === null) {
|
|
145
|
+
try {
|
|
146
|
+
proc.kill();
|
|
147
|
+
logger.debug("[bunExec] Killed still-running process in cleanup");
|
|
148
|
+
} catch (cleanupError) {
|
|
149
|
+
logger.debug(
|
|
150
|
+
"[bunExec] Process cleanup error (process may have already exited):",
|
|
151
|
+
cleanupError
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function bunExecSimple(command, args = [], options = {}) {
|
|
158
|
+
const result = await bunExec(command, args, options);
|
|
159
|
+
if (!result.success && options.stdio !== "ignore") {
|
|
160
|
+
throw new ProcessExecutionError(
|
|
161
|
+
`Command failed: ${command} ${args.map(escapeShellArg).join(" ")}`,
|
|
162
|
+
result.exitCode,
|
|
163
|
+
result.stderr,
|
|
164
|
+
command
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
return { stdout: result.stdout };
|
|
168
|
+
}
|
|
169
|
+
async function bunExecInherit(command, args = [], options = {}) {
|
|
170
|
+
return bunExec(command, args, {
|
|
171
|
+
...options,
|
|
172
|
+
stdio: "inherit"
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
async function commandExists(command) {
|
|
176
|
+
try {
|
|
177
|
+
if (process.platform === "win32") {
|
|
178
|
+
const result = await bunExec("where", [command], {
|
|
179
|
+
stdio: "ignore",
|
|
180
|
+
timeout: COMMAND_EXISTS_TIMEOUT_MS
|
|
181
|
+
});
|
|
182
|
+
return result.success;
|
|
183
|
+
} else {
|
|
184
|
+
const result = await bunExec("which", [command], {
|
|
185
|
+
stdio: "ignore",
|
|
186
|
+
timeout: COMMAND_EXISTS_TIMEOUT_MS
|
|
187
|
+
});
|
|
188
|
+
return result.success;
|
|
189
|
+
}
|
|
190
|
+
} catch {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export {
|
|
196
|
+
ProcessExecutionError,
|
|
197
|
+
ProcessTimeoutError,
|
|
198
|
+
bunExec,
|
|
199
|
+
bunExecSimple,
|
|
200
|
+
bunExecInherit,
|
|
201
|
+
commandExists
|
|
202
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
6
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
7
|
+
}) : x)(function(x) {
|
|
8
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
9
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
__require
|
|
14
|
+
};
|
|
@@ -7,16 +7,17 @@ import {
|
|
|
7
7
|
createPlugin,
|
|
8
8
|
createProject,
|
|
9
9
|
createTEEProject,
|
|
10
|
+
hasEmbeddingSupport,
|
|
10
11
|
selectAIModel,
|
|
11
12
|
selectDatabase,
|
|
12
13
|
selectEmbeddingModel,
|
|
13
14
|
validateCreateOptions,
|
|
14
15
|
validateProjectName
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2ZF5OAMV.js";
|
|
16
17
|
import {
|
|
17
18
|
displayBanner,
|
|
18
19
|
handleError
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-KKAK7OQA.js";
|
|
20
21
|
|
|
21
22
|
// src/commands/create/index.ts
|
|
22
23
|
import { Command } from "commander";
|
|
@@ -114,9 +115,34 @@ var create = new Command("create").description("Create a new ElizaOS project, pl
|
|
|
114
115
|
clack.intro(colors.inverse(` Creating ElizaOS ${introType} `));
|
|
115
116
|
}
|
|
116
117
|
switch (projectType) {
|
|
117
|
-
case "plugin":
|
|
118
|
-
|
|
118
|
+
case "plugin": {
|
|
119
|
+
let pluginType = "full";
|
|
120
|
+
if (!isNonInteractive) {
|
|
121
|
+
const selectedPluginType = await clack.select({
|
|
122
|
+
message: "What type of plugin would you like to create?",
|
|
123
|
+
options: [
|
|
124
|
+
{
|
|
125
|
+
label: "Quick Plugin (Backend Only)",
|
|
126
|
+
value: "quick",
|
|
127
|
+
hint: "Simple backend-only plugin without frontend"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: "Full Plugin (with Frontend)",
|
|
131
|
+
value: "full",
|
|
132
|
+
hint: "Complete plugin with React frontend and API routes"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
initialValue: "quick"
|
|
136
|
+
});
|
|
137
|
+
if (clack.isCancel(selectedPluginType)) {
|
|
138
|
+
clack.cancel("Operation cancelled.");
|
|
139
|
+
process.exit(0);
|
|
140
|
+
}
|
|
141
|
+
pluginType = selectedPluginType;
|
|
142
|
+
}
|
|
143
|
+
await createPlugin(projectName, process.cwd(), pluginType, isNonInteractive);
|
|
119
144
|
break;
|
|
145
|
+
}
|
|
120
146
|
case "agent":
|
|
121
147
|
await createAgent(projectName, process.cwd(), isNonInteractive);
|
|
122
148
|
break;
|
|
@@ -127,7 +153,7 @@ var create = new Command("create").description("Create a new ElizaOS project, pl
|
|
|
127
153
|
if (!isNonInteractive) {
|
|
128
154
|
database = await selectDatabase();
|
|
129
155
|
aiModel = await selectAIModel();
|
|
130
|
-
if (aiModel
|
|
156
|
+
if (!hasEmbeddingSupport(aiModel)) {
|
|
131
157
|
embeddingModel = await selectEmbeddingModel();
|
|
132
158
|
}
|
|
133
159
|
}
|
|
@@ -149,7 +175,7 @@ var create = new Command("create").description("Create a new ElizaOS project, pl
|
|
|
149
175
|
if (!isNonInteractive) {
|
|
150
176
|
database = await selectDatabase();
|
|
151
177
|
aiModel = await selectAIModel();
|
|
152
|
-
if (aiModel
|
|
178
|
+
if (!hasEmbeddingSupport(aiModel)) {
|
|
153
179
|
embeddingModel = await selectEmbeddingModel();
|
|
154
180
|
}
|
|
155
181
|
}
|