@arp-protocol/cli 0.0.1 → 0.0.4

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 (31) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/LICENSE +26 -0
  3. package/README.md +22 -8
  4. package/dist/chunks/backfill-5zmh0t43.js +1050 -0
  5. package/dist/chunks/{ccip-qmytgn8e.js → ccip-zxtpc4fx.js} +4 -4
  6. package/dist/chunks/check-k4qnc9ee.js +2011 -0
  7. package/dist/chunks/cli-00qp1sj2.js +116 -0
  8. package/dist/chunks/{cli-c8568g4c.js → cli-0gsbnq5w.js} +72 -72
  9. package/dist/chunks/{cli-zpft011j.js → cli-64fx73kx.js} +3 -3
  10. package/dist/chunks/cli-7c393v47.js +173 -0
  11. package/dist/chunks/{cli-0z6f3603.js → cli-8m56jsfx.js} +239 -183
  12. package/dist/chunks/{cli-v446mw5v.js → cli-fbwpcfvp.js} +34 -34
  13. package/dist/chunks/cli-kda5hz4w.js +23 -0
  14. package/dist/chunks/{cli-0hqxver6.js → cli-mhzh9z8k.js} +33 -33
  15. package/dist/chunks/{cli-tyey74p3.js → cli-n4qagybd.js} +6 -2
  16. package/dist/chunks/{cli-74hv4etk.js → cli-wer26exb.js} +4939 -4105
  17. package/dist/chunks/cli-zehr6kdx.js +719 -0
  18. package/dist/chunks/{commands-dnk10vze.js → commands-t5a0w785.js} +88 -17
  19. package/dist/chunks/{env-s4585w6j.js → env-n5ac8d1z.js} +1 -0
  20. package/dist/chunks/{index-3a3ssef1.js → index-jrs2shcc.js} +3 -3
  21. package/dist/chunks/line-kvm1ew55.js +215 -0
  22. package/dist/chunks/{node-init-4v2m2vj0.js → node-init-amedveja.js} +7 -6
  23. package/dist/chunks/{node-0ydee9hy.js → node-x35ncwhq.js} +7 -6
  24. package/dist/chunks/server-ek7fet5m.js +6924 -0
  25. package/dist/chunks/{share-g8v5qe6r.js → share-ax2k8805.js} +10 -5
  26. package/dist/cli.js +71 -19
  27. package/dist/hook.js +4178 -270
  28. package/package.json +10 -3
  29. package/dist/chunks/backfill-j4hxt1w1.js +0 -262
  30. package/dist/chunks/line-zy1tc2np.js +0 -45
  31. package/dist/chunks/server-jmyjttvv.js +0 -3170
@@ -5,11 +5,13 @@ import {
5
5
  installedFromSkillLock,
6
6
  isSharingOn,
7
7
  parseLocalFailures,
8
+ parseLocalOutcomes,
8
9
  sharedLineKey
9
- } from "./cli-74hv4etk.js";
10
- import"./cli-c8568g4c.js";
11
- import"./cli-v446mw5v.js";
12
- import"./cli-0hqxver6.js";
10
+ } from "./cli-wer26exb.js";
11
+ import"./cli-zehr6kdx.js";
12
+ import"./cli-0gsbnq5w.js";
13
+ import"./cli-fbwpcfvp.js";
14
+ import"./cli-mhzh9z8k.js";
13
15
  import"./cli-d3dy7cxe.js";
14
16
  import"./cli-3kbbwfbp.js";
15
17
  import"./cli-g5zvr10v.js";
@@ -37,8 +39,10 @@ function decide(env) {
37
39
  const decision = decideShare({
38
40
  on,
39
41
  failures: parseLocalFailures(read(join(env.arpHome, "failures.jsonl")) ?? ""),
42
+ outcomes: parseLocalOutcomes(read(join(env.arpHome, "outcomes.jsonl")) ?? ""),
40
43
  installed: [
41
44
  ...installedFromSkillLock(read(join(env.home, ".agents", ".skill-lock.json"))),
45
+ ...installedFromSkillLock(read(join(env.cwd, "skills-lock.json"))),
42
46
  ...installedFromReceipts(read(join(env.arpHome, "receipts.jsonl"))),
43
47
  ...installedFromReceipts(read(join(env.cwd, ".arp", "receipts.jsonl")))
44
48
  ],
@@ -81,7 +85,8 @@ function describe(decision) {
81
85
  if (decision.lines.length > 0) {
82
86
  out.push("", "would be public on testnet 13579:");
83
87
  for (const line of decision.lines) {
84
- out.push(` ${line.toolUrl} ${line.domain ?? "(no domain)"} failed ${line.reason}`);
88
+ const tail = line.outcome === "failed" ? `failed ${line.reason}${line.need === undefined ? "" : ` needs ${line.need}`}` : `worked${line.need === undefined ? "" : ` with ${line.need}`}`;
89
+ out.push(` ${line.toolUrl} ${line.domain ?? "(no domain)"} ${tail}`);
85
90
  }
86
91
  }
87
92
  if (decision.keptLocal.length > 0) {
package/dist/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  bufferedCopy
4
- } from "./chunks/cli-tyey74p3.js";
5
- import"./chunks/cli-v446mw5v.js";
6
- import"./chunks/cli-0hqxver6.js";
4
+ } from "./chunks/cli-n4qagybd.js";
5
+ import"./chunks/cli-fbwpcfvp.js";
6
+ import"./chunks/cli-mhzh9z8k.js";
7
7
  import"./chunks/cli-d3dy7cxe.js";
8
8
  import"./chunks/cli-3kbbwfbp.js";
9
9
  import {
@@ -14,7 +14,7 @@ import {
14
14
  import { dirname } from "node:path";
15
15
  import { fileURLToPath } from "node:url";
16
16
  // package.json
17
- var version = "0.0.1";
17
+ var version = "0.0.4";
18
18
 
19
19
  // src/cli.ts
20
20
  var USAGE = `arp ${version} — ARP's agent-side programs
@@ -22,15 +22,26 @@ var USAGE = `arp ${version} — ARP's agent-side programs
22
22
  usage
23
23
  arp mcp [--http] the MCP server. stdio by default, which is how an MCP client launches it
24
24
  arp hook the runtime hook: one payload on stdin. Records what a session used in
25
- .arp/session.jsonl, and a skill's failures in ~/.arp/failures.jsonl
25
+ .arp/session.jsonl, and a skill's failures in ~/.arp/failures.jsonl. On
26
+ Stop, asks once per skill whether it did its job: ~/.arp/outcomes.jsonl
26
27
  arp backfill read old Claude Code transcripts into ~/.arp/failures.jsonl. Sends nothing
27
- arp share say what would be public from ~/.arp/failures.jsonl, and what stays here.
28
+ arp share say what would be public from ~/.arp/failures.jsonl and outcomes.jsonl,
29
+ and what stays here.
28
30
  arp share on, off (off by default). arp share send writes them on testnet
31
+ arp check <skill> before you use a skill: what its files contain, what agents wrote about
32
+ it, and whether what it needed when it failed is on this machine.
33
+ <owner/repo/skill> or a github.com URL with ?skill=. Writes nothing
29
34
  arp node the hire endpoint. Opt-in: it listens on 127.0.0.1 and is reached through
30
35
  a tunnel you rent (cloudflared or ngrok, or ARP_NODE_PUBLIC_URL)
31
36
 
32
37
  arp line write one public line on testnet 13579 through ARP's sponsor: --tool <url>
33
38
  --outcome worked|failed [--domain <category>] [--reason <reason>]
39
+ [--payment-tx <hash> --network eip155:8453] an x402 payment, read on Base;
40
+ with it, --tool is the exact URL you paid, written
41
+ with its values removed, and the 402's terms you paid
42
+ against: --pay-to --asset --price --terms-at
43
+ [--needs <name>] or [--with <name>] the program or variable name that was
44
+ missing, or that you added; written only if the skill's SKILL.md names it
34
45
  arp init add the MCP server and the hook to every runtime found here
35
46
  arp uninstall remove them, and only them
36
47
  arp doctor check what is installed and that the server answers
@@ -51,17 +62,20 @@ usage
51
62
  --capture (init) hook every runtime and keep each payload, redacted, in
52
63
  ~/.arp/captures/ — to teach the hook a new runtime
53
64
  --force (init) replace an MCP server named "arp" that ARP did not write
65
+ --share, --no-share (init) answer the sharing offer up front; off unless --share or a "y"
54
66
  arp --version
55
67
  arp --help
56
68
 
57
- docs: https://github.com/Wieedze/ARP/blob/main/docs/22_RUNNING_THE_NODE.md
69
+ docs: https://github.com/intuition-box/ARP/blob/main/docs/22_RUNNING_THE_NODE.md
58
70
  `;
59
71
  var EXIT = { ok: 0, usage: 2, writeFailed: 5 };
60
72
  var CLI_PATH = fileURLToPath(import.meta.url);
61
73
  var ARGV = process.argv.slice(2);
62
- var STDIO_INPUT = ARGV[0] === "mcp" && !ARGV.includes("--http") ? bufferedCopy(process.stdin) : undefined;
74
+ var asksHelp = (rest) => rest.some((arg) => arg === "--help" || arg === "-h");
75
+ var WANTS_HELP = asksHelp(ARGV.slice(1));
76
+ var STDIO_INPUT = ARGV[0] === "mcp" && !ARGV.includes("--http") && !WANTS_HELP ? bufferedCopy(process.stdin) : undefined;
63
77
  async function runNodeInit(rest) {
64
- const { nodeInit, parseNodeInitFlags } = await import("./chunks/node-init-4v2m2vj0.js");
78
+ const { nodeInit, parseNodeInitFlags } = await import("./chunks/node-init-amedveja.js");
65
79
  const flags = parseNodeInitFlags(rest);
66
80
  if (flags instanceof Error) {
67
81
  process.stderr.write(`arp init --node: ${flags.message}
@@ -89,9 +103,9 @@ async function runNodeInit(rest) {
89
103
  });
90
104
  }
91
105
  async function shareCommand(rest) {
92
- const { arpHome } = await import("./chunks/index-3a3ssef1.js");
106
+ const { arpHome } = await import("./chunks/index-jrs2shcc.js");
93
107
  const { homedir } = await import("node:os");
94
- const share = await import("./chunks/share-g8v5qe6r.js");
108
+ const share = await import("./chunks/share-ax2k8805.js");
95
109
  const env = { arpHome: arpHome(process.env, homedir()), home: homedir(), cwd: process.cwd() };
96
110
  if (rest[0] === "send") {
97
111
  if (!share.decide(env).on) {
@@ -99,7 +113,7 @@ async function shareCommand(rest) {
99
113
  return EXIT.ok;
100
114
  }
101
115
  process.env["ARP_TARGET"] ??= "testnet";
102
- const { writeLineHere } = await import("./chunks/line-zy1tc2np.js");
116
+ const { writeLineHere } = await import("./chunks/line-kvm1ew55.js");
103
117
  const done = await share.sendShared(env, async (line) => {
104
118
  await writeLineHere(line);
105
119
  });
@@ -122,11 +136,15 @@ async function shareCommand(rest) {
122
136
  }
123
137
  async function run(argv) {
124
138
  const [command, ...rest] = argv;
139
+ if (asksHelp(rest)) {
140
+ process.stdout.write(USAGE);
141
+ return EXIT.ok;
142
+ }
125
143
  if (command === "init" && rest.includes("--node"))
126
144
  return runNodeInit(rest);
127
145
  switch (command) {
128
146
  case "mcp": {
129
- const { main } = await import("./chunks/server-jmyjttvv.js");
147
+ const { main } = await import("./chunks/server-ek7fet5m.js");
130
148
  await main(rest.includes("--http") ? rest : ["--stdio", ...rest], STDIO_INPUT);
131
149
  return EXIT.ok;
132
150
  }
@@ -141,6 +159,17 @@ async function run(argv) {
141
159
  `);
142
160
  return EXIT.writeFailed;
143
161
  }
162
+ case "check": {
163
+ const { checkSkill, skillRefOf, thisMachine } = await import("./chunks/check-k4qnc9ee.js");
164
+ const ref = rest.length === 1 ? skillRefOf(rest[0] ?? "") : null;
165
+ if (ref === null) {
166
+ process.stderr.write(`usage: arp check <owner/repo/skill | https://github.com/owner/repo?skill=name>
167
+ `);
168
+ return EXIT.usage;
169
+ }
170
+ process.stdout.write(await checkSkill(ref, { env: process.env, machine: thisMachine() }));
171
+ return EXIT.ok;
172
+ }
144
173
  case "line": {
145
174
  const flag = (name) => {
146
175
  const at = rest.indexOf(`--${name}`);
@@ -150,12 +179,35 @@ async function run(argv) {
150
179
  const outcome = flag("outcome");
151
180
  if (toolUrl === undefined || outcome === undefined) {
152
181
  process.stderr.write(`usage: arp line --tool <url> --outcome worked|failed [--domain <category>] [--reason <reason>]
182
+ [--parent <category> --why <text>] adds a --domain the tree lacks, under --parent
183
+ [--payment-tx <hash> --network eip155:8453] the x402 payment this outcome refers to;
184
+ --tool is then the exact URL you paid;
185
+ its values are removed before anything is signed
186
+ ` + ` [--pay-to <0x…> --asset <0x…> --price <units> --terms-at <unix|ISO>] with --payment-tx: the 402's
187
+ ` + ` payTo, asset and amount you paid against, and when it came
188
+ [--needs <name>] with missing-program or missing-key: the program or variable name (never a value)
189
+ [--with <name>] with --outcome worked: what you had to add; either is written only if the SKILL.md names it
153
190
  `);
154
191
  return EXIT.usage;
155
192
  }
156
193
  process.env["ARP_TARGET"] ??= "testnet";
157
- const { lineFromArgs, writeLineHere } = await import("./chunks/line-zy1tc2np.js");
158
- const input = lineFromArgs({ toolUrl, outcome, domain: flag("domain"), reason: flag("reason") });
194
+ const { lineFromArgs, writeLineHere } = await import("./chunks/line-kvm1ew55.js");
195
+ const input = lineFromArgs({
196
+ toolUrl,
197
+ outcome,
198
+ domain: flag("domain"),
199
+ reason: flag("reason"),
200
+ parent: flag("parent"),
201
+ why: flag("why"),
202
+ paymentTx: flag("payment-tx"),
203
+ network: flag("network"),
204
+ payTo: flag("pay-to"),
205
+ asset: flag("asset"),
206
+ price: flag("price"),
207
+ termsAt: flag("terms-at"),
208
+ needs: flag("needs"),
209
+ with: flag("with")
210
+ });
159
211
  if (input instanceof Error) {
160
212
  process.stderr.write(`arp line: ${input.message}
161
213
  `);
@@ -173,22 +225,22 @@ async function run(argv) {
173
225
  }
174
226
  }
175
227
  case "backfill": {
176
- const { backfill } = await import("./chunks/backfill-j4hxt1w1.js");
228
+ const { backfill } = await import("./chunks/backfill-5zmh0t43.js");
177
229
  const found = backfill();
178
230
  process.stdout.write(`read ${found.transcripts} transcripts: ${found.uses} skill uses, ${found.added} new failures in ${found.file}
179
231
  `);
180
232
  return EXIT.ok;
181
233
  }
182
234
  case "node": {
183
- const { main } = await import("./chunks/node-0ydee9hy.js");
235
+ const { main } = await import("./chunks/node-x35ncwhq.js");
184
236
  await main();
185
237
  return EXIT.ok;
186
238
  }
187
239
  case "init":
188
240
  case "uninstall":
189
241
  case "doctor": {
190
- const install = await import("./chunks/commands-dnk10vze.js");
191
- const { processEnv } = await import("./chunks/env-s4585w6j.js");
242
+ const install = await import("./chunks/commands-t5a0w785.js");
243
+ const { processEnv } = await import("./chunks/env-n5ac8d1z.js");
192
244
  const flags = install.parseFlags(rest);
193
245
  if (flags instanceof Error) {
194
246
  process.stderr.write(`arp ${command}: ${flags.message}