grains-cli 0.2.0__tar.gz → 0.2.1__tar.gz

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 (28) hide show
  1. {grains_cli-0.2.0 → grains_cli-0.2.1}/PKG-INFO +1 -1
  2. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/deploy.py +22 -0
  3. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/main.py +5 -0
  4. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli.egg-info/PKG-INFO +1 -1
  5. {grains_cli-0.2.0 → grains_cli-0.2.1}/pyproject.toml +1 -1
  6. {grains_cli-0.2.0 → grains_cli-0.2.1}/LICENSE +0 -0
  7. {grains_cli-0.2.0 → grains_cli-0.2.1}/README.md +0 -0
  8. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/__init__.py +0 -0
  9. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/apiclient.py +0 -0
  10. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/dev.py +0 -0
  11. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/init.py +0 -0
  12. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/login.py +0 -0
  13. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/pay.py +0 -0
  14. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/ship.py +0 -0
  15. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/templates.py +0 -0
  16. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli/verify.py +0 -0
  17. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli.egg-info/SOURCES.txt +0 -0
  18. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli.egg-info/dependency_links.txt +0 -0
  19. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli.egg-info/entry_points.txt +0 -0
  20. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli.egg-info/requires.txt +0 -0
  21. {grains_cli-0.2.0 → grains_cli-0.2.1}/grains_cli.egg-info/top_level.txt +0 -0
  22. {grains_cli-0.2.0 → grains_cli-0.2.1}/setup.cfg +0 -0
  23. {grains_cli-0.2.0 → grains_cli-0.2.1}/tests/test_deploy.py +0 -0
  24. {grains_cli-0.2.0 → grains_cli-0.2.1}/tests/test_dev.py +0 -0
  25. {grains_cli-0.2.0 → grains_cli-0.2.1}/tests/test_init.py +0 -0
  26. {grains_cli-0.2.0 → grains_cli-0.2.1}/tests/test_init_node.py +0 -0
  27. {grains_cli-0.2.0 → grains_cli-0.2.1}/tests/test_pay.py +0 -0
  28. {grains_cli-0.2.0 → grains_cli-0.2.1}/tests/test_verify.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: grains-cli
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Command-line tools for Grains: build, run, deploy, and pay AI agents.
5
5
  Author: Grains
6
6
  License-Expression: Apache-2.0
@@ -78,3 +78,25 @@ def cmd_agents(args: argparse.Namespace) -> int:
78
78
  vis = "public" if a.get("public") else "private"
79
79
  print(f"{a['name']:<24} {a.get('status', ''):<8} {vis}{price}")
80
80
  return 0
81
+
82
+
83
+ def cmd_balance(args: argparse.Namespace) -> int:
84
+ client = _client_or_exit(args)
85
+ try:
86
+ data = client._req("GET", "/v1/balance")
87
+ except GrainsAPIError as e:
88
+ print(f"error: {e}", file=sys.stderr)
89
+ return 1
90
+ agents = data.get("agents", [])
91
+ if not agents:
92
+ print("No paid calls yet. Set a price with `grains_set_price` in Claude "
93
+ "or from the dashboard, and this fills up.")
94
+ return 0
95
+ cur = data.get("currency", "USDC")
96
+ print(f"{'agent':<24} {'calls':>6} {'gross':>12} {'fee':>10} {'net':>12}")
97
+ for a in agents:
98
+ print(f"{a['agent']:<24} {a['calls']:>6} {a['gross']:>12} {a['fee']:>10} {a['net']:>12}")
99
+ t = data["total"]
100
+ print("-" * 68)
101
+ print(f"{'total':<24} {'':>6} {t['gross']:>12} {t['fee']:>10} {t['net']:>12} {cur}")
102
+ return 0
@@ -70,6 +70,11 @@ def build_parser() -> argparse.ArgumentParser:
70
70
  p_logs.add_argument("--api")
71
71
  p_logs.set_defaults(func=deploy_cmd.cmd_logs)
72
72
 
73
+ p_balance = sub.add_parser("balance", help="earnings across your paid agents")
74
+ p_balance.add_argument("--token")
75
+ p_balance.add_argument("--api")
76
+ p_balance.set_defaults(func=deploy_cmd.cmd_balance)
77
+
73
78
  p_agents = sub.add_parser("agents", help="list your agents")
74
79
  p_agents.add_argument("--token")
75
80
  p_agents.add_argument("--api")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: grains-cli
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Command-line tools for Grains: build, run, deploy, and pay AI agents.
5
5
  Author: Grains
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "grains-cli"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Command-line tools for Grains: build, run, deploy, and pay AI agents."
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes