@agentis-hq/cli 0.1.3 → 0.1.5

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/README.md +2 -8
  2. package/dist/index.js +70 -51
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -38,7 +38,7 @@ https://api.agentis.systems
38
38
  To point the CLI at a local or self-hosted backend:
39
39
 
40
40
  ```bash
41
- AGENTIS_API_URL=http://localhost:3001 agentis agent list
41
+ AGENTIS_API_URL=http://localhost:3001 agentis wallet list
42
42
  ```
43
43
 
44
44
  ## Authentication
@@ -75,12 +75,6 @@ agentis wallet list
75
75
 
76
76
  ## Hosted Agents
77
77
 
78
- List agents:
79
-
80
- ```bash
81
- agentis agent list
82
- ```
83
-
84
78
  Create a hosted agent:
85
79
 
86
80
  ```bash
@@ -277,7 +271,7 @@ bun src/index.ts --help
277
271
  Point at a local backend:
278
272
 
279
273
  ```bash
280
- AGENTIS_API_URL=http://localhost:3001 bun src/index.ts agent list
274
+ AGENTIS_API_URL=http://localhost:3001 bun src/index.ts wallet list
281
275
  ```
282
276
 
283
277
  ## Notes
package/dist/index.js CHANGED
@@ -1,5 +1,10 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
+ // src/index.ts
4
+ import { readFileSync as readFileSync2 } from "fs";
5
+ import { dirname as dirname2, join as join3 } from "path";
6
+ import { fileURLToPath } from "url";
7
+
3
8
  // src/lib/keychain.ts
4
9
  import { Entry } from "@napi-rs/keyring";
5
10
  var entry = new Entry("agentis-cli", "account-key");
@@ -269,31 +274,6 @@ function recordLocalSpend(wallet, spend) {
269
274
  return updated;
270
275
  }
271
276
 
272
- // src/lib/format-agent.ts
273
- function formatPolicy(agent) {
274
- const mode = agent.policyMode ?? "backend";
275
- if (mode !== "onchain") return "policy=backend";
276
- return `policy=onchain:${agent.onchainPolicy?.initialized ? "ready" : "pending"}`;
277
- }
278
- function formatPrivacy(agent) {
279
- if (!agent.privacyEnabled && !agent.umbraStatus) return null;
280
- return `privacy=${agent.umbraStatus ?? "enabled"}`;
281
- }
282
- function formatLocalPolicy(wallet) {
283
- return wallet.policy.killSwitch ? "policy=local:killed" : "policy=local";
284
- }
285
- function formatBadges(parts) {
286
- return parts.filter(Boolean).join(", ");
287
- }
288
- function formatHostedAgentLine(agent) {
289
- const badges = formatBadges(["hosted", formatPolicy(agent), formatPrivacy(agent)]);
290
- return ` ${agent.name.padEnd(20)} ${agent.walletAddress} [${agent.id}] ${badges}`;
291
- }
292
- function formatLocalWalletLine(wallet) {
293
- const badges = formatBadges(["local", formatLocalPolicy(wallet)]);
294
- return ` ${wallet.name.padEnd(20)} ${wallet.solanaAddress} [${wallet.id}] ${badges}`;
295
- }
296
-
297
277
  // src/commands/agent.ts
298
278
  import { checkPolicy } from "@agentis-hq/core";
299
279
  import {
@@ -345,19 +325,6 @@ async function solToUsd(sol) {
345
325
  cachedSolPrice = { usd: price, fetchedAt: now };
346
326
  return sol * price;
347
327
  }
348
- async function agentList() {
349
- const token = await requireAuth();
350
- const agents = await fetchAccountAgents(token);
351
- if (agents.length === 0) {
352
- console.log("No agents found. Run `agentis agent create <name>` to create one.");
353
- return;
354
- }
355
- console.log();
356
- for (const a of agents) {
357
- console.log(formatHostedAgentLine(a));
358
- }
359
- console.log();
360
- }
361
328
  async function agentCreate(args2) {
362
329
  const parts = Array.isArray(args2) ? args2 : args2 ? [args2] : [];
363
330
  const name = parts.find((part) => !part.startsWith("--"));
@@ -521,6 +488,31 @@ Sent!`);
521
488
  `);
522
489
  }
523
490
 
491
+ // src/lib/format-agent.ts
492
+ function formatPolicy(agent) {
493
+ const mode = agent.policyMode ?? "backend";
494
+ if (mode !== "onchain") return "policy=backend";
495
+ return `policy=onchain:${agent.onchainPolicy?.initialized ? "ready" : "pending"}`;
496
+ }
497
+ function formatPrivacy(agent) {
498
+ if (!agent.privacyEnabled && !agent.umbraStatus) return null;
499
+ return `privacy=${agent.umbraStatus ?? "enabled"}`;
500
+ }
501
+ function formatLocalPolicy(wallet) {
502
+ return wallet.policy.killSwitch ? "policy=local:killed" : "policy=local";
503
+ }
504
+ function formatBadges(parts) {
505
+ return parts.filter(Boolean).join(", ");
506
+ }
507
+ function formatHostedAgentLine(agent) {
508
+ const badges = formatBadges(["hosted", formatPolicy(agent), formatPrivacy(agent)]);
509
+ return ` ${agent.name.padEnd(20)} ${agent.walletAddress} [${agent.id}] ${badges}`;
510
+ }
511
+ function formatLocalWalletLine(wallet) {
512
+ const badges = formatBadges(["local", formatLocalPolicy(wallet)]);
513
+ return ` ${wallet.name.padEnd(20)} ${wallet.solanaAddress} [${wallet.id}] ${badges}`;
514
+ }
515
+
524
516
  // src/commands/wallet.ts
525
517
  async function walletCreate(args2) {
526
518
  const nameIdx = args2.indexOf("--name");
@@ -567,6 +559,7 @@ Wallet created (hosted)`);
567
559
  async function walletList() {
568
560
  const token = await getToken();
569
561
  const localWallets = listLocalWallets();
562
+ let printedHosted = false;
570
563
  if (token) {
571
564
  try {
572
565
  const res = await apiFetch("/account/agents", {}, token);
@@ -577,10 +570,25 @@ async function walletList() {
577
570
  for (const a of hosted) {
578
571
  console.log(formatHostedAgentLine(a));
579
572
  }
573
+ printedHosted = true;
574
+ } else {
575
+ console.log("\nNo hosted wallets found.");
580
576
  }
577
+ } else if (res.status === 401) {
578
+ console.error(`
579
+ Could not list hosted wallets: stored login is expired or invalid. Run \`agentis logout\` and then \`agentis login\`.`);
580
+ } else {
581
+ const data = await res.json().catch(() => ({}));
582
+ console.error(`
583
+ Could not list hosted wallets from ${API_BASE}: ${data.error ?? res.statusText}`);
581
584
  }
582
- } catch {
585
+ } catch (err) {
586
+ const message = err instanceof Error ? err.message : String(err);
587
+ console.error(`
588
+ Could not list hosted wallets from ${API_BASE}: ${message}`);
583
589
  }
590
+ } else {
591
+ console.error("\nNot logged in. Run `agentis login` to list hosted wallets.");
584
592
  }
585
593
  if (localWallets.length > 0) {
586
594
  console.log("\nLocal wallets:");
@@ -590,6 +598,8 @@ async function walletList() {
590
598
  }
591
599
  if (localWallets.length === 0 && !token) {
592
600
  console.log("No wallets found. Run `agentis wallet create --name <name>` to create one.");
601
+ } else if (localWallets.length === 0 && token && !printedHosted) {
602
+ console.log("\nNo local wallets found.");
593
603
  }
594
604
  console.log();
595
605
  }
@@ -1342,6 +1352,16 @@ var green = "\x1B[38;5;114m";
1342
1352
  var muted = "\x1B[38;5;244m";
1343
1353
  var bold = "\x1B[1m";
1344
1354
  var reset = "\x1B[0m";
1355
+ function readCliVersion() {
1356
+ try {
1357
+ const packageJsonPath = join3(dirname2(fileURLToPath(import.meta.url)), "..", "package.json");
1358
+ const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf8"));
1359
+ return packageJson.version ?? "unknown";
1360
+ } catch {
1361
+ return "unknown";
1362
+ }
1363
+ }
1364
+ var version = readCliVersion();
1345
1365
  var helpSpecs = {
1346
1366
  login: {
1347
1367
  usage: "agentis login",
@@ -1355,6 +1375,10 @@ var helpSpecs = {
1355
1375
  usage: "agentis whoami",
1356
1376
  description: "Show the currently authenticated Agentis account key in masked form."
1357
1377
  },
1378
+ version: {
1379
+ usage: "agentis version",
1380
+ description: "Show the installed Agentis CLI version."
1381
+ },
1358
1382
  wallet: {
1359
1383
  usage: "agentis wallet <command>",
1360
1384
  description: "Create and list hosted or local Solana wallets.",
@@ -1381,17 +1405,11 @@ var helpSpecs = {
1381
1405
  usage: "agentis agent <command>",
1382
1406
  description: "Manage hosted agents and send funds from hosted or local wallets.",
1383
1407
  commands: [
1384
- ["list", "list hosted agents"],
1385
1408
  ["create <name> [--onchain-policy]", "create a hosted agent"],
1386
1409
  ["balance <name-or-id>", "show SOL and token balances"],
1387
1410
  ["send <name-or-id> <to> <amount> [options]", "send SOL from an agent or local wallet"]
1388
1411
  ]
1389
1412
  },
1390
- "agent list": {
1391
- usage: "agentis agent list",
1392
- description: "List hosted agents owned by your Agentis account.",
1393
- options: [["-h, --help", "display help for command"]]
1394
- },
1395
1413
  "agent create": {
1396
1414
  usage: "agentis agent create <name> [--onchain-policy]",
1397
1415
  description: "Create a hosted agent wallet and return its wallet address and API key.",
@@ -1609,7 +1627,7 @@ function showHelp() {
1609
1627
  \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551
1610
1628
  \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551
1611
1629
  \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D
1612
- ${reset}${muted}v0.1.0${reset}
1630
+ ${reset}${muted}v${version}${reset}
1613
1631
 
1614
1632
  ${bold}Agentis${reset} \u2014 financial infrastructure for AI agents
1615
1633
 
@@ -1617,12 +1635,12 @@ ${green}${bold}Commands:${reset}
1617
1635
  login authenticate with your Agentis account
1618
1636
  logout remove stored credentials
1619
1637
  whoami show current account
1638
+ version show installed CLI version
1620
1639
 
1621
1640
  wallet create --name <name> create hosted wallet (requires login)
1622
1641
  wallet create --name <name> --local create local encrypted wallet
1623
1642
  wallet list list all wallets (hosted + local)
1624
1643
 
1625
- agent list list your hosted agents
1626
1644
  agent create <name> create a new hosted agent
1627
1645
  --onchain-policy create with Quasar on-chain policy mode
1628
1646
  agent send <name-or-id> <to> <amount> send SOL (amount in lamports)
@@ -1706,6 +1724,10 @@ function showCommandHelp(path) {
1706
1724
  console.log();
1707
1725
  }
1708
1726
  async function main() {
1727
+ if (cmd === "--version" || cmd === "-v" || cmd === "version") {
1728
+ console.log(version);
1729
+ return;
1730
+ }
1709
1731
  if (!cmd || hasHelpFlag(args)) {
1710
1732
  showCommandHelp(helpPath(args));
1711
1733
  return;
@@ -1734,9 +1756,6 @@ async function main() {
1734
1756
  break;
1735
1757
  case "agent":
1736
1758
  switch (sub) {
1737
- case "list":
1738
- await agentList();
1739
- break;
1740
1759
  case "create":
1741
1760
  await agentCreate(args.slice(2));
1742
1761
  break;
@@ -1747,7 +1766,7 @@ async function main() {
1747
1766
  await agentBalance(args[2]);
1748
1767
  break;
1749
1768
  default:
1750
- console.log("Usage: agentis agent <list|create|send|balance>");
1769
+ console.log("Usage: agentis agent <create|send|balance>");
1751
1770
  }
1752
1771
  break;
1753
1772
  case "policy":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentis-hq/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "agentis": "dist/index.js"