@indigoai-us/hq-cli 5.345.212 → 5.345.215-beta.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 (161) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/bin/hq-auth-refresh.js +2 -1
  3. package/dist/command-catalog.generated.d.ts +442 -50
  4. package/dist/command-catalog.generated.js +541 -50
  5. package/dist/commands/agent-inbox.d.ts +11 -1
  6. package/dist/commands/agent-inbox.js +128 -38
  7. package/dist/commands/agent-kit.js +2 -2
  8. package/dist/commands/agents.d.ts +51 -1
  9. package/dist/commands/agents.js +154 -2
  10. package/dist/commands/bot-jobs.d.ts +2 -15
  11. package/dist/commands/bot-jobs.js +2 -94
  12. package/dist/commands/bot-runtime.d.ts +46 -5
  13. package/dist/commands/bot-runtime.js +228 -18
  14. package/dist/commands/bot.d.ts +16 -9
  15. package/dist/commands/bot.js +169 -51
  16. package/dist/commands/cloud.d.ts +66 -13
  17. package/dist/commands/cloud.js +120 -39
  18. package/dist/commands/company-restore.d.ts +23 -0
  19. package/dist/commands/company-restore.js +128 -0
  20. package/dist/commands/company.js +2 -0
  21. package/dist/commands/core-handoff.js +1 -0
  22. package/dist/commands/core-hq-session-native.js +2 -2
  23. package/dist/commands/core-pin-native.js +1 -1
  24. package/dist/commands/core-policy.js +1 -1
  25. package/dist/commands/core-resolve-company-native.js +1 -1
  26. package/dist/commands/core-sentry-report-fast.d.ts +2 -0
  27. package/dist/commands/core-sentry-report-fast.js +3 -1
  28. package/dist/commands/daemon.js +11 -1
  29. package/dist/commands/integrations-connect.d.ts +17 -4
  30. package/dist/commands/integrations-connect.js +224 -26
  31. package/dist/commands/lanes-link.js +10 -5
  32. package/dist/commands/lanes.js +26 -9
  33. package/dist/commands/rescue.js +13 -0
  34. package/dist/commands/secrets.d.ts +11 -0
  35. package/dist/commands/secrets.js +41 -7
  36. package/dist/commands/sources.js +6 -0
  37. package/dist/commands/storage-offload.d.ts +12 -0
  38. package/dist/commands/storage-offload.js +41 -3
  39. package/dist/commands/sync-mode.js +5 -0
  40. package/dist/commands/whoami.js +4 -0
  41. package/dist/index.js +2 -0
  42. package/dist/lazy-commands.js +2 -0
  43. package/dist/lib/agent-kit/inbox-fetch.d.ts +122 -1
  44. package/dist/lib/agent-kit/inbox-fetch.js +215 -3
  45. package/dist/lib/agent-kit/inbox-redact.js +1 -1
  46. package/dist/lib/agent-kit/inbox-state.d.ts +98 -1
  47. package/dist/lib/agent-kit/inbox-state.js +261 -4
  48. package/dist/lib/agent-kit/mcp/tools.d.ts +3 -3
  49. package/dist/lib/agent-kit/mcp/tools.js +68 -25
  50. package/dist/lib/agent-kit/run/inbox.js +4 -2
  51. package/dist/lib/agent-kit/skills.js +4 -1
  52. package/dist/lib/agent-kit/wake.d.ts +9 -1
  53. package/dist/lib/agent-kit/wake.js +10 -3
  54. package/dist/lib/bot/config.d.ts +1 -0
  55. package/dist/lib/bot/config.js +10 -0
  56. package/dist/lib/bot/eventbridge-cron.d.ts +22 -0
  57. package/dist/lib/bot/eventbridge-cron.js +104 -0
  58. package/dist/lib/bot/fleet-cron.js +193 -14
  59. package/dist/lib/bot/fleet-download.d.ts +2 -0
  60. package/dist/lib/bot/fleet-download.js +23 -0
  61. package/dist/lib/bot/fleet-local.d.ts +34 -1
  62. package/dist/lib/bot/fleet-local.js +254 -37
  63. package/dist/lib/bot/fleet-python.d.ts +3 -0
  64. package/dist/lib/bot/fleet-python.js +34 -4
  65. package/dist/lib/bot/fleet-runtime-sources.d.ts +15 -0
  66. package/dist/lib/bot/fleet-runtime-sources.js +30 -0
  67. package/dist/lib/bot/legacy-provider-login.d.ts +8 -0
  68. package/dist/lib/bot/legacy-provider-login.js +19 -2
  69. package/dist/lib/bot/prompt.js +1 -1
  70. package/dist/lib/bot/readiness.d.ts +8 -0
  71. package/dist/lib/bot/readiness.js +17 -3
  72. package/dist/lib/bot/runtime-auth.d.ts +30 -0
  73. package/dist/lib/bot/runtime-auth.js +94 -3
  74. package/dist/lib/bot/status.d.ts +2 -0
  75. package/dist/lib/capacity/collectors/grok-refresh.d.ts +80 -0
  76. package/dist/lib/capacity/collectors/grok-refresh.js +189 -0
  77. package/dist/lib/capacity/collectors/grok.d.ts +5 -0
  78. package/dist/lib/capacity/collectors/grok.js +56 -5
  79. package/dist/lib/core-utils/session-id.d.ts +1 -1
  80. package/dist/lib/core-utils/session-id.js +4 -0
  81. package/dist/lib/daemon/catalog.js +11 -1
  82. package/dist/lib/daemon/run.js +9 -1
  83. package/dist/lib/daemon/updater.d.ts +34 -2
  84. package/dist/lib/daemon/updater.js +51 -2
  85. package/dist/lib/db/sqlite-binding.d.ts +1 -0
  86. package/dist/lib/db/sqlite-binding.js +1 -1
  87. package/dist/lib/delivery/artifacts.d.ts +99 -0
  88. package/dist/lib/delivery/artifacts.js +548 -0
  89. package/dist/lib/delivery/backup.d.ts +78 -0
  90. package/dist/lib/delivery/backup.js +343 -0
  91. package/dist/lib/delivery/cache.d.ts +29 -0
  92. package/dist/lib/delivery/cache.js +33 -0
  93. package/dist/lib/delivery/contracts.d.ts +142 -0
  94. package/dist/lib/delivery/contracts.js +289 -0
  95. package/dist/lib/delivery/credentials.d.ts +54 -0
  96. package/dist/lib/delivery/credentials.js +119 -0
  97. package/dist/lib/delivery/enrollment.d.ts +142 -0
  98. package/dist/lib/delivery/enrollment.js +382 -0
  99. package/dist/lib/delivery/identity.d.ts +25 -0
  100. package/dist/lib/delivery/identity.js +82 -0
  101. package/dist/lib/delivery/inbox.d.ts +116 -0
  102. package/dist/lib/delivery/inbox.js +260 -0
  103. package/dist/lib/delivery/migrations.d.ts +139 -0
  104. package/dist/lib/delivery/migrations.js +623 -0
  105. package/dist/lib/delivery/mqtt-adapter.d.ts +50 -0
  106. package/dist/lib/delivery/mqtt-adapter.js +242 -0
  107. package/dist/lib/delivery/mqtt.d.ts +61 -0
  108. package/dist/lib/delivery/mqtt.js +112 -0
  109. package/dist/lib/delivery/outbox.d.ts +95 -0
  110. package/dist/lib/delivery/outbox.js +187 -0
  111. package/dist/lib/delivery/provenance.d.ts +129 -0
  112. package/dist/lib/delivery/provenance.js +93 -0
  113. package/dist/lib/delivery/reconciler.d.ts +151 -0
  114. package/dist/lib/delivery/reconciler.js +492 -0
  115. package/dist/lib/delivery/restore.d.ts +35 -0
  116. package/dist/lib/delivery/restore.js +134 -0
  117. package/dist/lib/delivery/store.d.ts +161 -0
  118. package/dist/lib/delivery/store.js +940 -0
  119. package/dist/lib/delivery/workers/macos-job-helper.d.ts +103 -0
  120. package/dist/lib/delivery/workers/macos-job-helper.js +927 -0
  121. package/dist/lib/delivery/workers/macos.d.ts +176 -0
  122. package/dist/lib/delivery/workers/macos.js +901 -0
  123. package/dist/lib/delivery/workers/windows-boundary.d.ts +453 -0
  124. package/dist/lib/delivery/workers/windows-boundary.js +693 -0
  125. package/dist/lib/delivery/workers/windows-job-helper.d.ts +35 -0
  126. package/dist/lib/delivery/workers/windows-job-helper.js +264 -0
  127. package/dist/lib/delivery/workers/windows.d.ts +241 -0
  128. package/dist/lib/delivery/workers/windows.js +608 -0
  129. package/dist/lib/doctor/checks/release-links.d.ts +50 -8
  130. package/dist/lib/doctor/checks/release-links.js +260 -24
  131. package/dist/lib/doctor/fix/apply.js +24 -8
  132. package/dist/lib/doctor/fix/remediation.js +15 -5
  133. package/dist/lib/install/provider-wrappers.d.ts +2 -0
  134. package/dist/lib/install/provider-wrappers.js +68 -3
  135. package/dist/lib/lanes/autopilot-registry.d.ts +14 -0
  136. package/dist/lib/lanes/autopilot-registry.js +59 -7
  137. package/dist/lib/lanes/links.d.ts +14 -0
  138. package/dist/lib/lanes/links.js +320 -25
  139. package/dist/lib/lanes/outpost-pruner-install.d.ts +10 -0
  140. package/dist/lib/lanes/outpost-pruner-install.js +4 -3
  141. package/dist/main.js +3 -1
  142. package/dist/sentry-init.d.ts +2 -0
  143. package/dist/sentry-init.js +13 -2
  144. package/dist/sentry.d.ts +2 -0
  145. package/dist/sentry.js +5 -1
  146. package/dist/utils/cli-network-lifecycle.d.ts +9 -0
  147. package/dist/utils/cli-network-lifecycle.js +52 -0
  148. package/dist/utils/cognito-callback-port.d.ts +14 -0
  149. package/dist/utils/cognito-callback-port.js +24 -0
  150. package/dist/utils/cognito-session.js +3 -3
  151. package/dist/utils/deleted-company-notice.d.ts +59 -0
  152. package/dist/utils/deleted-company-notice.js +156 -0
  153. package/dist/utils/login-browser.d.ts +1 -1
  154. package/dist/utils/login-browser.js +7 -5
  155. package/dist/utils/resident-package-preload.js +30 -15
  156. package/dist/utils/safe-link.d.ts +63 -0
  157. package/dist/utils/safe-link.js +246 -0
  158. package/dist/utils/sentry-keepalive-transport.d.ts +28 -0
  159. package/dist/utils/sentry-keepalive-transport.js +70 -0
  160. package/dist/utils/vault-api.js +7 -0
  161. package/package.json +7 -7
@@ -306,4 +306,250 @@ function assertStillLink(linkPath) {
306
306
  throw new Error(`Refusing to remove ${linkPath}: it is no longer a link.`);
307
307
  }
308
308
  }
309
+ // ---------------------------------------------------------------------------
310
+ // Copies made in place of a release-shipped directory link
311
+ //
312
+ // On some Windows machines a junction a standard user creates is written with
313
+ // the right target but cannot be listed through by anyone (Beaker, Windows 11
314
+ // build 26300, hq-core-staging PR 1883). HQ then removes the junction and
315
+ // copies the target folder in its place. The copy carries a `.hq-link-copy`
316
+ // marker with the same fields as a skill copy's marker (source, entry name,
317
+ // hash of the copied files), so `hq doctor` can tell an HQ copy from a folder
318
+ // the user made, tell whether the user changed it, and tell whether its source
319
+ // moved on since the copy was made.
320
+ // ---------------------------------------------------------------------------
321
+ /** Marker file written into a folder HQ copied in place of a release link. */
322
+ export const LINK_COPY_MARKER = '.hq-link-copy';
323
+ function isUnderReal(rootReal, candidate) {
324
+ const base = rootReal.endsWith(path.sep) ? rootReal.slice(0, -1) : rootReal;
325
+ return candidate === base || candidate.startsWith(base + path.sep);
326
+ }
327
+ /**
328
+ * Walk `root` in sorted order the way a link copy reads it: links are followed
329
+ * only when their real path is under `within`, a link back to a folder on the
330
+ * current path (a loop) is skipped, and the top-level marker is ignored.
331
+ * Entries that are neither files nor folders are skipped.
332
+ */
333
+ function walkLinkCopyTree(root, within, visit, linksAsEntries = false) {
334
+ const ancestors = new Set([fs.realpathSync.native(root)]);
335
+ const walk = (rel) => {
336
+ const abs = rel === '' ? root : path.join(root, rel);
337
+ for (const name of fs.readdirSync(abs).sort()) {
338
+ if (rel === '' && name === LINK_COPY_MARKER)
339
+ continue;
340
+ const childRel = rel === '' ? name : `${rel}/${name}`;
341
+ const child = path.join(abs, name);
342
+ const lst = fs.lstatSync(child);
343
+ let st = lst;
344
+ if (lst.isSymbolicLink() && linksAsEntries) {
345
+ visit({ kind: 'link', rel: childRel, abs: child });
346
+ continue;
347
+ }
348
+ if (lst.isSymbolicLink()) {
349
+ let real;
350
+ try {
351
+ real = fs.realpathSync.native(child);
352
+ }
353
+ catch {
354
+ continue; // A dangling link has nothing to copy.
355
+ }
356
+ if (!isUnderReal(within, real)) {
357
+ visit({ kind: 'outside', rel: childRel, abs: child });
358
+ continue;
359
+ }
360
+ st = fs.statSync(child);
361
+ }
362
+ if (st.isDirectory()) {
363
+ const real = fs.realpathSync.native(child);
364
+ if (ancestors.has(real))
365
+ continue;
366
+ visit({ kind: 'dir', rel: childRel, abs: child });
367
+ ancestors.add(real);
368
+ try {
369
+ walk(childRel);
370
+ }
371
+ finally {
372
+ ancestors.delete(real);
373
+ }
374
+ }
375
+ else if (st.isFile()) {
376
+ visit({ kind: 'file', rel: childRel, abs: child });
377
+ }
378
+ }
379
+ };
380
+ walk('');
381
+ }
382
+ /**
383
+ * A sha256 over the names and contents of what a link copy of `dir` holds,
384
+ * read with the same rules as the copy (see {@link walkLinkCopyTree}). Hashing
385
+ * the copy and hashing its source give the same value while they match.
386
+ */
387
+ export function linkCopyTreeHash(dir, within) {
388
+ const hash = crypto.createHash('sha256');
389
+ walkLinkCopyTree(dir, within, (entry) => {
390
+ if (entry.kind === 'dir')
391
+ hash.update(`d:${entry.rel}\0`);
392
+ else if (entry.kind === 'file') {
393
+ const content = crypto.createHash('sha256').update(fs.readFileSync(entry.abs)).digest('hex');
394
+ hash.update(`f:${entry.rel}\0${content}\0`);
395
+ }
396
+ });
397
+ return hash.digest('hex');
398
+ }
399
+ /**
400
+ * The hash of an HQ link copy as it sits on disk. HQ copies never contain
401
+ * links (links in the source are copied as real files and folders, or left
402
+ * out), so any link inside the copy is something the user added: it is hashed
403
+ * by its text and never followed. For a copy without links this equals
404
+ * {@link linkCopyTreeHash} of the copy.
405
+ */
406
+ export function linkCopyContentHash(dir, within) {
407
+ const hash = crypto.createHash('sha256');
408
+ walkLinkCopyTree(dir, within, (entry) => {
409
+ if (entry.kind === 'dir')
410
+ hash.update(`d:${entry.rel}\0`);
411
+ else if (entry.kind === 'file') {
412
+ const content = crypto.createHash('sha256').update(fs.readFileSync(entry.abs)).digest('hex');
413
+ hash.update(`f:${entry.rel}\0${content}\0`);
414
+ }
415
+ else if (entry.kind === 'link') {
416
+ hash.update(`l:${entry.rel}\0${fs.readlinkSync(entry.abs)}\0`);
417
+ }
418
+ }, true);
419
+ return hash.digest('hex');
420
+ }
421
+ /**
422
+ * The marker of a folder HQ copied in place of a release link, or null when
423
+ * `p` is not a real folder carrying a valid marker.
424
+ */
425
+ export function readLinkCopyMarker(p) {
426
+ try {
427
+ if (!fs.lstatSync(p).isDirectory())
428
+ return null;
429
+ const parsed = JSON.parse(fs.readFileSync(path.join(p, LINK_COPY_MARKER), 'utf-8'));
430
+ if (typeof parsed.source !== 'string' || parsed.source.length === 0)
431
+ return null;
432
+ if (typeof parsed.name !== 'string' || typeof parsed.hash !== 'string')
433
+ return null;
434
+ return {
435
+ source: parsed.source,
436
+ name: parsed.name,
437
+ hash: parsed.hash,
438
+ reason: typeof parsed.reason === 'string' ? parsed.reason : undefined,
439
+ };
440
+ }
441
+ catch {
442
+ return null;
443
+ }
444
+ }
445
+ function copyIntoNewFolder(source, dest, opts, name) {
446
+ const sourceReal = fs.realpathSync.native(source);
447
+ if (!isUnderReal(opts.within, sourceReal)) {
448
+ throw new Error(`Refusing to copy ${source}: it resolves outside ${opts.within}.`);
449
+ }
450
+ const skippedOutside = [];
451
+ let created = false;
452
+ try {
453
+ fs.mkdirSync(dest);
454
+ created = true;
455
+ walkLinkCopyTree(source, opts.within, (entry) => {
456
+ const to = path.join(dest, ...entry.rel.split('/'));
457
+ if (entry.kind === 'outside')
458
+ skippedOutside.push(entry.rel);
459
+ else if (entry.kind === 'dir')
460
+ fs.mkdirSync(to);
461
+ else if (entry.kind === 'file')
462
+ fs.copyFileSync(entry.abs, to, fs.constants.COPYFILE_EXCL);
463
+ });
464
+ const hash = linkCopyContentHash(dest, opts.within);
465
+ const marker = { source, name, hash, ...(opts.reason ? { reason: opts.reason } : {}) };
466
+ fs.writeFileSync(path.join(dest, LINK_COPY_MARKER), `${JSON.stringify(marker)}\n`);
467
+ return { hash, skippedOutside };
468
+ }
469
+ catch (err) {
470
+ // Remove the partial copy, but only when this call created the folder.
471
+ if (created) {
472
+ try {
473
+ removeTreeNoFollow(dest);
474
+ }
475
+ catch { /* report the copy error */ }
476
+ }
477
+ throw err;
478
+ }
479
+ }
480
+ /**
481
+ * Copy the folder `source` to the new path `dest` and mark it as a link copy.
482
+ * `source` must resolve under `opts.within` (the HQ root). A link inside the
483
+ * source is followed only when it resolves under `opts.within`; one that
484
+ * resolves outside is left out and listed in `skippedOutside`. A partial copy
485
+ * is removed when the copy fails.
486
+ */
487
+ export function copyFolderForLink(source, dest, opts) {
488
+ return copyIntoNewFolder(source, dest, opts, path.basename(dest));
489
+ }
490
+ /**
491
+ * Replace the marked link copy at `dest` with a fresh copy of `source`. The
492
+ * new copy is made beside it first, so a failed copy leaves the old copy in
493
+ * place. The old copy is then renamed aside, the new one renamed into place,
494
+ * and only then is the old one deleted; if the second rename fails the old
495
+ * copy is renamed back. A failure at any step leaves a complete, marked copy
496
+ * at `dest`. Refuses a folder without a link-copy marker. The caller decides
497
+ * whether the old copy holds user changes (compare
498
+ * {@link linkCopyContentHash} with the marker's hash) before calling this.
499
+ */
500
+ export function refreshLinkCopy(source, dest, opts) {
501
+ if (readLinkCopyMarker(dest) === null) {
502
+ throw new Error(`Refusing to refresh ${dest}: it is not a copy made by HQ.`);
503
+ }
504
+ // Fixed names reserved for HQ, so a leftover from an interrupted run is
505
+ // found and cleared by the next one.
506
+ const staging = `${dest}.hq-link-refresh`;
507
+ const old = `${dest}.hq-link-old`;
508
+ for (const leftover of [staging, old]) {
509
+ if (fs.existsSync(leftover) || isLinkPath(leftover))
510
+ removeEntryNoFollow(leftover);
511
+ }
512
+ const result = copyIntoNewFolder(source, staging, opts, path.basename(dest));
513
+ try {
514
+ fs.renameSync(dest, old);
515
+ }
516
+ catch (err) {
517
+ try {
518
+ removeTreeNoFollow(staging);
519
+ }
520
+ catch { /* report the swap error */ }
521
+ throw err;
522
+ }
523
+ try {
524
+ fs.renameSync(staging, dest);
525
+ }
526
+ catch (err) {
527
+ try {
528
+ fs.renameSync(old, dest);
529
+ }
530
+ catch {
531
+ /* the old copy stays at `old`; report the swap error */
532
+ }
533
+ try {
534
+ removeTreeNoFollow(staging);
535
+ }
536
+ catch { /* report the swap error */ }
537
+ throw err;
538
+ }
539
+ try {
540
+ removeTreeNoFollow(old);
541
+ }
542
+ catch {
543
+ // The fresh copy is in place; the next refresh clears the leftover.
544
+ }
545
+ return result;
546
+ }
547
+ function isLinkPath(p) {
548
+ try {
549
+ return fs.lstatSync(p).isSymbolicLink();
550
+ }
551
+ catch {
552
+ return false;
553
+ }
554
+ }
309
555
  //# sourceMappingURL=safe-link.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * One shared keep-alive agent for the Sentry transport.
3
+ *
4
+ * `@sentry/node-core`'s default transport builds an agent with
5
+ * `keepAlive: false` and `maxSockets: 30`, so every envelope is a new TCP
6
+ * connection that this process closes, leaving a TIME_WAIT behind. This
7
+ * module reuses one connection per process and caps it at a few sockets.
8
+ *
9
+ * No static network import: fast native entries reach the Sentry setup, and
10
+ * their closure guard (node-network-compat-closure.test.ts) rejects one. The
11
+ * built-in modules are loaded on the first request.
12
+ */
13
+ import type { Agent, ClientRequest, IncomingMessage, RequestOptions } from "node:http";
14
+ type Protocol = "http:" | "https:";
15
+ /** At most this many sockets to Sentry ingest at once, per process. */
16
+ export declare const SENTRY_MAX_SOCKETS = 2;
17
+ /** An idle or stalled Sentry socket is closed after this long. */
18
+ export declare const SENTRY_SOCKET_TIMEOUT_MS = 2000;
19
+ /** The shared agent for one protocol, created on first use. */
20
+ export declare function sentryTransportAgent(protocol?: Protocol): Agent;
21
+ /** `transportOptions.httpModule` for the Sentry Node transport. */
22
+ export declare const sentryHttpModule: {
23
+ request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
24
+ };
25
+ /** Close the shared sockets at the end of a run. A later send opens a new agent. */
26
+ export declare function closeSentryTransportAgents(): void;
27
+ export {};
28
+ //# sourceMappingURL=sentry-keepalive-transport.d.ts.map
@@ -0,0 +1,70 @@
1
+ /**
2
+ * One shared keep-alive agent for the Sentry transport.
3
+ *
4
+ * `@sentry/node-core`'s default transport builds an agent with
5
+ * `keepAlive: false` and `maxSockets: 30`, so every envelope is a new TCP
6
+ * connection that this process closes, leaving a TIME_WAIT behind. This
7
+ * module reuses one connection per process and caps it at a few sockets.
8
+ *
9
+ * No static network import: fast native entries reach the Sentry setup, and
10
+ * their closure guard (node-network-compat-closure.test.ts) rejects one. The
11
+ * built-in modules are loaded on the first request.
12
+ */
13
+ import { createRequire } from "node:module";
14
+ const requireBuiltin = createRequire(import.meta.url);
15
+ /** At most this many sockets to Sentry ingest at once, per process. */
16
+ export const SENTRY_MAX_SOCKETS = 2;
17
+ /** An idle or stalled Sentry socket is closed after this long. */
18
+ export const SENTRY_SOCKET_TIMEOUT_MS = 2_000;
19
+ const agents = new Map();
20
+ function builtin(protocol) {
21
+ return requireBuiltin(protocol === "http:" ? "node:http" : "node:https");
22
+ }
23
+ /** The shared agent for one protocol, created on first use. */
24
+ export function sentryTransportAgent(protocol = "https:") {
25
+ let agent = agents.get(protocol);
26
+ if (!agent) {
27
+ agent = new (builtin(protocol).Agent)({
28
+ keepAlive: true,
29
+ keepAliveMsecs: 1_000,
30
+ maxSockets: SENTRY_MAX_SOCKETS,
31
+ maxFreeSockets: 1,
32
+ timeout: SENTRY_SOCKET_TIMEOUT_MS,
33
+ });
34
+ agents.set(protocol, agent);
35
+ }
36
+ return agent;
37
+ }
38
+ /**
39
+ * The SDK passes its own plain agent with every request. A proxy agent is a
40
+ * subclass; keep it so proxied installs still reach Sentry.
41
+ */
42
+ function isSdkPlainAgent(agent) {
43
+ if (agent === undefined || agent === null)
44
+ return true;
45
+ if (typeof agent !== "object")
46
+ return false;
47
+ const ctor = agent.constructor;
48
+ return ctor === builtin("http:").Agent || ctor === builtin("https:").Agent;
49
+ }
50
+ /** `transportOptions.httpModule` for the Sentry Node transport. */
51
+ export const sentryHttpModule = {
52
+ request(options, callback) {
53
+ if (typeof options === "string" || options instanceof URL) {
54
+ const protocol = new URL(String(options)).protocol === "http:" ? "http:" : "https:";
55
+ return builtin(protocol).request(options, { agent: sentryTransportAgent(protocol) }, callback);
56
+ }
57
+ const protocol = options.protocol === "http:" ? "http:" : "https:";
58
+ const request = isSdkPlainAgent(options.agent)
59
+ ? { ...options, agent: sentryTransportAgent(protocol) }
60
+ : options;
61
+ return builtin(protocol).request(request, callback);
62
+ },
63
+ };
64
+ /** Close the shared sockets at the end of a run. A later send opens a new agent. */
65
+ export function closeSentryTransportAgents() {
66
+ for (const agent of agents.values())
67
+ agent.destroy();
68
+ agents.clear();
69
+ }
70
+ //# sourceMappingURL=sentry-keepalive-transport.js.map
@@ -658,6 +658,13 @@ async function resolveCompanyFromMemberships(token, baseUrl) {
658
658
  const data = (await res.json());
659
659
  const active = data.memberships.filter((m) => m.status === 'active');
660
660
  if (active.length === 0) {
661
+ // The person's company may have been deleted: say so before the error.
662
+ // Reuses this response, so no second request is made. Loaded on use:
663
+ // the notice module imports this one, and a failed load must not replace
664
+ // the error below.
665
+ await import('./deleted-company-notice.js')
666
+ .then(({ printDeletedCompanyNotices }) => printDeletedCompanyNotices({ entries: data.deletedCompanies }))
667
+ .catch(() => undefined);
661
668
  throw new CompanySelectionError('No active company memberships found. Use --company <slug> to specify.');
662
669
  }
663
670
  if (active.length === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.212",
3
+ "version": "5.345.215-beta.0",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -117,11 +117,11 @@
117
117
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
118
118
  },
119
119
  "optionalDependencies": {
120
- "@indigoai-us/hq-hook-win32-x64": "5.345.212",
121
- "@indigoai-us/hq-hook-win32-arm64": "5.345.212",
122
- "@indigoai-us/hq-hook-darwin-x64": "5.345.212",
123
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.212",
124
- "@indigoai-us/hq-hook-linux-x64": "5.345.212",
125
- "@indigoai-us/hq-hook-linux-arm64": "5.345.212"
120
+ "@indigoai-us/hq-hook-win32-x64": "5.345.215-beta.0",
121
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.215-beta.0",
122
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.215-beta.0",
123
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.215-beta.0",
124
+ "@indigoai-us/hq-hook-linux-x64": "5.345.215-beta.0",
125
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.215-beta.0"
126
126
  }
127
127
  }