@indigoai-us/hq-cli 5.345.135 → 5.345.137

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 (63) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/assets/scaffold/core/scripts/worktree-gc.sh +98 -8
  3. package/dist/command-catalog.generated.d.ts +17 -6
  4. package/dist/command-catalog.generated.js +23 -7
  5. package/dist/commands/core-checkpoint-native.d.ts +10 -0
  6. package/dist/commands/core-checkpoint-native.js +60 -15
  7. package/dist/commands/daemon.js +3 -1
  8. package/dist/commands/integrations-core.d.ts +22 -0
  9. package/dist/commands/integrations-core.js +25 -0
  10. package/dist/commands/integrations-manage.d.ts +24 -1
  11. package/dist/commands/integrations-manage.js +92 -17
  12. package/dist/commands/integrations.d.ts +11 -0
  13. package/dist/commands/integrations.js +100 -19
  14. package/dist/commands/lanes-loop.d.ts +9 -0
  15. package/dist/commands/lanes-loop.js +9 -1
  16. package/dist/commands/lanes.js +69 -54
  17. package/dist/commands/meetings.d.ts +2 -0
  18. package/dist/commands/meetings.js +57 -14
  19. package/dist/commands/mesh.d.ts +19 -1
  20. package/dist/commands/mesh.js +158 -70
  21. package/dist/commands/reindex.js +80 -5
  22. package/dist/commands/storage-offload.d.ts +93 -28
  23. package/dist/commands/storage-offload.js +290 -34
  24. package/dist/commands/storage.js +60 -7
  25. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +2550 -1748
  26. package/dist/hq-cloud-sync-runner/package.json +1 -1
  27. package/dist/index.js +4 -0
  28. package/dist/lib/capacity/route.js +24 -0
  29. package/dist/lib/core-utils/session-company.d.ts +11 -0
  30. package/dist/lib/core-utils/session-company.js +34 -0
  31. package/dist/lib/core-utils/worktree-resume.js +44 -4
  32. package/dist/lib/core-utils/worktree-session-owner.d.ts +27 -0
  33. package/dist/lib/core-utils/worktree-session-owner.js +157 -0
  34. package/dist/lib/daemon/catalog.d.ts +2 -0
  35. package/dist/lib/daemon/catalog.js +3 -3
  36. package/dist/lib/daemon/hq-child-bootstrap-stage.d.ts +5 -0
  37. package/dist/lib/daemon/hq-child-bootstrap-stage.js +3 -11
  38. package/dist/lib/daemon/server.js +10 -1
  39. package/dist/lib/daemon/supervisor.js +6 -0
  40. package/dist/lib/daemon/sync-runner-bundle.d.ts +5 -0
  41. package/dist/lib/daemon/sync-runner-bundle.js +4 -12
  42. package/dist/lib/doctor/checks/claude-wiring.js +2 -1
  43. package/dist/lib/doctor/fix/apply.d.ts +20 -0
  44. package/dist/lib/doctor/fix/apply.js +63 -3
  45. package/dist/lib/doctor/fix/remediation.d.ts +1 -1
  46. package/dist/lib/doctor/fix/remediation.js +16 -0
  47. package/dist/lib/doctor/shared.d.ts +11 -1
  48. package/dist/lib/doctor/shared.js +16 -2
  49. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  50. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  51. package/dist/lib/lanes/monitor.js +14 -2
  52. package/dist/lib/mesh/live/daemon/install.d.ts +12 -0
  53. package/dist/lib/mesh/live/daemon/install.js +22 -0
  54. package/dist/lib/mesh/live/flush.js +106 -3
  55. package/dist/lib/mesh/live/session-events-client.d.ts +9 -0
  56. package/dist/lib/mesh/live/session-events-client.js +15 -0
  57. package/dist/lib/work-context/state.d.ts +10 -0
  58. package/dist/lib/work-context/state.js +5 -0
  59. package/dist/utils/fsync-directory.d.ts +17 -0
  60. package/dist/utils/fsync-directory.js +27 -0
  61. package/dist/utils/windows-hide-default.d.ts +42 -0
  62. package/dist/utils/windows-hide-default.js +98 -0
  63. package/package.json +2 -2
@@ -41,6 +41,7 @@ import { execFile } from "node:child_process";
41
41
  import { dropExpiredBackups, reclaimFields, reclaimWindowHours, runCoreScript, } from "./storage-core.js";
42
42
  import { S3Client, ListObjectVersionsCommand, DeleteObjectsCommand, } from "@aws-sdk/client-s3";
43
43
  import { PERSONAL_VAULT_EXCLUDED_TOP_LEVEL, VaultClient } from "@indigoai-us/hq-cloud";
44
+ import * as hqCloud from "@indigoai-us/hq-cloud";
44
45
  import { buildVaultConfig, DEFAULT_COGNITO } from "../utils/cognito-session.js";
45
46
  import { resolveVaultCredential } from "../utils/resolve-vault-credential.js";
46
47
  import { vaultApiFetch } from "../utils/vault-api.js";
@@ -775,7 +776,10 @@ export function formatOffloadStatus(o) {
775
776
  export function formatOffload(r) {
776
777
  const lines = [];
777
778
  const h = r.history;
778
- if (h.refused) {
779
+ if (h.skipped) {
780
+ // History was not part of this run.
781
+ }
782
+ else if (h.refused) {
779
783
  // Core's and the CLI's refusal messages may already say nothing changed;
780
784
  // add that sentence only when the message lacks it.
781
785
  const msg = (h.message ?? "").trim();
@@ -797,7 +801,7 @@ export function formatOffload(r) {
797
801
  else {
798
802
  lines.push(`History: uploaded ${h.uploaded} old version(s), ${formatBytes(h.bytes)}; freed ${formatBytes(h.freed_bytes)}`);
799
803
  }
800
- if (h.available !== false) {
804
+ if (!h.skipped && h.available !== false) {
801
805
  const pending = reclaimLine(h);
802
806
  if (pending)
803
807
  lines.push(` ${pending}`);
@@ -806,16 +810,44 @@ export function formatOffload(r) {
806
810
  lines.push(` ${h.held_by_worktrees.count} more old version(s) (${formatBytes(h.held_by_worktrees.bytes)}) stay: ${names} still uses this history.`);
807
811
  }
808
812
  }
809
- if (r.current.available === false) {
810
- lines.push(`Current files: not available - ${r.current.reason ?? "unknown"}`);
813
+ const c = r.current;
814
+ if (c.skipped) {
815
+ // Current files were not part of this run.
816
+ }
817
+ else if (c.available === false) {
818
+ lines.push(`Current files: not available - ${c.reason ?? "unknown"}`);
811
819
  }
812
820
  else {
813
- lines.push(`Current files: moved ${r.current.offloaded.length}, freed ${formatBytes(r.current.freed_bytes)}`);
821
+ const files = c.files ?? [];
822
+ if (r.dry_run) {
823
+ const todo = files.filter((f) => f.action !== "skip");
824
+ lines.push(`Current files: would offload ${todo.length} of ${files.length}, ${formatBytes(todo.reduce((n, f) => n + f.bytes, 0))}`);
825
+ }
826
+ else {
827
+ lines.push(`Current files: moved ${c.offloaded.length}, freed ${formatBytes(c.freed_bytes)}`);
828
+ }
829
+ for (const f of files)
830
+ lines.push(` ${formatCurrentFile(f)}`);
831
+ if (c.message)
832
+ lines.push(` ${c.message}`);
814
833
  }
815
834
  for (const e of r.errors)
816
835
  lines.push(chalk.red(` ${e}`));
817
836
  return lines.join("\n");
818
837
  }
838
+ const CURRENT_ACTION_LABEL = {
839
+ "point-at-vault": "point at vault",
840
+ upload: "upload",
841
+ skip: "skip",
842
+ };
843
+ /** One `--current` plan line: path, size, owning vault, sync state, action. */
844
+ function formatCurrentFile(f) {
845
+ const vault = f.vault === "company" ? `company ${f.company ?? "?"}` : "personal vault";
846
+ const parts = [f.path, formatBytes(f.bytes), vault, f.synced ? "synced" : "not synced", CURRENT_ACTION_LABEL[f.action]];
847
+ if (f.action === "skip" && f.reason)
848
+ parts.push(`(${f.reason})`);
849
+ return parts.join(" ");
850
+ }
819
851
  /** One line on when backed-up space comes back, or nothing. */
820
852
  export function reclaimLine(r) {
821
853
  const pending = num(r.pending_reclaim_bytes);
@@ -993,6 +1025,7 @@ async function buildOffloadDeps() {
993
1025
  }
994
1026
  return companiesFromMemberships(await res.json());
995
1027
  };
1028
+ const journals = new Map();
996
1029
  return {
997
1030
  hqRoot,
998
1031
  now: () => new Date(),
@@ -1008,6 +1041,25 @@ async function buildOffloadDeps() {
1008
1041
  return personalS3Store({ bucket, region: DEFAULT_COGNITO.region, credentials });
1009
1042
  },
1010
1043
  activeCompanySlugs: async () => (await activeCompanies()).map((c) => c.slug),
1044
+ // Current-file offload replaces a file with a placeholder only when the
1045
+ // installed sync engine holds every `.hqcloud` sibling (no delete, no
1046
+ // download over it). Older engines lack the flag, so this stays false.
1047
+ syncHoldsPlaceholders: () => hqCloud.CLOUD_PLACEHOLDER_HOLDS_ANY_SIBLING === true,
1048
+ // What HQ sync last stored for a file, read from its local journal.
1049
+ // Company journal keys are relative to the company folder; personal keys
1050
+ // are relative to the HQ root. Read-only: offload never writes a journal.
1051
+ syncRecord: async (target) => {
1052
+ const slug = target.vault === "company" ? target.slug : hqCloud.PERSONAL_VAULT_JOURNAL_SLUG;
1053
+ let journal = journals.get(slug);
1054
+ if (!journal) {
1055
+ journal = hqCloud.readJournal(slug);
1056
+ journals.set(slug, journal);
1057
+ }
1058
+ const entry = hqCloud.getEntry(journal, target.key);
1059
+ if (!entry || hqCloud.isTombstone(entry))
1060
+ return null;
1061
+ return { hash: entry.hash, size: entry.size, remoteEtag: entry.remoteEtag };
1062
+ },
1011
1063
  // Read-only, for placeholders that HQ sync rewrote. Company credentials
1012
1064
  // come from the existing membership-scoped /sts/vend path.
1013
1065
  openVaultObjects: async (target) => {
@@ -1169,11 +1221,11 @@ export function registerStorageCommand(program) {
1169
1221
  });
1170
1222
  storage
1171
1223
  .command("offload")
1172
- .description("Move big files to your personal HQ cloud storage and leave links behind (old versions in history; idle current files)")
1224
+ .description("Move big files to HQ cloud storage and leave links behind (old versions in history; with --current, idle working files to the vault that owns them)")
1173
1225
  .option("--min-size <size>", "Only files at least this big, e.g. 50MB (env HQ_OFFLOAD_MIN_BYTES)")
1174
1226
  .option("--idle-days <days>", "Current files must be untouched this many days", String(DEFAULT_IDLE_DAYS))
1175
1227
  .option("--history", "Only old versions in local autosave history")
1176
- .option("--current", "Only idle files in the working tree")
1228
+ .option("--current [paths...]", "Idle working files instead of history; optional HQ paths limit it to those files or folders")
1177
1229
  .option("--dry-run", "Show what would move without uploading or changing anything")
1178
1230
  .option("--yes", "Skip the confirmation prompt")
1179
1231
  .option("--json", "Print JSON")
@@ -1188,6 +1240,7 @@ export function registerStorageCommand(program) {
1188
1240
  idleDays,
1189
1241
  history: Boolean(opts.history),
1190
1242
  current: Boolean(opts.current),
1243
+ paths: Array.isArray(opts.current) ? opts.current : undefined,
1191
1244
  dryRun: Boolean(opts.dryRun),
1192
1245
  yes: Boolean(opts.yes),
1193
1246
  }, await buildOffloadDeps());