run402 1.33.2 → 1.34.0

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/cli.mjs CHANGED
@@ -42,6 +42,7 @@ Commands:
42
42
  billing Email billing accounts, Stripe tier checkout, email packs
43
43
  contracts KMS contract wallets ($0.04/day rental + $0.000005/sign)
44
44
  agent Manage agent identity (contact info)
45
+ service Run402 service health and availability (status, health)
45
46
 
46
47
  Run 'run402 <command> --help' for detailed usage of each command.
47
48
 
@@ -183,6 +184,11 @@ switch (cmd) {
183
184
  await run(sub, rest);
184
185
  break;
185
186
  }
187
+ case "service": {
188
+ const { run } = await import("./lib/service.mjs");
189
+ await run(sub, rest);
190
+ break;
191
+ }
186
192
  default:
187
193
  console.error(`Unknown command: ${cmd}\n`);
188
194
  console.log(HELP);
@@ -0,0 +1,47 @@
1
+ import { API } from "./config.mjs";
2
+
3
+ const HELP = `run402 service — Run402 service health and availability
4
+
5
+ Usage:
6
+ run402 service status Public availability report (uptime, capabilities, operator, deployment)
7
+ run402 service health Liveness check (per-dependency status + version)
8
+
9
+ Notes:
10
+ - Both endpoints are unauthenticated and free. No allowance required.
11
+ - This is the Run402 SERVICE status. For your ACCOUNT status (allowance,
12
+ balance, tier, projects), use 'run402 status'.
13
+ `;
14
+
15
+ async function fetchAndEmit(path) {
16
+ let res;
17
+ try {
18
+ res = await fetch(`${API}${path}`);
19
+ } catch (err) {
20
+ console.log(JSON.stringify({ error: "fetch_failed", message: err?.message || String(err) }));
21
+ return;
22
+ }
23
+ const text = await res.text();
24
+ let body;
25
+ try { body = JSON.parse(text); } catch { body = text; }
26
+ if (!res.ok) {
27
+ console.log(JSON.stringify({ error: "non_2xx", status: res.status, body }, null, 2));
28
+ return;
29
+ }
30
+ console.log(JSON.stringify(body, null, 2));
31
+ }
32
+
33
+ export async function run(sub, args) {
34
+ if (!sub || sub === "--help" || sub === "-h") { console.log(HELP); process.exit(0); }
35
+ switch (sub) {
36
+ case "status":
37
+ await fetchAndEmit("/status");
38
+ return;
39
+ case "health":
40
+ await fetchAndEmit("/health");
41
+ return;
42
+ default:
43
+ console.error(`Unknown subcommand: ${sub}\n`);
44
+ console.log(HELP);
45
+ process.exit(1);
46
+ }
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "1.33.2",
3
+ "version": "1.34.0",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 and MPP micropayments.",
5
5
  "type": "module",
6
6
  "bin": {