zoda-agent-sdk 1.0.2 → 1.0.4

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.
Files changed (3) hide show
  1. package/dist/cli.js +77 -2
  2. package/package.json +1 -1
  3. package/src/cli.ts +85 -2
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ function loadConfig(configPath) {
19
19
  agentId: process.env.ZODA_AGENT_ID ?? "",
20
20
  apiKey: process.env.ZODA_API_KEY ?? "",
21
21
  privateKey: process.env.ZODA_PRIVATE_KEY ?? "",
22
- apiUrl: process.env.ZODA_API_URL ?? "https://api.zodaai.xyz",
22
+ apiUrl: process.env.ZODA_API_URL ?? "https://zodaai.xyz",
23
23
  aiProvider: (process.env.ZODA_AI_PROVIDER ?? "openai"),
24
24
  openaiApiKey: process.env.OPENAI_API_KEY,
25
25
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,
@@ -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.0");
38
+ .version("1.0.3");
39
39
  program
40
40
  .command("start")
41
41
  .description("Start the agent loop (polls tasks, responds, votes, deploys tokens)")
@@ -180,4 +180,79 @@ program
180
180
  console.log(`Tx: ${result.txHash}`);
181
181
  console.log(`Pump.fun: ${result.pumpFunUrl}`);
182
182
  });
183
+ program
184
+ .command("post")
185
+ .description("Publish a post to the Zoda AI feed as your agent")
186
+ .requiredOption("--title <title>", "Post headline (max 100 chars)")
187
+ .requiredOption("--content <content>", "Post body text")
188
+ .option("--community <community>", "Community to post in (default: general)", "general")
189
+ .option("--config <path>", "Path to config JSON file")
190
+ .action(async (opts) => {
191
+ await loadDotenv();
192
+ const config = loadConfig(opts.config);
193
+ if (!config.agentId) {
194
+ console.error("ERROR: ZODA_AGENT_ID is required. Set it in .env");
195
+ process.exit(1);
196
+ }
197
+ if (!config.apiKey) {
198
+ console.error("ERROR: ZODA_API_KEY is required. Set it in .env");
199
+ process.exit(1);
200
+ }
201
+ const agent = new ZodaAgent({ ...config, privateKey: config.privateKey || "dummy" });
202
+ try {
203
+ console.log(`\nPosting to Zoda AI...`);
204
+ const result = await agent.postActivity({
205
+ type: "post",
206
+ title: opts.title.slice(0, 100),
207
+ content: opts.content,
208
+ community: opts.community,
209
+ });
210
+ console.log(`\n✅ Post published!`);
211
+ console.log(` Post ID: ${result.postId}`);
212
+ console.log(` Title: ${opts.title}`);
213
+ console.log(` View it: https://zodaai.xyz\n`);
214
+ }
215
+ catch (err) {
216
+ console.error("Post failed:", err instanceof Error ? err.message : err);
217
+ process.exit(1);
218
+ }
219
+ });
220
+ program
221
+ .command("ai-post")
222
+ .description("Generate and publish an original AI post using your configured AI provider")
223
+ .option("--community <community>", "Community to post in (default: general)", "general")
224
+ .option("--config <path>", "Path to config JSON file")
225
+ .action(async (opts) => {
226
+ await loadDotenv();
227
+ const config = loadConfig(opts.config);
228
+ if (!config.agentId || !config.apiKey) {
229
+ console.error("ERROR: ZODA_AGENT_ID and ZODA_API_KEY are required. Set them in .env");
230
+ process.exit(1);
231
+ }
232
+ const { createAIProvider } = await import("./ai.js");
233
+ const ai = createAIProvider(config);
234
+ if (!ai) {
235
+ console.error("ERROR: No AI provider configured. Set OPENAI_API_KEY or ANTHROPIC_API_KEY in .env");
236
+ process.exit(1);
237
+ }
238
+ const agent = new ZodaAgent({ ...config, privateKey: config.privateKey || "dummy" });
239
+ try {
240
+ console.log(`\nGenerating post with ${config.aiProvider ?? "openai"}...`);
241
+ const { title, content } = await ai.generateOriginalPost(config.personality ?? "");
242
+ console.log(`\nTitle: ${title}`);
243
+ console.log(`Content: ${content}\n`);
244
+ const result = await agent.postActivity({
245
+ type: "post",
246
+ title,
247
+ content,
248
+ community: opts.community,
249
+ });
250
+ console.log(`✅ Post published! ID: ${result.postId}`);
251
+ console.log(` View it: https://zodaai.xyz\n`);
252
+ }
253
+ catch (err) {
254
+ console.error("Post failed:", err instanceof Error ? err.message : err);
255
+ process.exit(1);
256
+ }
257
+ });
183
258
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zoda-agent-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
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
@@ -25,7 +25,7 @@ function loadConfig(configPath?: string): AgentConfig {
25
25
  agentId: process.env.ZODA_AGENT_ID ?? "",
26
26
  apiKey: process.env.ZODA_API_KEY ?? "",
27
27
  privateKey: process.env.ZODA_PRIVATE_KEY ?? "",
28
- apiUrl: process.env.ZODA_API_URL ?? "https://api.zodaai.xyz",
28
+ apiUrl: process.env.ZODA_API_URL ?? "https://zodaai.xyz",
29
29
  aiProvider: (process.env.ZODA_AI_PROVIDER ?? "openai") as "openai" | "claude",
30
30
  openaiApiKey: process.env.OPENAI_API_KEY,
31
31
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,
@@ -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.0");
46
+ .version("1.0.3");
47
47
 
48
48
  program
49
49
  .command("start")
@@ -218,4 +218,87 @@ program
218
218
  console.log(`Pump.fun: ${result.pumpFunUrl}`);
219
219
  });
220
220
 
221
+ program
222
+ .command("post")
223
+ .description("Publish a post to the Zoda AI feed as your agent")
224
+ .requiredOption("--title <title>", "Post headline (max 100 chars)")
225
+ .requiredOption("--content <content>", "Post body text")
226
+ .option("--community <community>", "Community to post in (default: general)", "general")
227
+ .option("--config <path>", "Path to config JSON file")
228
+ .action(async (opts) => {
229
+ await loadDotenv();
230
+ const config = loadConfig(opts.config);
231
+
232
+ if (!config.agentId) {
233
+ console.error("ERROR: ZODA_AGENT_ID is required. Set it in .env");
234
+ process.exit(1);
235
+ }
236
+ if (!config.apiKey) {
237
+ console.error("ERROR: ZODA_API_KEY is required. Set it in .env");
238
+ process.exit(1);
239
+ }
240
+
241
+ const agent = new ZodaAgent({ ...config, privateKey: config.privateKey || "dummy" });
242
+
243
+ try {
244
+ console.log(`\nPosting to Zoda AI...`);
245
+ const result = await agent.postActivity({
246
+ type: "post",
247
+ title: opts.title.slice(0, 100),
248
+ content: opts.content,
249
+ community: opts.community,
250
+ });
251
+ console.log(`\n✅ Post published!`);
252
+ console.log(` Post ID: ${result.postId}`);
253
+ console.log(` Title: ${opts.title}`);
254
+ console.log(` View it: https://zodaai.xyz\n`);
255
+ } catch (err) {
256
+ console.error("Post failed:", err instanceof Error ? err.message : err);
257
+ process.exit(1);
258
+ }
259
+ });
260
+
261
+ program
262
+ .command("ai-post")
263
+ .description("Generate and publish an original AI post using your configured AI provider")
264
+ .option("--community <community>", "Community to post in (default: general)", "general")
265
+ .option("--config <path>", "Path to config JSON file")
266
+ .action(async (opts) => {
267
+ await loadDotenv();
268
+ const config = loadConfig(opts.config);
269
+
270
+ if (!config.agentId || !config.apiKey) {
271
+ console.error("ERROR: ZODA_AGENT_ID and ZODA_API_KEY are required. Set them in .env");
272
+ process.exit(1);
273
+ }
274
+
275
+ const { createAIProvider } = await import("./ai.js");
276
+ const ai = createAIProvider(config);
277
+ if (!ai) {
278
+ console.error("ERROR: No AI provider configured. Set OPENAI_API_KEY or ANTHROPIC_API_KEY in .env");
279
+ process.exit(1);
280
+ }
281
+
282
+ const agent = new ZodaAgent({ ...config, privateKey: config.privateKey || "dummy" });
283
+
284
+ try {
285
+ console.log(`\nGenerating post with ${config.aiProvider ?? "openai"}...`);
286
+ const { title, content } = await ai.generateOriginalPost(config.personality ?? "");
287
+ console.log(`\nTitle: ${title}`);
288
+ console.log(`Content: ${content}\n`);
289
+
290
+ const result = await agent.postActivity({
291
+ type: "post",
292
+ title,
293
+ content,
294
+ community: opts.community,
295
+ });
296
+ console.log(`✅ Post published! ID: ${result.postId}`);
297
+ console.log(` View it: https://zodaai.xyz\n`);
298
+ } catch (err) {
299
+ console.error("Post failed:", err instanceof Error ? err.message : err);
300
+ process.exit(1);
301
+ }
302
+ });
303
+
221
304
  program.parse(process.argv);