@heyanon-arp/cli 0.0.14 → 0.0.16

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/README.md CHANGED
@@ -200,15 +200,19 @@ RPC URL and the server's deploy cluster MUST agree, otherwise
200
200
  `create_lock` tx.
201
201
 
202
202
  When a delegation's `settlement = escrow` is offered:
203
- 1. The buyer builds an on-chain lock for the agreed amount using
203
+ 1. The buyer builds + signs an on-chain lock for the agreed amount with
204
204
  `heyarp wallet create-lock` (the CLI auto-discovers the program id
205
- from the server).
206
- 2. The lock is attached to the delegation offer.
207
- 3. After the payee responds + buyer co-signs the receipt, the server's
208
- relayer submits `release_lock` (or `partial_release` / `refund_lock`)
209
- on chain.
205
+ from the server), then funds it after the worker accepts via
206
+ `heyarp delegation fund`.
207
+ 2. The worker accepts the lock on-chain (`heyarp escrow accept`,
208
+ staking the worker stake) and marks delivery with
209
+ `heyarp escrow submit-work`.
210
+ 3. The buyer approves payment by sending `claim_work_payment` on chain
211
+ (`heyarp escrow claim`); the payee is paid in full minus the
212
+ protocol fee. Refunds go through `cancel_lock` (before accept) or
213
+ `claim_expired_work` (work window lapsed).
210
214
  4. `heyarp wallet verify-release --json` confirms the on-chain state
211
- (`released_clean`, `released_partial`, or `released_refunded`).
215
+ (`released: true`, `status: paid`).
212
216
 
213
217
  ## Compatibility
214
218
 
package/bin/heyarp.cjs ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /*
5
+ * heyarp launcher shim.
6
+ *
7
+ * Its ONLY job is to gate on the Node.js version BEFORE requiring the real
8
+ * bundle (dist/cli.js). The bundle is built for modern Node (tsup target
9
+ * node22) and uses ES2020 syntax such as optional chaining; on an old Node
10
+ * that syntax throws a cryptic `SyntaxError: Unexpected token .` at PARSE
11
+ * time — before any in-bundle version check could ever run. A user whose
12
+ * `#!/usr/bin/env node` resolves to a stale Node on their PATH (a common
13
+ * macOS footgun: an old /usr/local/bin/node shadowing a newer
14
+ * /opt/homebrew/bin/node) would otherwise see that opaque error instead of
15
+ * a clear "upgrade Node" message.
16
+ *
17
+ * Therefore this file is INTENTIONALLY written in pre-ES2020 style so it
18
+ * parses on any realistic Node and can print a helpful diagnostic. Do NOT
19
+ * introduce optional chaining (`?.`), nullish coalescing (`??`), or other
20
+ * ES2020+ syntax here — that would defeat the entire purpose. (It also
21
+ * means the `engines.node` minimum is read defensively without `?.`.)
22
+ */
23
+
24
+ const pkg = require('../package.json');
25
+ const engines = pkg.engines || {};
26
+ const declared = typeof engines.node === 'string' ? engines.node : '>=22';
27
+ const declaredMatch = declared.match(/\d+/);
28
+ const required = declaredMatch ? parseInt(declaredMatch[0], 10) : 22;
29
+
30
+ const current = String(process.versions.node);
31
+ const currentMajor = parseInt(current.split('.')[0], 10);
32
+
33
+ if (Number.isNaN(currentMajor) || currentMajor < required) {
34
+ process.stderr.write(
35
+ `\n heyarp requires Node.js >= ${required}, but this process is Node ${current}.\n\n` +
36
+ ` The \`node\` resolved by the shebang is:\n ${process.execPath}\n\n` +
37
+ ` A stale Node earlier on your PATH is the usual cause (e.g. an old\n` +
38
+ ` /usr/local/bin/node shadowing a newer one). Fix it with one of:\n` +
39
+ ` - nvm install ${required} && nvm alias default ${required}\n` +
40
+ ` - put your Node >= ${required} directory first on $PATH\n` +
41
+ ` - reinstall heyarp under a modern Node\n\n` +
42
+ ` Tip: \`which -a node\` lists every node on your PATH.\n\n`,
43
+ );
44
+ process.exit(1);
45
+ }
46
+
47
+ require('../dist/cli.js');