run402 4.1.0 → 4.1.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.
package/cli.mjs CHANGED
@@ -27,7 +27,7 @@ Commands:
27
27
  credentials Manage local credential material (project-keys)
28
28
  allowance Manage your agent allowance (create, fund, balance, status)
29
29
  tier Manage tier subscription (status, set)
30
- projects Manage projects (provision, list, query, inspect, delete)
30
+ projects Manage projects (provision, list, get, sql, delete)
31
31
  apply Alias for deploy apply; supports --rehearse for migration rehearsal
32
32
  snapshots Create/list/restore/delete project data snapshots
33
33
  branches Create/list/renew/delete contained project branches
package/lib/allowance.mjs CHANGED
@@ -242,7 +242,17 @@ async function balance() {
242
242
  }, null, 2));
243
243
  }
244
244
 
245
- async function exportAddr() {
245
+ async function exportAddr(args = []) {
246
+ const parsedArgs = normalizeArgv(args);
247
+ assertKnownFlags(parsedArgs, [], []);
248
+ const bare = positionalArgs(parsedArgs, []);
249
+ if (bare.length > 0) {
250
+ fail({
251
+ code: "BAD_USAGE",
252
+ message: `Unexpected argument for allowance export: ${bare[0]}`,
253
+ details: { argument: bare[0] },
254
+ });
255
+ }
246
256
  try {
247
257
  const address = await getSdk().allowance.export();
248
258
  console.log(JSON.stringify({ address }));
@@ -333,7 +343,7 @@ export async function run(sub, args) {
333
343
  case "create": await create(); break;
334
344
  case "fund": await fund(); break;
335
345
  case "balance": await balance(); break;
336
- case "export": await exportAddr(); break;
346
+ case "export": await exportAddr(args); break;
337
347
  case "checkout": await checkout(args); break;
338
348
  case "history": await history(args); break;
339
349
  default:
package/lib/doctor.mjs CHANGED
@@ -56,6 +56,13 @@ Exit codes:
56
56
  1 — one or more checks failed (details in output)
57
57
  `;
58
58
 
59
+ function redactAllowanceForDiagnostics(allowance) {
60
+ if (!allowance || typeof allowance !== "object") return allowance;
61
+ const safe = { ...allowance };
62
+ delete safe.privateKey;
63
+ return safe;
64
+ }
65
+
59
66
  export async function run(sub, args = []) {
60
67
  const all = [sub, ...args].filter(Boolean);
61
68
  if (all.includes("--help") || all.includes("-h")) {
@@ -113,8 +120,9 @@ export async function run(sub, args = []) {
113
120
  value: {
114
121
  rail: allowance.rail,
115
122
  // Don't surface amounts or addresses unless --verbose; agents
116
- // checking for config presence don't need wallet details.
117
- ...(verbose && { details: allowance }),
123
+ // checking for config presence don't need wallet details. Never
124
+ // include keystore secrets in diagnostics, even in verbose mode.
125
+ ...(verbose && { details: redactAllowanceForDiagnostics(allowance) }),
118
126
  },
119
127
  });
120
128
  } else {
@@ -182,19 +190,34 @@ export async function run(sub, args = []) {
182
190
  const sdk = getSdk();
183
191
  const tier = await sdk.tier.status();
184
192
  const tierName = tier?.tier ?? null;
185
- if (tierName && tierName !== "past_due" && tierName !== "frozen" && tierName !== "dormant") {
193
+ const lifecycle = tier?.organization_lifecycle_state ?? null;
194
+ const active = tier?.active === true;
195
+ if (tierName && active && lifecycle === "active") {
186
196
  checks.push({
187
197
  name: "tier",
188
198
  status: "ok",
189
- value: { tier: tierName },
199
+ value: { tier: tierName, active, organization_lifecycle_state: lifecycle },
190
200
  });
191
201
  } else {
202
+ const status = lifecycle && lifecycle !== "active"
203
+ ? lifecycle
204
+ : tierName && !active
205
+ ? "inactive"
206
+ : tierName && lifecycle === null
207
+ ? "unknown"
208
+ : tierName ?? "missing";
192
209
  checks.push({
193
210
  name: "tier",
194
- status: tierName ?? "missing",
195
- ...(tierName && {
196
- hint: "Run 'run402 tier set prototype' to subscribe (or upgrade).",
197
- }),
211
+ status,
212
+ value: {
213
+ tier: tierName,
214
+ active,
215
+ organization_lifecycle_state: lifecycle,
216
+ lease_expires_at: tier?.lease_expires_at ?? null,
217
+ },
218
+ hint: lifecycle === null && tierName
219
+ ? "Tier resolved, but organization lifecycle could not be determined. Check `run402 tier status` before assuming the account is healthy."
220
+ : "Run 'run402 tier set prototype' to subscribe, renew, or reactivate the tier.",
198
221
  });
199
222
  }
200
223
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
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": {