@indigoai-us/hq-cli 5.345.257 → 5.345.260

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 (45) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/assets/scaffold/core/scripts/handoff-knowledge-commit.sh +163 -5
  3. package/assets/scaffold/core/scripts/handoff-sync-prefetch.sh +39 -0
  4. package/assets/scaffold/core/scripts/handoff-sync-publish.sh +51 -3
  5. package/contracts/host-canary-release.json +7 -7
  6. package/dist/commands/cloud.d.ts +2 -7
  7. package/dist/commands/cloud.js +6 -30
  8. package/dist/commands/core-bucket-c-handoff-knowledge-native.d.ts +24 -2
  9. package/dist/commands/core-bucket-c-handoff-knowledge-native.js +170 -19
  10. package/dist/commands/core-bucket-c-handoff-sync-native.d.ts +4 -2
  11. package/dist/commands/core-bucket-c-handoff-sync-native.js +153 -34
  12. package/dist/commands/core-bucket-c-handoff-sync-worker.cjs +201 -0
  13. package/dist/commands/core-handoff.js +57 -14
  14. package/dist/commands/keyed-sync-pull.d.ts +7 -3
  15. package/dist/commands/keyed-sync-pull.js +90 -22
  16. package/dist/commands/reindex.d.ts +3 -0
  17. package/dist/commands/reindex.js +11 -5
  18. package/dist/commands/rescue.js +7 -2
  19. package/dist/commands/sync-core.js +24 -7
  20. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +3227 -2138
  21. package/dist/hq-cloud-sync-runner/package.json +1 -1
  22. package/dist/lib/canonical-person.d.ts +19 -0
  23. package/dist/lib/canonical-person.js +30 -0
  24. package/dist/lib/company-sessions-cli.d.ts +12 -0
  25. package/dist/lib/company-sessions-cli.js +54 -0
  26. package/dist/lib/company-sessions.d.ts +31 -0
  27. package/dist/lib/company-sessions.js +304 -0
  28. package/dist/lib/doctor/checks/replay-recorder.js +3 -3
  29. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  30. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  31. package/dist/lib/flag-snapshot-file.d.ts +47 -1
  32. package/dist/lib/flag-snapshot-file.js +143 -20
  33. package/dist/lib/hook-engine/coverage.d.ts +115 -7
  34. package/dist/lib/hook-engine/coverage.js +280 -10
  35. package/dist/lib/mesh/live/company-flag-refresh.js +2 -2
  36. package/dist/lib/onboarding/orchestrator.js +4 -2
  37. package/dist/lib/sync-core/engine-home.d.ts +5 -1
  38. package/dist/lib/sync-core/engine-home.js +6 -2
  39. package/dist/lib/sync-core/reconcile.d.ts +5 -0
  40. package/dist/lib/sync-core/reconcile.js +21 -1
  41. package/dist/lib/sync-core/vault-uid.d.ts +2 -0
  42. package/dist/lib/sync-core/vault-uid.js +4 -0
  43. package/dist/utils/sync-operation-lock.d.ts +2 -1
  44. package/dist/utils/sync-operation-lock.js +13 -2
  45. package/package.json +8 -8
@@ -11,6 +11,8 @@ import { reconcileSyncCore } from "../lib/sync-core/reconcile.js";
11
11
  import { engineOwnedManifestScopes, manifestScopeArg } from "../lib/sync-core/manifest-scopes.js";
12
12
  import { readSyncCoreRolloutState, syncCoreRolloutStatePath } from "../lib/sync-core/rollout-state.js";
13
13
  import { reindexAfterEngineChanges } from "../lib/sync-core/post-apply-reindex.js";
14
+ import { principalFromIdToken, readCachedPersonUid, rememberPersonUid, resolveCompanySessionOptions, signedInPersonPrincipal, withCompanySessions, } from "../lib/company-sessions.js";
15
+ import { runsAsAgent } from "../lib/company-sessions-cli.js";
14
16
  import { readVaultSyncSwitches } from "../lib/vault-sync-switches.js";
15
17
  import { isSyncCoreVaultUid } from "../lib/sync-core/vault-uid.js";
16
18
  import { effectiveEngineSettings, readSyncCoreVaultSettings, setSyncCoreVaultSetting, SyncCoreVaultSettingError, } from "../lib/sync-core/vault-settings.js";
@@ -24,12 +26,20 @@ export async function runPostApplyReindex(hqRoot, vaults, d, log) {
24
26
  vaults,
25
27
  reindex: d.reindex ?? (async (root) => {
26
28
  const { reindex } = await import("@indigoai-us/hq-cloud");
27
- return reindex({
29
+ const agent = runsAsAgent(d.home, d.env);
30
+ const companySessions = await resolveCompanySessionOptions({
31
+ home: d.home,
32
+ hqRoot: root,
33
+ agent,
34
+ principal: signedInPersonPrincipal(d.home, d.env),
35
+ log,
36
+ });
37
+ return reindex(withCompanySessions({
28
38
  repoRoot: root,
29
39
  lockTimeoutSec: 0,
30
40
  sessionLogQuietForMs: SESSION_LOG_CAPTURE_QUIET_FOR_MS,
31
41
  sessionLogMaxStalenessMs: SESSION_LOG_CAPTURE_MAX_STALENESS_MS,
32
- });
42
+ }, companySessions));
33
43
  }),
34
44
  now: d.now,
35
45
  log,
@@ -97,17 +107,24 @@ export async function runSyncCoreReconcile(opts, d = defaultDeps()) {
97
107
  ]);
98
108
  const journal = await loadLegacyJournalReader([currentHqCloud(daemonPaths(d.home, d.env).root), bundledHqCloud()]);
99
109
  const { resolveCanonicalPersonUid } = await import("./cloud.js");
110
+ const principal = machine ? null : principalFromIdToken(token);
100
111
  const result = await reconcileSyncCore({
101
112
  home: d.home,
102
113
  hqRoot,
103
114
  tokenFile,
104
115
  companiesOnly: opts.companiesOnly === true || machine,
105
116
  listMemberships: async () => (await client.listMyMemberships()).map((m) => ({ companyUid: m.companyUid })),
106
- resolvePersonUid: () => resolveCanonicalPersonUid({
107
- listMyMemberships: () => client.listMyMemberships(),
108
- listPersonEntities: () => client.entity.listByType("person"),
109
- getEntity: async () => null,
110
- }),
117
+ resolvePersonUid: async () => {
118
+ const uid = await resolveCanonicalPersonUid({
119
+ listMyMemberships: () => client.listMyMemberships(),
120
+ listPersonEntities: () => client.entity.listByType("person"),
121
+ getEntity: async () => null,
122
+ });
123
+ if (principal)
124
+ rememberPersonUid(d.home, principal, uid);
125
+ return uid;
126
+ },
127
+ ...(principal ? { cachedPersonUid: () => readCachedPersonUid(d.home, principal) } : {}),
111
128
  readRolloutFlag: (companyUid) => readCompanyRolloutFlag(companyUid, token, { env: d.env }),
112
129
  resolveCompany: (companyUid) => client.entity.get(companyUid),
113
130
  ...(journal.reader ? { readLegacyJournal: journal.reader } : { legacyJournalUnavailable: journal.reason }),