@indigoai-us/hq-cli 5.345.258 → 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.
- package/CHANGELOG.md +20 -0
- package/assets/scaffold/core/scripts/handoff-knowledge-commit.sh +163 -5
- package/assets/scaffold/core/scripts/handoff-sync-prefetch.sh +39 -0
- package/assets/scaffold/core/scripts/handoff-sync-publish.sh +51 -3
- package/contracts/host-canary-release.json +7 -7
- package/dist/commands/cloud.d.ts +2 -7
- package/dist/commands/cloud.js +2 -29
- package/dist/commands/core-bucket-c-handoff-knowledge-native.d.ts +24 -2
- package/dist/commands/core-bucket-c-handoff-knowledge-native.js +170 -19
- package/dist/commands/core-bucket-c-handoff-sync-native.d.ts +4 -2
- package/dist/commands/core-bucket-c-handoff-sync-native.js +153 -34
- package/dist/commands/core-bucket-c-handoff-sync-worker.cjs +201 -0
- package/dist/commands/core-handoff.js +57 -14
- package/dist/commands/reindex.d.ts +3 -0
- package/dist/commands/reindex.js +11 -5
- package/dist/commands/rescue.js +7 -2
- package/dist/commands/sync-core.js +24 -7
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +3227 -2138
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lib/canonical-person.d.ts +19 -0
- package/dist/lib/canonical-person.js +30 -0
- package/dist/lib/company-sessions-cli.d.ts +12 -0
- package/dist/lib/company-sessions-cli.js +54 -0
- package/dist/lib/company-sessions.d.ts +31 -0
- package/dist/lib/company-sessions.js +304 -0
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/hook-engine/coverage.d.ts +43 -0
- package/dist/lib/hook-engine/coverage.js +127 -0
- package/dist/lib/onboarding/orchestrator.js +4 -2
- package/dist/lib/sync-core/engine-home.d.ts +5 -1
- package/dist/lib/sync-core/engine-home.js +6 -2
- package/dist/lib/sync-core/reconcile.d.ts +5 -0
- package/dist/lib/sync-core/reconcile.js +21 -1
- package/dist/lib/sync-core/vault-uid.d.ts +2 -0
- package/dist/lib/sync-core/vault-uid.js +4 -0
- package/dist/utils/sync-operation-lock.d.ts +2 -1
- package/dist/utils/sync-operation-lock.js +13 -2
- package/package.json +8 -8
|
@@ -168,6 +168,20 @@ export declare function coversKey(key: string): {
|
|
|
168
168
|
export declare function coveredOn(covers: Readonly<Record<string, readonly string[]>> | undefined, event: string, host: CoreNextHost): string[];
|
|
169
169
|
/** The old dispatcher's hooks for `event` on `host` that the engine does not cover. */
|
|
170
170
|
export declare function uncoveredHooks(root: string, host: CoreNextHost, event: string, covers: Readonly<Record<string, readonly string[]>> | undefined, env?: NodeJS.ProcessEnv): string[];
|
|
171
|
+
/**
|
|
172
|
+
* The two script revision sets the native `merged-write-guard-shadow` port rebuilds:
|
|
173
|
+
* legacy (`v16.0.48-beta.109`, constants in `crates/hq-hook/src/merged_write_guard.rs`) and
|
|
174
|
+
* released (`v16.0.49` / `v16.0.50`, constants in `crates/hq-hook/src/merged_write_guard/release_1649.rs`
|
|
175
|
+
* plus `Revision::Beta124` in `crates/hq-hook/src/block_core_writes.rs`).
|
|
176
|
+
*/
|
|
177
|
+
export declare const MERGED_WRITE_GUARD_PINS_LEGACY: ReadonlyArray<readonly [string, string]>;
|
|
178
|
+
export declare const MERGED_WRITE_GUARD_PINS_1649: ReadonlyArray<readonly [string, string]>;
|
|
179
|
+
/**
|
|
180
|
+
* Why `merged-write-guard-shadow` must stay on the shell registration in `root`: the wrapper
|
|
181
|
+
* script is present on disk and either the wrapper or one of its companion scripts does not match
|
|
182
|
+
* the pinned revision set that `crates/hq-hook/src/merged_write_guard.rs` rebuilds.
|
|
183
|
+
*/
|
|
184
|
+
export declare function fleetLocalMergedWriteGuardHold(root: string): string | null;
|
|
171
185
|
/**
|
|
172
186
|
* The script revisions the native SessionStart master rebuilds (hq-core v16.0.48 through v16.0.50,
|
|
173
187
|
* and the hq-core-staging fd709b39a shim and hq-session.sh):
|
|
@@ -200,6 +214,23 @@ export declare const MIGRATE_POLICY_TRIGGERS_PINS: ReadonlyArray<readonly [strin
|
|
|
200
214
|
* does not hold. Null when every present pinned file matches.
|
|
201
215
|
*/
|
|
202
216
|
export declare function migratePolicyTriggersHold(root: string): string | null;
|
|
217
|
+
/**
|
|
218
|
+
* The script revisions the native fleet-local PreToolUse adapter port models (hq-core v16.0.48
|
|
219
|
+
* through v16.0.50): `host::fleet::local_pre::RELEASED_CORE_SHA256` (`hook-adapter-core.sh`)
|
|
220
|
+
* and `host::fleet::inherit_scope::RELEASED_LIB_SHA256` (`session-scope-capability.sh`).
|
|
221
|
+
* `FleetLocalPre` matches the shell adapter when either file is absent (`DISPATCHER_UNAVAILABLE`
|
|
222
|
+
* / skip scope inheritance), and refuses any other revision present on disk.
|
|
223
|
+
* `RELEASED_CORE_SHA256` also accepts the two classifying cores of hq-core-staging #2119. This
|
|
224
|
+
* list accepts only the bd733f7b core, the one the fleet-local parity tests run against, so a
|
|
225
|
+
* root on a classifying core keeps fleet-local PreToolUse on the shell adapter.
|
|
226
|
+
*/
|
|
227
|
+
export declare const FLEET_LOCAL_PRE_TOOL_USE_PINS: readonly PinnedFile[];
|
|
228
|
+
/**
|
|
229
|
+
* Why fleet-local PreToolUse must stay on the shell adapter in `root`: a present file of
|
|
230
|
+
* [`FLEET_LOCAL_PRE_TOOL_USE_PINS`] cannot be read or is not the pinned revision. Uses the shared
|
|
231
|
+
* [`pinnedFilesHold`] helper. Null when every present file matches.
|
|
232
|
+
*/
|
|
233
|
+
export declare function fleetLocalPreToolUseHold(root: string): string | null;
|
|
203
234
|
/**
|
|
204
235
|
* The one Codex adapter pair the native Codex SubagentStop is modelled on (hq-core v16.0.47):
|
|
205
236
|
* `ADAPTER_RELEASES` and `ADAPTER_CORE_RELEASES` in crates/hq-hook/src/post_hooks/codex.rs.
|
|
@@ -304,6 +335,16 @@ export declare const PRE_TOOL_USE_CODEX_ADAPTER_PIN: PinnedFile;
|
|
|
304
335
|
* credential guard holds that file.
|
|
305
336
|
*/
|
|
306
337
|
export declare const PRE_TOOL_USE_VAULT_GUARD_PINS: readonly PinnedFile[];
|
|
338
|
+
/**
|
|
339
|
+
* Claimed PreToolUse hooks whose native member answers in place of the root's script with no port
|
|
340
|
+
* pin of its own, with the script revisions the member answers for: pre_tool_use_master.rs
|
|
341
|
+
* `CLAIMED_SCRIPT_PINS`, where the native PreToolUse refuses any other present revision. The scope
|
|
342
|
+
* authorizer: hq-core v16.0.45 to v16.0.52 and the prereleases core-pins.json lists. hq-core
|
|
343
|
+
* 16.0.53-beta.1 (36312275) adds a PowerShell check the native scope member does not have, so that
|
|
344
|
+
* root stays on the old dispatcher. A missing script is not held: the native PreToolUse refuses a
|
|
345
|
+
* registered safety guard that is missing, as master-hook did.
|
|
346
|
+
*/
|
|
347
|
+
export declare const PRE_TOOL_USE_CLAIMED_SCRIPT_PINS: readonly PinnedFile[];
|
|
307
348
|
/**
|
|
308
349
|
* The credential guard's script revisions, each with the arithmetic library its port follows
|
|
309
350
|
* (ports.rs `HOOK_SCRIPT_SHA256`, `HOOK_COMPANION_SHA256` and `COMPANION_SCRIPT_BINDINGS`): the
|
|
@@ -420,6 +461,8 @@ export declare function stableEngineCommand(command: string, windows: boolean):
|
|
|
420
461
|
* `changed_files_on`, checked by `guard_refusal_in` before any member): missing, not a regular
|
|
421
462
|
* file or another revision, or the credential guard's script and library not a bound pair. The
|
|
422
463
|
* Codex adapter is read on Codex only;
|
|
464
|
+
* - a claimed guard script present at a revision its native member does not answer for
|
|
465
|
+
* (`PRE_TOOL_USE_CLAIMED_SCRIPT_PINS`, pre_tool_use_master.rs `unmodelled_claimed_scripts`);
|
|
423
466
|
* - the policy enforcement gate beside the hook-lib.sh its revision accepts (the injector runs it
|
|
424
467
|
* on Bash calls whatever the registry lists), as for PostToolUse;
|
|
425
468
|
* - the policy-frontmatter evaluator scripts;
|
|
@@ -1748,13 +1748,92 @@ export function uncoveredHooks(root, host, event, covers, env = process.env) {
|
|
|
1748
1748
|
if (hold)
|
|
1749
1749
|
missing.push(`(native SessionStart compatibility: ${hold})`);
|
|
1750
1750
|
}
|
|
1751
|
+
if (host === 'fleet-local' && event === 'PreToolUse' && covered.includes('fleet-local-adapter:PreToolUse')) {
|
|
1752
|
+
const hold = fleetLocalPreToolUseHold(root);
|
|
1753
|
+
if (hold)
|
|
1754
|
+
missing.push(`(native PreToolUse compatibility: ${hold})`);
|
|
1755
|
+
}
|
|
1751
1756
|
if (host === 'agents-v2' && event === 'PreToolUse' && covered.includes('agents-v2-adapter:PreToolUse')) {
|
|
1752
1757
|
const hold = sessionStartHold(root);
|
|
1753
1758
|
if (hold)
|
|
1754
1759
|
missing.push(`(native PreToolUse compatibility: ${hold})`);
|
|
1755
1760
|
}
|
|
1761
|
+
if ((host === 'fleet-local' || host === 'agents-v2')
|
|
1762
|
+
&& event === 'PreToolUse'
|
|
1763
|
+
&& hooks.includes('merged-write-guard-shadow')
|
|
1764
|
+
&& covered.includes('merged-write-guard-shadow')) {
|
|
1765
|
+
const hold = fleetLocalMergedWriteGuardHold(root);
|
|
1766
|
+
if (hold)
|
|
1767
|
+
missing.push(`(native merged-write-guard-shadow compatibility: ${hold})`);
|
|
1768
|
+
}
|
|
1756
1769
|
return missing;
|
|
1757
1770
|
}
|
|
1771
|
+
/**
|
|
1772
|
+
* The two script revision sets the native `merged-write-guard-shadow` port rebuilds:
|
|
1773
|
+
* legacy (`v16.0.48-beta.109`, constants in `crates/hq-hook/src/merged_write_guard.rs`) and
|
|
1774
|
+
* released (`v16.0.49` / `v16.0.50`, constants in `crates/hq-hook/src/merged_write_guard/release_1649.rs`
|
|
1775
|
+
* plus `Revision::Beta124` in `crates/hq-hook/src/block_core_writes.rs`).
|
|
1776
|
+
*/
|
|
1777
|
+
export const MERGED_WRITE_GUARD_PINS_LEGACY = [
|
|
1778
|
+
['.claude/hooks/merged-write-guard-shadow.sh', '63ddff4a40e861d8d922b0701863259a3cedbffaf6d44a94d837865e62cca6ac'],
|
|
1779
|
+
['.claude/hooks/merged-write-guard-shadow.cjs', '225e5c89501ab87965db46e6520c0fd8d08ec5e9745068a2e7324e64f7360884'],
|
|
1780
|
+
['.claude/hooks/block-core-writes.sh', 'e6c14f48c38bd01ed0f2120fd7c18022fd7dd0dac18ed09f2307414a5646932f'],
|
|
1781
|
+
['.claude/hooks/block-core-writes-bash.sh', '1c52342ab3030c1ee5540341dd1c8f6dbe7721c300d900c4947d98f1407638b2'],
|
|
1782
|
+
['core/hooks/PreToolUse/10-Edit,Write,MultiEdit--block-repo-edits-use-worktree.sh', 'c4c0786ff75ef466f3cd6068e3d54b3fd68c3e3cfabb98debfe1de770523526c'],
|
|
1783
|
+
['core/scripts/hook-lib.sh', 'df3d8ddc15a0c179227c9ba7f855c040973fcee249673156d08b2e2ff2c850b8'],
|
|
1784
|
+
];
|
|
1785
|
+
export const MERGED_WRITE_GUARD_PINS_1649 = [
|
|
1786
|
+
['.claude/hooks/merged-write-guard-shadow.sh', '742870a2ada4f9357320f7708fca7363be6d81fde374948b59873c327a7d7206'],
|
|
1787
|
+
['.claude/hooks/merged-write-guard-shadow.cjs', '6f65f2b9425612f9b2ec2590dace82585230210dcd69a124a9cdeb0116ea7f30'],
|
|
1788
|
+
['.claude/hooks/block-core-writes.sh', 'a39061417bf31cf251c661ebc3e5bc87ee1bb2424a0552d2aeb266eec3d29fcc'],
|
|
1789
|
+
['.claude/hooks/block-core-writes-bash.sh', '0b4ce070ef18595bd8ee794e2f364720854170a63eb0eb5999e135ada4d1b497'],
|
|
1790
|
+
['core/hooks/PreToolUse/10-Edit,Write,MultiEdit--block-repo-edits-use-worktree.sh', 'c4c0786ff75ef466f3cd6068e3d54b3fd68c3e3cfabb98debfe1de770523526c'],
|
|
1791
|
+
['core/scripts/hook-lib.sh', '9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f'],
|
|
1792
|
+
];
|
|
1793
|
+
/**
|
|
1794
|
+
* Why `merged-write-guard-shadow` must stay on the shell registration in `root`: the wrapper
|
|
1795
|
+
* script is present on disk and either the wrapper or one of its companion scripts does not match
|
|
1796
|
+
* the pinned revision set that `crates/hq-hook/src/merged_write_guard.rs` rebuilds.
|
|
1797
|
+
*/
|
|
1798
|
+
export function fleetLocalMergedWriteGuardHold(root) {
|
|
1799
|
+
const wrapperRel = '.claude/hooks/merged-write-guard-shadow.sh';
|
|
1800
|
+
const wrapperFile = path.join(root, wrapperRel);
|
|
1801
|
+
let wrapperBytes;
|
|
1802
|
+
try {
|
|
1803
|
+
if (!fs.statSync(wrapperFile).isFile())
|
|
1804
|
+
return `unreadable merged-write-guard-shadow file ${wrapperRel}`;
|
|
1805
|
+
wrapperBytes = fs.readFileSync(wrapperFile);
|
|
1806
|
+
}
|
|
1807
|
+
catch (err) {
|
|
1808
|
+
if (err?.code === 'ENOENT')
|
|
1809
|
+
return null;
|
|
1810
|
+
return `unreadable merged-write-guard-shadow file ${wrapperRel}`;
|
|
1811
|
+
}
|
|
1812
|
+
const wrapperSha = createHash('sha256').update(wrapperBytes).digest('hex');
|
|
1813
|
+
const pins = wrapperSha === MERGED_WRITE_GUARD_PINS_1649[0][1]
|
|
1814
|
+
? MERGED_WRITE_GUARD_PINS_1649
|
|
1815
|
+
: wrapperSha === MERGED_WRITE_GUARD_PINS_LEGACY[0][1]
|
|
1816
|
+
? MERGED_WRITE_GUARD_PINS_LEGACY
|
|
1817
|
+
: null;
|
|
1818
|
+
if (!pins)
|
|
1819
|
+
return `unmodeled merged-write-guard-shadow file ${wrapperRel}`;
|
|
1820
|
+
for (const [relative, sha] of pins.slice(1)) {
|
|
1821
|
+
let bytes;
|
|
1822
|
+
try {
|
|
1823
|
+
const file = path.join(root, relative);
|
|
1824
|
+
if (!fs.statSync(file).isFile())
|
|
1825
|
+
return `unreadable merged-write-guard-shadow file ${relative}`;
|
|
1826
|
+
bytes = fs.readFileSync(file);
|
|
1827
|
+
}
|
|
1828
|
+
catch {
|
|
1829
|
+
return `unreadable merged-write-guard-shadow file ${relative}`;
|
|
1830
|
+
}
|
|
1831
|
+
if (createHash('sha256').update(bytes).digest('hex') !== sha) {
|
|
1832
|
+
return `unmodeled merged-write-guard-shadow file ${relative}`;
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
return null;
|
|
1836
|
+
}
|
|
1758
1837
|
/**
|
|
1759
1838
|
* The script revisions the native SessionStart master rebuilds (hq-core v16.0.48 through v16.0.50,
|
|
1760
1839
|
* and the hq-core-staging fd709b39a shim and hq-session.sh):
|
|
@@ -1848,6 +1927,28 @@ export function migratePolicyTriggersHold(root) {
|
|
|
1848
1927
|
}
|
|
1849
1928
|
return null;
|
|
1850
1929
|
}
|
|
1930
|
+
/**
|
|
1931
|
+
* The script revisions the native fleet-local PreToolUse adapter port models (hq-core v16.0.48
|
|
1932
|
+
* through v16.0.50): `host::fleet::local_pre::RELEASED_CORE_SHA256` (`hook-adapter-core.sh`)
|
|
1933
|
+
* and `host::fleet::inherit_scope::RELEASED_LIB_SHA256` (`session-scope-capability.sh`).
|
|
1934
|
+
* `FleetLocalPre` matches the shell adapter when either file is absent (`DISPATCHER_UNAVAILABLE`
|
|
1935
|
+
* / skip scope inheritance), and refuses any other revision present on disk.
|
|
1936
|
+
* `RELEASED_CORE_SHA256` also accepts the two classifying cores of hq-core-staging #2119. This
|
|
1937
|
+
* list accepts only the bd733f7b core, the one the fleet-local parity tests run against, so a
|
|
1938
|
+
* root on a classifying core keeps fleet-local PreToolUse on the shell adapter.
|
|
1939
|
+
*/
|
|
1940
|
+
export const FLEET_LOCAL_PRE_TOOL_USE_PINS = [
|
|
1941
|
+
{ relative: 'core/scripts/lib/hook-adapter-core.sh', accepted: ['940bb5a0a268929a4cd3f88b61a0ce619f0fdf64e5d3f25f7f18da35df466ab5'], missing: 'allowed' },
|
|
1942
|
+
{ relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'], missing: 'allowed' },
|
|
1943
|
+
];
|
|
1944
|
+
/**
|
|
1945
|
+
* Why fleet-local PreToolUse must stay on the shell adapter in `root`: a present file of
|
|
1946
|
+
* [`FLEET_LOCAL_PRE_TOOL_USE_PINS`] cannot be read or is not the pinned revision. Uses the shared
|
|
1947
|
+
* [`pinnedFilesHold`] helper. Null when every present file matches.
|
|
1948
|
+
*/
|
|
1949
|
+
export function fleetLocalPreToolUseHold(root) {
|
|
1950
|
+
return pinnedFilesHold(root, 'fleet-local PreToolUse', FLEET_LOCAL_PRE_TOOL_USE_PINS);
|
|
1951
|
+
}
|
|
1851
1952
|
/**
|
|
1852
1953
|
* The one Codex adapter pair the native Codex SubagentStop is modelled on (hq-core v16.0.47):
|
|
1853
1954
|
* `ADAPTER_RELEASES` and `ADAPTER_CORE_RELEASES` in crates/hq-hook/src/post_hooks/codex.rs.
|
|
@@ -2117,6 +2218,29 @@ export const PRE_TOOL_USE_VAULT_GUARD_PINS = [
|
|
|
2117
2218
|
},
|
|
2118
2219
|
{ relative: '.claude/hooks/enforce-vault-write-access-flag.cjs', accepted: ['87dbddf1867296562ce76096c47869bca5c1a6a262b526421ac96aecfef90c45'] },
|
|
2119
2220
|
];
|
|
2221
|
+
/**
|
|
2222
|
+
* Claimed PreToolUse hooks whose native member answers in place of the root's script with no port
|
|
2223
|
+
* pin of its own, with the script revisions the member answers for: pre_tool_use_master.rs
|
|
2224
|
+
* `CLAIMED_SCRIPT_PINS`, where the native PreToolUse refuses any other present revision. The scope
|
|
2225
|
+
* authorizer: hq-core v16.0.45 to v16.0.52 and the prereleases core-pins.json lists. hq-core
|
|
2226
|
+
* 16.0.53-beta.1 (36312275) adds a PowerShell check the native scope member does not have, so that
|
|
2227
|
+
* root stays on the old dispatcher. A missing script is not held: the native PreToolUse refuses a
|
|
2228
|
+
* registered safety guard that is missing, as master-hook did.
|
|
2229
|
+
*/
|
|
2230
|
+
export const PRE_TOOL_USE_CLAIMED_SCRIPT_PINS = [
|
|
2231
|
+
{
|
|
2232
|
+
relative: '.claude/hooks/mandatory-scope-authorizer.sh',
|
|
2233
|
+
accepted: [
|
|
2234
|
+
'861fc09c36886e167dc837dedc69d78f7a9707f904f962770ce711dddba26083',
|
|
2235
|
+
'de22307449fa4b0a98b379e603b9f9c9aa25cf8ee79127888552695c50a88233',
|
|
2236
|
+
'bebbca28287440c42bf8b61d936e76812440dd6ea84a43a8771d812940af0cf8',
|
|
2237
|
+
'bfe9c24e9aaa6403a83a137326f43ff1eba09acd791ceae232b0b6aed315b6ef',
|
|
2238
|
+
'1b114e78a6f46a534a3cf4cba96b7d0a9ee33683e0976f9968ee0c956abe6482',
|
|
2239
|
+
'23e1ce16f323178623faae664697ea5e38e24834884cacfc0978622dad46f74f',
|
|
2240
|
+
],
|
|
2241
|
+
missing: 'allowed',
|
|
2242
|
+
},
|
|
2243
|
+
];
|
|
2120
2244
|
/**
|
|
2121
2245
|
* The credential guard's script revisions, each with the arithmetic library its port follows
|
|
2122
2246
|
* (ports.rs `HOOK_SCRIPT_SHA256`, `HOOK_COMPANION_SHA256` and `COMPANION_SCRIPT_BINDINGS`): the
|
|
@@ -2360,6 +2484,8 @@ export function stableEngineCommand(command, windows) {
|
|
|
2360
2484
|
* `changed_files_on`, checked by `guard_refusal_in` before any member): missing, not a regular
|
|
2361
2485
|
* file or another revision, or the credential guard's script and library not a bound pair. The
|
|
2362
2486
|
* Codex adapter is read on Codex only;
|
|
2487
|
+
* - a claimed guard script present at a revision its native member does not answer for
|
|
2488
|
+
* (`PRE_TOOL_USE_CLAIMED_SCRIPT_PINS`, pre_tool_use_master.rs `unmodelled_claimed_scripts`);
|
|
2363
2489
|
* - the policy enforcement gate beside the hook-lib.sh its revision accepts (the injector runs it
|
|
2364
2490
|
* on Bash calls whatever the registry lists), as for PostToolUse;
|
|
2365
2491
|
* - the policy-frontmatter evaluator scripts;
|
|
@@ -2387,6 +2513,7 @@ export function preToolUseHold(root, host, hooks = []) {
|
|
|
2387
2513
|
return pinnedFilesHold(root, 'PreToolUse', files)
|
|
2388
2514
|
?? (host === 'codex' ? codexExecFormSettingsHold(root, 'PreToolUse') : null)
|
|
2389
2515
|
?? pinnedFilesHold(root, 'PreToolUse', PRE_TOOL_USE_VAULT_GUARD_PINS)
|
|
2516
|
+
?? pinnedFilesHold(root, 'PreToolUse', PRE_TOOL_USE_CLAIMED_SCRIPT_PINS)
|
|
2390
2517
|
?? pinnedFilesHold(root, 'PreToolUse', [
|
|
2391
2518
|
{ relative: CREDENTIAL_GUARD, accepted: [...new Set(credential.map(([script]) => script))] },
|
|
2392
2519
|
{ relative: CREDENTIAL_ARITH_LIB, accepted: [...new Set(credential.map(([, lib]) => lib))] },
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
import { writeFile, mkdir } from "node:fs/promises";
|
|
15
15
|
import { join, dirname } from "node:path";
|
|
16
16
|
import { VaultClient, VaultConflictError, VaultNotFoundError, resolveEntityContext, sync, parseToken, } from "@indigoai-us/hq-cloud";
|
|
17
|
+
import { withCompanySessions } from "../company-sessions.js";
|
|
18
|
+
import { companySessionsForCommand } from "../company-sessions-cli.js";
|
|
17
19
|
import { PersonCreationError, CompanyCreationError, ProvisioningError, MembershipBootstrapError, StsVerifyError, InviteAcceptError, FirstSyncError, } from "./errors.js";
|
|
18
20
|
import { readCheckpoint, writeCheckpoint, isStepComplete, deleteCheckpoint, CHECKPOINT_VERSION, } from "./checkpoint.js";
|
|
19
21
|
// ---------------------------------------------------------------------------
|
|
@@ -406,11 +408,11 @@ export async function joinCompanyFlow(input, config, onProgress, { resumed = fal
|
|
|
406
408
|
if (!isStepComplete(checkpoint, "first-sync")) {
|
|
407
409
|
emit(onProgress, "first-sync", "running");
|
|
408
410
|
try {
|
|
409
|
-
await sync({
|
|
411
|
+
await sync(withCompanySessions({
|
|
410
412
|
company: checkpoint.companyUid,
|
|
411
413
|
hqRoot: config.hqRoot,
|
|
412
414
|
vaultConfig: config.vaultConfig,
|
|
413
|
-
});
|
|
415
|
+
}, await companySessionsForCommand(config.hqRoot, true)));
|
|
414
416
|
checkpoint.completedSteps.push("first-sync");
|
|
415
417
|
await writeCheckpoint(config.hqRoot, checkpoint);
|
|
416
418
|
emit(onProgress, "first-sync", "done");
|
|
@@ -24,7 +24,9 @@ export declare function syncCoreUnitId(vaultUid: string): string;
|
|
|
24
24
|
export { isSyncCoreVaultUid } from "./vault-uid.js";
|
|
25
25
|
export declare function engineConfigToml(vault: SyncCoreVault, hqRoot: string, phase: SyncCoreVaultPhase, tokenPath?: string,
|
|
26
26
|
/** The engine release this vault runs. Not given: treated as an engine that still counts requests. */
|
|
27
|
-
release?: string
|
|
27
|
+
release?: string,
|
|
28
|
+
/** This account's `prs_` person uid, the only `sessions/<uid>/` folder a company vault uploads. Omitted when not a valid uid. */
|
|
29
|
+
personUid?: string): string;
|
|
28
30
|
export interface WriteEngineHomeOptions {
|
|
29
31
|
home: string;
|
|
30
32
|
hqRoot: string;
|
|
@@ -34,6 +36,8 @@ export interface WriteEngineHomeOptions {
|
|
|
34
36
|
platform?: NodeJS.Platform;
|
|
35
37
|
/** The engine release this vault runs; decides whether the config carries `requests_per_day`. */
|
|
36
38
|
release?: string;
|
|
39
|
+
/** This account's `prs_` person uid, written as `sync.person_uid`. */
|
|
40
|
+
personUid?: string;
|
|
37
41
|
}
|
|
38
42
|
export declare function writeEngineHome(opts: WriteEngineHomeOptions): {
|
|
39
43
|
engineHome: string;
|
|
@@ -2,6 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { parse as parseToml } from "smol-toml";
|
|
4
4
|
import { compareSyncCoreReleases } from "./release-compare.js";
|
|
5
|
+
import { isPersonUid } from "./vault-uid.js";
|
|
5
6
|
import { CLIENT_HEALTH_MAX_SYNC_ENGINE_COUNT, } from "../../utils/client-health-contract.js";
|
|
6
7
|
export const SYNC_CORE_REQUESTS_PER_DAY = 20_000;
|
|
7
8
|
// The first engine release with no daily request count; it ignores `requests_per_day`.
|
|
@@ -15,7 +16,9 @@ export function syncCoreUnitId(vaultUid) {
|
|
|
15
16
|
export { isSyncCoreVaultUid } from "./vault-uid.js";
|
|
16
17
|
export function engineConfigToml(vault, hqRoot, phase, tokenPath,
|
|
17
18
|
/** The engine release this vault runs. Not given: treated as an engine that still counts requests. */
|
|
18
|
-
release
|
|
19
|
+
release,
|
|
20
|
+
/** This account's `prs_` person uid, the only `sessions/<uid>/` folder a company vault uploads. Omitted when not a valid uid. */
|
|
21
|
+
personUid) {
|
|
19
22
|
// Engines before the removal fall back to 10,000 a day when the line is missing.
|
|
20
23
|
// A release that is not a plain vX.Y.Z (a pre-release, a mislabelled marker) keeps the line too.
|
|
21
24
|
const countsRequests = release === undefined ||
|
|
@@ -30,6 +33,7 @@ release) {
|
|
|
30
33
|
`hq_root = ${JSON.stringify(hqRoot)}`,
|
|
31
34
|
...(countsRequests ? [`requests_per_day = ${SYNC_CORE_REQUESTS_PER_DAY}`] : []),
|
|
32
35
|
...(tokenPath ? [`token_path = ${JSON.stringify(tokenPath)}`] : []),
|
|
36
|
+
...(isPersonUid(personUid) ? [`person_uid = ${JSON.stringify(personUid)}`] : []),
|
|
33
37
|
];
|
|
34
38
|
if (vault.kind === "company") {
|
|
35
39
|
lines.push("[sync.roots]", `${vault.uid} = ${JSON.stringify(`companies/${vault.slug}`)}`);
|
|
@@ -79,7 +83,7 @@ export function writeEngineHome(opts) {
|
|
|
79
83
|
replaceSymlink(path.join(hq, "work-mesh"), path.join(opts.home, ".hq", "work-mesh"));
|
|
80
84
|
replaceSymlink(path.join(hq, "cognito-tokens.json"), opts.tokenFile);
|
|
81
85
|
}
|
|
82
|
-
const configChanged = writeIfChanged(path.join(root, "config.toml"), engineConfigToml(opts.vault, opts.hqRoot, opts.phase, windows ? opts.tokenFile : undefined, opts.release));
|
|
86
|
+
const configChanged = writeIfChanged(path.join(root, "config.toml"), engineConfigToml(opts.vault, opts.hqRoot, opts.phase, windows ? opts.tokenFile : undefined, opts.release, opts.personUid));
|
|
83
87
|
const ownedPath = path.join(root, "owned", `${opts.vault.uid}.json`);
|
|
84
88
|
let ownedChanged = false;
|
|
85
89
|
if (opts.phase === "full") {
|
|
@@ -15,6 +15,11 @@ export interface SyncCoreReconcileDeps {
|
|
|
15
15
|
companiesOnly: boolean;
|
|
16
16
|
listMemberships: () => Promise<SyncCoreMembership[]>;
|
|
17
17
|
resolvePersonUid: () => Promise<string | null>;
|
|
18
|
+
/**
|
|
19
|
+
* This account's person uid from the local cache, used for `sync.person_uid` when
|
|
20
|
+
* resolvePersonUid is not called or fails. Omitted: no cached uid.
|
|
21
|
+
*/
|
|
22
|
+
cachedPersonUid?: () => string | null;
|
|
18
23
|
readRolloutFlag: (companyUid: string) => Promise<boolean>;
|
|
19
24
|
/**
|
|
20
25
|
* The company's parallel download stream count from the flag registry, or
|
|
@@ -6,6 +6,7 @@ import { engineOwnsVault } from "./hand-back.js";
|
|
|
6
6
|
import { clearEngineStatus, engineFirstCycle, isSyncCoreVaultUid, removeEngineOwnership, syncCoreEngineHome, writeEngineHome, } from "./engine-home.js";
|
|
7
7
|
import { SYNC_CORE_FULL_RELEASE, SYNC_CORE_RELEASE, compareSyncCoreReleases, fullModeAllowed, installedSyncCoreRelease, syncCoreBinaryPath, windowsFullRelease, } from "./release.js";
|
|
8
8
|
import { readSyncCoreSkips } from "./skip.js";
|
|
9
|
+
import { isPersonUid } from "./vault-uid.js";
|
|
9
10
|
import { isLiveCompanyEntity, joinedCompanySlug, setUpJoinedCompany } from "./company-adoption.js";
|
|
10
11
|
import { heldDeletesHandoverLine, heldLocalBodiesHandoverLine, readEngineHeldDeletes, readEngineHeldLocalBodies, writeHandbackKeep } from "./engine-holds.js";
|
|
11
12
|
import { dropStaleLegacyJournalExport, legacyJournalDirs, legacyJournalExportState, markLegacyJournalExportStale, removeLegacyJournalExport, writeLegacyJournalExport, } from "./legacy-journal-export.js";
|
|
@@ -204,6 +205,7 @@ export async function reconcileSyncCore(deps) {
|
|
|
204
205
|
desired.push(company);
|
|
205
206
|
}
|
|
206
207
|
}
|
|
208
|
+
let sessionPersonUid = null;
|
|
207
209
|
if (!deps.companiesOnly && anyCompanyOn) {
|
|
208
210
|
let personUid = null;
|
|
209
211
|
try {
|
|
@@ -216,6 +218,15 @@ export async function reconcileSyncCore(deps) {
|
|
|
216
218
|
}
|
|
217
219
|
if (personUid)
|
|
218
220
|
desired.push({ uid: personUid, kind: "personal" });
|
|
221
|
+
sessionPersonUid = personUid;
|
|
222
|
+
}
|
|
223
|
+
if (!isPersonUid(sessionPersonUid)) {
|
|
224
|
+
try {
|
|
225
|
+
sessionPersonUid = deps.cachedPersonUid?.() ?? null;
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
sessionPersonUid = null;
|
|
229
|
+
}
|
|
219
230
|
}
|
|
220
231
|
let skips;
|
|
221
232
|
try {
|
|
@@ -296,7 +307,16 @@ export async function reconcileSyncCore(deps) {
|
|
|
296
307
|
if (!before)
|
|
297
308
|
clearEngineStatus(deps.home, vault.uid);
|
|
298
309
|
const dropFailed = !before && !pending && !dropLegacyJournalExport(deps.home, vault, warnings);
|
|
299
|
-
writeEngineHome({
|
|
310
|
+
writeEngineHome({
|
|
311
|
+
home: deps.home,
|
|
312
|
+
hqRoot: deps.hqRoot,
|
|
313
|
+
vault,
|
|
314
|
+
phase: "full",
|
|
315
|
+
tokenFile: deps.tokenFile,
|
|
316
|
+
platform,
|
|
317
|
+
release: engineRelease,
|
|
318
|
+
...(isPersonUid(sessionPersonUid) ? { personUid: sessionPersonUid } : {}),
|
|
319
|
+
});
|
|
300
320
|
const wasFull = before?.phase === "full";
|
|
301
321
|
const alreadyOff = vault.kind === "personal"
|
|
302
322
|
? switchesBefore.personalOff
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export function isSyncCoreVaultUid(value) {
|
|
2
2
|
return typeof value === "string" && /^(prs|cmp)_[A-Za-z0-9][A-Za-z0-9_-]*$/.test(value);
|
|
3
3
|
}
|
|
4
|
+
export const PERSON_UID_PATTERN = /^prs_[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
5
|
+
export function isPersonUid(value) {
|
|
6
|
+
return typeof value === "string" && PERSON_UID_PATTERN.test(value);
|
|
7
|
+
}
|
|
4
8
|
//# sourceMappingURL=vault-uid.js.map
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { type SyncOptions, type SyncResult } from "@indigoai-us/hq-cloud";
|
|
19
19
|
import { type LockHandle } from "@indigoai-us/hq-cloud/operation-lock";
|
|
20
|
+
import { type CompanySessionRetentionOptions } from "../lib/company-sessions.js";
|
|
20
21
|
export interface SyncUnderOperationLockDeps<Options, Result> {
|
|
21
22
|
sync: (options: Options & {
|
|
22
23
|
operationLockAlreadyHeld: true;
|
|
@@ -33,5 +34,5 @@ export declare function syncUnderOperationLock<Options extends {
|
|
|
33
34
|
* The production sync leg: hq-cloud's `sync()` under a lock this process takes
|
|
34
35
|
* itself. Every `hq sync` path in `src/commands/cloud.ts` calls this.
|
|
35
36
|
*/
|
|
36
|
-
export declare function syncLeg(options: SyncOptions): Promise<SyncResult>;
|
|
37
|
+
export declare function syncLeg(options: SyncOptions, resolveCompanySessions?: (hqRoot: string) => Promise<CompanySessionRetentionOptions | undefined>): Promise<SyncResult>;
|
|
37
38
|
//# sourceMappingURL=sync-operation-lock.d.ts.map
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
import { sync } from "@indigoai-us/hq-cloud";
|
|
19
19
|
import { acquireOperationLockAsync, } from "@indigoai-us/hq-cloud/operation-lock";
|
|
20
20
|
import { withPackageUseLeaseReleasedDuring } from "./package-use-lease.js";
|
|
21
|
+
import { withCompanySessions } from "../lib/company-sessions.js";
|
|
22
|
+
import { companySessionsForCommand } from "../lib/company-sessions-cli.js";
|
|
21
23
|
export async function syncUnderOperationLock(options, deps) {
|
|
22
24
|
const acquireLock = deps.acquireLock ?? ((hqRoot) => acquireOperationLockAsync(hqRoot, "sync"));
|
|
23
25
|
const withLeaseReleased = deps.withLeaseReleased ??
|
|
@@ -34,7 +36,16 @@ export async function syncUnderOperationLock(options, deps) {
|
|
|
34
36
|
* The production sync leg: hq-cloud's `sync()` under a lock this process takes
|
|
35
37
|
* itself. Every `hq sync` path in `src/commands/cloud.ts` calls this.
|
|
36
38
|
*/
|
|
37
|
-
export function syncLeg(options) {
|
|
38
|
-
|
|
39
|
+
export async function syncLeg(options, resolveCompanySessions = defaultCompanySessions) {
|
|
40
|
+
const companySessions = options.skipReindex === true ? undefined : await resolveCompanySessions(options.hqRoot);
|
|
41
|
+
return syncUnderOperationLock(withCompanySessions(options, companySessions), { sync });
|
|
42
|
+
}
|
|
43
|
+
async function defaultCompanySessions(hqRoot) {
|
|
44
|
+
try {
|
|
45
|
+
return await companySessionsForCommand(hqRoot, true);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
39
50
|
}
|
|
40
51
|
//# sourceMappingURL=sync-operation-lock.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigoai-us/hq-cli",
|
|
3
|
-
"version": "5.345.
|
|
3
|
+
"version": "5.345.260",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@aws-sdk/client-iot-data-plane": "^3.1096.0",
|
|
66
66
|
"@aws-sdk/client-s3": "^3.1049.0",
|
|
67
67
|
"@aws-sdk/dsql-signer": "^3.1146.0",
|
|
68
|
-
"@indigoai-us/hq-cloud": "6.18.
|
|
68
|
+
"@indigoai-us/hq-cloud": "6.18.127",
|
|
69
69
|
"@indigoai-us/hq-flags-client": "^0.2.0",
|
|
70
70
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
71
71
|
"@sentry/node": "^10.49.0",
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
|
|
129
129
|
},
|
|
130
130
|
"optionalDependencies": {
|
|
131
|
-
"@indigoai-us/hq-hook-win32-x64": "5.345.
|
|
132
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
133
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
134
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
135
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
136
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
131
|
+
"@indigoai-us/hq-hook-win32-x64": "5.345.260",
|
|
132
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.260",
|
|
133
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.260",
|
|
134
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.260",
|
|
135
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.260",
|
|
136
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.260"
|
|
137
137
|
}
|
|
138
138
|
}
|