@arp-protocol/cli 0.0.0-stage → 0.0.1

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.
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ import"./cli-g5zvr10v.js";
3
+
4
+ // src/install/env.ts
5
+ import { spawnSync } from "node:child_process";
6
+ import { existsSync } from "node:fs";
7
+ import { homedir } from "node:os";
8
+ import { delimiter, join } from "node:path";
9
+ import { createInterface } from "node:readline/promises";
10
+ function which(command) {
11
+ for (const dir of (process.env.PATH ?? "").split(delimiter)) {
12
+ if (dir.length === 0)
13
+ continue;
14
+ const candidate = join(dir, command);
15
+ if (existsSync(candidate))
16
+ return candidate;
17
+ }
18
+ return null;
19
+ }
20
+ function processEnv(dist, version) {
21
+ return {
22
+ home: homedir(),
23
+ cwd: process.cwd(),
24
+ which,
25
+ run: (argv, stdin, timeoutMs = 15000) => {
26
+ const [command, ...args] = argv;
27
+ const result = spawnSync(command ?? "", args, {
28
+ input: stdin,
29
+ encoding: "utf8",
30
+ timeout: timeoutMs
31
+ });
32
+ return { code: result.status, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
33
+ },
34
+ interactive: process.stdin.isTTY === true && process.stdout.isTTY === true,
35
+ ask: async (question) => {
36
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
37
+ try {
38
+ const answer = await rl.question(`${question} [y/N] `);
39
+ return /^y(es)?$/i.test(answer.trim());
40
+ } finally {
41
+ rl.close();
42
+ }
43
+ },
44
+ out: (line) => process.stdout.write(`${line}
45
+ `),
46
+ err: (line) => process.stderr.write(`${line}
47
+ `),
48
+ now: () => new Date,
49
+ node: process.execPath,
50
+ dist,
51
+ version
52
+ };
53
+ }
54
+ export {
55
+ processEnv
56
+ };
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ DEFAULT_REQUEST_TIMEOUT_MS,
4
+ DEFAULT_SERVE_MAX_BODY_BYTES,
5
+ KeyFileError,
6
+ MovedStateError,
7
+ appendJsonLine,
8
+ arpHome,
9
+ bigintSafe,
10
+ bufferedCopy,
11
+ jsonResponse,
12
+ linesOf,
13
+ loadOrCreateKeyFile,
14
+ lockFile,
15
+ loopbackHosts,
16
+ readJsonLines,
17
+ readKeyFile,
18
+ redactUrls,
19
+ refuseForeignRequest,
20
+ refuseMovedState,
21
+ serveFetch,
22
+ stateFile
23
+ } from "./cli-tyey74p3.js";
24
+ import {
25
+ ERC8004_REGISTRY
26
+ } from "./cli-v446mw5v.js";
27
+ import"./cli-0hqxver6.js";
28
+ import"./cli-d3dy7cxe.js";
29
+ import"./cli-3kbbwfbp.js";
30
+ import"./cli-g5zvr10v.js";
31
+ export {
32
+ stateFile,
33
+ serveFetch,
34
+ refuseMovedState,
35
+ refuseForeignRequest,
36
+ redactUrls,
37
+ readKeyFile,
38
+ readJsonLines,
39
+ loopbackHosts,
40
+ lockFile,
41
+ loadOrCreateKeyFile,
42
+ linesOf,
43
+ jsonResponse,
44
+ bufferedCopy,
45
+ bigintSafe,
46
+ arpHome,
47
+ appendJsonLine,
48
+ MovedStateError,
49
+ KeyFileError,
50
+ ERC8004_REGISTRY as ERC8004_REGISTRY_REF,
51
+ DEFAULT_SERVE_MAX_BODY_BYTES,
52
+ DEFAULT_REQUEST_TIMEOUT_MS
53
+ };
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ agentFor,
4
+ chainId,
5
+ loopConfig,
6
+ writeLine
7
+ } from "./cli-0z6f3603.js";
8
+ import"./cli-tyey74p3.js";
9
+ import {
10
+ USAGE_REASONS,
11
+ isUsageOutcome,
12
+ isUsageReason
13
+ } from "./cli-74hv4etk.js";
14
+ import"./cli-c8568g4c.js";
15
+ import"./cli-v446mw5v.js";
16
+ import"./cli-0hqxver6.js";
17
+ import"./cli-d3dy7cxe.js";
18
+ import"./cli-3kbbwfbp.js";
19
+ import"./cli-g5zvr10v.js";
20
+
21
+ // ../mcp/src/line.ts
22
+ function lineFromArgs(args) {
23
+ if (!isUsageOutcome(args.outcome))
24
+ return new Error("--outcome must be worked or failed");
25
+ if (args.reason !== undefined && !isUsageReason(args.reason)) {
26
+ return new Error(`--reason must be one of ${USAGE_REASONS.join(", ")}`);
27
+ }
28
+ if (args.reason !== undefined && args.outcome !== "failed")
29
+ return new Error("a reason only follows --outcome failed");
30
+ return {
31
+ toolUrl: args.toolUrl,
32
+ outcome: args.outcome,
33
+ ...args.domain === undefined ? {} : { domain: args.domain },
34
+ ...args.reason === undefined ? {} : { reason: args.reason }
35
+ };
36
+ }
37
+ async function writeLineHere(input) {
38
+ if (chainId !== 13579)
39
+ throw new Error("a line is written on testnet 13579 only for now");
40
+ return writeLine(loopConfig(), agentFor(), input);
41
+ }
42
+ export {
43
+ writeLineHere,
44
+ lineFromArgs
45
+ };