@openactionrecord/cli 0.0.0-stage → 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 ADDED
@@ -0,0 +1,55 @@
1
+ Apache License
2
+
3
+ Version 2.0, January 2004
4
+
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
+
17
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18
+
19
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20
+
21
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22
+
23
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24
+
25
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26
+
27
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28
+
29
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30
+
31
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34
+
35
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36
+
37
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
38
+
39
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
40
+
41
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42
+
43
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # @openactionrecord/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `oar`: verify [Open Action Records](https://github.com/openactionrecord/oar) from the command line, and see what they prove.
4
+
5
+ ```bash
6
+ npx @openactionrecord/cli demo # a one-minute demo; writes ./oar-demo
7
+ npx @openactionrecord/cli verify evidence.json # verify, and show what each action did
8
+ npx @openactionrecord/cli verify evidence.json --cross-check --keys published-keys.json
9
+ npx @openactionrecord/cli html evidence.json # a page that verifies the bundle offline
10
+ npx @openactionrecord/cli keygen my-agent-2026 # a signing key and its public key set
11
+ ```
12
+
13
+ Exit codes: `0` verified, `1` verification failed, `2` the input could not be read. Set `NO_COLOR=1` for plain output.
14
+
15
+ Apache-2.0.
package/dist/demo.js ADDED
@@ -0,0 +1,134 @@
1
+ import { mkdir, writeFile } from 'node:fs/promises';
2
+ import { join, relative } from 'node:path';
3
+ import { createLocalSealer, createRecorder, generateSigningKey, summarize, verifyBundle } from '@openactionrecord/core';
4
+ import { standaloneVerifierHtml } from '@openactionrecord/core/standalone';
5
+ import { c, line, printActions, printReport, PASS, FAIL } from './print.js';
6
+ // `oar demo`: one minute, nothing to set up. An AI support agent at an online store takes three actions; OAR
7
+ // records each one, the bundle verifies, an edit to it is caught, and an agent's false claim of success shows up.
8
+ const pause = (ms) => (process.stdout.isTTY ? new Promise((r) => setTimeout(r, ms)) : Promise.resolve());
9
+ /** A pretend payment system: one order, and refunds that may or may not really happen. */
10
+ function paymentSystem() {
11
+ const orders = new Map([
12
+ ['1142', { totalCents: 190_000, refundedCents: 0 }],
13
+ ['1187', { totalCents: 4_500, refundedCents: 0 }],
14
+ ]);
15
+ const refunds = new Map();
16
+ let n = 0;
17
+ return {
18
+ read: (order) => () => ({ order, ...orders.get(order) }),
19
+ refund(order, cents) {
20
+ const id = `re_${(++n).toString().padStart(4, '0')}`;
21
+ orders.get(order).refundedCents += cents;
22
+ refunds.set(id, { order, cents });
23
+ return { id, status: 'succeeded' };
24
+ },
25
+ /** A bug: the API answers "succeeded" but nothing is refunded. */
26
+ brokenRefund: () => ({ id: `re_${(++n).toString().padStart(4, '0')}`, status: 'succeeded' }),
27
+ hasRefund: (id) => refunds.has(id),
28
+ };
29
+ }
30
+ export async function demo(dir, options = {}) {
31
+ line();
32
+ line(c.bold('Open Action Record · demo'));
33
+ line(c.dim('An AI support agent works for an online store. Its rules: refunds over $1,250 need a person; discounts are capped at 20%.'));
34
+ line(c.dim('Every action it takes is recorded: what was asked, who approved it, what actually changed, and whether the payment system confirms it.'));
35
+ line();
36
+ const issuer = generateSigningKey('store-agent-2026');
37
+ const sealer = createLocalSealer({ key: generateSigningKey('store-sealer-2026') });
38
+ const oar = createRecorder({ issuer, sealer, org: 'example-store', orgName: 'Example Store', agent: 'support-agent', policyId: 'store-rules-v3', policy: { refundApprovalAboveCents: 125_000, maxDiscountPercent: 20 } });
39
+ const pay = paymentSystem();
40
+ line(`${c.cyan('1.')} A customer's $1,900 order arrived damaged. The agent refunds it.`);
41
+ await pause(250);
42
+ const refund = await oar.run({
43
+ type: 'refund',
44
+ target: 'payments',
45
+ params: { order: '1142', amountCents: 190_000 },
46
+ check: (p) => (p.amountCents > 125_000 ? { result: 'held', reasons: ['over_approval_limit'] } : { result: 'allowed' }),
47
+ approve: async () => {
48
+ line(` ${c.dim('held: over the $1,250 approval limit → Jordan, the support lead, approves')}`);
49
+ await pause(250);
50
+ return { approver: 'jordan', approved: true };
51
+ },
52
+ readState: pay.read('1142'),
53
+ execute: () => pay.refund('1142', 190_000),
54
+ targetRef: (r) => r.id,
55
+ confirm: (r) => pay.hasRefund(r.id),
56
+ });
57
+ line(` ${PASS} refunded, and the payment system confirms it`);
58
+ await pause(200);
59
+ line(`${c.cyan('2.')} A customer asks for 80% off. The agent tries to create the code.`);
60
+ await pause(250);
61
+ await oar.run({
62
+ type: 'discount_code',
63
+ target: 'store',
64
+ params: { percent: 80 },
65
+ check: (p) => (p.percent > 20 ? { result: 'denied', reasons: ['over_maximum_discount'] } : { result: 'allowed' }),
66
+ execute: () => 'never runs',
67
+ });
68
+ line(` ${FAIL} blocked: over the 20% maximum (recorded, not executed)`);
69
+ await pause(200);
70
+ line(`${c.cyan('3.')} A $45 refund. The payment API answers "succeeded"… but a bug means nothing was refunded.`);
71
+ await pause(250);
72
+ const ghost = await oar.run({
73
+ type: 'refund',
74
+ target: 'payments',
75
+ params: { order: '1187', amountCents: 4_500 },
76
+ readState: pay.read('1187'),
77
+ execute: () => pay.brokenRefund(),
78
+ targetRef: (r) => r.id,
79
+ confirm: (r) => pay.hasRefund(r.id),
80
+ });
81
+ line(` ${ghost.confirmed ? PASS : FAIL} the agent reported success; the read-back shows ${c.bold('no refund')}. Recorded as NOT confirmed.`);
82
+ line();
83
+ if (!options.offline) {
84
+ line(c.dim("Asking DigiCert's free public timestamp service to timestamp the sealing service's checkpoint (one request; only a hash is sent)…"));
85
+ try {
86
+ const anchor = await sealer.anchor({ timeoutMs: 5_000 });
87
+ line(` ${PASS} timestamped by ${anchor?.tsa} at ${anchor?.gen_time}`);
88
+ }
89
+ catch (error) {
90
+ line(` ${c.yellow('●')} skipped: ${error instanceof Error ? error.message : 'no answer'} The records are still sealed.`);
91
+ }
92
+ line();
93
+ }
94
+ await mkdir(dir, { recursive: true });
95
+ const shareable = await oar.bundle({ purpose: 'dispute' });
96
+ const debugging = await oar.bundle({ disclose: 'all', purpose: 'debugging' });
97
+ const files = {
98
+ bundle: join(dir, 'evidence.json'),
99
+ full: join(dir, 'evidence-with-details.json'),
100
+ tampered: join(dir, 'evidence-tampered.json'),
101
+ html: join(dir, 'verify.html'),
102
+ keys: join(dir, 'aar-keys.json'),
103
+ };
104
+ await writeFile(files.bundle, JSON.stringify(shareable, null, 2));
105
+ await writeFile(files.full, JSON.stringify(debugging, null, 2));
106
+ await writeFile(files.keys, JSON.stringify(await oar.keys(), null, 2));
107
+ await writeFile(files.html, standaloneVerifierHtml(JSON.stringify(shareable)));
108
+ line(c.bold(`Wrote ${shareable.records.length} records to ${rel(files.bundle)}`) + c.dim(' (amounts, order numbers and refund IDs are committed, not written in clear)'));
109
+ line();
110
+ line(c.bold('Verify it:'));
111
+ const report = verifyBundle(debugging);
112
+ printReport(report);
113
+ printActions(summarize(debugging.records, debugging.disclosures, report));
114
+ line();
115
+ line(c.bold('Now someone edits the record to pretend the $1,900 refund never needed approval:'));
116
+ const tampered = structuredClone(shareable);
117
+ const held = tampered.records.find((r) => r.payload.result === 'held');
118
+ held.payload.result = 'allowed';
119
+ held.payload.reasons = ['within_limits'];
120
+ await writeFile(files.tampered, JSON.stringify(tampered, null, 2));
121
+ printReport(verifyBundle(tampered));
122
+ line();
123
+ line(c.bold('Next:'));
124
+ line(` pnpm oar verify ${rel(files.bundle)} ${c.dim('# the bundle you would share: proves what happened, discloses nothing')}`);
125
+ line(` open ${rel(files.html)} ${c.dim('# the same check, offline in a browser')}`);
126
+ line(` ${c.dim('Record your own agent: see examples/quickstart.ts and https://github.com/openactionrecord/oar')}`);
127
+ line();
128
+ return refund.status === 'completed' && report.result === 'pass' ? 0 : 1;
129
+ }
130
+ function rel(path) {
131
+ const r = relative(process.cwd(), path);
132
+ return r.startsWith('..') ? path : r;
133
+ }
134
+ //# sourceMappingURL=demo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo.js","sourceRoot":"","sources":["../src/demo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,SAA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I,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"}
package/dist/main.js ADDED
@@ -0,0 +1,173 @@
1
+ #!/usr/bin/env node
2
+ import { readFile, writeFile } from 'node:fs/promises';
3
+ import { webcrypto } from 'node:crypto';
4
+ import { createRequire } from 'node:module';
5
+ import { BundleError, generateSigningKey, keyFingerprints, parseBundle, publicKeys, summarize, verifyBundle, } from '@openactionrecord/core';
6
+ import { loadStandaloneVerifier, standaloneVerifierHtml } from '@openactionrecord/core/standalone';
7
+ import { demo } from './demo.js';
8
+ import { c, line, printActions, printReport, FAIL, PASS } from './print.js';
9
+ const HELP = `${c.bold('oar')}: Open Action Record, from the command line
10
+
11
+ ${c.bold('Usage')}
12
+ oar demo [dir] [--offline] See what OAR proves, in one minute (writes files to ./oar-demo)
13
+ oar verify <bundle.json> Verify a bundle and show what each action did
14
+ --keys <keys.json> Check against keys you trust ({ "issuer": JWKS, "sealer": JWKS })
15
+ --require-seal Fail records not countersigned by a separate sealing service
16
+ --tsa-roots <roots.json> Accept these timestamp-authority roots instead of the bundled DigiCert roots
17
+ --cross-check Also run the independent WebCrypto verifier; fail if they disagree
18
+ --json Print the report as JSON
19
+ --verbose Show every check on every record
20
+ oar inspect <bundle.json> Show the actions in a bundle without verifying
21
+ oar html <bundle.json> [out.html] Write a self-contained page that verifies the bundle offline
22
+ oar keygen <kid> [out.json] Make an Ed25519 signing key (keep it secret) and print its public key set
23
+ oar --version
24
+
25
+ Docs and source: https://github.com/openactionrecord/oar`;
26
+ function parseArgs(argv) {
27
+ const flags = { _: [] };
28
+ const takesValue = new Set(['keys', 'tsa-roots']);
29
+ for (let i = 0; i < argv.length; i++) {
30
+ const arg = argv[i];
31
+ if (arg.startsWith('--')) {
32
+ const name = arg.slice(2);
33
+ if (takesValue.has(name)) {
34
+ const value = argv[++i];
35
+ if (value === undefined)
36
+ throw new UsageError(`--${name} needs a file`);
37
+ flags[name] = value;
38
+ }
39
+ else
40
+ flags[name] = true;
41
+ }
42
+ else if (arg === '-h')
43
+ flags.help = true;
44
+ else if (arg === '-v')
45
+ flags.version = true;
46
+ else
47
+ flags._.push(arg);
48
+ }
49
+ return flags;
50
+ }
51
+ class UsageError extends Error {
52
+ }
53
+ async function readJson(path, what) {
54
+ let text;
55
+ try {
56
+ text = await readFile(path, 'utf8');
57
+ }
58
+ catch {
59
+ throw new UsageError(`Cannot read ${what} ${path}`);
60
+ }
61
+ try {
62
+ return JSON.parse(text);
63
+ }
64
+ catch {
65
+ throw new UsageError(`${path} is not valid JSON`);
66
+ }
67
+ }
68
+ async function main(argv) {
69
+ const flags = parseArgs(argv);
70
+ const [command, ...args] = flags._;
71
+ if (flags.version) {
72
+ const pkg = createRequire(import.meta.url)('../package.json');
73
+ line(pkg.version);
74
+ return 0;
75
+ }
76
+ if (!command || flags.help || command === 'help') {
77
+ line(HELP);
78
+ return command || flags.help ? 0 : 1;
79
+ }
80
+ switch (command) {
81
+ case 'demo':
82
+ return demo(args[0] ?? 'oar-demo', { offline: Boolean(flags.offline) });
83
+ case 'verify': {
84
+ const file = need(args[0], 'oar verify <bundle.json>');
85
+ const raw = await readJson(file, 'bundle');
86
+ const keys = flags.keys ? (await readJson(String(flags.keys), 'key file')) : undefined;
87
+ const tsaRoots = flags['tsa-roots'] ? (await readJson(String(flags['tsa-roots']), 'roots file')) : undefined;
88
+ const options = { ...(keys ? { keys } : {}), ...(tsaRoots ? { tsaRoots } : {}), requireSeal: Boolean(flags['require-seal']) };
89
+ const bundle = parseBundle(raw);
90
+ const report = verifyBundle(raw, options);
91
+ let agree = true;
92
+ if (flags['cross-check']) {
93
+ const alt = await loadStandaloneVerifier()(keys ? { ...raw, keys } : raw, webcrypto.subtle, { ...(tsaRoots ? { tsaRoots } : {}), requireSeal: Boolean(flags['require-seal']) });
94
+ agree = alt.result === report.result && alt.level === report.level;
95
+ if (!flags.json)
96
+ line(`${agree ? PASS : FAIL} Independent WebCrypto verifier ${agree ? 'agrees' : `DISAGREES (${alt.result}, ${alt.level})`}`);
97
+ }
98
+ if (flags.json) {
99
+ line(JSON.stringify({ report, actions: summarize(bundle.records, bundle.disclosures, report), crossCheck: flags['cross-check'] ? agree : undefined }, null, 2));
100
+ }
101
+ else {
102
+ printReport(report, { verbose: Boolean(flags.verbose) });
103
+ printActions(summarize(bundle.records, bundle.disclosures, report));
104
+ line();
105
+ line(c.dim(`Keys from ${keys ? String(flags.keys) : 'the bundle'}: issuer ${fp((keys ?? bundle.keys).issuer)}${(keys ?? bundle.keys).sealer ? `; sealer ${fp((keys ?? bundle.keys).sealer)}` : ''}`));
106
+ if (!keys)
107
+ line(c.dim('To rule out a substituted bundle, pass --keys with the key sets the issuer and sealing service publish.'));
108
+ }
109
+ return report.result === 'pass' && agree ? 0 : 1;
110
+ }
111
+ case 'inspect': {
112
+ const bundle = parseBundle(await readJson(need(args[0], 'oar inspect <bundle.json>'), 'bundle'));
113
+ line(c.bold(`${bundle.org.name}: ${bundle.records.length} records${bundle.purpose ? `, for ${bundle.purpose}` : ''}${bundle.generated_at ? `, ${bundle.generated_at}` : ''}`));
114
+ line(c.dim('Not verified. Run `oar verify` to check signatures, seals and the chain.'));
115
+ printActions(summarize(bundle.records, bundle.disclosures));
116
+ return 0;
117
+ }
118
+ case 'html': {
119
+ const file = need(args[0], 'oar html <bundle.json> [out.html]');
120
+ const raw = await readJson(file, 'bundle');
121
+ parseBundle(raw);
122
+ const out = args[1] ?? file.replace(/\.json$/i, '') + '.verify.html';
123
+ await writeFile(out, standaloneVerifierHtml(JSON.stringify(raw)));
124
+ line(`${PASS} Wrote ${out}: open it in any browser, offline, to verify the bundle.`);
125
+ return 0;
126
+ }
127
+ case 'keygen': {
128
+ const kid = need(args[0], 'oar keygen <kid> [out.json]');
129
+ const key = generateSigningKey(kid);
130
+ if (args[1]) {
131
+ await writeFile(args[1], JSON.stringify(key, null, 2), { mode: 0o600 });
132
+ line(`${PASS} Private key written to ${args[1]} (mode 600). Keep it secret; never commit it.`);
133
+ }
134
+ else {
135
+ line(c.yellow('Private key (keep it secret; store it in a secret manager or an environment variable):'));
136
+ line(JSON.stringify(key));
137
+ }
138
+ line();
139
+ line(c.bold('Public key set to publish, for example at /.well-known/aar-keys.json:'));
140
+ line(JSON.stringify(publicKeys(key), null, 2));
141
+ return 0;
142
+ }
143
+ default:
144
+ throw new UsageError(`Unknown command "${command}". Run \`oar help\`.`);
145
+ }
146
+ }
147
+ function need(value, usage) {
148
+ if (!value)
149
+ throw new UsageError(`Usage: ${usage}`);
150
+ return value;
151
+ }
152
+ function fp(jwks) {
153
+ return keyFingerprints(jwks).join(', ');
154
+ }
155
+ // Piping into `head` closes stdout early; that is not an error.
156
+ process.stdout.on('error', (error) => {
157
+ if (error.code === 'EPIPE')
158
+ process.exit(process.exitCode ?? 0);
159
+ throw error;
160
+ });
161
+ main(process.argv.slice(2)).then((code) => {
162
+ process.exitCode = code;
163
+ }, (error) => {
164
+ if (error instanceof UsageError || error instanceof BundleError) {
165
+ process.stderr.write(`${error.message}\n`);
166
+ process.exitCode = 2;
167
+ }
168
+ else {
169
+ process.stderr.write(`${error instanceof Error ? (error.stack ?? error.message) : String(error)}\n`);
170
+ process.exitCode = 1;
171
+ }
172
+ });
173
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,UAAU,EACV,SAAS,EACT,YAAY,GAIb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;A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C;QAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;QAC3C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrG,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CACF,CAAC"}
package/dist/print.js ADDED
@@ -0,0 +1,76 @@
1
+ import { LEVEL_LABELS, OUTCOME_LABELS } from '@openactionrecord/core';
2
+ // Terminal output: plain words, colour only when the terminal supports it (NO_COLOR and FORCE_COLOR respected).
3
+ const useColor = process.env.FORCE_COLOR ? process.env.FORCE_COLOR !== '0' : !process.env.NO_COLOR && Boolean(process.stdout.isTTY);
4
+ const paint = (code) => (s) => (useColor ? `\u001b[${code}m${s}\u001b[0m` : s);
5
+ export const c = {
6
+ bold: paint('1'),
7
+ dim: paint('2'),
8
+ green: paint('32'),
9
+ red: paint('31'),
10
+ yellow: paint('33'),
11
+ cyan: paint('36'),
12
+ };
13
+ export const PASS = c.green('✔');
14
+ export const FAIL = c.red('✘');
15
+ export const WAIT = c.yellow('●');
16
+ export function line(text = '') {
17
+ process.stdout.write(`${text}\n`);
18
+ }
19
+ const CHECK_ORDER = ['issuer_signature', 'seal', 'chain', 'checkpoint', 'timestamp', 'disclosures'];
20
+ const CHECK_SHORT = {
21
+ issuer_signature: 'signature',
22
+ seal: 'seal',
23
+ chain: 'chain',
24
+ checkpoint: 'checkpoint',
25
+ timestamp: 'timestamp',
26
+ disclosures: 'disclosures',
27
+ };
28
+ /** The verification headline and, per record, which checks passed. */
29
+ export function printReport(report, options = {}) {
30
+ const ok = report.result === 'pass';
31
+ const headline = (report.messages[0] ?? '').replace(/ Evidence level: .*$/, '');
32
+ line(`${ok ? PASS : FAIL} ${c.bold(headline)}${ok ? ` ${levelText(report.level)}` : ''}`);
33
+ for (const message of report.messages.slice(1))
34
+ line(` ${c.dim(message)}`);
35
+ const showRecords = options.verbose || !ok;
36
+ if (!showRecords)
37
+ return;
38
+ line();
39
+ for (const r of report.receipts) {
40
+ if (!options.verbose && r.result === 'pass')
41
+ continue;
42
+ const checks = CHECK_ORDER.filter((k) => r.checks[k] !== 'not_checked')
43
+ .map((k) => (r.checks[k] === 'pass' ? c.green(CHECK_SHORT[k]) : c.red(`${CHECK_SHORT[k]} FAILED`)))
44
+ .join(' · ');
45
+ line(` ${r.result === 'pass' ? PASS : FAIL} ${c.dim(r.receiptId.replace('urn:uuid:', '').slice(0, 8))} ${checks}`);
46
+ for (const m of r.messages)
47
+ if (r.result === 'fail' || options.verbose)
48
+ line(` ${c.dim(m)}`);
49
+ }
50
+ }
51
+ export function levelText(level) {
52
+ const text = `[${LEVEL_LABELS[level]}]`;
53
+ return level === 'timestamped' ? c.green(text) : level === 'sealed' ? c.cyan(text) : c.yellow(`${text} (no separate sealing service)`);
54
+ }
55
+ /** One block per action: what was asked, who approved it, what changed, whether it is confirmed. */
56
+ export function printActions(actions) {
57
+ for (const a of actions) {
58
+ const mark = a.outcome === 'confirmed' ? PASS : ['not_confirmed', 'failed', 'denied', 'rejected'].includes(a.outcome) ? FAIL : WAIT;
59
+ line();
60
+ line(`${mark} ${c.bold(`${a.type} → ${a.target}`)} ${OUTCOME_LABELS[a.outcome]}${a.verified === false ? c.red(' (records did not verify)') : ''}`);
61
+ for (const s of a.steps) {
62
+ const label = s.phase.padEnd(12);
63
+ line(` ${c.dim(label)} ${s.text}`);
64
+ }
65
+ if (a.before !== undefined || a.after !== undefined) {
66
+ line(` ${c.dim('state before'.padEnd(12))} ${compact(a.before)}`);
67
+ line(` ${c.dim('state after'.padEnd(12))} ${compact(a.after)}`);
68
+ }
69
+ if (a.external)
70
+ line(` ${c.dim('adds to'.padEnd(12))} ${a.external.format} receipt ${a.external.id ?? ''} ${c.dim(a.external.digest.slice(0, 20) + '…')}`);
71
+ }
72
+ }
73
+ function compact(value) {
74
+ return value === undefined ? c.dim('(not disclosed)') : JSON.stringify(value);
75
+ }
76
+ //# sourceMappingURL=print.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print.js","sourceRoot":"","sources":["../src/print.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAA+C,MAAM,wBAAwB,CAAC;AAEnH,gHAAgH;AAEhH,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpI,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/F,MAAM,CAAC,MAAM,CAAC,GAAG;IACf,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAChB,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;IAClB,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC;IAChB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC;IACnB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CA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AAI,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACrE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,CAAC,CAAC,QAAQ;YAAE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,YAAY,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC;IAChK,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@openactionrecord/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "oar: verify Open Action Records from the command line, and see a 60-second demo of what they prove.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "oar": "./dist/main.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md"
13
+ ],
14
+ "engines": {
15
+ "node": ">=20.12"
16
+ },
17
+ "keywords": [
18
+ "ai-agents",
19
+ "audit",
20
+ "receipts",
21
+ "verify",
22
+ "cli",
23
+ "open-action-record",
24
+ "oar"
25
+ ],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/openactionrecord/oar.git",
29
+ "directory": "packages/cli"
30
+ },
31
+ "homepage": "https://github.com/openactionrecord/oar#readme",
32
+ "dependencies": {
33
+ "@openactionrecord/core": "^0.1.0"
34
+ },
35
+ "scripts": {
36
+ "build": "tsc -p tsconfig.build.json && chmod +x dist/main.js",
37
+ "typecheck": "tsc --noEmit"
38
+ }
6
39
  }