@indigoai-us/hq-cli 5.130.0 → 5.132.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +155 -1
  2. package/contracts/preflight/v1/fixtures.json +87 -0
  3. package/contracts/preflight/v1/schema.json +58 -0
  4. package/dist/command-catalog.generated.d.ts +39 -0
  5. package/dist/command-catalog.generated.js +50 -0
  6. package/dist/commands/dm.d.ts +2 -0
  7. package/dist/commands/dm.js +1 -1
  8. package/dist/commands/files.js +137 -9
  9. package/dist/commands/lanes.d.ts +13 -2
  10. package/dist/commands/lanes.js +394 -42
  11. package/dist/commands/mesh.js +66 -13
  12. package/dist/commands/update.js +1 -1
  13. package/dist/lib/bot/paths.d.ts +7 -5
  14. package/dist/lib/bot/paths.js +8 -1
  15. package/dist/lib/bot/prompt.d.ts +0 -2
  16. package/dist/lib/bot/prompt.js +5 -11
  17. package/dist/lib/bot/room-policy.d.ts +1 -24
  18. package/dist/lib/bot/room-policy.js +2 -35
  19. package/dist/lib/bot/run.d.ts +7 -8
  20. package/dist/lib/bot/run.js +21 -33
  21. package/dist/lib/bot/session.d.ts +1 -1
  22. package/dist/lib/bot/session.js +1 -1
  23. package/dist/lib/lanes/accounts.d.ts +6 -0
  24. package/dist/lib/lanes/accounts.js +2 -1
  25. package/dist/lib/lanes/config.d.ts +4 -0
  26. package/dist/lib/lanes/config.js +9 -0
  27. package/dist/lib/lanes/index.d.ts +10 -3
  28. package/dist/lib/lanes/index.js +5 -1
  29. package/dist/lib/lanes/mesh-events.js +4 -0
  30. package/dist/lib/lanes/models.d.ts +78 -0
  31. package/dist/lib/lanes/models.js +205 -0
  32. package/dist/lib/lanes/move-account.d.ts +56 -0
  33. package/dist/lib/lanes/move-account.js +193 -0
  34. package/dist/lib/lanes/provider-rejection.d.ts +86 -0
  35. package/dist/lib/lanes/provider-rejection.js +258 -0
  36. package/dist/lib/lanes/quota.d.ts +17 -0
  37. package/dist/lib/lanes/quota.js +24 -0
  38. package/dist/lib/lanes/reconcile-install.d.ts +24 -3
  39. package/dist/lib/lanes/reconcile-install.js +48 -12
  40. package/dist/lib/lanes/reconcile.js +41 -11
  41. package/dist/lib/lanes/spawn.js +26 -5
  42. package/dist/lib/lanes/store.js +10 -0
  43. package/dist/lib/lanes/types.d.ts +49 -2
  44. package/dist/lib/lanes/types.js +4 -3
  45. package/dist/lib/lanes/watcher.d.ts +27 -0
  46. package/dist/lib/lanes/watcher.js +68 -5
  47. package/dist/lib/mesh/api.d.ts +2 -0
  48. package/dist/lib/mesh/api.js +15 -2
  49. package/dist/lib/mesh/live/backfill-held.d.ts +4 -3
  50. package/dist/lib/mesh/live/backfill-held.js +37 -14
  51. package/dist/lib/mesh/live/daemon/doctor.d.ts +4 -0
  52. package/dist/lib/mesh/live/daemon/doctor.js +15 -4
  53. package/dist/lib/mesh/live/daemon/install.d.ts +5 -0
  54. package/dist/lib/mesh/live/daemon/install.js +84 -1
  55. package/dist/lib/mesh/live/daemon/run.d.ts +5 -0
  56. package/dist/lib/mesh/live/daemon/run.js +17 -4
  57. package/dist/lib/mesh/live/emit-client.d.ts +2 -0
  58. package/dist/lib/mesh/live/emit-client.js +15 -8
  59. package/dist/lib/mesh/live/emit-evidence.d.ts +19 -0
  60. package/dist/lib/mesh/live/emit-evidence.js +20 -2
  61. package/dist/lib/mesh/live/emit.d.ts +9 -0
  62. package/dist/lib/mesh/live/emit.js +28 -2
  63. package/dist/lib/mesh/live/flush.js +9 -3
  64. package/dist/lib/search-index/index.js +22 -3
  65. package/dist/lib/work-context/company.d.ts +16 -0
  66. package/dist/lib/work-context/company.js +46 -14
  67. package/dist/lib/work-context/preflight-contract.d.ts +28 -0
  68. package/dist/lib/work-context/preflight-contract.js +85 -0
  69. package/dist/main.js +11 -1
  70. package/dist/utils/cognito-session.d.ts +39 -0
  71. package/dist/utils/cognito-session.js +119 -3
  72. package/dist/utils/environmental-error.d.ts +18 -0
  73. package/dist/utils/environmental-error.js +240 -7
  74. package/dist/utils/expected-cli-error.d.ts +2 -0
  75. package/dist/utils/expected-cli-error.js +4 -0
  76. package/dist/utils/self-update.js +4 -1
  77. package/dist/utils/vault-api.d.ts +1 -0
  78. package/dist/utils/vault-api.js +11 -3
  79. package/package.json +3 -2
@@ -6,6 +6,8 @@ import { CompanySelectionError } from './company-selection-error.js';
6
6
  import { recordPlanLimitStatus } from '../lib/plan-limit-nag.js';
7
7
  import { networkTransportErrorCode } from './network-transport-error.js';
8
8
  import { planGateErrorFromResponse } from './plan-gate-error.js';
9
+ import { markExpectedUserError } from './expected-cli-error.js';
10
+ import { redactErrorText } from './redact-error-text.js';
9
11
  /**
10
12
  * Identity / company resolution lookups must never hang forever. These small
11
13
  * GETs run BEFORE a command does its real work (e.g. `hq secrets env` resolves
@@ -193,6 +195,7 @@ export async function vaultApiFetch(opts) {
193
195
  // skew on EVERY authenticated request, not only health heartbeats.
194
196
  // Fixed build constant, never caller-supplied; attribution only.
195
197
  'x-hq-client-version': CLI_VERSION,
198
+ ...opts.headers,
196
199
  },
197
200
  body: opts.body ? JSON.stringify(opts.body) : undefined,
198
201
  signal: opts.signal,
@@ -342,6 +345,9 @@ function formatSlugLookupReason(res, body) {
342
345
  return fromStatus;
343
346
  return `HTTP ${res.status}`;
344
347
  }
348
+ function redactedSlugLookupMessage(message) {
349
+ return redactErrorText(message) || 'Company lookup failed.';
350
+ }
345
351
  function isTransientSlugLookupStatus(status) {
346
352
  return status === 408 || status === 425 || status === 429 || status >= 500;
347
353
  }
@@ -475,14 +481,15 @@ async function resolveCompanyUid(token, ref) {
475
481
  // failure — treating it as not-found sent owners to check a slug that
476
482
  // was fine (Shepherd #2306).
477
483
  if (res.status === 404 && mine.kind === "miss") {
478
- throw Object.assign(new Error(`Company slug '${ref}' was not found. Check the slug or run \`hq companies list\`.`), { expected: true });
484
+ throw Object.assign(new Error(redactedSlugLookupMessage(`Company slug '${ref}' was not found. Check the slug or run \`hq companies list\`.`)), { expected: true });
479
485
  }
480
486
  const reason = formatSlugLookupReason(res, body);
481
487
  const retryable = mine.kind === "transient" || isTransientSlugLookupStatus(res.status);
482
488
  const hint = retryable
483
489
  ? " This is a temporary lookup failure, not a missing company. Retry the command."
484
490
  : "";
485
- throw new Error(`Failed to resolve company slug '${ref}': ${reason}.${hint}`);
491
+ const error = new Error(redactedSlugLookupMessage(`Failed to resolve company slug '${ref}': ${reason}.${hint}`));
492
+ throw retryable ? error : markExpectedUserError(error);
486
493
  }
487
494
  const data = (await res.json());
488
495
  return data.entity.uid;
@@ -494,7 +501,8 @@ async function resolveCompanyFromMemberships(token) {
494
501
  signal: AbortSignal.timeout(identityLookupTimeoutMs()),
495
502
  });
496
503
  if (!res.ok) {
497
- throw new Error("Failed to fetch memberships — run `hq login` and try again");
504
+ const error = new Error("Failed to fetch memberships — run `hq login` and try again");
505
+ throw res.status === 401 ? markExpectedUserError(error) : error;
498
506
  }
499
507
  const data = (await res.json());
500
508
  const active = data.memberships.filter((m) => m.status === 'active');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.130.0",
3
+ "version": "5.132.0",
4
4
  "description": "HQ by Indigo management CLI \u2014 modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -17,7 +17,8 @@
17
17
  "assets/lanes-hooks",
18
18
  "templates",
19
19
  "CHANGELOG.md",
20
- "README.md"
20
+ "README.md",
21
+ "contracts"
21
22
  ],
22
23
  "scripts": {
23
24
  "build": "node scripts/generate-dsn.mjs && tsc && node scripts/generate-command-catalog.mjs --check && node scripts/copy-schemas.mjs && node scripts/chmod-bins.mjs",