@arp-protocol/cli 0.0.3 → 0.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arp-protocol/cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "mcpName": "io.github.Wieedze/arp",
5
5
  "description": "ARP's agent-side programs in one binary: the MCP server, the runtime hook that records what an agent used, and the opt-in hire node. Runs on Node 22 or later.",
6
6
  "homepage": "https://github.com/intuition-box/ARP",
@@ -21,7 +21,7 @@
21
21
  "LICENSE"
22
22
  ],
23
23
  "config": {
24
- "sponsorDefault": ""
24
+ "sponsorDefault": "https://sponsor.arp.intuition.box"
25
25
  },
26
26
  "engines": {
27
27
  "node": ">=22"
@@ -1,104 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- decideShare,
4
- installedFromReceipts,
5
- installedFromSkillLock,
6
- isSharingOn,
7
- parseLocalFailures,
8
- parseLocalOutcomes,
9
- sharedLineKey
10
- } from "./cli-wev0jgf7.js";
11
- import"./cli-0gsbnq5w.js";
12
- import"./cli-fbwpcfvp.js";
13
- import"./cli-mhzh9z8k.js";
14
- import"./cli-d3dy7cxe.js";
15
- import"./cli-3kbbwfbp.js";
16
- import"./cli-g5zvr10v.js";
17
-
18
- // src/share.ts
19
- import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
20
- import { join } from "node:path";
21
- var read = (path) => existsSync(path) ? readFileSync(path, "utf8") : null;
22
- function shared(env) {
23
- const keys = new Set;
24
- for (const row of (read(join(env.arpHome, "shared-failures.jsonl")) ?? "").split(`
25
- `)) {
26
- if (row.trim() === "")
27
- continue;
28
- try {
29
- keys.add(sharedLineKey(JSON.parse(row)));
30
- } catch {
31
- continue;
32
- }
33
- }
34
- return keys;
35
- }
36
- function decide(env) {
37
- const on = isSharingOn(read(join(env.arpHome, "sharing.json")));
38
- const decision = decideShare({
39
- on,
40
- failures: parseLocalFailures(read(join(env.arpHome, "failures.jsonl")) ?? ""),
41
- outcomes: parseLocalOutcomes(read(join(env.arpHome, "outcomes.jsonl")) ?? ""),
42
- installed: [
43
- ...installedFromSkillLock(read(join(env.home, ".agents", ".skill-lock.json"))),
44
- ...installedFromReceipts(read(join(env.arpHome, "receipts.jsonl"))),
45
- ...installedFromReceipts(read(join(env.cwd, ".arp", "receipts.jsonl")))
46
- ],
47
- alreadyShared: shared(env)
48
- });
49
- return { ...decision, on };
50
- }
51
- function setSharing(env, on) {
52
- mkdirSync(env.arpHome, { recursive: true });
53
- writeFileSync(join(env.arpHome, "sharing.json"), `${JSON.stringify({ failures: on })}
54
- `);
55
- }
56
- async function sendShared(env, write) {
57
- const { on, lines } = decide(env);
58
- if (!on)
59
- return { sent: 0, failed: 0, firstError: null };
60
- let sent = 0;
61
- let failed = 0;
62
- let firstError = null;
63
- for (const line of lines) {
64
- try {
65
- await write(line);
66
- appendFileSync(join(env.arpHome, "shared-failures.jsonl"), `${JSON.stringify(line)}
67
- `);
68
- sent += 1;
69
- } catch (error) {
70
- failed += 1;
71
- firstError ??= error instanceof Error ? error.message : String(error);
72
- }
73
- }
74
- return { sent, failed, firstError };
75
- }
76
- var WHY = {
77
- sharing_off: "sharing is off",
78
- no_public_source: "no known public source",
79
- several_sources: "several sources with this name"
80
- };
81
- function describe(decision) {
82
- const out = [`sharing is ${decision.on ? "on" : "off"}`];
83
- if (decision.lines.length > 0) {
84
- out.push("", "would be public on testnet 13579:");
85
- for (const line of decision.lines) {
86
- const tail = line.outcome === "failed" ? `failed ${line.reason}${line.need === undefined ? "" : ` needs ${line.need}`}` : `worked${line.need === undefined ? "" : ` with ${line.need}`}`;
87
- out.push(` ${line.toolUrl} ${line.domain ?? "(no domain)"} ${tail}`);
88
- }
89
- }
90
- if (decision.keptLocal.length > 0) {
91
- out.push("", "stays on this machine:");
92
- for (const row of decision.keptLocal)
93
- out.push(` ${row.skill}: ${WHY[row.why]}`);
94
- }
95
- return `${out.join(`
96
- `)}
97
- `;
98
- }
99
- export {
100
- setSharing,
101
- sendShared,
102
- describe,
103
- decide
104
- };