@agent-receipts/cli 0.1.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.
- package/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/index.js +345 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Webaes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @agent-receipts/cli
|
|
2
|
+
|
|
3
|
+
Command-line tool for [Agent Receipts](https://github.com/webaesbyamin/agent-receipts). Inspect, verify, and manage cryptographically signed receipts.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @agent-receipts/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @agent-receipts/cli <command>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Generate signing keys
|
|
21
|
+
npx @agent-receipts/cli init
|
|
22
|
+
|
|
23
|
+
# Show your public key (share this for third-party verification)
|
|
24
|
+
npx @agent-receipts/cli keys
|
|
25
|
+
|
|
26
|
+
# List all receipts
|
|
27
|
+
npx @agent-receipts/cli list
|
|
28
|
+
|
|
29
|
+
# Verify a receipt
|
|
30
|
+
npx @agent-receipts/cli verify <receipt-id>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
| Command | Description |
|
|
36
|
+
|---------|-------------|
|
|
37
|
+
| `init` | Create data directory and generate signing keys |
|
|
38
|
+
| `keys` | Display the public key |
|
|
39
|
+
| `keys --export` | Export public key as JSON |
|
|
40
|
+
| `keys --import <hex>` | Import a private key (64 hex chars) |
|
|
41
|
+
| `inspect <id\|file>` | Pretty-print a receipt |
|
|
42
|
+
| `verify <id\|file>` | Verify a receipt signature |
|
|
43
|
+
| `verify <id\|file> --key <hex>` | Verify with an external public key |
|
|
44
|
+
| `list` | List receipts (default: 50) |
|
|
45
|
+
| `list --agent <id> --status <s>` | Filter by agent or status |
|
|
46
|
+
| `list --json` | Output as JSON |
|
|
47
|
+
| `chain <chain_id>` | Show all receipts in a chain |
|
|
48
|
+
| `chain <chain_id> --tree` | Show chain as visual tree |
|
|
49
|
+
| `stats` | Show aggregate receipt statistics |
|
|
50
|
+
| `export <id>` | Export a single receipt as JSON |
|
|
51
|
+
| `export --all` | Export all receipts as compact JSON |
|
|
52
|
+
| `export --all --pretty` | Export all receipts as formatted JSON |
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { readFile, writeFile, mkdir, chmod, stat } from "fs/promises";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import { createInterface } from "readline";
|
|
7
|
+
import {
|
|
8
|
+
ReceiptStore,
|
|
9
|
+
KeyManager,
|
|
10
|
+
ConfigManager,
|
|
11
|
+
ReceiptEngine
|
|
12
|
+
} from "@agent-receipts/mcp-server";
|
|
13
|
+
import { verifyReceipt, getSignablePayload, getPublicKeyFromPrivate } from "@agent-receipts/crypto";
|
|
14
|
+
var HELP = `
|
|
15
|
+
agent-receipts \u2014 CLI for managing Agent Receipts
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
agent-receipts <command> [options]
|
|
19
|
+
|
|
20
|
+
Commands:
|
|
21
|
+
init Create data directory and generate signing keys
|
|
22
|
+
keys [--export] [--import <hex>] Display, export, or import signing keys
|
|
23
|
+
inspect <id|file> Pretty-print a receipt
|
|
24
|
+
verify <id|file> [--key <hex>] Verify a receipt's signature
|
|
25
|
+
list [options] List receipts
|
|
26
|
+
chain <chain_id> [--tree] Show all receipts in a chain
|
|
27
|
+
stats Show aggregate receipt statistics
|
|
28
|
+
export <id> | --all [--pretty] Export receipt(s) as JSON to stdout
|
|
29
|
+
|
|
30
|
+
List options:
|
|
31
|
+
--agent <id> Filter by agent ID
|
|
32
|
+
--status <status> Filter by status (pending|completed|failed|timeout)
|
|
33
|
+
--limit <n> Limit results (default: 50)
|
|
34
|
+
--json Output as JSON
|
|
35
|
+
|
|
36
|
+
General:
|
|
37
|
+
--help, -h Show this help
|
|
38
|
+
--version, -v Show version
|
|
39
|
+
`.trim();
|
|
40
|
+
async function getEngine(dataDir) {
|
|
41
|
+
const dir = dataDir ?? ConfigManager.getDefaultDataDir();
|
|
42
|
+
const store = new ReceiptStore(dir);
|
|
43
|
+
await store.init();
|
|
44
|
+
const keyManager = new KeyManager(dir);
|
|
45
|
+
await keyManager.init();
|
|
46
|
+
const configManager = new ConfigManager(dir);
|
|
47
|
+
await configManager.init();
|
|
48
|
+
return { engine: new ReceiptEngine(store, keyManager, configManager), keyManager, dataDir: dir };
|
|
49
|
+
}
|
|
50
|
+
async function cmdInit() {
|
|
51
|
+
const { keyManager } = await getEngine();
|
|
52
|
+
console.log("Initialized Agent Receipts data directory");
|
|
53
|
+
console.log(`Public key: ${keyManager.getPublicKey()}`);
|
|
54
|
+
}
|
|
55
|
+
async function cmdKeys(args) {
|
|
56
|
+
if (args.includes("--import")) {
|
|
57
|
+
const importIdx = args.indexOf("--import");
|
|
58
|
+
const hex = args[importIdx + 1];
|
|
59
|
+
if (!hex) {
|
|
60
|
+
console.error("Usage: agent-receipts keys --import <hex>");
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
if (!/^[a-f0-9]{64}$/i.test(hex)) {
|
|
64
|
+
console.error("Invalid key: must be 64 hex characters (32 bytes)");
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
const dataDir = ConfigManager.getDefaultDataDir();
|
|
68
|
+
const keysDir = join(dataDir, "keys");
|
|
69
|
+
const privateKeyPath = join(keysDir, "private.key");
|
|
70
|
+
let keysExist = false;
|
|
71
|
+
try {
|
|
72
|
+
await stat(privateKeyPath);
|
|
73
|
+
keysExist = true;
|
|
74
|
+
} catch {
|
|
75
|
+
}
|
|
76
|
+
if (keysExist) {
|
|
77
|
+
if (process.stdin.isTTY) {
|
|
78
|
+
const answer = await new Promise((resolve) => {
|
|
79
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
80
|
+
rl.question("Keys already exist. Overwrite? (y/N) ", (ans) => {
|
|
81
|
+
rl.close();
|
|
82
|
+
resolve(ans);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
if (answer.toLowerCase() !== "y") {
|
|
86
|
+
console.log("Aborted.");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
console.error("Keys already exist. Use interactive terminal to overwrite.");
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const publicKey2 = getPublicKeyFromPrivate(hex);
|
|
95
|
+
await mkdir(keysDir, { recursive: true });
|
|
96
|
+
await writeFile(privateKeyPath, hex, { encoding: "utf-8", mode: 384 });
|
|
97
|
+
await chmod(privateKeyPath, 384);
|
|
98
|
+
await writeFile(join(keysDir, "public.key"), publicKey2, "utf-8");
|
|
99
|
+
console.log(`Keys imported successfully. Public key: ${publicKey2}`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const { keyManager } = await getEngine();
|
|
103
|
+
const publicKey = keyManager.getPublicKey();
|
|
104
|
+
if (args.includes("--export")) {
|
|
105
|
+
console.log(JSON.stringify({ algorithm: "Ed25519", public_key: publicKey, format: "hex" }, null, 2));
|
|
106
|
+
} else {
|
|
107
|
+
console.log(`Public key: ${publicKey}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function cmdInspect(target) {
|
|
111
|
+
let receipt;
|
|
112
|
+
if (target.endsWith(".json") || target.includes("/")) {
|
|
113
|
+
const data = await readFile(target, "utf-8");
|
|
114
|
+
receipt = JSON.parse(data);
|
|
115
|
+
} else {
|
|
116
|
+
const { engine } = await getEngine();
|
|
117
|
+
receipt = await engine.get(target);
|
|
118
|
+
if (!receipt) {
|
|
119
|
+
console.error(`Receipt not found: ${target}`);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
console.log(`Receipt: ${receipt.receipt_id}`);
|
|
124
|
+
console.log(` Chain: ${receipt.chain_id}`);
|
|
125
|
+
console.log(` Action: ${receipt.action}`);
|
|
126
|
+
console.log(` Status: ${receipt.status}`);
|
|
127
|
+
console.log(` Agent: ${receipt.agent_id}`);
|
|
128
|
+
console.log(` Time: ${receipt.timestamp}`);
|
|
129
|
+
if (receipt.completed_at) console.log(` Completed: ${receipt.completed_at}`);
|
|
130
|
+
if (receipt.model) console.log(` Model: ${receipt.model}`);
|
|
131
|
+
if (receipt.latency_ms != null) console.log(` Latency: ${receipt.latency_ms}ms`);
|
|
132
|
+
if (receipt.cost_usd != null) console.log(` Cost: $${receipt.cost_usd}`);
|
|
133
|
+
console.log(` Input: ${receipt.input_hash}`);
|
|
134
|
+
if (receipt.output_hash) console.log(` Output: ${receipt.output_hash}`);
|
|
135
|
+
if (receipt.output_summary) console.log(` Summary: ${receipt.output_summary}`);
|
|
136
|
+
console.log(` Signature: ${receipt.signature.slice(0, 30)}...`);
|
|
137
|
+
}
|
|
138
|
+
async function cmdVerify(target, args) {
|
|
139
|
+
let receipt;
|
|
140
|
+
if (target.endsWith(".json") || target.includes("/")) {
|
|
141
|
+
const data = await readFile(target, "utf-8");
|
|
142
|
+
receipt = JSON.parse(data);
|
|
143
|
+
} else {
|
|
144
|
+
const { engine } = await getEngine();
|
|
145
|
+
receipt = await engine.get(target);
|
|
146
|
+
if (!receipt) {
|
|
147
|
+
console.error(`Receipt not found: ${target}`);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const keyIdx = args.indexOf("--key");
|
|
152
|
+
let publicKey;
|
|
153
|
+
if (keyIdx !== -1 && args[keyIdx + 1] !== void 0) {
|
|
154
|
+
publicKey = args[keyIdx + 1];
|
|
155
|
+
} else {
|
|
156
|
+
const { keyManager } = await getEngine();
|
|
157
|
+
publicKey = keyManager.getPublicKey();
|
|
158
|
+
}
|
|
159
|
+
const signable = getSignablePayload(receipt);
|
|
160
|
+
const verified = verifyReceipt(signable, receipt.signature, publicKey);
|
|
161
|
+
if (verified) {
|
|
162
|
+
console.log(`Verified: ${receipt.receipt_id}`);
|
|
163
|
+
console.log(`Public key: ${publicKey}`);
|
|
164
|
+
} else {
|
|
165
|
+
console.error(`FAILED: ${receipt.receipt_id} \u2014 signature invalid`);
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async function cmdList(args) {
|
|
170
|
+
const { engine } = await getEngine();
|
|
171
|
+
const filter = {};
|
|
172
|
+
const isJson = args.includes("--json");
|
|
173
|
+
let limit = 50;
|
|
174
|
+
for (let i = 0; i < args.length; i++) {
|
|
175
|
+
const arg = args[i];
|
|
176
|
+
const next = args[i + 1];
|
|
177
|
+
if (arg === "--agent" && next) {
|
|
178
|
+
filter["agent_id"] = next;
|
|
179
|
+
i++;
|
|
180
|
+
}
|
|
181
|
+
if (arg === "--status" && next) {
|
|
182
|
+
filter["status"] = next;
|
|
183
|
+
i++;
|
|
184
|
+
}
|
|
185
|
+
if (arg === "--limit" && next) {
|
|
186
|
+
limit = parseInt(next, 10);
|
|
187
|
+
i++;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const result = await engine.list(filter, 1, limit);
|
|
191
|
+
if (isJson) {
|
|
192
|
+
console.log(JSON.stringify(result, null, 2));
|
|
193
|
+
} else {
|
|
194
|
+
console.log(`Receipts (${result.pagination.total} total):`);
|
|
195
|
+
for (const r of result.data) {
|
|
196
|
+
const status = r.status.padEnd(9);
|
|
197
|
+
console.log(` ${r.receipt_id} ${status} ${r.action} ${r.timestamp}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async function cmdChain(chainId, args) {
|
|
202
|
+
const { engine } = await getEngine();
|
|
203
|
+
const receipts = await engine.getChain(chainId);
|
|
204
|
+
if (receipts.length === 0) {
|
|
205
|
+
console.log(`No receipts found for chain: ${chainId}`);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (args.includes("--tree")) {
|
|
209
|
+
let renderTree2 = function(node, prefix, isLast) {
|
|
210
|
+
const connector = isLast ? "\u2514\u2500" : "\u251C\u2500";
|
|
211
|
+
const ts = node.timestamp.replace("T", " ").replace(/\.\d+Z$/, "");
|
|
212
|
+
console.log(`${prefix}${connector} ${node.receipt_id} ${node.action} [${node.status}] ${ts}`);
|
|
213
|
+
const children = childrenOf.get(node.receipt_id) ?? [];
|
|
214
|
+
for (let i = 0; i < children.length; i++) {
|
|
215
|
+
const child = children[i];
|
|
216
|
+
const childPrefix = prefix + (isLast ? " " : "\u2502 ");
|
|
217
|
+
renderTree2(child, childPrefix, i === children.length - 1);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
var renderTree = renderTree2;
|
|
221
|
+
console.log(`Chain: ${chainId} (${receipts.length} receipts)`);
|
|
222
|
+
const childrenOf = /* @__PURE__ */ new Map();
|
|
223
|
+
const roots = [];
|
|
224
|
+
for (const r of receipts) {
|
|
225
|
+
const parentId = r.parent_receipt_id;
|
|
226
|
+
if (!parentId || !receipts.some((p) => p.receipt_id === parentId)) {
|
|
227
|
+
roots.push(r);
|
|
228
|
+
} else {
|
|
229
|
+
const siblings = childrenOf.get(parentId) ?? [];
|
|
230
|
+
siblings.push(r);
|
|
231
|
+
childrenOf.set(parentId, siblings);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
for (let i = 0; i < roots.length; i++) {
|
|
235
|
+
renderTree2(roots[i], "", i === roots.length - 1);
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
console.log(`Chain: ${chainId} (${receipts.length} receipts)`);
|
|
240
|
+
for (let i = 0; i < receipts.length; i++) {
|
|
241
|
+
const r = receipts[i];
|
|
242
|
+
console.log(` ${i + 1}. ${r.receipt_id} ${r.status.padEnd(9)} ${r.action} ${r.timestamp}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async function cmdStats() {
|
|
246
|
+
const { engine } = await getEngine();
|
|
247
|
+
const all = await engine.list(void 0, 1, 1e4);
|
|
248
|
+
const receipts = all.data;
|
|
249
|
+
const byStatus = {};
|
|
250
|
+
const byAction = {};
|
|
251
|
+
for (const r of receipts) {
|
|
252
|
+
byStatus[r.status] = (byStatus[r.status] ?? 0) + 1;
|
|
253
|
+
byAction[r.action] = (byAction[r.action] ?? 0) + 1;
|
|
254
|
+
}
|
|
255
|
+
console.log(`Total receipts: ${receipts.length}`);
|
|
256
|
+
console.log(`By status:`);
|
|
257
|
+
for (const [s, c] of Object.entries(byStatus)) {
|
|
258
|
+
console.log(` ${s}: ${c}`);
|
|
259
|
+
}
|
|
260
|
+
console.log(`By action:`);
|
|
261
|
+
for (const [a, c] of Object.entries(byAction)) {
|
|
262
|
+
console.log(` ${a}: ${c}`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
async function cmdExport(target, args) {
|
|
266
|
+
const { engine } = await getEngine();
|
|
267
|
+
const isPretty = args.includes("--pretty");
|
|
268
|
+
if (target === "--all" || args.includes("--all")) {
|
|
269
|
+
const result = await engine.list(void 0, 1, 1e4);
|
|
270
|
+
const sorted = result.data.sort(
|
|
271
|
+
(a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
|
|
272
|
+
);
|
|
273
|
+
console.log(JSON.stringify(sorted, null, isPretty ? 2 : void 0));
|
|
274
|
+
} else {
|
|
275
|
+
const receipt = await engine.get(target);
|
|
276
|
+
if (!receipt) {
|
|
277
|
+
console.error(`Receipt not found: ${target}`);
|
|
278
|
+
process.exit(1);
|
|
279
|
+
}
|
|
280
|
+
console.log(JSON.stringify(receipt, null, 2));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
async function main() {
|
|
284
|
+
const args = process.argv.slice(2);
|
|
285
|
+
const command = args[0];
|
|
286
|
+
if (!command || command === "--help" || command === "-h") {
|
|
287
|
+
console.log(HELP);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (command === "--version" || command === "-v") {
|
|
291
|
+
console.log("0.1.0");
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
switch (command) {
|
|
295
|
+
case "init":
|
|
296
|
+
await cmdInit();
|
|
297
|
+
break;
|
|
298
|
+
case "keys":
|
|
299
|
+
await cmdKeys(args.slice(1));
|
|
300
|
+
break;
|
|
301
|
+
case "inspect":
|
|
302
|
+
if (!args[1]) {
|
|
303
|
+
console.error("Usage: agent-receipts inspect <id|file>");
|
|
304
|
+
process.exit(1);
|
|
305
|
+
}
|
|
306
|
+
await cmdInspect(args[1]);
|
|
307
|
+
break;
|
|
308
|
+
case "verify":
|
|
309
|
+
if (!args[1]) {
|
|
310
|
+
console.error("Usage: agent-receipts verify <id|file>");
|
|
311
|
+
process.exit(1);
|
|
312
|
+
}
|
|
313
|
+
await cmdVerify(args[1], args.slice(2));
|
|
314
|
+
break;
|
|
315
|
+
case "list":
|
|
316
|
+
await cmdList(args.slice(1));
|
|
317
|
+
break;
|
|
318
|
+
case "chain":
|
|
319
|
+
if (!args[1]) {
|
|
320
|
+
console.error("Usage: agent-receipts chain <chain_id>");
|
|
321
|
+
process.exit(1);
|
|
322
|
+
}
|
|
323
|
+
await cmdChain(args[1], args.slice(2));
|
|
324
|
+
break;
|
|
325
|
+
case "stats":
|
|
326
|
+
await cmdStats();
|
|
327
|
+
break;
|
|
328
|
+
case "export":
|
|
329
|
+
if (!args[1]) {
|
|
330
|
+
console.error("Usage: agent-receipts export <id|--all>");
|
|
331
|
+
process.exit(1);
|
|
332
|
+
}
|
|
333
|
+
await cmdExport(args[1], args.slice(2));
|
|
334
|
+
break;
|
|
335
|
+
default:
|
|
336
|
+
console.error(`Unknown command: ${command}`);
|
|
337
|
+
console.log(HELP);
|
|
338
|
+
process.exit(1);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
main().catch((err) => {
|
|
342
|
+
console.error("Error:", err.message);
|
|
343
|
+
process.exit(1);
|
|
344
|
+
});
|
|
345
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { readFile, writeFile, mkdir, chmod, stat } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { createInterface } from 'node:readline'\nimport {\n ReceiptStore,\n KeyManager,\n ConfigManager,\n ReceiptEngine,\n} from '@agent-receipts/mcp-server'\nimport { verifyReceipt, getSignablePayload, getPublicKeyFromPrivate } from '@agent-receipts/crypto'\n\nconst HELP = `\nagent-receipts — CLI for managing Agent Receipts\n\nUsage:\n agent-receipts <command> [options]\n\nCommands:\n init Create data directory and generate signing keys\n keys [--export] [--import <hex>] Display, export, or import signing keys\n inspect <id|file> Pretty-print a receipt\n verify <id|file> [--key <hex>] Verify a receipt's signature\n list [options] List receipts\n chain <chain_id> [--tree] Show all receipts in a chain\n stats Show aggregate receipt statistics\n export <id> | --all [--pretty] Export receipt(s) as JSON to stdout\n\nList options:\n --agent <id> Filter by agent ID\n --status <status> Filter by status (pending|completed|failed|timeout)\n --limit <n> Limit results (default: 50)\n --json Output as JSON\n\nGeneral:\n --help, -h Show this help\n --version, -v Show version\n`.trim()\n\nasync function getEngine(dataDir?: string) {\n const dir = dataDir ?? ConfigManager.getDefaultDataDir()\n const store = new ReceiptStore(dir)\n await store.init()\n const keyManager = new KeyManager(dir)\n await keyManager.init()\n const configManager = new ConfigManager(dir)\n await configManager.init()\n return { engine: new ReceiptEngine(store, keyManager, configManager), keyManager, dataDir: dir }\n}\n\nasync function cmdInit() {\n const { keyManager } = await getEngine()\n console.log('Initialized Agent Receipts data directory')\n console.log(`Public key: ${keyManager.getPublicKey()}`)\n}\n\nasync function cmdKeys(args: string[]) {\n if (args.includes('--import')) {\n const importIdx = args.indexOf('--import')\n const hex = args[importIdx + 1]\n if (!hex) {\n console.error('Usage: agent-receipts keys --import <hex>')\n process.exit(1)\n }\n if (!/^[a-f0-9]{64}$/i.test(hex)) {\n console.error('Invalid key: must be 64 hex characters (32 bytes)')\n process.exit(1)\n }\n\n const dataDir = ConfigManager.getDefaultDataDir()\n const keysDir = join(dataDir, 'keys')\n const privateKeyPath = join(keysDir, 'private.key')\n\n // Check if keys already exist\n let keysExist = false\n try {\n await stat(privateKeyPath)\n keysExist = true\n } catch {\n // Does not exist\n }\n\n if (keysExist) {\n if (process.stdin.isTTY) {\n const answer = await new Promise<string>((resolve) => {\n const rl = createInterface({ input: process.stdin, output: process.stdout })\n rl.question('Keys already exist. Overwrite? (y/N) ', (ans) => {\n rl.close()\n resolve(ans)\n })\n })\n if (answer.toLowerCase() !== 'y') {\n console.log('Aborted.')\n return\n }\n } else {\n console.error('Keys already exist. Use interactive terminal to overwrite.')\n process.exit(1)\n }\n }\n\n const publicKey = getPublicKeyFromPrivate(hex)\n await mkdir(keysDir, { recursive: true })\n await writeFile(privateKeyPath, hex, { encoding: 'utf-8', mode: 0o600 })\n await chmod(privateKeyPath, 0o600)\n await writeFile(join(keysDir, 'public.key'), publicKey, 'utf-8')\n\n console.log(`Keys imported successfully. Public key: ${publicKey}`)\n return\n }\n\n const { keyManager } = await getEngine()\n const publicKey = keyManager.getPublicKey()\n if (args.includes('--export')) {\n console.log(JSON.stringify({ algorithm: 'Ed25519', public_key: publicKey, format: 'hex' }, null, 2))\n } else {\n console.log(`Public key: ${publicKey}`)\n }\n}\n\nasync function cmdInspect(target: string) {\n let receipt\n if (target.endsWith('.json') || target.includes('/')) {\n const data = await readFile(target, 'utf-8')\n receipt = JSON.parse(data)\n } else {\n const { engine } = await getEngine()\n receipt = await engine.get(target)\n if (!receipt) {\n console.error(`Receipt not found: ${target}`)\n process.exit(1)\n }\n }\n\n console.log(`Receipt: ${receipt.receipt_id}`)\n console.log(` Chain: ${receipt.chain_id}`)\n console.log(` Action: ${receipt.action}`)\n console.log(` Status: ${receipt.status}`)\n console.log(` Agent: ${receipt.agent_id}`)\n console.log(` Time: ${receipt.timestamp}`)\n if (receipt.completed_at) console.log(` Completed: ${receipt.completed_at}`)\n if (receipt.model) console.log(` Model: ${receipt.model}`)\n if (receipt.latency_ms != null) console.log(` Latency: ${receipt.latency_ms}ms`)\n if (receipt.cost_usd != null) console.log(` Cost: $${receipt.cost_usd}`)\n console.log(` Input: ${receipt.input_hash}`)\n if (receipt.output_hash) console.log(` Output: ${receipt.output_hash}`)\n if (receipt.output_summary) console.log(` Summary: ${receipt.output_summary}`)\n console.log(` Signature: ${receipt.signature.slice(0, 30)}...`)\n}\n\nasync function cmdVerify(target: string, args: string[]) {\n let receipt\n if (target.endsWith('.json') || target.includes('/')) {\n const data = await readFile(target, 'utf-8')\n receipt = JSON.parse(data)\n } else {\n const { engine } = await getEngine()\n receipt = await engine.get(target)\n if (!receipt) {\n console.error(`Receipt not found: ${target}`)\n process.exit(1)\n }\n }\n\n const keyIdx = args.indexOf('--key')\n let publicKey: string\n if (keyIdx !== -1 && args[keyIdx + 1] !== undefined) {\n publicKey = args[keyIdx + 1] as string\n } else {\n const { keyManager } = await getEngine()\n publicKey = keyManager.getPublicKey()\n }\n\n const signable = getSignablePayload(receipt)\n const verified = verifyReceipt(signable, receipt.signature, publicKey)\n\n if (verified) {\n console.log(`Verified: ${receipt.receipt_id}`)\n console.log(`Public key: ${publicKey}`)\n } else {\n console.error(`FAILED: ${receipt.receipt_id} — signature invalid`)\n process.exit(1)\n }\n}\n\nasync function cmdList(args: string[]) {\n const { engine } = await getEngine()\n const filter: Record<string, string> = {}\n const isJson = args.includes('--json')\n let limit = 50\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i]\n const next = args[i + 1]\n if (arg === '--agent' && next) { filter['agent_id'] = next; i++ }\n if (arg === '--status' && next) { filter['status'] = next; i++ }\n if (arg === '--limit' && next) { limit = parseInt(next, 10); i++ }\n }\n\n const result = await engine.list(filter, 1, limit)\n\n if (isJson) {\n console.log(JSON.stringify(result, null, 2))\n } else {\n console.log(`Receipts (${result.pagination.total} total):`)\n for (const r of result.data) {\n const status = r.status.padEnd(9)\n console.log(` ${r.receipt_id} ${status} ${r.action} ${r.timestamp}`)\n }\n }\n}\n\nasync function cmdChain(chainId: string, args: string[]) {\n const { engine } = await getEngine()\n const receipts = await engine.getChain(chainId)\n if (receipts.length === 0) {\n console.log(`No receipts found for chain: ${chainId}`)\n return\n }\n\n if (args.includes('--tree')) {\n console.log(`Chain: ${chainId} (${receipts.length} receipts)`)\n\n // Build parent-child map\n type Receipt = typeof receipts[number]\n const childrenOf = new Map<string, Receipt[]>()\n const roots: Receipt[] = []\n\n for (const r of receipts) {\n const parentId = r.parent_receipt_id\n if (!parentId || !receipts.some((p) => p.receipt_id === parentId)) {\n roots.push(r)\n } else {\n const siblings = childrenOf.get(parentId) ?? []\n siblings.push(r)\n childrenOf.set(parentId, siblings)\n }\n }\n\n function renderTree(node: Receipt, prefix: string, isLast: boolean): void {\n const connector = isLast ? '└─' : '├─'\n const ts = node.timestamp.replace('T', ' ').replace(/\\.\\d+Z$/, '')\n console.log(`${prefix}${connector} ${node.receipt_id} ${node.action} [${node.status}] ${ts}`)\n const children = childrenOf.get(node.receipt_id) ?? []\n for (let i = 0; i < children.length; i++) {\n const child = children[i]!\n const childPrefix = prefix + (isLast ? ' ' : '│ ')\n renderTree(child, childPrefix, i === children.length - 1)\n }\n }\n\n for (let i = 0; i < roots.length; i++) {\n renderTree(roots[i]!, '', i === roots.length - 1)\n }\n return\n }\n\n console.log(`Chain: ${chainId} (${receipts.length} receipts)`)\n for (let i = 0; i < receipts.length; i++) {\n const r = receipts[i]!\n console.log(` ${i + 1}. ${r.receipt_id} ${r.status.padEnd(9)} ${r.action} ${r.timestamp}`)\n }\n}\n\nasync function cmdStats() {\n const { engine } = await getEngine()\n const all = await engine.list(undefined, 1, 10000)\n const receipts = all.data\n\n const byStatus: Record<string, number> = {}\n const byAction: Record<string, number> = {}\n for (const r of receipts) {\n byStatus[r.status] = (byStatus[r.status] ?? 0) + 1\n byAction[r.action] = (byAction[r.action] ?? 0) + 1\n }\n\n console.log(`Total receipts: ${receipts.length}`)\n console.log(`By status:`)\n for (const [s, c] of Object.entries(byStatus)) {\n console.log(` ${s}: ${c}`)\n }\n console.log(`By action:`)\n for (const [a, c] of Object.entries(byAction)) {\n console.log(` ${a}: ${c}`)\n }\n}\n\nasync function cmdExport(target: string, args: string[]) {\n const { engine } = await getEngine()\n const isPretty = args.includes('--pretty')\n if (target === '--all' || args.includes('--all')) {\n const result = await engine.list(undefined, 1, 10000)\n const sorted = result.data.sort((a, b) =>\n new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()\n )\n console.log(JSON.stringify(sorted, null, isPretty ? 2 : undefined))\n } else {\n const receipt = await engine.get(target)\n if (!receipt) {\n console.error(`Receipt not found: ${target}`)\n process.exit(1)\n }\n console.log(JSON.stringify(receipt, null, 2))\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2)\n const command = args[0]\n\n if (!command || command === '--help' || command === '-h') {\n console.log(HELP)\n return\n }\n\n if (command === '--version' || command === '-v') {\n console.log('0.1.0')\n return\n }\n\n switch (command) {\n case 'init':\n await cmdInit()\n break\n case 'keys':\n await cmdKeys(args.slice(1))\n break\n case 'inspect':\n if (!args[1]) { console.error('Usage: agent-receipts inspect <id|file>'); process.exit(1) }\n await cmdInspect(args[1])\n break\n case 'verify':\n if (!args[1]) { console.error('Usage: agent-receipts verify <id|file>'); process.exit(1) }\n await cmdVerify(args[1], args.slice(2))\n break\n case 'list':\n await cmdList(args.slice(1))\n break\n case 'chain':\n if (!args[1]) { console.error('Usage: agent-receipts chain <chain_id>'); process.exit(1) }\n await cmdChain(args[1], args.slice(2))\n break\n case 'stats':\n await cmdStats()\n break\n case 'export':\n if (!args[1]) { console.error('Usage: agent-receipts export <id|--all>'); process.exit(1) }\n await cmdExport(args[1], args.slice(2))\n break\n default:\n console.error(`Unknown command: ${command}`)\n console.log(HELP)\n process.exit(1)\n }\n}\n\nmain().catch((err) => {\n console.error('Error:', err.message)\n process.exit(1)\n})\n"],"mappings":";;;AAAA,SAAS,UAAU,WAAW,OAAO,OAAO,YAAY;AACxD,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe,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description": "CLI for Agent Receipts — inspect, verify, and manage receipts",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Amin <amin@webaes.co> (https://webaes.co)",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/webaesbyamin/agent-receipts",
|
|
11
|
+
"directory": "packages/cli"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/webaesbyamin/agent-receipts#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/webaesbyamin/agent-receipts/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"agent-receipts",
|
|
19
|
+
"cli",
|
|
20
|
+
"ai-agents",
|
|
21
|
+
"receipts",
|
|
22
|
+
"verification",
|
|
23
|
+
"inspect"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20.0.0"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"agent-receipts": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@agent-receipts/mcp-server": "0.1.0",
|
|
36
|
+
"@agent-receipts/crypto": "0.1.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^20.0.0",
|
|
40
|
+
"tsup": "^8.2.0",
|
|
41
|
+
"typescript": "^5.4.0",
|
|
42
|
+
"vitest": "^2.1.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"dev": "tsup --watch",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"typecheck": "tsc --noEmit"
|
|
49
|
+
}
|
|
50
|
+
}
|