@wasit-dev/cli 0.8.0-beta.1 → 0.8.0-beta.3

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/dist/run.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  * The payment tier pays only when every one of these holds (D-022a, B3, A1):
12
12
  * the GitHub event may pay (push to the default branch, schedule,
13
13
  * workflow_dispatch on it; outside GitHub Actions always), the network is a
14
- * test network (L0; the mainnet opt-in is not part of this version), the
14
+ * test network (L0; `stellar:pubnet` pays only through `--mainnet`, below), the
15
15
  * environment has `operatedByMe: true`, the chain's key variable is set, and
16
16
  * the plan (L1) fits the caps. Then one budget is shared by every endpoint, each
17
17
  * endpoint's checks get its entry of the plan, and the pin and `maxRunUsd` come
@@ -19,8 +19,19 @@
19
19
  * run is the read-only tier and says so. A key variable that is set on a run that
20
20
  * may not pay is refused before the service starts (Najmi, 2026-11-16).
21
21
  *
22
- * `--mainnet` asks for the mainnet opt-in, which this version does not have:
23
- * the run is refused at once, exit 2, before the config is read (spec B12).
22
+ * `--mainnet` (spec B5, B18 O2) is the CLI's switch of the mainnet opt-in: an
23
+ * x402 run on `stellar:pubnet` that pays real USDC. Core opens it
24
+ * (`openMainnetOptIn`) only when every rule holds: a pubnet environment with
25
+ * `operatedByMe` and a USDC pin, the key in `WASIT_MAINNET_PAYER_SECRET` only,
26
+ * an https RPC that serves pubnet, no other mainnet run holding the lock in the
27
+ * ledger's folder, and in GitHub Actions the mainnet job rules. All of that is
28
+ * checked before a service starts or the target is asked anything. The first
29
+ * line then says MAINNET RUN; the plan reads the payer and the chain; the
30
+ * ledger takes every signature before the key signs; a refusal stops the whole
31
+ * run; L4 waits for every authorization to expire and compares the balances.
32
+ * The switch is never read from the config or the environment. Without it, a
33
+ * paying run on pubnet is refused. `--dry-run` on pubnet plans by the mainnet
34
+ * rules and reads no key.
24
35
  *
25
36
  * `executeRun` does not call `process.exit` and does not read the process: the
26
37
  * environment and the output are passed in, so it can be tested in-process.
@@ -43,11 +54,16 @@ export interface RunCommandOptions {
43
54
  readonly startIfLocal?: boolean;
44
55
  readonly baseline?: string;
45
56
  /**
46
- * `--mainnet`: the switch of the mainnet opt-in (spec B5). This version has no
47
- * opt-in, so it always refuses, exit 2, before anything else is done (B12).
57
+ * `--mainnet`: the switch of the mainnet opt-in (spec B5): an x402 run that
58
+ * pays real USDC on `stellar:pubnet`, when every rule of the opt-in holds.
48
59
  * Never read from the config or the environment.
49
60
  */
50
61
  readonly mainnet?: boolean;
62
+ /**
63
+ * `--ledger-dir`: where a mainnet run writes its ledger and takes its lock.
64
+ * Only with `--mainnet`. Default: the working directory.
65
+ */
66
+ readonly ledgerDir?: string;
51
67
  }
52
68
  export interface RunContext {
53
69
  /** The environment of the run: the header variables, the RPC url, and what `--start` derives the service's from. */
@@ -60,5 +76,10 @@ export interface RunContext {
60
76
  readonly cwd?: string;
61
77
  /** Tests only: the sudo `--start` uses for a separate service user. Index never sets it; no flag or variable reaches it. */
62
78
  readonly sudo?: string;
79
+ /** Tests only: the wait between two reads of L4 (a mainnet run). Index never sets it. */
80
+ readonly sleep?: (ms: number) => Promise<void>;
63
81
  }
82
+ /** The key variables of the MPP checks: MPP-01's payer, and the channel's commitment key (`wasit init` sets up the same ones). */
83
+ export declare const MPP_PAYER_KEY_ENV = "MPP_PAYER_SECRET";
84
+ export declare const MPP_COMMITMENT_KEY_ENV = "COMMITMENT_SECRET_HEX";
64
85
  export declare function executeRun(options: RunCommandOptions, context: RunContext): Promise<number>;