@indigoai-us/hq-cli 5.345.255 → 5.345.258
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 +72 -0
- package/README.md +21 -0
- package/assets/scaffold/core/scripts/handoff-finalize.sh +981 -46
- package/assets/scaffold/core/scripts/hq-delegate-bundle.sh +51 -2
- package/assets/scaffold/core/scripts/hq-delegate-send.sh +49 -6
- package/assets/scaffold/core/scripts/hq-delegate-transfer.sh +20 -0
- package/assets/scaffold/core/scripts/hq-delegate-verify.sh +56 -10
- package/assets/scaffold/core/scripts/lib/fingerprint.sh +423 -0
- package/assets/scaffold/core/scripts/rebuild-companies-index.sh +10 -1
- package/assets/scaffold/core/scripts/rebuild-company-knowledge-index.sh +10 -1
- package/assets/scaffold/core/scripts/rebuild-projects-index.sh +10 -1
- package/assets/scaffold/core/scripts/register-project.sh +110 -19
- package/contracts/host-canary-release.json +7 -7
- package/dist/command-catalog.generated.d.ts +1 -1
- package/dist/command-catalog.generated.js +1 -1
- package/dist/commands/cloud.js +4 -1
- package/dist/commands/core-delegate-w1b.js +107 -16
- package/dist/commands/core-delegate.d.ts +7 -0
- package/dist/commands/core-delegate.js +66 -2
- package/dist/commands/core-handoff-fast.d.ts +1 -1
- package/dist/commands/core-handoff-fast.js +2 -2
- package/dist/commands/core-handoff.d.ts +3 -1
- package/dist/commands/core-handoff.js +1407 -177
- package/dist/commands/core-register-project-native.js +1 -1
- package/dist/commands/core.js +2 -2
- package/dist/commands/files.d.ts +2 -0
- package/dist/commands/files.js +34 -5
- package/dist/commands/keyed-sync-pull.d.ts +7 -3
- package/dist/commands/keyed-sync-pull.js +90 -22
- package/dist/commands/team-sync.js +1 -1
- package/dist/lib/company-skill-wrapper.js +72 -4
- package/dist/lib/daemon/requests.d.ts +14 -1
- package/dist/lib/daemon/requests.js +17 -3
- package/dist/lib/daemon/run.js +44 -2
- package/dist/lib/daemon/supervisor.d.ts +11 -0
- package/dist/lib/daemon/supervisor.js +33 -0
- package/dist/lib/daemon/sync-perf-telemetry.d.ts +85 -0
- package/dist/lib/daemon/sync-perf-telemetry.js +206 -0
- package/dist/lib/daemon/windows-relaunch.d.ts +55 -0
- package/dist/lib/daemon/windows-relaunch.js +72 -0
- package/dist/lib/doctor/checks/replay-recorder.js +3 -3
- package/dist/lib/flag-snapshot-file.d.ts +47 -1
- package/dist/lib/flag-snapshot-file.js +143 -20
- package/dist/lib/hook-engine/coverage.d.ts +82 -8
- package/dist/lib/hook-engine/coverage.js +192 -14
- package/dist/lib/index-render/companies.js +3 -2
- package/dist/lib/index-render/index.js +2 -1
- package/dist/lib/index-render/session-scope.d.ts +2 -3
- package/dist/lib/index-render/session-scope.js +2 -5
- package/dist/lib/index-render/shared.d.ts +7 -0
- package/dist/lib/index-render/shared.js +9 -0
- package/dist/lib/mesh/live/company-flag-refresh.js +2 -2
- package/dist/lib/work-context/windows-acl.d.ts +14 -0
- package/dist/lib/work-context/windows-acl.js +26 -0
- package/dist/utils/cli-telemetry.d.ts +26 -7
- package/dist/utils/cli-telemetry.js +70 -13
- package/dist/utils/git.js +1 -1
- package/dist/utils/resident-package-preload.js +4 -0
- package/dist/utils/sync-perf-telemetry-flag.d.ts +26 -0
- package/dist/utils/sync-perf-telemetry-flag.js +32 -0
- package/dist/utils/telemetry-opt-out.d.ts +13 -0
- package/dist/utils/telemetry-opt-out.js +19 -0
- package/package.json +8 -8
|
@@ -2012,7 +2012,8 @@ export function grokPreToolUseHold(root, shadow) {
|
|
|
2012
2012
|
/**
|
|
2013
2013
|
* The dispatcher files the native PreToolUse master model reproduces, in its check order:
|
|
2014
2014
|
* crates/hq-hook/src/pre_tool_use_master.rs `DISPATCHER_PINS`. master-hook.sh is v16.0.48 (1a2439ae),
|
|
2015
|
-
* v16.0.50 (774bca73)
|
|
2015
|
+
* v16.0.50 (774bca73), v16.0.49 (d5049d5f), v16.0.51 (443272ef) or v16.0.52 (ab46ebdf; v16.0.51 plus a PostToolUse-only
|
|
2016
|
+
* prefilter text for MCP tools), whose session-id alias record the native bind writes too; hook-adapter-core.sh is held per host below; hqd-hook-shim.sh is the released ab289ac0 or the
|
|
2016
2017
|
* hq-core-staging fd709b39a ee5e9fe7, and session-id.sh the released 2ebbc508 or the fd709b39a
|
|
2017
2018
|
* d6a04155; every other file is one revision.
|
|
2018
2019
|
*/
|
|
@@ -2025,7 +2026,13 @@ export const PRE_TOOL_USE_DISPATCHER_PINS = [
|
|
|
2025
2026
|
'4dd7f5296934d4488c137c9a485d4c9d55b597ee3aa2ceb6dbc3afdb0d3c1a74',
|
|
2026
2027
|
],
|
|
2027
2028
|
},
|
|
2028
|
-
{
|
|
2029
|
+
{
|
|
2030
|
+
relative: '.claude/hooks/hook-timeout-probe.sh',
|
|
2031
|
+
accepted: [
|
|
2032
|
+
'ae5c40212c088044205e246a5715a53f52c28f4021e798bd7a74df6ba570113b',
|
|
2033
|
+
'ed0daf8c9b2cf9c8f44c67db5e5666ac75307df1be512b89eb0f4ccca4ed823e',
|
|
2034
|
+
],
|
|
2035
|
+
},
|
|
2029
2036
|
{ relative: '.claude/hooks/hook-timeout-watchdog.sh', accepted: ['3017517bbcd618be5162c621105c229aeba66fea1c39f6dd744416029f0448b5'] },
|
|
2030
2037
|
{ relative: '.claude/hooks/machine-check-owner.sh', accepted: ['04ee93b3669470930732a2f6f7d9f0011fe7221d3ee0fe706b8f468cd30da16d'] },
|
|
2031
2038
|
{
|
|
@@ -2034,25 +2041,62 @@ export const PRE_TOOL_USE_DISPATCHER_PINS = [
|
|
|
2034
2041
|
'1a2439aee50652c5143ccd18561a0aa84a1e94848d02c1aa1c99157f70023f29',
|
|
2035
2042
|
'774bca73a2e806b4d9ad96b803525bdf25afd2265d63c9216881aa4ced403f16',
|
|
2036
2043
|
'd5049d5fb38d2b33467d493a4a136df8f6d9021c29e722df0d1e6a17d7f452ab',
|
|
2044
|
+
'443272ef7642d87b6833bc97b71350502491445cd09b26be9f45140804368b00',
|
|
2045
|
+
'ab46ebdf0cc84a90dd95a54417817f9f9023b109d5b3710c472a8f5e89061592',
|
|
2037
2046
|
],
|
|
2038
2047
|
},
|
|
2039
2048
|
{ relative: '.claude/hooks/turn-timing.sh', accepted: ['97c70a3251225ba9e469e41fd3fe2341cfe2936490f54571d2ca16de8e766443'] },
|
|
2040
|
-
{
|
|
2049
|
+
{
|
|
2050
|
+
relative: 'core/scripts/hook-lib.sh',
|
|
2051
|
+
accepted: [
|
|
2052
|
+
'9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f',
|
|
2053
|
+
'436493e3325fb0cbcad651ae8ef42d89f4adf43fe38abd938ed6a39c0b6d17c1',
|
|
2054
|
+
],
|
|
2055
|
+
},
|
|
2041
2056
|
{ relative: 'core/scripts/hq-anywhere-runtime-flag.cjs', accepted: ['8a484cef83d383b440462798ac13e26d132e10bbe509b47e0eb1a3d0db76b2b4'] },
|
|
2042
2057
|
{ relative: 'core/scripts/hqd-hook-flag-cache-lib.sh', accepted: ['061d264460408e9eaf43fdf0fdde662c906a9a7dacb4e7a591e684bca28c138a'] },
|
|
2043
2058
|
{ relative: 'core/scripts/hqd-hook-shim.sh', accepted: ['ab289ac0af680fe3bcacb110302ca8b998bdc33c6f94321d42bd04a344163eed', 'ee5e9fe729eb7e51f87b5f90cdc020be865f5b6b35ac0b5758587546b35715c0'] },
|
|
2044
2059
|
{ relative: 'core/scripts/lib/advisory-cap.sh', accepted: ['ab80b2a3f63a5955db392eaff4e54fed88d20130e96ca5c2a0945a3ea146d39b'] },
|
|
2045
2060
|
{ relative: 'core/scripts/lib/epochrealtime.sh', accepted: ['4c9205520dba31533c95eea145f6068ba626885c342c2aa1f232a7237d046cdf'] },
|
|
2046
|
-
{ relative: 'core/scripts/lib/hook-adapter-core.sh', accepted: ['940bb5a0a268929a4cd3f88b61a0ce619f0fdf64e5d3f25f7f18da35df466ab5'] },
|
|
2047
2061
|
{ relative: 'core/scripts/lib/perl-child-locale.sh', accepted: ['18e6b9d0e22874eea00ecc868b4dcfebbc3bb42434d8d0c81b20baec1194df2e'] },
|
|
2048
2062
|
{ relative: 'core/scripts/lib/session-id.sh', accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d', 'd6a04155571ec53edd853878cebaba5a5bab93801a73e356499440c1cd009c71'] },
|
|
2049
2063
|
{ relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'] },
|
|
2050
2064
|
{ relative: 'core/scripts/resolve-hq-root.sh', accepted: ['188e99c7c60bc9909290a666d6f3b93387ae6cf68f2eeb41fd24c2dea62a5240'] },
|
|
2051
2065
|
];
|
|
2066
|
+
/**
|
|
2067
|
+
* hook-adapter-core.sh, held per host (pre_tool_use_master.rs `HOST_DISPATCHER_PINS`). On Claude
|
|
2068
|
+
* Code master-hook.sh calls only `hqad_registry_prefilter_match` from it, byte-equal with its
|
|
2069
|
+
* helpers in v16.0.50 (940bb5a0), v16.0.51 (09f5a3e0) and v16.0.52 (cf1abd5c, a comment change), so all three are accepted; on Codex the
|
|
2070
|
+
* adapter runs the functions v16.0.51 changed, so only 940bb5a0 is.
|
|
2071
|
+
*/
|
|
2072
|
+
export const PRE_TOOL_USE_CLAUDE_DISPATCHER_PINS = [
|
|
2073
|
+
{
|
|
2074
|
+
relative: 'core/scripts/lib/hook-adapter-core.sh',
|
|
2075
|
+
accepted: [
|
|
2076
|
+
'940bb5a0a268929a4cd3f88b61a0ce619f0fdf64e5d3f25f7f18da35df466ab5',
|
|
2077
|
+
RELEASED_CLASSIFYING_ADAPTER_CORE_SHA256,
|
|
2078
|
+
CLASSIFYING_ADAPTER_CORE_SHA256,
|
|
2079
|
+
],
|
|
2080
|
+
},
|
|
2081
|
+
];
|
|
2082
|
+
export const PRE_TOOL_USE_CODEX_DISPATCHER_PINS = [
|
|
2083
|
+
{
|
|
2084
|
+
relative: 'core/scripts/lib/hook-adapter-core.sh',
|
|
2085
|
+
accepted: [
|
|
2086
|
+
'940bb5a0a268929a4cd3f88b61a0ce619f0fdf64e5d3f25f7f18da35df466ab5',
|
|
2087
|
+
RELEASED_CLASSIFYING_ADAPTER_CORE_SHA256,
|
|
2088
|
+
CLASSIFYING_ADAPTER_CORE_SHA256,
|
|
2089
|
+
],
|
|
2090
|
+
},
|
|
2091
|
+
];
|
|
2052
2092
|
/** The Codex adapter the model reproduces on Codex only (pre_tool_use_master.rs `CODEX_ADAPTER_PIN`). */
|
|
2053
2093
|
export const PRE_TOOL_USE_CODEX_ADAPTER_PIN = {
|
|
2054
2094
|
relative: '.codex/hooks/hq-codex-hook-adapter.sh',
|
|
2055
|
-
|
|
2095
|
+
// a3178b59: v16.0.48-beta.124 to v16.0.50. a905f518: v16.0.51 and v16.0.52.
|
|
2096
|
+
accepted: [
|
|
2097
|
+
'a3178b59e633310f3cc39a8c257ff58863169696ffda04dc6ea93a34a5db05ef',
|
|
2098
|
+
'a905f51887c497165df1e46e703a504fee7dbc6c879ebcec845d585b13151f52',
|
|
2099
|
+
],
|
|
2056
2100
|
};
|
|
2057
2101
|
/**
|
|
2058
2102
|
* The claimed vault-write guard's script and the companions it reads (crates/hq-hook/src/ports.rs
|
|
@@ -2068,6 +2112,7 @@ export const PRE_TOOL_USE_VAULT_GUARD_PINS = [
|
|
|
2068
2112
|
'9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f',
|
|
2069
2113
|
'df3d8ddc15a0c179227c9ba7f855c040973fcee249673156d08b2e2ff2c850b8',
|
|
2070
2114
|
'b971dae4a2b82bfa5b31782e54717115abaf052457fb1a546893d04cae43adbb',
|
|
2115
|
+
'436493e3325fb0cbcad651ae8ef42d89f4adf43fe38abd938ed6a39c0b6d17c1',
|
|
2071
2116
|
],
|
|
2072
2117
|
},
|
|
2073
2118
|
{ relative: '.claude/hooks/enforce-vault-write-access-flag.cjs', accepted: ['87dbddf1867296562ce76096c47869bca5c1a6a262b526421ac96aecfef90c45'] },
|
|
@@ -2075,8 +2120,8 @@ export const PRE_TOOL_USE_VAULT_GUARD_PINS = [
|
|
|
2075
2120
|
/**
|
|
2076
2121
|
* The credential guard's script revisions, each with the arithmetic library its port follows
|
|
2077
2122
|
* (ports.rs `HOOK_SCRIPT_SHA256`, `HOOK_COMPANION_SHA256` and `COMPANION_SCRIPT_BINDINGS`): the
|
|
2078
|
-
* 16.0.48 script 6512581d
|
|
2079
|
-
* other revision only with 0566180c.
|
|
2123
|
+
* 16.0.48 script 6512581d, its 16.0.51-beta.44 successor 5064061f and the 16.0.52 script e8f19ecc
|
|
2124
|
+
* only with e90d160f, every other revision only with 0566180c.
|
|
2080
2125
|
*/
|
|
2081
2126
|
export const PRE_TOOL_USE_CREDENTIAL_GUARD_GENERATIONS = [
|
|
2082
2127
|
['25f5507cc97bfe700a8505f59463b4f42280c60d4733110c0a5faabb87cda4f3', '0566180ce52bed559d57a08247bf39c8ec1cec6b7e271da496d0c09077fc6f57'],
|
|
@@ -2085,6 +2130,7 @@ export const PRE_TOOL_USE_CREDENTIAL_GUARD_GENERATIONS = [
|
|
|
2085
2130
|
['30015cbcae48b7227d3e271dd73235b2eac8d7b86955ac653d30ca3c377bc599', '0566180ce52bed559d57a08247bf39c8ec1cec6b7e271da496d0c09077fc6f57'],
|
|
2086
2131
|
['6512581d1200558d4ef78dfb11eca4a92f663042c6b0b11b2e6664762139e2a0', 'e90d160fed02cbcf7e33aed679233af5a9cf9f9a87dd979aba04493a37c00ec8'],
|
|
2087
2132
|
['5064061fd64da6d56c0c974c0719f6729b23dba9ab1a768e1ba70d5a9645c8ae', 'e90d160fed02cbcf7e33aed679233af5a9cf9f9a87dd979aba04493a37c00ec8'],
|
|
2133
|
+
['e8f19eccc25adfb1aa51a4d24de29714f700001a31abc21537682ee8635c76cb', 'e90d160fed02cbcf7e33aed679233af5a9cf9f9a87dd979aba04493a37c00ec8'],
|
|
2088
2134
|
];
|
|
2089
2135
|
const CREDENTIAL_GUARD = '.claude/hooks/block-credential-file-read.sh';
|
|
2090
2136
|
const CREDENTIAL_ARITH_LIB = '.claude/hooks/bash-arith-subst-guard-lib.sh';
|
|
@@ -2110,6 +2156,7 @@ export const PRE_TOOL_USE_IMAGE_GUARD_PINS = [
|
|
|
2110
2156
|
'c5c8153f1e6cead7a2cbfc9085788f26970efc79752660ff2c308112622a5c8e',
|
|
2111
2157
|
'b971dae4a2b82bfa5b31782e54717115abaf052457fb1a546893d04cae43adbb',
|
|
2112
2158
|
'9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f',
|
|
2159
|
+
'436493e3325fb0cbcad651ae8ef42d89f4adf43fe38abd938ed6a39c0b6d17c1',
|
|
2113
2160
|
],
|
|
2114
2161
|
missing: 'allowed',
|
|
2115
2162
|
},
|
|
@@ -2122,7 +2169,8 @@ const MERGED_WRITE_HELPER = '.claude/hooks/merged-write-guard-shadow.cjs';
|
|
|
2122
2169
|
* sha256 picks the set and never refuses by itself: the v16.0.49 wrapper (742870a2) picks
|
|
2123
2170
|
* `released`, any other wrapper `legacy`. In a set the helper .cjs, when listed, must match; each
|
|
2124
2171
|
* guard may be missing (bash exits 127) but not another revision; hook-lib.sh is read only once a
|
|
2125
|
-
* guard is on its pin, and must then be the set's
|
|
2172
|
+
* guard is on its pin, and must then be one of the set's libraries (the released set also takes the
|
|
2173
|
+
* v16.0.52 library 436493e3).
|
|
2126
2174
|
*/
|
|
2127
2175
|
export const MERGED_WRITE_GUARD_SETS = {
|
|
2128
2176
|
releasedWrapper: '742870a2ada4f9357320f7708fca7363be6d81fde374948b59873c327a7d7206',
|
|
@@ -2133,7 +2181,7 @@ export const MERGED_WRITE_GUARD_SETS = {
|
|
|
2133
2181
|
['.claude/hooks/block-core-writes.sh', 'a39061417bf31cf251c661ebc3e5bc87ee1bb2424a0552d2aeb266eec3d29fcc'],
|
|
2134
2182
|
['core/hooks/PreToolUse/10-Edit,Write,MultiEdit--block-repo-edits-use-worktree.sh', 'c4c0786ff75ef466f3cd6068e3d54b3fd68c3e3cfabb98debfe1de770523526c'],
|
|
2135
2183
|
],
|
|
2136
|
-
|
|
2184
|
+
hookLibs: ['9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f', '436493e3325fb0cbcad651ae8ef42d89f4adf43fe38abd938ed6a39c0b6d17c1'],
|
|
2137
2185
|
},
|
|
2138
2186
|
legacy: {
|
|
2139
2187
|
helper: null,
|
|
@@ -2142,7 +2190,7 @@ export const MERGED_WRITE_GUARD_SETS = {
|
|
|
2142
2190
|
['.claude/hooks/block-core-writes.sh', 'e6c14f48c38bd01ed0f2120fd7c18022fd7dd0dac18ed09f2307414a5646932f'],
|
|
2143
2191
|
['core/hooks/PreToolUse/10-Edit,Write,MultiEdit--block-repo-edits-use-worktree.sh', 'c4c0786ff75ef466f3cd6068e3d54b3fd68c3e3cfabb98debfe1de770523526c'],
|
|
2144
2192
|
],
|
|
2145
|
-
|
|
2193
|
+
hookLibs: ['df3d8ddc15a0c179227c9ba7f855c040973fcee249673156d08b2e2ff2c850b8'],
|
|
2146
2194
|
},
|
|
2147
2195
|
};
|
|
2148
2196
|
/** The sha256 of `relative` under `root`, or null when it is not a regular file or cannot be read. */
|
|
@@ -2177,7 +2225,132 @@ export function mergedWriteGuardHold(root, event) {
|
|
|
2177
2225
|
return guards;
|
|
2178
2226
|
if (!set.guards.some(([relative]) => regularFile(path.join(root, relative))))
|
|
2179
2227
|
return null;
|
|
2180
|
-
return pinnedFilesHold(root, event, [{ relative: HOOK_LIB, accepted: [set.
|
|
2228
|
+
return pinnedFilesHold(root, event, [{ relative: HOOK_LIB, accepted: [...set.hookLibs] }]);
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Why a Codex `event` must stay on the shell adapter in `root`: `.claude/settings.json` holds an
|
|
2232
|
+
* entry of that event with a non-empty `args` list (the exec form, which `hq reindex` and the
|
|
2233
|
+
* update healer write for the engine launcher). The adapter library may run such an entry as
|
|
2234
|
+
* master-hook (`hqad_classify_exec`), which the native work does not model, so the native
|
|
2235
|
+
* PreToolUse refuses every Codex tool call on such a root, whatever the tool or the entry's
|
|
2236
|
+
* matcher (pre_tool_use_master.rs `codex_exec_refusal`). Without this hold `hq reindex` would
|
|
2237
|
+
* switch the event onto that refusal, as for `codexSubagentStopHold`.
|
|
2238
|
+
*
|
|
2239
|
+
* The engine's own registration for this root is not such an entry ([`engineOwnExecEntry`]):
|
|
2240
|
+
* `hq reindex` writes it into this file for Claude Code when the new core is on, the native
|
|
2241
|
+
* PreToolUse models what the adapter did with it (fleet_settings.rs `engine_own_master`), and a
|
|
2242
|
+
* hold on it would undo reindex's own switch on the next run.
|
|
2243
|
+
*
|
|
2244
|
+
* The walk is the one in crates/hq-hook/src/host/fleet_settings.rs `unsupported_exec_form_entry`:
|
|
2245
|
+
* the event's slot and each group's `hooks` are a list's items or an object's values, as the
|
|
2246
|
+
* adapter's jq query walks them. The hold is wider than the run-time refusal in two ways, both of
|
|
2247
|
+
* which only keep the event on the shell adapter: it does not ask whether master-hook.sh and
|
|
2248
|
+
* hook-adapter-core.sh are present (without either the engine is idle before it reads the
|
|
2249
|
+
* settings; the pinned-file hold already keeps such a root), and it reads the file with
|
|
2250
|
+
* `JSON.parse`, which accepts a few files serde_json rejects (invalid UTF-8 read with replacement
|
|
2251
|
+
* characters, a lone surrogate escape, nesting deeper than 128), where the engine reads no
|
|
2252
|
+
* entry. A file that is absent or that `JSON.parse` rejects holds no such entry. Null when there
|
|
2253
|
+
* is none.
|
|
2254
|
+
*/
|
|
2255
|
+
export function codexExecFormSettingsHold(root, event) {
|
|
2256
|
+
let settings;
|
|
2257
|
+
try {
|
|
2258
|
+
settings = JSON.parse(fs.readFileSync(path.join(root, '.claude', 'settings.json'), 'utf8'));
|
|
2259
|
+
}
|
|
2260
|
+
catch {
|
|
2261
|
+
return null;
|
|
2262
|
+
}
|
|
2263
|
+
const field = (value, key) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value[key] : undefined;
|
|
2264
|
+
const values = (value) => Array.isArray(value) ? value : value !== null && typeof value === 'object' ? Object.values(value) : [];
|
|
2265
|
+
const exec = values(field(field(settings, 'hooks'), event)).some((group) => values(field(group, 'hooks')).some((entry) => {
|
|
2266
|
+
const args = field(entry, 'args');
|
|
2267
|
+
return Array.isArray(args) && args.length > 0 && !engineOwnExecEntry(entry, root, event);
|
|
2268
|
+
}));
|
|
2269
|
+
return exec ? `unmodeled ${event} settings entry in .claude/settings.json (exec form)` : null;
|
|
2270
|
+
}
|
|
2271
|
+
/**
|
|
2272
|
+
* Whether `entry` is the registration `hq reindex` writes for `event` on this root when the new
|
|
2273
|
+
* core is on. Three tests, each the one the adapter library's `hqad_classify_exec` makes before it
|
|
2274
|
+
* gives the entry a master record, so no entry is exempt here that the library reads another way:
|
|
2275
|
+
* - a `command` entry whose arguments are exactly `run --host <host> <event> --hq-root <root>`, the
|
|
2276
|
+
* host a plain word;
|
|
2277
|
+
* - the command is the release-stable hq-hook as the library tests it ([`stableEngineCommand`]). A
|
|
2278
|
+
* command that only contains the stable segment somewhere is not one;
|
|
2279
|
+
* - the root value is absolute and names this root ([`ownRootValue`]).
|
|
2280
|
+
*
|
|
2281
|
+
* This is narrower than [`isCoreNextEntry`], which registration uses to find its entries: every
|
|
2282
|
+
* entry this accepts, that accepts. crates/hq-hook/src/host/fleet_settings.rs `engine_own_entry` is
|
|
2283
|
+
* the same three tests, statement for statement.
|
|
2284
|
+
*/
|
|
2285
|
+
export function engineOwnExecEntry(entry, root, event, windows = process.platform === 'win32') {
|
|
2286
|
+
if (entry === null || typeof entry !== 'object' || Array.isArray(entry))
|
|
2287
|
+
return false;
|
|
2288
|
+
const { type, command, args } = entry;
|
|
2289
|
+
if (type !== 'command' || typeof command !== 'string')
|
|
2290
|
+
return false;
|
|
2291
|
+
if (!Array.isArray(args) || args.length !== 6 || !args.every((arg) => typeof arg === 'string'))
|
|
2292
|
+
return false;
|
|
2293
|
+
const [run, flag, host, slot, rootFlag, value] = args;
|
|
2294
|
+
return run === 'run' && flag === '--host' && /^[a-z][a-z0-9-]*$/.test(host) && slot === event && rootFlag === '--hq-root'
|
|
2295
|
+
&& ownRootValue(value, root, windows) && stableEngineCommand(command, windows);
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* Whether a `--hq-root` value names `root`. The value must be absolute (`/...`, or on Windows a
|
|
2299
|
+
* drive path; a `\\?\` verbatim path or a UNC path is not one) and, trailing separators aside,
|
|
2300
|
+
* every name in it must be a plain name: no `.`, `..` or empty segment. The separators are `/`, and
|
|
2301
|
+
* `\` on Windows only (elsewhere a backslash is part of a name). It then names the root when it is
|
|
2302
|
+
* the root's spelling, trailing separators aside, or when the operating system resolves it to the
|
|
2303
|
+
* same folder as the root (`fs.realpathSync.native`, which is realpath(3), or
|
|
2304
|
+
* `GetFinalPathNameByHandle` on Windows). Refusing `.` and `..` before resolving means no value
|
|
2305
|
+
* depends on whether `..` is applied before or after a link. fleet_settings.rs `own_root_value` is
|
|
2306
|
+
* the same function, resolving with `Path::canonicalize`; both answer
|
|
2307
|
+
* crates/hq-hook/tests/fixtures/engine-own-entry/cases.json.
|
|
2308
|
+
*/
|
|
2309
|
+
export function ownRootValue(value, root, windows) {
|
|
2310
|
+
const drive = /^[A-Za-z]:[\\/]/.test(value);
|
|
2311
|
+
if (!(value.startsWith('/') || (windows && drive)))
|
|
2312
|
+
return false;
|
|
2313
|
+
const trailing = windows ? /[\\/]+$/ : /\/+$/;
|
|
2314
|
+
const trimmed = value.replace(trailing, '');
|
|
2315
|
+
const body = windows && drive ? trimmed.slice(2) : trimmed;
|
|
2316
|
+
const names = body.slice(1);
|
|
2317
|
+
if (names === '' || names.split(windows ? /[\\/]/ : /\//).some((name) => name === '' || name === '.' || name === '..'))
|
|
2318
|
+
return false;
|
|
2319
|
+
if (trimmed === root.replace(trailing, ''))
|
|
2320
|
+
return true;
|
|
2321
|
+
try {
|
|
2322
|
+
return normalizeRealpath(fs.realpathSync.native(value)) === normalizeRealpath(fs.realpathSync.native(root));
|
|
2323
|
+
}
|
|
2324
|
+
catch {
|
|
2325
|
+
return false;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
/** A resolved path without the `\\?\` prefix Node adds on Windows for long paths, so both sides compare alike. */
|
|
2329
|
+
function normalizeRealpath(resolved) {
|
|
2330
|
+
return resolved.startsWith('\\\\?\\') ? resolved.slice(4) : resolved;
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* The command tests of `hqad_classify_exec` for the stable link, with `cygpath` present on Windows
|
|
2334
|
+
* (`windows`) and absent elsewhere: an absolute path with no `.`, `..` or empty segment whose
|
|
2335
|
+
* first `.hq/bin/hq-hook/` is followed by `stable/` and an engine binary name. A Windows drive path
|
|
2336
|
+
* is read with its separators swapped, and only when it is written with one kind of separator.
|
|
2337
|
+
* fleet_settings.rs `stable_engine_command`.
|
|
2338
|
+
*/
|
|
2339
|
+
export function stableEngineCommand(command, windows) {
|
|
2340
|
+
const drive = /^[A-Za-z]:[\\/]/.test(command);
|
|
2341
|
+
if (drive && windows && command.includes('/') && command.includes('\\'))
|
|
2342
|
+
return false;
|
|
2343
|
+
const posix = drive && windows ? `/${command.slice(0, 1).toLowerCase()}${command.slice(2).replaceAll('\\', '/')}` : command;
|
|
2344
|
+
if (!posix.startsWith('/'))
|
|
2345
|
+
return false;
|
|
2346
|
+
const closed = `${posix}/`;
|
|
2347
|
+
if (['/../', '/./', '//'].some((part) => closed.includes(part)))
|
|
2348
|
+
return false;
|
|
2349
|
+
const marker = '/.hq/bin/hq-hook/';
|
|
2350
|
+
const at = posix.indexOf(marker);
|
|
2351
|
+
if (at < 0)
|
|
2352
|
+
return false;
|
|
2353
|
+
return ['stable/hq-hook', 'stable/hq-hook.exe', 'stable/hq-hook.app/Contents/MacOS/hq-hook'].includes(posix.slice(at + marker.length));
|
|
2181
2354
|
}
|
|
2182
2355
|
/**
|
|
2183
2356
|
* Why PreToolUse must stay on the old dispatcher in `root` on `host` once `master-hook:PreToolUse`
|
|
@@ -2191,11 +2364,15 @@ export function mergedWriteGuardHold(root, event) {
|
|
|
2191
2364
|
* on Bash calls whatever the registry lists), as for PostToolUse;
|
|
2192
2365
|
* - the policy-frontmatter evaluator scripts;
|
|
2193
2366
|
* - the merged-write-guard-shadow companions, where the registry lists that row;
|
|
2194
|
-
* - on Claude Code, the image rule's script
|
|
2195
|
-
*
|
|
2367
|
+
* - on Claude Code, the image rule's script;
|
|
2368
|
+
* - on Codex, a `.claude/settings.json` PreToolUse entry in the exec form
|
|
2369
|
+
* ([`codexExecFormSettingsHold`]).
|
|
2370
|
+
* Null when the native PreToolUse accepts every file and the settings.
|
|
2196
2371
|
*/
|
|
2197
2372
|
export function preToolUseHold(root, host, hooks = []) {
|
|
2198
|
-
const files = host === 'codex'
|
|
2373
|
+
const files = host === 'codex'
|
|
2374
|
+
? [...PRE_TOOL_USE_DISPATCHER_PINS, ...PRE_TOOL_USE_CODEX_DISPATCHER_PINS, PRE_TOOL_USE_CODEX_ADAPTER_PIN]
|
|
2375
|
+
: [...PRE_TOOL_USE_DISPATCHER_PINS, ...PRE_TOOL_USE_CLAUDE_DISPATCHER_PINS];
|
|
2199
2376
|
const credential = PRE_TOOL_USE_CREDENTIAL_GUARD_GENERATIONS;
|
|
2200
2377
|
const evaluator = () => {
|
|
2201
2378
|
for (const pin of PRE_TOOL_USE_FRONTMATTER_EVALUATOR_PINS) {
|
|
@@ -2208,6 +2385,7 @@ export function preToolUseHold(root, host, hooks = []) {
|
|
|
2208
2385
|
return null;
|
|
2209
2386
|
};
|
|
2210
2387
|
return pinnedFilesHold(root, 'PreToolUse', files)
|
|
2388
|
+
?? (host === 'codex' ? codexExecFormSettingsHold(root, 'PreToolUse') : null)
|
|
2211
2389
|
?? pinnedFilesHold(root, 'PreToolUse', PRE_TOOL_USE_VAULT_GUARD_PINS)
|
|
2212
2390
|
?? pinnedFilesHold(root, 'PreToolUse', [
|
|
2213
2391
|
{ relative: CREDENTIAL_GUARD, accepted: [...new Set(credential.map(([script]) => script))] },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { basename, countImmediate, exists, immediateEntries, isHidden, log, prdProjectStatus, readJson, sanitize, titleize, truncate, writeIfChanged } from "./shared.js";
|
|
3
|
+
import { basename, countImmediate, exists, immediateEntries, isHidden, log, prdProjectStatus, readJson, sanitize, SESSION_SCOPE_HELP, titleize, truncate, writeIfChanged } from "./shared.js";
|
|
4
4
|
export class CompanyIndexUserError extends Error {
|
|
5
5
|
constructor(message) {
|
|
6
6
|
super(message);
|
|
@@ -38,7 +38,8 @@ export function renderCompanies(context, args = []) {
|
|
|
38
38
|
(context.output ?? ((message) => process.stdout.write(message)))("Usage: hq core rebuild-index companies [--company <slug>]\n\n" +
|
|
39
39
|
"Regenerate company root INDEX.md files. Without --company, all companies are regenerated.\n" +
|
|
40
40
|
"--company <slug> regenerates only that company's index.\n" +
|
|
41
|
-
"Company-scoped writes require the cli.rebuild-index-company-scope flag.\n"
|
|
41
|
+
"Company-scoped writes require the cli.rebuild-index-company-scope flag.\n" +
|
|
42
|
+
SESSION_SCOPE_HELP);
|
|
42
43
|
return { written: [] };
|
|
43
44
|
}
|
|
44
45
|
let selectedCompany;
|
|
@@ -7,6 +7,7 @@ import { renderProjects } from "./projects.js";
|
|
|
7
7
|
import { renderPublicKnowledge } from "./public-knowledge.js";
|
|
8
8
|
import { renderReports } from "./reports.js";
|
|
9
9
|
import { renderSocialDrafts } from "./social-drafts.js";
|
|
10
|
+
import { SESSION_SCOPE_HELP } from "./shared.js";
|
|
10
11
|
import { renderThreads } from "./threads.js";
|
|
11
12
|
import { renderWorkers } from "./workers.js";
|
|
12
13
|
const allOrder = ["threads", "orchestrator", "companies", "projects", "company-knowledge", "public-knowledge", "workers", "reports", "social-drafts"];
|
|
@@ -110,7 +111,7 @@ function isHelp(args) {
|
|
|
110
111
|
export function renderIndexTarget(target, context, args = []) {
|
|
111
112
|
if (target === "company-knowledge" || target === "projects") {
|
|
112
113
|
if (isHelp(args)) {
|
|
113
|
-
(context.output ?? ((message) => process.stdout.write(message)))(`Usage: hq core rebuild-index ${target} [<company> | --company <company>] [--accept]\n\nWith a company, rebuild only that company's index. Without a company, retain the all-company rebuild. Help performs no writes.\n`);
|
|
114
|
+
(context.output ?? ((message) => process.stdout.write(message)))(`Usage: hq core rebuild-index ${target} [<company> | --company <company>] [--accept]\n\nWith a company, rebuild only that company's index. Without a company, retain the all-company rebuild. Help performs no writes.\n${SESSION_SCOPE_HELP}`);
|
|
114
115
|
return { written: [] };
|
|
115
116
|
}
|
|
116
117
|
const company = companyScope(target, context, args);
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* CompanyIndexUserError raised before the first renderer call.
|
|
23
23
|
*/
|
|
24
24
|
import { type IndexTarget } from "./index.js";
|
|
25
|
+
import { ALL_COMPANIES_FLAG, SESSION_SCOPE_HELP } from "./shared.js";
|
|
25
26
|
export interface PlannedRebuild {
|
|
26
27
|
target: IndexTarget;
|
|
27
28
|
args: string[];
|
|
@@ -37,9 +38,7 @@ export type SessionCompanyState = {
|
|
|
37
38
|
kind: "bound";
|
|
38
39
|
companies: string[];
|
|
39
40
|
};
|
|
40
|
-
export
|
|
41
|
-
/** Appended to the help of the company targets (projects, company-knowledge, companies). */
|
|
42
|
-
export declare const SESSION_SCOPE_HELP: string;
|
|
41
|
+
export { ALL_COMPANIES_FLAG, SESSION_SCOPE_HELP };
|
|
43
42
|
export declare const UNBOUND_ALL_COMPANIES_WARNING = "hq: rebuild-index: this session is not bound to a company, so every company's index is rebuilt. Pass --company <slug> to rebuild one.";
|
|
44
43
|
export declare const COMPANY_SCOPE_FLAG_OFF_WARNING = "hq: rebuild-index: cli.rebuild-index-company-scope is off, so the company root indexes (companies/<slug>/INDEX.md) are rebuilt for every company, as before scoping.";
|
|
45
44
|
export declare const PERSONAL_ALL_NOTE = "hq: rebuild-index all: this session is bound to personal; company indexes are skipped and the rest are rebuilt.";
|
|
@@ -28,12 +28,9 @@ import { sessionIdFromEnv, validSessionId } from "../core-utils/session-id.js";
|
|
|
28
28
|
import { resolveBundledAsset } from "../../utils/hq-roots-core.js";
|
|
29
29
|
import { CompanyIndexUserError } from "./companies.js";
|
|
30
30
|
import { SKIP_COMPANY_INDEXES, UNSCOPED_COMPANIES_INDEX } from "./index.js";
|
|
31
|
+
import { ALL_COMPANIES_FLAG, SESSION_SCOPE_HELP } from "./shared.js";
|
|
31
32
|
const COMPANY_TARGETS = new Set(["all", "companies", "company-knowledge", "projects"]);
|
|
32
|
-
export
|
|
33
|
-
/** Appended to the help of the company targets (projects, company-knowledge, companies). */
|
|
34
|
-
export const SESSION_SCOPE_HELP = "\nCompany scope: in a company-bound session, a run with no company rebuilds only the bound companies\n" +
|
|
35
|
-
"(core/scripts/hq-session.sh get company_slugs), and a company outside that set is refused.\n" +
|
|
36
|
-
`An unbound session keeps the every-company rebuild (or pass --company <slug>); ${ALL_COMPANIES_FLAG} states that explicitly.\n`;
|
|
33
|
+
export { ALL_COMPANIES_FLAG, SESSION_SCOPE_HELP };
|
|
37
34
|
export const UNBOUND_ALL_COMPANIES_WARNING = "hq: rebuild-index: this session is not bound to a company, so every company's index is rebuilt. Pass --company <slug> to rebuild one.";
|
|
38
35
|
export const COMPANY_SCOPE_FLAG_OFF_WARNING = "hq: rebuild-index: cli.rebuild-index-company-scope is off, so the company root indexes (companies/<slug>/INDEX.md) are rebuilt for every company, as before scoping.";
|
|
39
36
|
export const PERSONAL_ALL_NOTE = "hq: rebuild-index all: this session is bound to personal; company indexes are skipped and the rest are rebuilt.";
|
|
@@ -13,6 +13,13 @@ export type RenderResult = {
|
|
|
13
13
|
/** Relative paths whose rendered content matched the file on disk, so no write happened. */
|
|
14
14
|
unchanged?: string[];
|
|
15
15
|
};
|
|
16
|
+
export declare const ALL_COMPANIES_FLAG = "--all-companies";
|
|
17
|
+
/**
|
|
18
|
+
* Last paragraph of the --help text of the company targets (projects,
|
|
19
|
+
* company-knowledge, companies). The renderers print it, so the renderer, the
|
|
20
|
+
* `hq core rebuild-index` command and the bundled script print one help text.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SESSION_SCOPE_HELP: string;
|
|
16
23
|
export declare function rel(root: string, file: string): string;
|
|
17
24
|
export declare function at(root: string, relative: string): string;
|
|
18
25
|
export declare function exists(root: string, relative: string): boolean;
|
|
@@ -2,6 +2,15 @@ import { createHash } from "crypto";
|
|
|
2
2
|
import * as fs from "fs";
|
|
3
3
|
import * as os from "os";
|
|
4
4
|
import * as path from "path";
|
|
5
|
+
export const ALL_COMPANIES_FLAG = "--all-companies";
|
|
6
|
+
/**
|
|
7
|
+
* Last paragraph of the --help text of the company targets (projects,
|
|
8
|
+
* company-knowledge, companies). The renderers print it, so the renderer, the
|
|
9
|
+
* `hq core rebuild-index` command and the bundled script print one help text.
|
|
10
|
+
*/
|
|
11
|
+
export const SESSION_SCOPE_HELP = "\nCompany scope: in a company-bound session, a run with no company rebuilds only the bound companies\n" +
|
|
12
|
+
"(core/scripts/hq-session.sh get company_slugs), and a company outside that set is refused.\n" +
|
|
13
|
+
`An unbound session keeps the every-company rebuild (or pass --company <slug>); ${ALL_COMPANIES_FLAG} states that explicitly.\n`;
|
|
5
14
|
export function rel(root, file) {
|
|
6
15
|
return path.relative(root, file).split(path.sep).join("/");
|
|
7
16
|
}
|
|
@@ -23,7 +23,7 @@ import * as fs from "node:fs";
|
|
|
23
23
|
import * as path from "node:path";
|
|
24
24
|
import { createHqFlagClient as createFlagClient } from "../../flag-client-headers.js";
|
|
25
25
|
import { resolveFlagRegistryEndpoint } from "../../flag-registry-endpoint.js";
|
|
26
|
-
import {
|
|
26
|
+
import { readCurrentFlagSnapshotFile, writeFlagSnapshotFile } from "../../flag-snapshot-file.js";
|
|
27
27
|
import { isNonCloudCompanySlug } from "../../work-context/company-rebind.js";
|
|
28
28
|
import { isWorkContextSessionStateFileName, workContextSessionsDir } from "../../work-context/paths.js";
|
|
29
29
|
import { readSessionState } from "../../work-context/state.js";
|
|
@@ -91,7 +91,7 @@ export function companiesNeedingFlagRefresh(workContextRoot, env, now = () => ne
|
|
|
91
91
|
}
|
|
92
92
|
return [...latest.values()]
|
|
93
93
|
.sort((a, b) => b.at - a.at)
|
|
94
|
-
.filter(({ uid }) =>
|
|
94
|
+
.filter(({ uid }) => readCurrentFlagSnapshotFile(uid, { env, now: nowMs, maxAgeMs: refreshAgeMs }) === null)
|
|
95
95
|
.slice(0, COMPANY_FLAG_REFRESH_MAX_COMPANIES)
|
|
96
96
|
.map(({ uid, slug }) => (slug ? { uid, slug } : { uid }));
|
|
97
97
|
}
|
|
@@ -19,6 +19,20 @@
|
|
|
19
19
|
* S-1-3-0 (CREATOR OWNER), S-1-3-4 (OWNER RIGHTS), the current user's SID and
|
|
20
20
|
* the owner's SID when known.
|
|
21
21
|
*
|
|
22
|
+
* One principal is trusted by its SDDL abbreviation instead: `LA`. Microsoft's
|
|
23
|
+
* SID Strings page defines it as SDDL_LOCAL_ADMIN, "Local administrator", with
|
|
24
|
+
* RID DOMAIN_USER_RID_ADMIN (500). On a standalone hosted Windows runner
|
|
25
|
+
* icacls writes the built-in Administrator account's grant as `LA` (seen in
|
|
26
|
+
* CI); the machine part of that SID is not available here without another
|
|
27
|
+
* process spawn. Microsoft's Local accounts page says the Administrator
|
|
28
|
+
* account cannot be removed from the Administrators group, which is already
|
|
29
|
+
* trusted, so a grant to `LA` gives nothing a grant to `BA` does not. This is
|
|
30
|
+
* the normal DACL of a profile directory when the signed-in user is the
|
|
31
|
+
* built-in Administrator (GitHub's hosted Windows runners, some single-user
|
|
32
|
+
* machines): `(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;LA)`.
|
|
33
|
+
* Not tested: a domain-joined machine. The documentation does not say which
|
|
34
|
+
* domain's RID 500 account a tool may print as `LA` there.
|
|
35
|
+
*
|
|
22
36
|
* Reduced-guarantee path (explicit, documented): the check does NOT throw and
|
|
23
37
|
* instead emits one stderr diagnostic that the config is unprotected on this
|
|
24
38
|
* platform when, and only when, the DACL cannot be evaluated:
|
|
@@ -19,6 +19,20 @@
|
|
|
19
19
|
* S-1-3-0 (CREATOR OWNER), S-1-3-4 (OWNER RIGHTS), the current user's SID and
|
|
20
20
|
* the owner's SID when known.
|
|
21
21
|
*
|
|
22
|
+
* One principal is trusted by its SDDL abbreviation instead: `LA`. Microsoft's
|
|
23
|
+
* SID Strings page defines it as SDDL_LOCAL_ADMIN, "Local administrator", with
|
|
24
|
+
* RID DOMAIN_USER_RID_ADMIN (500). On a standalone hosted Windows runner
|
|
25
|
+
* icacls writes the built-in Administrator account's grant as `LA` (seen in
|
|
26
|
+
* CI); the machine part of that SID is not available here without another
|
|
27
|
+
* process spawn. Microsoft's Local accounts page says the Administrator
|
|
28
|
+
* account cannot be removed from the Administrators group, which is already
|
|
29
|
+
* trusted, so a grant to `LA` gives nothing a grant to `BA` does not. This is
|
|
30
|
+
* the normal DACL of a profile directory when the signed-in user is the
|
|
31
|
+
* built-in Administrator (GitHub's hosted Windows runners, some single-user
|
|
32
|
+
* machines): `(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;LA)`.
|
|
33
|
+
* Not tested: a domain-joined machine. The documentation does not say which
|
|
34
|
+
* domain's RID 500 account a tool may print as `LA` there.
|
|
35
|
+
*
|
|
22
36
|
* Reduced-guarantee path (explicit, documented): the check does NOT throw and
|
|
23
37
|
* instead emits one stderr diagnostic that the config is unprotected on this
|
|
24
38
|
* platform when, and only when, the DACL cannot be evaluated:
|
|
@@ -65,6 +79,13 @@ const SDDL_SID_ABBREVIATIONS = {
|
|
|
65
79
|
LA: "S-1-5-21-<domain>-500", // Local Administrator account
|
|
66
80
|
LG: "S-1-5-21-<domain>-501", // Local Guest account
|
|
67
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* Domain-relative abbreviations trusted without a concrete SID. Only the
|
|
84
|
+
* built-in Administrator account: it is always a member of Administrators
|
|
85
|
+
* (see the module header). The other domain-relative abbreviations (LG, DA,
|
|
86
|
+
* DU) stay unresolvable.
|
|
87
|
+
*/
|
|
88
|
+
const TRUSTED_SDDL_ABBREVIATIONS = new Set(["LA"]);
|
|
68
89
|
/** Resolve an SDDL account field to a SID, or null when unknown. */
|
|
69
90
|
export function sddlAccountToSid(account) {
|
|
70
91
|
const a = account.trim();
|
|
@@ -329,6 +350,11 @@ export function evaluateDacl(aces, opts) {
|
|
|
329
350
|
}
|
|
330
351
|
if ((mask & WRITE_MASK) === 0)
|
|
331
352
|
continue;
|
|
353
|
+
// Trusted, so go on to the next entry. A resolved untrusted writer after
|
|
354
|
+
// this one is still reported; an unresolvable entry after it still ends
|
|
355
|
+
// the scan with the reduced-guarantee diagnostic, as for any other DACL.
|
|
356
|
+
if (TRUSTED_SDDL_ABBREVIATIONS.has(ace.account.toUpperCase()))
|
|
357
|
+
continue;
|
|
332
358
|
const sid = sddlAccountToSid(ace.account);
|
|
333
359
|
if (!sid) {
|
|
334
360
|
return { kind: "unresolvable", reason: `cannot resolve principal "${ace.account}" to a SID` };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type FirstSyncStepOutcome } from "../lib/first-sync-next-step.js";
|
|
2
|
+
import type { SyncPerfEvent } from "../lib/daemon/sync-perf-telemetry.js";
|
|
3
|
+
import { isCliTelemetryDisabled } from "./telemetry-opt-out.js";
|
|
4
|
+
import { CLI_SYNC_PERF_TELEMETRY_FLAG, isCliSyncPerfTelemetryEnabled } from "./sync-perf-telemetry-flag.js";
|
|
2
5
|
export { CLI_FIRST_SYNC_NEXT_STEP_FLAG, FIRST_SYNC_CONFIRMATION_COPY, FIRST_SYNC_NEXT_STEP_COPY, claimFirstSyncStepMarker, firstSyncStepMarkerPaths, firstSyncStepTelemetryProperties, isHumanInteractiveCliSession, isWorkBearingSyncResult, maybeShowFirstSyncNextStep, recordFirstWorkBearingSync, shouldConfirmFirstWorkBearingSync, shouldShowFirstSyncNextStep, takeFirstSyncStepOutcomes, type FirstSyncStepOutcome, } from "../lib/first-sync-next-step.js";
|
|
3
6
|
export declare const TELEMETRY_TIMEOUT_MS = 1200;
|
|
4
7
|
export declare const CLI_SESSION_STARTED_BUDGET_MAX_EVENTS = 30;
|
|
@@ -14,6 +17,11 @@ export declare const FIRST_SYNC_TELEMETRY_DISCLOSURE_LINE = "HQ sends a usage ev
|
|
|
14
17
|
export declare const CLI_INVITE_NUDGE_TELEMETRY_DISCLOSURE_LINE = "HQ sends a usage event when it shows the teammate invite prompt (your company UID and whether you saw, clicked, or dismissed the prompt; no invitee details, command names, file contents, or secrets). Set HQ_TELEMETRY=0 to turn this off.";
|
|
15
18
|
export declare const CLI_FEATURE_USED_TELEMETRY_FLAG = "cli.feature-used-telemetry-v1";
|
|
16
19
|
export declare const CLI_FEATURE_USED_TELEMETRY_DISCLOSURE_LINE = "HQ sends a feature-use event when you run a supported CLI feature (feature kind and outcome, plus your company UID when available; never command names, file contents, or secrets). The hq-flags key cli.feature-used-telemetry-v1 controls these events. Set HQ_TELEMETRY=0 to turn this off.";
|
|
20
|
+
/** hq-pro's usage ingest; it applies the person/agent/company consent rules. */
|
|
21
|
+
export declare const SYNC_PERF_USAGE_PATH = "/v1/usage";
|
|
22
|
+
/** Marks a usage row as a sync-engine perf sample (hq-pro `_usage-perf-rows.ts`). */
|
|
23
|
+
export declare const SYNC_PERF_USAGE_EVENT_TYPE = "perf";
|
|
24
|
+
export declare const SYNC_PERF_USAGE_MAX_ROWS = 50;
|
|
17
25
|
/**
|
|
18
26
|
* What HQ stores on this computer and never sends: the local command count
|
|
19
27
|
* (utils/command-usage.ts). Printed once on stderr on the first interactive
|
|
@@ -70,15 +78,26 @@ export declare function isCliLimitResourceKind(value: string): value is CliLimit
|
|
|
70
78
|
* It never refreshes credentials or turns telemetry failure into command failure.
|
|
71
79
|
*/
|
|
72
80
|
export declare function emitCliFeatureUsed(usage: CliFeatureUsage, timeoutMs?: number): Promise<void>;
|
|
73
|
-
|
|
74
|
-
export declare function withCliFeatureUsed<T>(kind: CliFeatureKind, action: () => Promise<T>, companyUid?: string): Promise<T>;
|
|
81
|
+
export { CLI_SYNC_PERF_TELEMETRY_FLAG, isCliSyncPerfTelemetryEnabled };
|
|
75
82
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
83
|
+
* Send one batch of validated sync-engine perf events (see
|
|
84
|
+
* lib/daemon/sync-perf-telemetry.ts) to hq-pro's usage ingest as
|
|
85
|
+
* `eventType: "perf"` rows on `POST /v1/usage`.
|
|
86
|
+
*
|
|
87
|
+
* Consent is checked on this machine first, like every other emitter in this
|
|
88
|
+
* file (owner decision 2026-11-21, "Gate on opt-in"): nothing is sent unless
|
|
89
|
+
* `hasCliTelemetryConsent` is true for this principal, so a person who opted
|
|
90
|
+
* out or never answered sends no rows at all. Agents and machine identities
|
|
91
|
+
* are always collected. hq-pro then applies its own ingest gates, the same as
|
|
92
|
+
* for token-usage rows. This client sends the cached identity token and, for a
|
|
93
|
+
* company vault, its company UID. `HQ_TELEMETRY` and the default-on kill switch
|
|
94
|
+
* `cli.sync-perf-telemetry-v1` are checked before consent. Uses the cached human or machine token, never
|
|
95
|
+
* refreshes, bounded by `timeoutMs`. Never throws.
|
|
80
96
|
*/
|
|
81
|
-
export declare function
|
|
97
|
+
export declare function emitSyncPerfEvents(events: readonly SyncPerfEvent[], timeoutMs?: number): Promise<void>;
|
|
98
|
+
/** Run one action and emit exactly one success/failure event without masking errors. */
|
|
99
|
+
export declare function withCliFeatureUsed<T>(kind: CliFeatureKind, action: () => Promise<T>, companyUid?: string): Promise<T>;
|
|
100
|
+
export { isCliTelemetryDisabled };
|
|
82
101
|
/** Feature-use collection stays off until the HQ flag is explicitly enabled. */
|
|
83
102
|
export declare function isCliFeatureUsedTelemetryEnabled(): boolean;
|
|
84
103
|
export declare const CLI_TELEMETRY_CONSENT_TTL_MS: number;
|