@jaw.id/cli 0.1.26 → 0.2.1

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 (72) hide show
  1. package/dist/base-command.js +3 -1
  2. package/dist/base-command.js.map +1 -1
  3. package/dist/commands/config/set.js +140 -12
  4. package/dist/commands/config/set.js.map +1 -1
  5. package/dist/commands/config/show.js +3 -1
  6. package/dist/commands/config/show.js.map +1 -1
  7. package/dist/commands/config/write.js +6 -4
  8. package/dist/commands/config/write.js.map +1 -1
  9. package/dist/commands/disconnect.js +24 -10
  10. package/dist/commands/disconnect.js.map +1 -1
  11. package/dist/commands/mcp/index.js +2426 -94
  12. package/dist/commands/mcp/index.js.map +1 -1
  13. package/dist/commands/rpc/call.js +197 -45
  14. package/dist/commands/rpc/call.js.map +1 -1
  15. package/dist/commands/session/add.js +1547 -0
  16. package/dist/commands/session/add.js.map +1 -0
  17. package/dist/commands/session/revoke.js +181 -54
  18. package/dist/commands/session/revoke.js.map +1 -1
  19. package/dist/commands/session/setup.js +516 -65
  20. package/dist/commands/session/setup.js.map +1 -1
  21. package/dist/commands/session/status.js +315 -6
  22. package/dist/commands/session/status.js.map +1 -1
  23. package/dist/commands/version.js +3 -1
  24. package/dist/commands/version.js.map +1 -1
  25. package/dist/commands/x402/log.js +344 -0
  26. package/dist/commands/x402/log.js.map +1 -0
  27. package/dist/commands/x402/pay.js +2122 -0
  28. package/dist/commands/x402/pay.js.map +1 -0
  29. package/dist/commands/x402/status.js +1047 -0
  30. package/dist/commands/x402/status.js.map +1 -0
  31. package/dist/index.js +41 -14
  32. package/dist/index.js.map +1 -1
  33. package/dist/lib/bridge-singleton.js +41 -14
  34. package/dist/lib/bridge-singleton.js.map +1 -1
  35. package/dist/lib/config.js +26 -3
  36. package/dist/lib/config.js.map +1 -1
  37. package/dist/lib/keystore.js +13 -2
  38. package/dist/lib/keystore.js.map +1 -1
  39. package/dist/lib/paths.js +3 -1
  40. package/dist/lib/paths.js.map +1 -1
  41. package/dist/lib/payment-lock.js +121 -0
  42. package/dist/lib/payment-lock.js.map +1 -0
  43. package/dist/lib/session-bridge.js +148 -24
  44. package/dist/lib/session-bridge.js.map +1 -1
  45. package/dist/lib/session-config.js +78 -11
  46. package/dist/lib/session-config.js.map +1 -1
  47. package/dist/lib/terminal.js +22 -0
  48. package/dist/lib/terminal.js.map +1 -0
  49. package/dist/lib/validation.js +3 -3
  50. package/dist/lib/validation.js.map +1 -1
  51. package/dist/lib/ws-bridge.js +22 -10
  52. package/dist/lib/ws-bridge.js.map +1 -1
  53. package/dist/mcp/handlers/config.js +73 -6
  54. package/dist/mcp/handlers/config.js.map +1 -1
  55. package/dist/mcp/handlers/daemon.js +43 -12
  56. package/dist/mcp/handlers/daemon.js.map +1 -1
  57. package/dist/mcp/handlers/resources.js +119 -0
  58. package/dist/mcp/handlers/resources.js.map +1 -1
  59. package/dist/mcp/handlers/rpc.js +269 -60
  60. package/dist/mcp/handlers/rpc.js.map +1 -1
  61. package/dist/mcp/helpers.js +50 -3
  62. package/dist/mcp/helpers.js.map +1 -1
  63. package/dist/mcp/server.js +2426 -94
  64. package/dist/mcp/server.js.map +1 -1
  65. package/dist/mcp/tools.js +43 -3
  66. package/dist/mcp/tools.js.map +1 -1
  67. package/dist/x402/log-view.js +160 -0
  68. package/dist/x402/log-view.js.map +1 -0
  69. package/dist/x402/status-report.js +90 -0
  70. package/dist/x402/status-report.js.map +1 -0
  71. package/oclif.manifest.json +405 -11
  72. package/package.json +5 -2
@@ -144,7 +144,9 @@
144
144
  "examples": [
145
145
  "<%= config.bin %> config set apiKey=your-api-key defaultChain=8453",
146
146
  "<%= config.bin %> config set ens=yourdomain.eth sessionExpiry=14",
147
- "<%= config.bin %> config set apiKey your-api-key"
147
+ "<%= config.bin %> config set apiKey your-api-key",
148
+ "<%= config.bin %> config set x402.maxAmountPerPayment=50000 x402.maxTotalPerSession=1000000",
149
+ "<%= config.bin %> config set x402.allowedNetworks=eip155:8453,eip155:84532"
148
150
  ],
149
151
  "flags": {
150
152
  "output": {
@@ -351,6 +353,30 @@
351
353
  "write.js"
352
354
  ]
353
355
  },
356
+ "mcp": {
357
+ "aliases": [],
358
+ "args": {},
359
+ "description": "Start the MCP server for AI agents (stdio transport)",
360
+ "examples": [
361
+ "<%= config.bin %> mcp"
362
+ ],
363
+ "flags": {},
364
+ "hasDynamicHelp": false,
365
+ "hiddenAliases": [],
366
+ "id": "mcp",
367
+ "pluginAlias": "@jaw.id/cli",
368
+ "pluginName": "@jaw.id/cli",
369
+ "pluginType": "core",
370
+ "strict": true,
371
+ "enableJsonFlag": false,
372
+ "isESM": true,
373
+ "relativePath": [
374
+ "dist",
375
+ "commands",
376
+ "mcp",
377
+ "index.js"
378
+ ]
379
+ },
354
380
  "rpc:call": {
355
381
  "aliases": [],
356
382
  "args": {
@@ -422,9 +448,8 @@
422
448
  },
423
449
  "timeout": {
424
450
  "char": "t",
425
- "description": "Request timeout in seconds",
451
+ "description": "Request timeout in seconds (default 120, or JAW_BRIDGE_TIMEOUT_MS)",
426
452
  "name": "timeout",
427
- "default": 120,
428
453
  "hasDynamicHelp": false,
429
454
  "multiple": false,
430
455
  "type": "option"
@@ -454,17 +479,85 @@
454
479
  "call.js"
455
480
  ]
456
481
  },
457
- "mcp": {
482
+ "x402:log": {
458
483
  "aliases": [],
459
484
  "args": {},
460
- "description": "Start the MCP server for AI agents (stdio transport)",
485
+ "description": "Show the local x402 payment ledger: every attempt, paid, failed or refused, with amounts and transactions.",
461
486
  "examples": [
462
- "<%= config.bin %> mcp"
487
+ "<%= config.bin %> x402 log",
488
+ "<%= config.bin %> x402 log --limit 20",
489
+ "<%= config.bin %> x402 log --status failed",
490
+ "<%= config.bin %> x402 log --output json"
463
491
  ],
464
- "flags": {},
492
+ "flags": {
493
+ "output": {
494
+ "char": "o",
495
+ "description": "Output format",
496
+ "env": "JAW_OUTPUT",
497
+ "name": "output",
498
+ "default": "human",
499
+ "hasDynamicHelp": false,
500
+ "multiple": false,
501
+ "options": [
502
+ "json",
503
+ "human"
504
+ ],
505
+ "type": "option"
506
+ },
507
+ "chain": {
508
+ "char": "c",
509
+ "description": "Chain ID",
510
+ "env": "JAW_CHAIN_ID",
511
+ "name": "chain",
512
+ "hasDynamicHelp": false,
513
+ "multiple": false,
514
+ "type": "option"
515
+ },
516
+ "api-key": {
517
+ "description": "JAW API key",
518
+ "env": "JAW_API_KEY",
519
+ "name": "api-key",
520
+ "hasDynamicHelp": false,
521
+ "multiple": false,
522
+ "type": "option"
523
+ },
524
+ "yes": {
525
+ "char": "y",
526
+ "description": "Skip confirmations (for AI agents)",
527
+ "name": "yes",
528
+ "allowNo": false,
529
+ "type": "boolean"
530
+ },
531
+ "quiet": {
532
+ "char": "q",
533
+ "description": "Suppress non-essential output",
534
+ "name": "quiet",
535
+ "allowNo": false,
536
+ "type": "boolean"
537
+ },
538
+ "limit": {
539
+ "description": "Show only the most recent N entries.",
540
+ "name": "limit",
541
+ "hasDynamicHelp": false,
542
+ "multiple": false,
543
+ "type": "option"
544
+ },
545
+ "status": {
546
+ "description": "Show only entries with this outcome.",
547
+ "name": "status",
548
+ "hasDynamicHelp": false,
549
+ "multiple": false,
550
+ "options": [
551
+ "paid",
552
+ "failed",
553
+ "refused"
554
+ ],
555
+ "type": "option"
556
+ }
557
+ },
465
558
  "hasDynamicHelp": false,
466
559
  "hiddenAliases": [],
467
- "id": "mcp",
560
+ "id": "x402:log",
468
561
  "pluginAlias": "@jaw.id/cli",
469
562
  "pluginName": "@jaw.id/cli",
470
563
  "pluginType": "core",
@@ -474,8 +567,282 @@
474
567
  "relativePath": [
475
568
  "dist",
476
569
  "commands",
477
- "mcp",
478
- "index.js"
570
+ "x402",
571
+ "log.js"
572
+ ]
573
+ },
574
+ "x402:pay": {
575
+ "aliases": [],
576
+ "args": {
577
+ "url": {
578
+ "description": "Resource URL to fetch",
579
+ "name": "url",
580
+ "required": true
581
+ }
582
+ },
583
+ "description": "Fetch a URL, paying an x402 challenge with the session key. Dry run by default: pass --pay to actually spend.",
584
+ "examples": [
585
+ "<%= config.bin %> x402 pay https://api.example.com/resource",
586
+ "<%= config.bin %> x402 pay https://api.example.com/resource --pay",
587
+ "<%= config.bin %> x402 pay https://api.example.com/resource --pay --max-amount 50000"
588
+ ],
589
+ "flags": {
590
+ "output": {
591
+ "char": "o",
592
+ "description": "Output format",
593
+ "env": "JAW_OUTPUT",
594
+ "name": "output",
595
+ "default": "human",
596
+ "hasDynamicHelp": false,
597
+ "multiple": false,
598
+ "options": [
599
+ "json",
600
+ "human"
601
+ ],
602
+ "type": "option"
603
+ },
604
+ "chain": {
605
+ "char": "c",
606
+ "description": "Chain ID",
607
+ "env": "JAW_CHAIN_ID",
608
+ "name": "chain",
609
+ "hasDynamicHelp": false,
610
+ "multiple": false,
611
+ "type": "option"
612
+ },
613
+ "api-key": {
614
+ "description": "JAW API key",
615
+ "env": "JAW_API_KEY",
616
+ "name": "api-key",
617
+ "hasDynamicHelp": false,
618
+ "multiple": false,
619
+ "type": "option"
620
+ },
621
+ "yes": {
622
+ "char": "y",
623
+ "description": "Skip confirmations (for AI agents)",
624
+ "name": "yes",
625
+ "allowNo": false,
626
+ "type": "boolean"
627
+ },
628
+ "quiet": {
629
+ "char": "q",
630
+ "description": "Suppress non-essential output",
631
+ "name": "quiet",
632
+ "allowNo": false,
633
+ "type": "boolean"
634
+ },
635
+ "pay": {
636
+ "description": "Actually sign and send the payment. Without this the command stops before spending.",
637
+ "name": "pay",
638
+ "allowNo": false,
639
+ "type": "boolean"
640
+ },
641
+ "max-amount": {
642
+ "description": "Hard ceiling in base units for this call, on top of the configured policy.",
643
+ "name": "max-amount",
644
+ "hasDynamicHelp": false,
645
+ "multiple": false,
646
+ "type": "option"
647
+ },
648
+ "method": {
649
+ "description": "HTTP method (default GET).",
650
+ "name": "method",
651
+ "hasDynamicHelp": false,
652
+ "multiple": false,
653
+ "type": "option"
654
+ },
655
+ "body": {
656
+ "description": "Request body.",
657
+ "name": "body",
658
+ "hasDynamicHelp": false,
659
+ "multiple": false,
660
+ "type": "option"
661
+ }
662
+ },
663
+ "hasDynamicHelp": false,
664
+ "hiddenAliases": [],
665
+ "id": "x402:pay",
666
+ "pluginAlias": "@jaw.id/cli",
667
+ "pluginName": "@jaw.id/cli",
668
+ "pluginType": "core",
669
+ "strict": true,
670
+ "enableJsonFlag": false,
671
+ "isESM": true,
672
+ "relativePath": [
673
+ "dist",
674
+ "commands",
675
+ "x402",
676
+ "pay.js"
677
+ ]
678
+ },
679
+ "x402:status": {
680
+ "aliases": [],
681
+ "args": {},
682
+ "description": "Show x402 payment readiness: which account holds the funds, the resolved caps, and what has been spent. Reads only, never pays.",
683
+ "examples": [
684
+ "<%= config.bin %> x402 status",
685
+ "<%= config.bin %> x402 status --output json"
686
+ ],
687
+ "flags": {
688
+ "output": {
689
+ "char": "o",
690
+ "description": "Output format",
691
+ "env": "JAW_OUTPUT",
692
+ "name": "output",
693
+ "default": "human",
694
+ "hasDynamicHelp": false,
695
+ "multiple": false,
696
+ "options": [
697
+ "json",
698
+ "human"
699
+ ],
700
+ "type": "option"
701
+ },
702
+ "chain": {
703
+ "char": "c",
704
+ "description": "Chain ID",
705
+ "env": "JAW_CHAIN_ID",
706
+ "name": "chain",
707
+ "hasDynamicHelp": false,
708
+ "multiple": false,
709
+ "type": "option"
710
+ },
711
+ "api-key": {
712
+ "description": "JAW API key",
713
+ "env": "JAW_API_KEY",
714
+ "name": "api-key",
715
+ "hasDynamicHelp": false,
716
+ "multiple": false,
717
+ "type": "option"
718
+ },
719
+ "yes": {
720
+ "char": "y",
721
+ "description": "Skip confirmations (for AI agents)",
722
+ "name": "yes",
723
+ "allowNo": false,
724
+ "type": "boolean"
725
+ },
726
+ "quiet": {
727
+ "char": "q",
728
+ "description": "Suppress non-essential output",
729
+ "name": "quiet",
730
+ "allowNo": false,
731
+ "type": "boolean"
732
+ }
733
+ },
734
+ "hasDynamicHelp": false,
735
+ "hiddenAliases": [],
736
+ "id": "x402:status",
737
+ "pluginAlias": "@jaw.id/cli",
738
+ "pluginName": "@jaw.id/cli",
739
+ "pluginType": "core",
740
+ "strict": true,
741
+ "enableJsonFlag": false,
742
+ "isESM": true,
743
+ "relativePath": [
744
+ "dist",
745
+ "commands",
746
+ "x402",
747
+ "status.js"
748
+ ]
749
+ },
750
+ "session:add": {
751
+ "aliases": [],
752
+ "args": {},
753
+ "description": "Add permissions to the current session, keeping the ones it already has (one browser approval to grant, one to revoke the old).",
754
+ "examples": [
755
+ "<%= config.bin %> session add --x402",
756
+ "<%= config.bin %> session add --x402 --limit 10/day",
757
+ "<%= config.bin %> session add --permissions '{\"calls\":[...]}'"
758
+ ],
759
+ "flags": {
760
+ "output": {
761
+ "char": "o",
762
+ "description": "Output format",
763
+ "env": "JAW_OUTPUT",
764
+ "name": "output",
765
+ "default": "human",
766
+ "hasDynamicHelp": false,
767
+ "multiple": false,
768
+ "options": [
769
+ "json",
770
+ "human"
771
+ ],
772
+ "type": "option"
773
+ },
774
+ "chain": {
775
+ "char": "c",
776
+ "description": "Chain ID",
777
+ "env": "JAW_CHAIN_ID",
778
+ "name": "chain",
779
+ "hasDynamicHelp": false,
780
+ "multiple": false,
781
+ "type": "option"
782
+ },
783
+ "api-key": {
784
+ "description": "JAW API key",
785
+ "env": "JAW_API_KEY",
786
+ "name": "api-key",
787
+ "hasDynamicHelp": false,
788
+ "multiple": false,
789
+ "type": "option"
790
+ },
791
+ "yes": {
792
+ "char": "y",
793
+ "description": "Skip confirmations (for AI agents)",
794
+ "name": "yes",
795
+ "allowNo": false,
796
+ "type": "boolean"
797
+ },
798
+ "quiet": {
799
+ "char": "q",
800
+ "description": "Suppress non-essential output",
801
+ "name": "quiet",
802
+ "allowNo": false,
803
+ "type": "boolean"
804
+ },
805
+ "permissions": {
806
+ "description": "Permissions to add (inline JSON or file path).",
807
+ "exclusive": [
808
+ "x402"
809
+ ],
810
+ "name": "permissions",
811
+ "hasDynamicHelp": false,
812
+ "multiple": false,
813
+ "type": "option"
814
+ },
815
+ "x402": {
816
+ "description": "Add exactly what x402 payments need on the session chain. Tune the cap with --limit.",
817
+ "exclusive": [
818
+ "permissions"
819
+ ],
820
+ "name": "x402",
821
+ "allowNo": false,
822
+ "type": "boolean"
823
+ },
824
+ "limit": {
825
+ "description": "Spend cap for --x402, as <amount>/<period> (default 10/day).",
826
+ "name": "limit",
827
+ "hasDynamicHelp": false,
828
+ "multiple": false,
829
+ "type": "option"
830
+ }
831
+ },
832
+ "hasDynamicHelp": false,
833
+ "hiddenAliases": [],
834
+ "id": "session:add",
835
+ "pluginAlias": "@jaw.id/cli",
836
+ "pluginName": "@jaw.id/cli",
837
+ "pluginType": "core",
838
+ "strict": true,
839
+ "enableJsonFlag": false,
840
+ "isESM": true,
841
+ "relativePath": [
842
+ "dist",
843
+ "commands",
844
+ "session",
845
+ "add.js"
479
846
  ]
480
847
  },
481
848
  "session:revoke": {
@@ -527,6 +894,12 @@
527
894
  "name": "quiet",
528
895
  "allowNo": false,
529
896
  "type": "boolean"
897
+ },
898
+ "force": {
899
+ "description": "Delete the local session even if some permissions could not be revoked. They stay live on chain until they expire, and their ids are printed because deleting the session is what loses them.",
900
+ "name": "force",
901
+ "allowNo": false,
902
+ "type": "boolean"
530
903
  }
531
904
  },
532
905
  "hasDynamicHelp": false,
@@ -550,6 +923,8 @@
550
923
  "args": {},
551
924
  "description": "Generate a session key and grant scoped on-chain permissions (one-time browser approval).",
552
925
  "examples": [
926
+ "<%= config.bin %> session setup --chain 8453 --x402",
927
+ "<%= config.bin %> session setup --chain 8453 --x402 --limit 25/day --expiry 14",
553
928
  "<%= config.bin %> session setup --chain 84532",
554
929
  "<%= config.bin %> session setup --permissions '{\"calls\":[...]}' --expiry 14",
555
930
  "<%= config.bin %> session setup --permissions ./permissions.json"
@@ -602,11 +977,30 @@
602
977
  },
603
978
  "permissions": {
604
979
  "description": "Permission scope (inline JSON or file path). Overrides config.permissions.",
980
+ "exclusive": [
981
+ "x402"
982
+ ],
605
983
  "name": "permissions",
606
984
  "hasDynamicHelp": false,
607
985
  "multiple": false,
608
986
  "type": "option"
609
987
  },
988
+ "x402": {
989
+ "description": "Grant exactly what x402 payments need on this chain: a USDC transfer capped per period. Builds the permission from the asset registry so the USDC address and function signature do not have to be written by hand. Tune the cap with --limit.",
990
+ "exclusive": [
991
+ "permissions"
992
+ ],
993
+ "name": "x402",
994
+ "allowNo": false,
995
+ "type": "boolean"
996
+ },
997
+ "limit": {
998
+ "description": "Spend cap for --x402, as <amount>/<period> (default 10/day). Examples: 25/day, 2.5/week, 100/month.",
999
+ "name": "limit",
1000
+ "hasDynamicHelp": false,
1001
+ "multiple": false,
1002
+ "type": "option"
1003
+ },
610
1004
  "expiry": {
611
1005
  "description": "Permission expiry in days. Overrides config.sessionExpiry.",
612
1006
  "name": "expiry",
@@ -699,5 +1093,5 @@
699
1093
  ]
700
1094
  }
701
1095
  },
702
- "version": "0.1.26"
1096
+ "version": "0.2.1"
703
1097
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jaw.id/cli",
3
3
  "description": "CLI + MCP Server for JAW.id smart accounts — for humans and AI agents",
4
- "version": "0.1.26",
4
+ "version": "0.2.1",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "bin": {
@@ -55,6 +55,9 @@
55
55
  },
56
56
  "session": {
57
57
  "description": "Manage session keys for autonomous AI agents"
58
+ },
59
+ "x402": {
60
+ "description": "Inspect and test agentic x402 payments"
58
61
  }
59
62
  }
60
63
  },
@@ -109,7 +112,7 @@
109
112
  }
110
113
  },
111
114
  "dependencies": {
112
- "@jaw.id/core": "1.2.3",
115
+ "@jaw.id/core": "1.3.1",
113
116
  "@modelcontextprotocol/sdk": "^1.12.1",
114
117
  "@oclif/core": "^4.3.0",
115
118
  "open": "^10.1.0",