@paylobster/cli 4.0.0

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 (89) hide show
  1. package/BUILD_SUMMARY.md +429 -0
  2. package/CHANGELOG.md +78 -0
  3. package/CONTRIBUTING.md +368 -0
  4. package/EXAMPLES.md +432 -0
  5. package/LICENSE +21 -0
  6. package/QUICKSTART.md +189 -0
  7. package/README.md +377 -0
  8. package/TEST_REPORT.md +191 -0
  9. package/bin/plob.js +9 -0
  10. package/bin/plob.ts +9 -0
  11. package/demo.sh +154 -0
  12. package/dist/bin/plob.d.ts +7 -0
  13. package/dist/bin/plob.d.ts.map +1 -0
  14. package/dist/bin/plob.js +10 -0
  15. package/dist/bin/plob.js.map +1 -0
  16. package/dist/src/commands/auth.d.ts +3 -0
  17. package/dist/src/commands/auth.d.ts.map +1 -0
  18. package/dist/src/commands/auth.js +75 -0
  19. package/dist/src/commands/auth.js.map +1 -0
  20. package/dist/src/commands/config.d.ts +3 -0
  21. package/dist/src/commands/config.d.ts.map +1 -0
  22. package/dist/src/commands/config.js +79 -0
  23. package/dist/src/commands/config.js.map +1 -0
  24. package/dist/src/commands/escrow.d.ts +3 -0
  25. package/dist/src/commands/escrow.d.ts.map +1 -0
  26. package/dist/src/commands/escrow.js +193 -0
  27. package/dist/src/commands/escrow.js.map +1 -0
  28. package/dist/src/commands/mandate.d.ts +8 -0
  29. package/dist/src/commands/mandate.d.ts.map +1 -0
  30. package/dist/src/commands/mandate.js +54 -0
  31. package/dist/src/commands/mandate.js.map +1 -0
  32. package/dist/src/commands/pay.d.ts +6 -0
  33. package/dist/src/commands/pay.d.ts.map +1 -0
  34. package/dist/src/commands/pay.js +77 -0
  35. package/dist/src/commands/pay.js.map +1 -0
  36. package/dist/src/commands/register.d.ts +3 -0
  37. package/dist/src/commands/register.d.ts.map +1 -0
  38. package/dist/src/commands/register.js +51 -0
  39. package/dist/src/commands/register.js.map +1 -0
  40. package/dist/src/commands/reputation.d.ts +3 -0
  41. package/dist/src/commands/reputation.d.ts.map +1 -0
  42. package/dist/src/commands/reputation.js +116 -0
  43. package/dist/src/commands/reputation.js.map +1 -0
  44. package/dist/src/commands/status.d.ts +3 -0
  45. package/dist/src/commands/status.d.ts.map +1 -0
  46. package/dist/src/commands/status.js +82 -0
  47. package/dist/src/commands/status.js.map +1 -0
  48. package/dist/src/index.d.ts +3 -0
  49. package/dist/src/index.d.ts.map +1 -0
  50. package/dist/src/index.js +59 -0
  51. package/dist/src/index.js.map +1 -0
  52. package/dist/src/lib/config.d.ts +26 -0
  53. package/dist/src/lib/config.d.ts.map +1 -0
  54. package/dist/src/lib/config.js +91 -0
  55. package/dist/src/lib/config.js.map +1 -0
  56. package/dist/src/lib/contracts.d.ts +18798 -0
  57. package/dist/src/lib/contracts.d.ts.map +1 -0
  58. package/dist/src/lib/contracts.js +361 -0
  59. package/dist/src/lib/contracts.js.map +1 -0
  60. package/dist/src/lib/display.d.ts +83 -0
  61. package/dist/src/lib/display.d.ts.map +1 -0
  62. package/dist/src/lib/display.js +293 -0
  63. package/dist/src/lib/display.js.map +1 -0
  64. package/dist/src/lib/types.d.ts +49 -0
  65. package/dist/src/lib/types.d.ts.map +1 -0
  66. package/dist/src/lib/types.js +3 -0
  67. package/dist/src/lib/types.js.map +1 -0
  68. package/dist/src/lib/wallet.d.ts +30 -0
  69. package/dist/src/lib/wallet.d.ts.map +1 -0
  70. package/dist/src/lib/wallet.js +143 -0
  71. package/dist/src/lib/wallet.js.map +1 -0
  72. package/jest.config.js +15 -0
  73. package/package.json +55 -0
  74. package/src/__tests__/cli.test.ts +38 -0
  75. package/src/commands/auth.ts +75 -0
  76. package/src/commands/config.ts +84 -0
  77. package/src/commands/escrow.ts +222 -0
  78. package/src/commands/mandate.ts +56 -0
  79. package/src/commands/pay.ts +96 -0
  80. package/src/commands/register.ts +57 -0
  81. package/src/commands/reputation.ts +84 -0
  82. package/src/commands/status.ts +91 -0
  83. package/src/index.ts +63 -0
  84. package/src/lib/config.ts +90 -0
  85. package/src/lib/contracts.ts +392 -0
  86. package/src/lib/display.ts +265 -0
  87. package/src/lib/types.ts +57 -0
  88. package/src/lib/wallet.ts +146 -0
  89. package/tsconfig.json +21 -0
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Simple pay command (wrapper around escrow create)
4
+ */
5
+ export declare function createPayCommand(): Command;
6
+ //# sourceMappingURL=pay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../../../src/commands/pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAuF1C"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPayCommand = createPayCommand;
4
+ const commander_1 = require("commander");
5
+ const contracts_1 = require("../lib/contracts");
6
+ const display_1 = require("../lib/display");
7
+ /**
8
+ * Simple pay command (wrapper around escrow create)
9
+ */
10
+ function createPayCommand() {
11
+ const cmd = new commander_1.Command('pay')
12
+ .description('Execute payment (creates escrow)')
13
+ .requiredOption('--to <address>', 'Recipient address')
14
+ .requiredOption('--amount <amount>', 'Amount in USDC')
15
+ .option('--description <desc>', 'Payment description', 'Payment via PayLobster CLI')
16
+ .option('--mandate <id>', 'Mandate ID (not yet implemented)')
17
+ .option('--yes', 'Skip confirmation')
18
+ .option('--json', 'Output as JSON')
19
+ .action(async (options) => {
20
+ try {
21
+ // Validate address format
22
+ if (!options.to.startsWith('0x') || options.to.length !== 42) {
23
+ (0, display_1.error)('Invalid recipient address format');
24
+ process.exit(1);
25
+ }
26
+ // Validate amount
27
+ const amount = parseFloat(options.amount);
28
+ if (isNaN(amount) || amount <= 0) {
29
+ (0, display_1.error)('Invalid amount. Must be a positive number');
30
+ process.exit(1);
31
+ }
32
+ if (options.mandate) {
33
+ (0, display_1.error)('Mandate payments are not yet implemented');
34
+ (0, display_1.info)('Use plob escrow create instead');
35
+ process.exit(1);
36
+ }
37
+ // Confirm payment
38
+ if (!options.yes) {
39
+ console.log();
40
+ console.log('Payment details:');
41
+ console.log(' To: ', options.to);
42
+ console.log(' Amount: ', options.amount, 'USDC');
43
+ console.log(' Description: ', options.description);
44
+ console.log();
45
+ const confirmed = await (0, display_1.confirm)('Send this payment?');
46
+ if (!confirmed) {
47
+ (0, display_1.info)('Cancelled');
48
+ process.exit(0);
49
+ }
50
+ }
51
+ (0, display_1.info)(`Sending ${options.amount} USDC to ${(0, display_1.formatAddress)(options.to)}`);
52
+ const txHash = await (0, display_1.withSpinner)('Processing payment...', async () => {
53
+ return await (0, contracts_1.createEscrow)(options.to, options.amount, options.description);
54
+ });
55
+ if ((0, display_1.outputJSON)({
56
+ txHash: txHash.toString(),
57
+ to: options.to,
58
+ amount: options.amount,
59
+ description: options.description,
60
+ }, options)) {
61
+ return;
62
+ }
63
+ (0, display_1.success)('Payment sent successfully!');
64
+ (0, display_1.info)(`Transaction: ${txHash.toString()}`);
65
+ (0, display_1.info)(`Recipient: ${options.to}`);
66
+ (0, display_1.info)(`Amount: ${options.amount} USDC`);
67
+ console.log();
68
+ (0, display_1.info)('Note: Payment is held in escrow. Use `plob escrow release <id>` to release funds.');
69
+ }
70
+ catch (err) {
71
+ (0, display_1.error)(`Failed to send payment: ${err}`);
72
+ process.exit(1);
73
+ }
74
+ });
75
+ return cmd;
76
+ }
77
+ //# sourceMappingURL=pay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pay.js","sourceRoot":"","sources":["../../../src/commands/pay.ts"],"names":[],"mappings":";;AAQA,4CAuFC;AA/FD,yCAAoC;AACpC,gDAAgD;AAChD,4CAAuG;AAGvG;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,KAAK,CAAC;SAC3B,WAAW,CAAC,kCAAkC,CAAC;SAC/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AAE,CAAC,CAAC;YACjC,IAAA,cAAI,EAAC,WAAW,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC;YACvC,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,IAAA,cAAI,EAAC,mFAAmF,CAAC,CAAC;QAC5F,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAA,eAAK,EAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createRegisterCommand(): Command;
3
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,IAAI,OAAO,CAkD/C"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRegisterCommand = createRegisterCommand;
4
+ const commander_1 = require("commander");
5
+ const contracts_1 = require("../lib/contracts");
6
+ const wallet_1 = require("../lib/wallet");
7
+ const display_1 = require("../lib/display");
8
+ function createRegisterCommand() {
9
+ const cmd = new commander_1.Command('register')
10
+ .description('Register agent identity on-chain')
11
+ .requiredOption('--name <name>', 'Agent name')
12
+ .requiredOption('--capabilities <capabilities>', 'Comma-separated capabilities (e.g., "code-review,bug-fix")')
13
+ .option('--json', 'Output as JSON')
14
+ .action(async (options) => {
15
+ try {
16
+ // Check if already registered
17
+ const address = (0, wallet_1.getWalletAddress)();
18
+ const agentInfo = await (0, contracts_1.getAgentInfo)(address);
19
+ if (agentInfo.registered) {
20
+ (0, display_1.error)('Agent is already registered');
21
+ (0, display_1.info)(`Current name: ${agentInfo.name}`);
22
+ (0, display_1.info)(`Token ID: ${agentInfo.tokenId.toString()}`);
23
+ process.exit(1);
24
+ }
25
+ // Register
26
+ const txHash = await (0, display_1.withSpinner)('Registering agent on-chain...', async () => {
27
+ return await (0, contracts_1.registerAgent)(options.name, options.capabilities);
28
+ });
29
+ // Get updated info
30
+ const updatedInfo = await (0, contracts_1.getAgentInfo)(address);
31
+ if ((0, display_1.outputJSON)({
32
+ txHash: txHash.toString(),
33
+ agentId: updatedInfo.tokenId.toString(),
34
+ name: updatedInfo.name,
35
+ address,
36
+ }, options)) {
37
+ return;
38
+ }
39
+ (0, display_1.success)('Agent registered successfully!');
40
+ (0, display_1.info)(`Name: ${updatedInfo.name}`);
41
+ (0, display_1.info)(`Agent ID: ${updatedInfo.tokenId.toString()}`);
42
+ (0, display_1.info)(`Transaction: ${txHash.toString()}`);
43
+ }
44
+ catch (err) {
45
+ (0, display_1.error)(`Failed to register agent: ${err}`);
46
+ process.exit(1);
47
+ }
48
+ });
49
+ return cmd;
50
+ }
51
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/register.ts"],"names":[],"mappings":";;AAMA,sDAkDC;AAxDD,yCAAoC;AACpC,gDAA+D;AAC/D,0CAAiD;AACjD,4CAA+E;AAG/E,SAAgB,qBAAqB;IACnC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,UAAU,CAAC;SAChC,WAAW,CAAC,kCAAkC,CAAC;SAC/C,cAAc,CAAC,eAAe,EAAE,YAAY,CAAC;SAC7C,cAAc,CAAC,+BAA+B,EAAE,4DAA4D,CAAC;SAC7G,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,OAA+D,EAAE,EAAE;QAChF,IAAI,CAAC;YACH,8BAA8B;YAC9B,MAAM,OAAO,GAAG,IAAA,yBAAgB,GAAmB,CAAC;YACpD,MAAM,SAAS,GAAG,MAAM,IAAA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AAC,CAAC;YAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createReputationCommand(): Command;
3
+ //# sourceMappingURL=reputation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reputation.d.ts","sourceRoot":"","sources":["../../../src/commands/reputation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,uBAAuB,IAAI,OAAO,CA8EjD"}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createReputationCommand = createReputationCommand;
37
+ const commander_1 = require("commander");
38
+ const contracts_1 = require("../lib/contracts");
39
+ const display_1 = require("../lib/display");
40
+ function createReputationCommand() {
41
+ const cmd = new commander_1.Command('reputation')
42
+ .description('Check reputation score')
43
+ .argument('[address]', 'Address to check (default: your wallet)')
44
+ .option('--json', 'Output as JSON')
45
+ .action(async (addressArg, options) => {
46
+ try {
47
+ let address;
48
+ if (addressArg) {
49
+ // Validate address format
50
+ if (!addressArg.startsWith('0x') || addressArg.length !== 42) {
51
+ (0, display_1.error)('Invalid address format');
52
+ process.exit(1);
53
+ }
54
+ address = addressArg;
55
+ }
56
+ else {
57
+ // Use wallet address
58
+ const { getWalletAddress } = await Promise.resolve().then(() => __importStar(require('../lib/wallet')));
59
+ address = getWalletAddress();
60
+ }
61
+ // Fetch reputation and agent info
62
+ const [reputation, agentInfo] = await Promise.all([
63
+ (0, contracts_1.getReputation)(address),
64
+ (0, contracts_1.getAgentInfo)(address),
65
+ ]);
66
+ const reputationScore = Number(reputation.score);
67
+ const trustVector = Number(reputation.trustVector);
68
+ if ((0, display_1.outputJSON)({
69
+ address,
70
+ name: agentInfo.name,
71
+ registered: agentInfo.registered,
72
+ reputation: {
73
+ score: reputationScore,
74
+ trustVector,
75
+ },
76
+ }, options)) {
77
+ return;
78
+ }
79
+ // Pretty output
80
+ (0, display_1.header)('Reputation Report');
81
+ console.log();
82
+ console.log('Address: ', address);
83
+ if (agentInfo.registered) {
84
+ console.log('Name: ', agentInfo.name);
85
+ console.log('Agent ID: ', agentInfo.tokenId.toString());
86
+ }
87
+ else {
88
+ console.log('Status: ', 'Not registered');
89
+ }
90
+ console.log();
91
+ console.log('Reputation: ', (0, display_1.printReputation)(reputationScore));
92
+ console.log('Trust: ', trustVector);
93
+ console.log();
94
+ // Add interpretation
95
+ if (reputationScore >= 80) {
96
+ console.log('✅ Excellent reputation - highly trusted');
97
+ }
98
+ else if (reputationScore >= 60) {
99
+ console.log('⚠️ Good reputation - generally trusted');
100
+ }
101
+ else if (reputationScore >= 40) {
102
+ console.log('⚠️ Fair reputation - proceed with caution');
103
+ }
104
+ else {
105
+ console.log('❌ Low reputation - high risk');
106
+ }
107
+ console.log();
108
+ }
109
+ catch (err) {
110
+ (0, display_1.error)(`Failed to fetch reputation: ${err}`);
111
+ process.exit(1);
112
+ }
113
+ });
114
+ return cmd;
115
+ }
116
+ //# sourceMappingURL=reputation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reputation.js","sourceRoot":"","sources":["../../../src/commands/reputation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,0DA8EC;AAnFD,yCAAoC;AACpC,gDAA+D;AAC/D,4CAA4E;AAG5E,SAAgB,uBAAuB;IACrC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,YAAY,CAAC;SAClC,WAAW,CAAC,wBAAwB,CAAC;SACrC,QAAQ,CAAC,WAAW,EAAE,yCAAyC,CAAC;SAChE,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,OAAsB,EAAE,EAAE;QACvE,IAAI,CAAC;YACH,IAAI,OAAsB,CAAC;YAE3B,IAAI,UAAU,EAAE,CAAC;gBACf,0BAA0B;gBAC1B,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;oBAC7D,IAAA,eAAK,EAAC,wBAAwB,CAAC,CAAC;oBAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;gBACD,OAAO,GAAG,UAA2B,CAAC;YACxC,CAAC;iBAAM,CAAC;gBACN,qBAAqB;gBACrB,MAAM,EAAE,gBAAgB,EAAE,GAAG,wDAAa,eAAe,GAAC,CA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,cAAc,EAAE,WAAW,CAAC,CAAC;YACzC,OAAO,CAAC,GAAG,EAAE,CAAC;YAEd,qBAAqB;YACrB,IAAI,eAAe,IAAI,EAAE,EAAE,CAAC;gBAC1B,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;YACzD,CAAC;iBAAM,IAAI,eAAe,IAAI,EAAE,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;YACzD,CAAC;iBAAM,IAAI,eAAe,IAAI,EAAE,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;YAC9C,CAAC;YACD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAA,eAAK,EAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createStatusCommand(): Command;
3
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,mBAAmB,IAAI,OAAO,CAmF7C"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createStatusCommand = createStatusCommand;
4
+ const commander_1 = require("commander");
5
+ const contracts_1 = require("../lib/contracts");
6
+ const wallet_1 = require("../lib/wallet");
7
+ const config_1 = require("../lib/config");
8
+ const display_1 = require("../lib/display");
9
+ function createStatusCommand() {
10
+ const cmd = new commander_1.Command('status')
11
+ .description('Show agent status and balances')
12
+ .option('--json', 'Output as JSON')
13
+ .action(async (options) => {
14
+ try {
15
+ const address = (0, wallet_1.getWalletAddress)();
16
+ const config = (0, config_1.loadConfig)();
17
+ // Fetch all data in parallel
18
+ const [agentInfo, reputation, creditStatus, balance, escrowCount] = await Promise.all([
19
+ (0, contracts_1.getAgentInfo)(address),
20
+ (0, contracts_1.getReputation)(address),
21
+ (0, contracts_1.getCreditStatus)(address),
22
+ (0, contracts_1.getBalance)(address),
23
+ (0, contracts_1.getUserEscrowCount)(address),
24
+ ]);
25
+ // Calculate reputation score (0-100)
26
+ const reputationScore = Number(reputation.score);
27
+ // Format balances
28
+ const usdcBalance = (0, contracts_1.formatUSDC)(balance.usdc);
29
+ const ethBalance = (0, contracts_1.formatETH)(balance.eth);
30
+ // Format credit
31
+ const creditLimit = (0, contracts_1.formatUSDC)(creditStatus.limit);
32
+ const creditAvailable = (0, contracts_1.formatUSDC)(creditStatus.available);
33
+ const creditInUse = (0, contracts_1.formatUSDC)(creditStatus.inUse);
34
+ if ((0, display_1.outputJSON)({
35
+ name: agentInfo.name,
36
+ address,
37
+ network: config.network,
38
+ registered: agentInfo.registered,
39
+ tokenId: agentInfo.tokenId.toString(),
40
+ balance: {
41
+ usdc: usdcBalance,
42
+ eth: ethBalance,
43
+ },
44
+ credit: {
45
+ limit: creditLimit,
46
+ available: creditAvailable,
47
+ inUse: creditInUse,
48
+ },
49
+ reputation: reputationScore,
50
+ escrows: escrowCount,
51
+ }, options)) {
52
+ return;
53
+ }
54
+ // Pretty output
55
+ (0, display_1.printAgentHeader)(agentInfo.name || 'Not Registered', address);
56
+ console.log('Network: ', (0, display_1.formatNetwork)(config.network));
57
+ console.log('Registered: ', (0, display_1.formatBoolean)(agentInfo.registered));
58
+ if (agentInfo.registered) {
59
+ console.log('Agent ID: ', agentInfo.tokenId.toString());
60
+ }
61
+ console.log();
62
+ console.log('💰 Balances');
63
+ console.log(' USDC: ', (0, display_1.formatNumber)(usdcBalance), 'USDC');
64
+ console.log(' ETH: ', (0, display_1.formatNumber)(ethBalance), 'ETH');
65
+ console.log();
66
+ console.log('💳 Credit');
67
+ console.log(' Limit: ', (0, display_1.formatNumber)(creditLimit), 'USDC');
68
+ console.log(' Available:', (0, display_1.formatNumber)(creditAvailable), 'USDC');
69
+ console.log(' In Use: ', (0, display_1.formatNumber)(creditInUse), 'USDC');
70
+ console.log();
71
+ console.log('⭐ Reputation:', (0, display_1.printReputation)(reputationScore));
72
+ console.log('📦 Escrows: ', escrowCount, 'total');
73
+ console.log();
74
+ }
75
+ catch (err) {
76
+ (0, display_1.error)(`Failed to fetch status: ${err}`);
77
+ process.exit(1);
78
+ }
79
+ });
80
+ return cmd;
81
+ }
82
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":";;AAOA,kDAmFC;AA1FD,yCAAoC;AACpC,gDAAuI;AACvI,0CAAiD;AACjD,0CAA2C;AAC3C,4CAAkI;AAGlI,SAAgB,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;SAC9B,WAAW,CAAC,gCAAgC,CAAC;SAC7C,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,OAAsB,EAAE,EAAE;QACvC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAA,yBAAgB,GAAmB,CAAC;YACpD,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;YAE5B,6BAA6B;YAC7B,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACpF,IAAA,wBAAY,EAAC,OAAO,CAAC;gBACrB,IAAA,yBAAa,EAAC,OAAO,CAAC;gBACtB,IA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G,EAAE,CAAC;YACb,IAAA,eAAK,EAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const auth_1 = require("./commands/auth");
9
+ const config_1 = require("./commands/config");
10
+ const register_1 = require("./commands/register");
11
+ const status_1 = require("./commands/status");
12
+ const escrow_1 = require("./commands/escrow");
13
+ const mandate_1 = require("./commands/mandate");
14
+ const pay_1 = require("./commands/pay");
15
+ const reputation_1 = require("./commands/reputation");
16
+ const chalk_1 = __importDefault(require("chalk"));
17
+ // Load environment variables from .env file if present
18
+ const dotenv_1 = __importDefault(require("dotenv"));
19
+ dotenv_1.default.config();
20
+ const program = new commander_1.Command();
21
+ program
22
+ .name('plob')
23
+ .description('🦞 PayLobster CLI - Payment infrastructure for AI agents')
24
+ .version('4.0.0');
25
+ // ASCII art banner
26
+ const banner = `
27
+ ${chalk_1.default.cyan('┌─────────────────────────────────┐')}
28
+ ${chalk_1.default.cyan('│')} ${chalk_1.default.bold.cyan('🦞 PayLobster CLI')} ${chalk_1.default.cyan('│')}
29
+ ${chalk_1.default.cyan('│')} Payment infrastructure for AI ${chalk_1.default.cyan('│')}
30
+ ${chalk_1.default.cyan('└─────────────────────────────────┘')}
31
+ `;
32
+ // Show banner on help
33
+ program.on('--help', () => {
34
+ console.log(banner);
35
+ });
36
+ // Add commands
37
+ program.addCommand((0, auth_1.createAuthCommand)());
38
+ program.addCommand((0, config_1.createConfigCommand)());
39
+ program.addCommand((0, register_1.createRegisterCommand)());
40
+ program.addCommand((0, status_1.createStatusCommand)());
41
+ program.addCommand((0, escrow_1.createEscrowCommand)());
42
+ program.addCommand((0, mandate_1.createMandateCommand)());
43
+ program.addCommand((0, pay_1.createPayCommand)());
44
+ program.addCommand((0, reputation_1.createReputationCommand)());
45
+ // Handle errors
46
+ program.exitOverride((err) => {
47
+ if (err.code === 'commander.help') {
48
+ console.log(banner);
49
+ }
50
+ process.exit(err.exitCode);
51
+ });
52
+ // Parse arguments
53
+ program.parse(process.argv);
54
+ // Show help if no command provided
55
+ if (!process.argv.slice(2).length) {
56
+ console.log(banner);
57
+ program.outputHelp();
58
+ }
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,0CAAoD;AACpD,8CAAwD;AACxD,kDAA4D;AAC5D,8CAAwD;AACxD,8CAAwD;AACxD,gDAA0D;AAC1D,wCAAkD;AAClD,sDAAgE;AAChE,kDAA0B;AAE1B,uDAAuD;AACvD,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,0DAA0D,CAAC;KACvE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,mBAAmB;AACnB,MAAM,MAAM,GAAG;EACb,eAAK,CAAC,IAAI,CAAC,qCAAqC,CAAC;EACjD,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,eAAK,CAAC,IAAI,CAAC,G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AAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { CLIConfig, Network } from './types';
2
+ /**
3
+ * Load CLI configuration from ~/.plob/config.json
4
+ */
5
+ export declare function loadConfig(): CLIConfig;
6
+ /**
7
+ * Save CLI configuration to ~/.plob/config.json
8
+ */
9
+ export declare function saveConfig(config: Partial<CLIConfig>): void;
10
+ /**
11
+ * Get a specific config value
12
+ */
13
+ export declare function getConfigValue(key: keyof CLIConfig): any;
14
+ /**
15
+ * Set a specific config value
16
+ */
17
+ export declare function setConfigValue(key: keyof CLIConfig, value: any): void;
18
+ /**
19
+ * Get RPC URL for the configured network
20
+ */
21
+ export declare function getRpcUrl(network?: Network): string;
22
+ /**
23
+ * Clear all configuration
24
+ */
25
+ export declare function clearConfig(): void;
26
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAWlD;;GAEG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAUtC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAc3D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,SAAS,GAAG,GAAG,CAGxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,SAAS,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAIrE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAYnD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAIlC"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadConfig = loadConfig;
7
+ exports.saveConfig = saveConfig;
8
+ exports.getConfigValue = getConfigValue;
9
+ exports.setConfigValue = setConfigValue;
10
+ exports.getRpcUrl = getRpcUrl;
11
+ exports.clearConfig = clearConfig;
12
+ const fs_1 = __importDefault(require("fs"));
13
+ const path_1 = __importDefault(require("path"));
14
+ const os_1 = __importDefault(require("os"));
15
+ const CONFIG_DIR = path_1.default.join(os_1.default.homedir(), '.plob');
16
+ const CONFIG_FILE = path_1.default.join(CONFIG_DIR, 'config.json');
17
+ // Default configuration
18
+ const DEFAULT_CONFIG = {
19
+ network: 'sepolia',
20
+ indexerUrl: 'https://api.thegraph.com/subgraphs/name/paylobster/registry',
21
+ };
22
+ /**
23
+ * Load CLI configuration from ~/.plob/config.json
24
+ */
25
+ function loadConfig() {
26
+ try {
27
+ if (!fs_1.default.existsSync(CONFIG_FILE)) {
28
+ return DEFAULT_CONFIG;
29
+ }
30
+ const data = fs_1.default.readFileSync(CONFIG_FILE, 'utf-8');
31
+ return { ...DEFAULT_CONFIG, ...JSON.parse(data) };
32
+ }
33
+ catch (error) {
34
+ return DEFAULT_CONFIG;
35
+ }
36
+ }
37
+ /**
38
+ * Save CLI configuration to ~/.plob/config.json
39
+ */
40
+ function saveConfig(config) {
41
+ try {
42
+ // Ensure config directory exists
43
+ if (!fs_1.default.existsSync(CONFIG_DIR)) {
44
+ fs_1.default.mkdirSync(CONFIG_DIR, { recursive: true });
45
+ }
46
+ const currentConfig = loadConfig();
47
+ const newConfig = { ...currentConfig, ...config };
48
+ fs_1.default.writeFileSync(CONFIG_FILE, JSON.stringify(newConfig, null, 2));
49
+ }
50
+ catch (error) {
51
+ throw new Error(`Failed to save config: ${error}`);
52
+ }
53
+ }
54
+ /**
55
+ * Get a specific config value
56
+ */
57
+ function getConfigValue(key) {
58
+ const config = loadConfig();
59
+ return config[key];
60
+ }
61
+ /**
62
+ * Set a specific config value
63
+ */
64
+ function setConfigValue(key, value) {
65
+ const config = loadConfig();
66
+ config[key] = value;
67
+ saveConfig(config);
68
+ }
69
+ /**
70
+ * Get RPC URL for the configured network
71
+ */
72
+ function getRpcUrl(network) {
73
+ const config = loadConfig();
74
+ const net = network || config.network;
75
+ if (config.rpcUrl) {
76
+ return config.rpcUrl;
77
+ }
78
+ // Default public RPCs
79
+ return net === 'mainnet'
80
+ ? 'https://mainnet.base.org'
81
+ : 'https://sepolia.base.org';
82
+ }
83
+ /**
84
+ * Clear all configuration
85
+ */
86
+ function clearConfig() {
87
+ if (fs_1.default.existsSync(CONFIG_FILE)) {
88
+ fs_1.default.unlinkSync(CONFIG_FILE);
89
+ }
90
+ }
91
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":";;;;;AAiBA,gCAUC;AAKD,gCAcC;AAKD,wCAGC;AAKD,wCAIC;AAKD,8BAYC;AAKD,kCAIC;AAzFD,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AAGpB,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AACpD,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAEzD,wBAAwB;AACxB,MAAM,cAAc,GAAc;IAChC,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,6DAA6D;CAC1E,CAAC;AAEF;;GAEG;AACH,SAAgB,UAAU;IACxB,IAAI,CAAC;QACH,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAChC,OAAO,cAAc,CAAC;QACxB,CAAC;QACD,MAAM,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