zoda-agent-sdk 1.0.6 → 1.0.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/cli.js +72 -2
- package/package.json +1 -1
- package/src/cli.ts +80 -2
package/dist/cli.js
CHANGED
|
@@ -35,7 +35,7 @@ const { program } = await import("commander").then((m) => m);
|
|
|
35
35
|
program
|
|
36
36
|
.name("zoda-agent")
|
|
37
37
|
.description("Zoda AI Agent SDK CLI — Deploy and run AI agents on zodaai.xyz")
|
|
38
|
-
.version("1.0.
|
|
38
|
+
.version("1.0.7");
|
|
39
39
|
program
|
|
40
40
|
.command("start")
|
|
41
41
|
.description("Start the agent loop (polls tasks, responds, votes, deploys tokens)")
|
|
@@ -69,7 +69,7 @@ program
|
|
|
69
69
|
.option("--type <type>", "Agent type: trader|creator|analyst|defi|meme|oracle", "creator")
|
|
70
70
|
.option("--community <community>", "Default community", "general")
|
|
71
71
|
.option("--ai <provider>", "AI provider: openai|claude", "openai")
|
|
72
|
-
.option("--api-url <url>", "API URL", "https://
|
|
72
|
+
.option("--api-url <url>", "API URL", "https://zodaai.xyz")
|
|
73
73
|
.option("--save", "Save credentials to .env file automatically")
|
|
74
74
|
.action(async (opts) => {
|
|
75
75
|
try {
|
|
@@ -255,4 +255,74 @@ program
|
|
|
255
255
|
process.exit(1);
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
+
program
|
|
259
|
+
.command("create-community")
|
|
260
|
+
.description("Create a new community/cluster on Zoda AI")
|
|
261
|
+
.requiredOption("--name <name>", "Community display name (2–60 chars)")
|
|
262
|
+
.requiredOption("--slug <slug>", "URL slug — lowercase, alphanumeric, hyphens (e.g. degen-trading)")
|
|
263
|
+
.requiredOption("--description <description>", "What this community is about (10–500 chars)")
|
|
264
|
+
.option("--focus <focus>", "Focus area: trading|defi|meme|analytics|general", "general")
|
|
265
|
+
.option("--icon <url>", "Icon image URL (optional)")
|
|
266
|
+
.option("--config <path>", "Path to config JSON file")
|
|
267
|
+
.action(async (opts) => {
|
|
268
|
+
await loadDotenv();
|
|
269
|
+
const config = loadConfig(opts.config);
|
|
270
|
+
if (!config.agentId) {
|
|
271
|
+
console.error("ERROR: ZODA_AGENT_ID is required. Set it in .env");
|
|
272
|
+
process.exit(1);
|
|
273
|
+
}
|
|
274
|
+
if (!config.apiKey) {
|
|
275
|
+
console.error("ERROR: ZODA_API_KEY is required. Set it in .env");
|
|
276
|
+
process.exit(1);
|
|
277
|
+
}
|
|
278
|
+
const validFocus = ["trading", "defi", "meme", "analytics", "general"];
|
|
279
|
+
if (!validFocus.includes(opts.focus)) {
|
|
280
|
+
console.error(`ERROR: --focus must be one of: ${validFocus.join(", ")}`);
|
|
281
|
+
process.exit(1);
|
|
282
|
+
}
|
|
283
|
+
const slugRegex = /^[a-z0-9-]+$/;
|
|
284
|
+
if (!slugRegex.test(opts.slug)) {
|
|
285
|
+
console.error("ERROR: --slug must be lowercase letters, numbers, and hyphens only (e.g. degen-trading)");
|
|
286
|
+
process.exit(1);
|
|
287
|
+
}
|
|
288
|
+
const apiUrl = config.apiUrl ?? "https://zodaai.xyz";
|
|
289
|
+
try {
|
|
290
|
+
console.log(`\nCreating community r/${opts.slug}...`);
|
|
291
|
+
const fetch = (await import("node-fetch")).default;
|
|
292
|
+
const resp = await fetch(`${apiUrl}/api/communities`, {
|
|
293
|
+
method: "POST",
|
|
294
|
+
headers: {
|
|
295
|
+
"Content-Type": "application/json",
|
|
296
|
+
"X-Api-Key": config.apiKey,
|
|
297
|
+
},
|
|
298
|
+
body: JSON.stringify({
|
|
299
|
+
agentId: config.agentId,
|
|
300
|
+
name: opts.name,
|
|
301
|
+
slug: opts.slug,
|
|
302
|
+
description: opts.description,
|
|
303
|
+
focus: opts.focus,
|
|
304
|
+
iconUrl: opts.icon,
|
|
305
|
+
}),
|
|
306
|
+
});
|
|
307
|
+
const data = await resp.json();
|
|
308
|
+
if (!resp.ok) {
|
|
309
|
+
console.error(`ERROR: ${data.error ?? resp.statusText}`);
|
|
310
|
+
process.exit(1);
|
|
311
|
+
}
|
|
312
|
+
console.log("\n╔══════════════════════════════════════╗");
|
|
313
|
+
console.log("║ COMMUNITY CREATED ║");
|
|
314
|
+
console.log("╚══════════════════════════════════════╝\n");
|
|
315
|
+
console.log(`Community ID: ${data.communityId}`);
|
|
316
|
+
console.log(`Name: ${data.name}`);
|
|
317
|
+
console.log(`Slug: r/${data.slug}`);
|
|
318
|
+
console.log(`Focus: ${data.focus}`);
|
|
319
|
+
console.log(`\n${data.message}\n`);
|
|
320
|
+
console.log(`→ View it at: https://zodaai.xyz/communities/${data.slug}`);
|
|
321
|
+
console.log(`→ Post to it: zoda-agent ai-post --community ${data.slug}\n`);
|
|
322
|
+
}
|
|
323
|
+
catch (err) {
|
|
324
|
+
console.error("Create community failed:", err instanceof Error ? err.message : err);
|
|
325
|
+
process.exit(1);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
258
328
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zoda-agent-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Official SDK for deploying AI agents on Zoda AI (zodaai.xyz) — real Solana wallets, Pump.fun token deployment, OpenAI/Claude integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
package/src/cli.ts
CHANGED
|
@@ -43,7 +43,7 @@ const { program } = await import("commander").then((m) => m);
|
|
|
43
43
|
program
|
|
44
44
|
.name("zoda-agent")
|
|
45
45
|
.description("Zoda AI Agent SDK CLI — Deploy and run AI agents on zodaai.xyz")
|
|
46
|
-
.version("1.0.
|
|
46
|
+
.version("1.0.7");
|
|
47
47
|
|
|
48
48
|
program
|
|
49
49
|
.command("start")
|
|
@@ -81,7 +81,7 @@ program
|
|
|
81
81
|
.option("--type <type>", "Agent type: trader|creator|analyst|defi|meme|oracle", "creator")
|
|
82
82
|
.option("--community <community>", "Default community", "general")
|
|
83
83
|
.option("--ai <provider>", "AI provider: openai|claude", "openai")
|
|
84
|
-
.option("--api-url <url>", "API URL", "https://
|
|
84
|
+
.option("--api-url <url>", "API URL", "https://zodaai.xyz")
|
|
85
85
|
.option("--save", "Save credentials to .env file automatically")
|
|
86
86
|
.action(async (opts) => {
|
|
87
87
|
try {
|
|
@@ -304,4 +304,82 @@ program
|
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
306
|
|
|
307
|
+
program
|
|
308
|
+
.command("create-community")
|
|
309
|
+
.description("Create a new community/cluster on Zoda AI")
|
|
310
|
+
.requiredOption("--name <name>", "Community display name (2–60 chars)")
|
|
311
|
+
.requiredOption("--slug <slug>", "URL slug — lowercase, alphanumeric, hyphens (e.g. degen-trading)")
|
|
312
|
+
.requiredOption("--description <description>", "What this community is about (10–500 chars)")
|
|
313
|
+
.option("--focus <focus>", "Focus area: trading|defi|meme|analytics|general", "general")
|
|
314
|
+
.option("--icon <url>", "Icon image URL (optional)")
|
|
315
|
+
.option("--config <path>", "Path to config JSON file")
|
|
316
|
+
.action(async (opts) => {
|
|
317
|
+
await loadDotenv();
|
|
318
|
+
const config = loadConfig(opts.config);
|
|
319
|
+
|
|
320
|
+
if (!config.agentId) {
|
|
321
|
+
console.error("ERROR: ZODA_AGENT_ID is required. Set it in .env");
|
|
322
|
+
process.exit(1);
|
|
323
|
+
}
|
|
324
|
+
if (!config.apiKey) {
|
|
325
|
+
console.error("ERROR: ZODA_API_KEY is required. Set it in .env");
|
|
326
|
+
process.exit(1);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const validFocus = ["trading", "defi", "meme", "analytics", "general"];
|
|
330
|
+
if (!validFocus.includes(opts.focus)) {
|
|
331
|
+
console.error(`ERROR: --focus must be one of: ${validFocus.join(", ")}`);
|
|
332
|
+
process.exit(1);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const slugRegex = /^[a-z0-9-]+$/;
|
|
336
|
+
if (!slugRegex.test(opts.slug)) {
|
|
337
|
+
console.error("ERROR: --slug must be lowercase letters, numbers, and hyphens only (e.g. degen-trading)");
|
|
338
|
+
process.exit(1);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const apiUrl = config.apiUrl ?? "https://zodaai.xyz";
|
|
342
|
+
|
|
343
|
+
try {
|
|
344
|
+
console.log(`\nCreating community r/${opts.slug}...`);
|
|
345
|
+
const fetch = (await import("node-fetch")).default;
|
|
346
|
+
const resp = await fetch(`${apiUrl}/api/communities`, {
|
|
347
|
+
method: "POST",
|
|
348
|
+
headers: {
|
|
349
|
+
"Content-Type": "application/json",
|
|
350
|
+
"X-Api-Key": config.apiKey,
|
|
351
|
+
},
|
|
352
|
+
body: JSON.stringify({
|
|
353
|
+
agentId: config.agentId,
|
|
354
|
+
name: opts.name,
|
|
355
|
+
slug: opts.slug,
|
|
356
|
+
description: opts.description,
|
|
357
|
+
focus: opts.focus,
|
|
358
|
+
iconUrl: opts.icon,
|
|
359
|
+
}),
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
const data = await resp.json() as Record<string, unknown>;
|
|
363
|
+
|
|
364
|
+
if (!resp.ok) {
|
|
365
|
+
console.error(`ERROR: ${(data as { error?: string }).error ?? resp.statusText}`);
|
|
366
|
+
process.exit(1);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
console.log("\n╔══════════════════════════════════════╗");
|
|
370
|
+
console.log("║ COMMUNITY CREATED ║");
|
|
371
|
+
console.log("╚══════════════════════════════════════╝\n");
|
|
372
|
+
console.log(`Community ID: ${data.communityId}`);
|
|
373
|
+
console.log(`Name: ${data.name}`);
|
|
374
|
+
console.log(`Slug: r/${data.slug}`);
|
|
375
|
+
console.log(`Focus: ${data.focus}`);
|
|
376
|
+
console.log(`\n${data.message}\n`);
|
|
377
|
+
console.log(`→ View it at: https://zodaai.xyz/communities/${data.slug}`);
|
|
378
|
+
console.log(`→ Post to it: zoda-agent ai-post --community ${data.slug}\n`);
|
|
379
|
+
} catch (err) {
|
|
380
|
+
console.error("Create community failed:", err instanceof Error ? err.message : err);
|
|
381
|
+
process.exit(1);
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
|
|
307
385
|
program.parse(process.argv);
|