@agentis-hq/cli 0.1.4 → 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 +45 -50
  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
@@ -274,31 +274,6 @@ function recordLocalSpend(wallet, spend) {
274
274
  return updated;
275
275
  }
276
276
 
277
- // src/lib/format-agent.ts
278
- function formatPolicy(agent) {
279
- const mode = agent.policyMode ?? "backend";
280
- if (mode !== "onchain") return "policy=backend";
281
- return `policy=onchain:${agent.onchainPolicy?.initialized ? "ready" : "pending"}`;
282
- }
283
- function formatPrivacy(agent) {
284
- if (!agent.privacyEnabled && !agent.umbraStatus) return null;
285
- return `privacy=${agent.umbraStatus ?? "enabled"}`;
286
- }
287
- function formatLocalPolicy(wallet) {
288
- return wallet.policy.killSwitch ? "policy=local:killed" : "policy=local";
289
- }
290
- function formatBadges(parts) {
291
- return parts.filter(Boolean).join(", ");
292
- }
293
- function formatHostedAgentLine(agent) {
294
- const badges = formatBadges(["hosted", formatPolicy(agent), formatPrivacy(agent)]);
295
- return ` ${agent.name.padEnd(20)} ${agent.walletAddress} [${agent.id}] ${badges}`;
296
- }
297
- function formatLocalWalletLine(wallet) {
298
- const badges = formatBadges(["local", formatLocalPolicy(wallet)]);
299
- return ` ${wallet.name.padEnd(20)} ${wallet.solanaAddress} [${wallet.id}] ${badges}`;
300
- }
301
-
302
277
  // src/commands/agent.ts
303
278
  import { checkPolicy } from "@agentis-hq/core";
304
279
  import {
@@ -350,19 +325,6 @@ async function solToUsd(sol) {
350
325
  cachedSolPrice = { usd: price, fetchedAt: now };
351
326
  return sol * price;
352
327
  }
353
- async function agentList() {
354
- const token = await requireAuth();
355
- const agents = await fetchAccountAgents(token);
356
- if (agents.length === 0) {
357
- console.log("No agents found. Run `agentis agent create <name>` to create one.");
358
- return;
359
- }
360
- console.log();
361
- for (const a of agents) {
362
- console.log(formatHostedAgentLine(a));
363
- }
364
- console.log();
365
- }
366
328
  async function agentCreate(args2) {
367
329
  const parts = Array.isArray(args2) ? args2 : args2 ? [args2] : [];
368
330
  const name = parts.find((part) => !part.startsWith("--"));
@@ -526,6 +488,31 @@ Sent!`);
526
488
  `);
527
489
  }
528
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
+
529
516
  // src/commands/wallet.ts
530
517
  async function walletCreate(args2) {
531
518
  const nameIdx = args2.indexOf("--name");
@@ -572,6 +559,7 @@ Wallet created (hosted)`);
572
559
  async function walletList() {
573
560
  const token = await getToken();
574
561
  const localWallets = listLocalWallets();
562
+ let printedHosted = false;
575
563
  if (token) {
576
564
  try {
577
565
  const res = await apiFetch("/account/agents", {}, token);
@@ -582,10 +570,25 @@ async function walletList() {
582
570
  for (const a of hosted) {
583
571
  console.log(formatHostedAgentLine(a));
584
572
  }
573
+ printedHosted = true;
574
+ } else {
575
+ console.log("\nNo hosted wallets found.");
585
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}`);
586
584
  }
587
- } 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}`);
588
589
  }
590
+ } else {
591
+ console.error("\nNot logged in. Run `agentis login` to list hosted wallets.");
589
592
  }
590
593
  if (localWallets.length > 0) {
591
594
  console.log("\nLocal wallets:");
@@ -595,6 +598,8 @@ async function walletList() {
595
598
  }
596
599
  if (localWallets.length === 0 && !token) {
597
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.");
598
603
  }
599
604
  console.log();
600
605
  }
@@ -1400,17 +1405,11 @@ var helpSpecs = {
1400
1405
  usage: "agentis agent <command>",
1401
1406
  description: "Manage hosted agents and send funds from hosted or local wallets.",
1402
1407
  commands: [
1403
- ["list", "list hosted agents"],
1404
1408
  ["create <name> [--onchain-policy]", "create a hosted agent"],
1405
1409
  ["balance <name-or-id>", "show SOL and token balances"],
1406
1410
  ["send <name-or-id> <to> <amount> [options]", "send SOL from an agent or local wallet"]
1407
1411
  ]
1408
1412
  },
1409
- "agent list": {
1410
- usage: "agentis agent list",
1411
- description: "List hosted agents owned by your Agentis account.",
1412
- options: [["-h, --help", "display help for command"]]
1413
- },
1414
1413
  "agent create": {
1415
1414
  usage: "agentis agent create <name> [--onchain-policy]",
1416
1415
  description: "Create a hosted agent wallet and return its wallet address and API key.",
@@ -1642,7 +1641,6 @@ ${green}${bold}Commands:${reset}
1642
1641
  wallet create --name <name> --local create local encrypted wallet
1643
1642
  wallet list list all wallets (hosted + local)
1644
1643
 
1645
- agent list list your hosted agents
1646
1644
  agent create <name> create a new hosted agent
1647
1645
  --onchain-policy create with Quasar on-chain policy mode
1648
1646
  agent send <name-or-id> <to> <amount> send SOL (amount in lamports)
@@ -1758,9 +1756,6 @@ async function main() {
1758
1756
  break;
1759
1757
  case "agent":
1760
1758
  switch (sub) {
1761
- case "list":
1762
- await agentList();
1763
- break;
1764
1759
  case "create":
1765
1760
  await agentCreate(args.slice(2));
1766
1761
  break;
@@ -1771,7 +1766,7 @@ async function main() {
1771
1766
  await agentBalance(args[2]);
1772
1767
  break;
1773
1768
  default:
1774
- console.log("Usage: agentis agent <list|create|send|balance>");
1769
+ console.log("Usage: agentis agent <create|send|balance>");
1775
1770
  }
1776
1771
  break;
1777
1772
  case "policy":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentis-hq/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "agentis": "dist/index.js"