@pingagent/sdk 0.1.7 → 0.1.9

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/bin/pingagent.js CHANGED
@@ -57,6 +57,22 @@ function printError(err) {
57
57
  }
58
58
  }
59
59
 
60
+ function formatRetentionLabel(ttlMs) {
61
+ if (!ttlMs || ttlMs <= 0) return '-';
62
+ const days = ttlMs / 86_400_000;
63
+ if (Number.isInteger(days) && days >= 1) return `${days}d`;
64
+ const hours = ttlMs / 3_600_000;
65
+ if (Number.isInteger(hours) && hours >= 1) return `${hours}h`;
66
+ return `${ttlMs}ms`;
67
+ }
68
+
69
+ function describeHostedTier(tier) {
70
+ if (tier === 'plus') return 'shareable identity + first alias + higher relay';
71
+ if (tier === 'pro') return 'multi-identity communication + audit export';
72
+ if (tier === 'enterprise') return 'high-scale governance + operational controls';
73
+ return 'free communication-first entry tier';
74
+ }
75
+
60
76
  function openStore(identityPath) {
61
77
  return new LocalStore(getStorePath(identityPath));
62
78
  }
@@ -84,7 +100,9 @@ async function getClient(identityPath) {
84
100
  let id = loadIdentity(p);
85
101
  await ensureTokenValid(p, id.serverUrl);
86
102
  id = loadIdentity(p);
87
- return makeClient(id, p);
103
+ const client = makeClient(id, p);
104
+ await client.ensureEncryptionKeyPublished().catch(() => undefined);
105
+ return client;
88
106
  }
89
107
 
90
108
  const program = new Command();
@@ -402,12 +420,15 @@ program
402
420
  if (subRes.ok && subRes.data) {
403
421
  const d = subRes.data;
404
422
  console.log(`Tier: ${d.tier}`);
423
+ console.log(`Plan: ${describeHostedTier(d.tier)}`);
405
424
  console.log(`Relay: ${d.usage.relay_today} / ${d.usage.relay_limit} today`);
425
+ console.log(`Retention: ${formatRetentionLabel(d.limits.store_forward_ttl_ms)}`);
406
426
  console.log(`Artifact: ${(d.usage.artifact_bytes / 1024 / 1024).toFixed(2)} MB / ${d.limits.artifact_storage_mb} MB`);
407
427
  console.log(`Alias: ${d.usage.alias_count} / ${d.usage.alias_limit}`);
428
+ console.log(`Audit export: ${d.limits.audit_export_allowed ? 'enabled' : 'not included on this plan'}`);
408
429
  if (d.billing_primary_did && d.billing_primary_did !== id.did) {
409
430
  console.log(`Billing: linked device (primary: ${d.billing_primary_did})`);
410
- console.log(' Subscription managed on primary. Use primary to create link codes or manage billing.');
431
+ console.log(' Subscription managed on primary. Use the primary device for checkout changes and customer portal access.');
411
432
  } else if (d.linked_device_count > 0) {
412
433
  console.log(`Billing: primary device (${d.linked_device_count} linked)`);
413
434
  }
@@ -1419,7 +1440,7 @@ billing
1419
1440
 
1420
1441
  program
1421
1442
  .command('web')
1422
- .description('Start local web UI for debugging and audit. By default scans ~/.pingagent for profiles; use --identity-dir to lock to one profile.')
1443
+ .description('Start local web UI and host panel for debugging, runtime inspection, trust policy, and audit. By default scans ~/.pingagent for profiles; use --identity-dir to lock to one profile.')
1423
1444
  .option('--port <port>', 'Port for the web server', '3846')
1424
1445
  .action(async (opts) => {
1425
1446
  const serverUrl = process.env.PINGAGENT_SERVER_URL || DEFAULT_SERVER;