@pmate/cli 0.49.7 → 0.50.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/README.md CHANGED
@@ -424,3 +424,21 @@ Permission risk: H requires an admin-level role, M requires maintainer or admin,
424
424
  A Bot Account may own multiple application Profiles. Normal registration ensures one initial Profile; explicit `account bot profile create` adds another Profile for testing or another role. Agent execution metadata uses the selected Profile ID, not the account name.
425
425
 
426
426
  Bot login and nickname updates accept `--profile-id 0x…`. With multiple Profiles, select the intended Profile explicitly. Login does not create a Profile or silently choose the first. The desktop Runtime editor also requires an existing canonical Bot Profile ID; plugin IDs retain their own namespace.
427
+
428
+ ## Account lookup
429
+
430
+ ### Background
431
+
432
+ `account view` separates basic identity from explicitly requested private fields. Looking up another account in an authorized App no longer requires account administration rights. Role bindings, sessions and credentials remain separate resources.
433
+
434
+ ```sh
435
+ pmate account view --app pmate:merry --nickname Arius --json
436
+ pmate account view --account <id> --json
437
+ pmate account view --account <id> --include private --json
438
+ ```
439
+
440
+ Nickname lookup requires `--app`; duplicate nicknames return candidates for selection by Account ID. ID lookups default to the authenticated session's App. An explicit different App requires platform `profile:read`; namespace-limited credentials cannot escape their namespace. The App flag filters profiles; it does not switch authentication identity or grant access.
441
+
442
+ The response remains a JSON array with `account`, `profiles`, and `nickNames`. Basic account fields are `id`, `createdAt`, `kind`, and optional `name`; profiles contain only `id`, `app`, `account`, `userName`, `nickName`, `avatar`. Even self/root lookups omit mobile by default. `--include private` adds mobile only for self or platform `account:read`; phone-number search always requires that permission before lookup, plus explicit private inclusion. Inaccessible and absent basic targets both return an empty array.
443
+
444
+ Migration: callers relying on the old aggregated `roles`, `session`, full profiles or implicit mobile must use the appropriate resource API or explicitly request private fields. Account list and app-users remain privileged administration commands and retain their existing contracts. Deploy the updated auth API before using these CLI options.
package/dist/index.d.ts CHANGED
@@ -379,6 +379,8 @@ type AccountCommandArgs = {
379
379
  account?: string;
380
380
  mobile?: string;
381
381
  nickName?: string;
382
+ app?: string;
383
+ include?: "private";
382
384
  baseUrl?: string;
383
385
  json: boolean;
384
386
  } | {
package/dist/index.js CHANGED
@@ -20164,7 +20164,7 @@ function logResponseError(status, message) {
20164
20164
  };
20165
20165
  if (status === 422 && message === "Requested window extends beyond the safe retained log window")
20166
20166
  return new DeveloperLogError("logs_retention", status, "Requested time window is outside retained logs");
20167
- if (status === 422 && ["Analysis exceeds 100 pages; reduce the time window", "Analysis exceeds 10000 records; reduce the time window", "Analysis budget exceeded; reduce the time window", "More than 100 groups; narrow query or choose a coarser dimension"].includes(String(message)))
20167
+ if (status === 422 && ["Log query budget exceeded; reduce the time window", "Analysis exceeds 100 pages; reduce the time window", "Analysis exceeds 10000 records; reduce the time window", "Analysis budget exceeded; reduce the time window", "More than 100 groups; narrow query or choose a coarser dimension"].includes(String(message)))
20168
20168
  return new DeveloperLogError("logs_budget_exceeded", status, "Analysis limit exceeded; use metric=count for counts, or narrow the window/dimensions for detailed metrics");
20169
20169
  const [code, detail] = errors[status] ?? ["logs_unavailable", "Log service temporarily unavailable"];
20170
20170
  return new DeveloperLogError(code, status, `${detail} (HTTP ${status})`);
@@ -22566,10 +22566,12 @@ var ServiceCommandHandler = class {
22566
22566
  throw new Error(`Unsupported runtime ${runtime.type} for ${service.id} env ${env.name}`);
22567
22567
  }
22568
22568
  async appendDeployHistory(registry, serviceId, environment, status, message, metadata) {
22569
+ const createdAt = Date.now();
22569
22570
  let lastError;
22570
22571
  for (let attempt = 1; attempt <= 5; attempt += 1) {
22571
22572
  try {
22572
22573
  await registry.appendDeployHistory(serviceId, {
22574
+ createdAt,
22573
22575
  environment,
22574
22576
  status,
22575
22577
  ...message ? { message } : {},
@@ -23417,7 +23419,7 @@ var AccountCommandHandler = class {
23417
23419
  "GET",
23418
23420
  `/accounts/view?${this.buildAccountViewQuery(args)}`
23419
23421
  );
23420
- this.renderAccountView(result.items, args.json);
23422
+ this.renderAccountLookup(result.items, args.json);
23421
23423
  return;
23422
23424
  }
23423
23425
  case "role-list": {
@@ -23821,6 +23823,8 @@ var AccountCommandHandler = class {
23821
23823
  if (args.account) params.set("account", args.account);
23822
23824
  if (args.mobile) params.set("mobile", args.mobile);
23823
23825
  if (args.nickName) params.set("nickName", args.nickName);
23826
+ if (args.app) params.set("app", args.app);
23827
+ if (args.include) params.set("include", args.include);
23824
23828
  return params.toString();
23825
23829
  }
23826
23830
  buildAccountListQuery(args) {
@@ -23897,6 +23901,19 @@ var AccountCommandHandler = class {
23897
23901
  ui.plain(item);
23898
23902
  }
23899
23903
  }
23904
+ renderAccountLookup(items, asJson) {
23905
+ if (asJson) {
23906
+ ui.plain(JSON.stringify(items, null, 2));
23907
+ return;
23908
+ }
23909
+ if (!items.length) {
23910
+ ui.warn("No accounts found in the visible scope.");
23911
+ return;
23912
+ }
23913
+ for (const item of items) {
23914
+ ui.info(item.account.id, { ...item.account, profiles: item.profiles, nickNames: item.nickNames });
23915
+ }
23916
+ }
23900
23917
  renderAccountView(items, asJson) {
23901
23918
  if (asJson) {
23902
23919
  ui.plain(JSON.stringify(items, null, 2));
@@ -26430,7 +26447,8 @@ function parseAccountArgs(tokens) {
26430
26447
  let account2;
26431
26448
  let mobile;
26432
26449
  let nickName;
26433
- let profileId;
26450
+ let app;
26451
+ let include;
26434
26452
  let baseUrl3;
26435
26453
  let json2 = false;
26436
26454
  while (rest.length > 0) {
@@ -26448,6 +26466,13 @@ function parseAccountArgs(tokens) {
26448
26466
  case "--nickName":
26449
26467
  nickName = requireValue5(rest, token);
26450
26468
  break;
26469
+ case "--app":
26470
+ app = parseNamespacedRef(requireValue5(rest, token), { entityLabel: "app ref" }).fullId;
26471
+ break;
26472
+ case "--include":
26473
+ if (requireValue5(rest, token) !== "private") throw new Error("--include must be private");
26474
+ include = "private";
26475
+ break;
26451
26476
  case "--base-url":
26452
26477
  baseUrl3 = requireValue5(rest, token);
26453
26478
  break;
@@ -26465,15 +26490,19 @@ function parseAccountArgs(tokens) {
26465
26490
  const provided = [account2, mobile, nickName].filter(Boolean).length;
26466
26491
  if (provided !== 1) {
26467
26492
  throw new Error(
26468
- "Usage: account view (--account <id> | --mobile <mobile> | --nickname <nickname>) [--base-url <url>] [--json]"
26493
+ "Usage: account view (--account <id> | --mobile <mobile> | --nickname <nickname>) [--app <ns:id>] [--include private] [--base-url <url>] [--json]"
26469
26494
  );
26470
26495
  }
26496
+ if (nickName && !app) throw new Error("Nickname lookup requires --app <ns:id>");
26497
+ if (mobile && include !== "private") throw new Error("Mobile lookup requires --include private");
26471
26498
  return {
26472
26499
  type: "account" /* Account */,
26473
26500
  action,
26474
26501
  account: account2,
26475
26502
  mobile,
26476
26503
  nickName,
26504
+ ...app ? { app } : {},
26505
+ ...include ? { include } : {},
26477
26506
  baseUrl: baseUrl3,
26478
26507
  json: json2
26479
26508
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.49.7",
3
+ "version": "0.50.1",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {