@indigoai-us/hq-cli 5.345.254 → 5.345.257
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 +68 -0
- package/README.md +29 -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/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/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/hook-engine/coverage.d.ts +10 -1
- package/dist/lib/hook-engine/coverage.js +41 -5
- 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/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
|
@@ -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;
|
|
@@ -7,6 +7,8 @@ import { cognitoCachePrincipalUid, isExpiring, isMachineIdentity, loadCachedToke
|
|
|
7
7
|
import { resolveProcessFlagCompanyContext, resolveProcessFlagGate, } from "../lib/flag-registry.js";
|
|
8
8
|
import { vaultApiFetch } from "./vault-api.js";
|
|
9
9
|
import { firstSyncStepTelemetryProperties, isHumanInteractiveCliSession, } from "../lib/first-sync-next-step.js";
|
|
10
|
+
import { isCliTelemetryDisabled } from "./telemetry-opt-out.js";
|
|
11
|
+
import { CLI_SYNC_PERF_TELEMETRY_FLAG, isCliSyncPerfTelemetryEnabled } from "./sync-perf-telemetry-flag.js";
|
|
10
12
|
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, } from "../lib/first-sync-next-step.js";
|
|
11
13
|
export const TELEMETRY_TIMEOUT_MS = 1_200;
|
|
12
14
|
export const CLI_SESSION_STARTED_BUDGET_MAX_EVENTS = 30;
|
|
@@ -22,6 +24,11 @@ export const FIRST_SYNC_TELEMETRY_DISCLOSURE_LINE = "HQ sends a usage event when
|
|
|
22
24
|
export 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.";
|
|
23
25
|
export const CLI_FEATURE_USED_TELEMETRY_FLAG = "cli.feature-used-telemetry-v1";
|
|
24
26
|
export 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.";
|
|
27
|
+
/** hq-pro's usage ingest; it applies the person/agent/company consent rules. */
|
|
28
|
+
export const SYNC_PERF_USAGE_PATH = "/v1/usage";
|
|
29
|
+
/** Marks a usage row as a sync-engine perf sample (hq-pro `_usage-perf-rows.ts`). */
|
|
30
|
+
export const SYNC_PERF_USAGE_EVENT_TYPE = "perf";
|
|
31
|
+
export const SYNC_PERF_USAGE_MAX_ROWS = 50;
|
|
25
32
|
/**
|
|
26
33
|
* What HQ stores on this computer and never sends: the local command count
|
|
27
34
|
* (utils/command-usage.ts). Printed once on stderr on the first interactive
|
|
@@ -29,7 +36,6 @@ export const CLI_FEATURE_USED_TELEMETRY_DISCLOSURE_LINE = "HQ sends a feature-us
|
|
|
29
36
|
* above because nothing is sent, so `HQ_TELEMETRY=0` does not turn it off.
|
|
30
37
|
*/
|
|
31
38
|
export const LOCAL_COMMAND_USAGE_DISCLOSURE_LINE = "HQ keeps a count of the commands you run in ~/.hq/command-usage on this computer (the command name and the date of each run, never arguments, file contents, or secrets). It is never sent anywhere, so HQ_TELEMETRY=0 does not turn it off. Run `hq doctor usage` to see it; delete that folder to clear it.";
|
|
32
|
-
const TELEMETRY_DISABLED_VALUES = new Set(["0", "false", "off"]);
|
|
33
39
|
const DISCLOSURE_MARKER = "cli-telemetry-disclosed";
|
|
34
40
|
const FIRST_SYNC_DISCLOSURE_MARKER = "cli-telemetry-disclosed-first-sync-v1";
|
|
35
41
|
const INVITE_NUDGE_DISCLOSURE_MARKER = "cli-telemetry-disclosed-invite-nudge-v1";
|
|
@@ -228,6 +234,68 @@ export async function emitCliFeatureUsed(usage, timeoutMs = TELEMETRY_TIMEOUT_MS
|
|
|
228
234
|
// Cached-token reads are also best effort (for example, a malformed cache).
|
|
229
235
|
}
|
|
230
236
|
}
|
|
237
|
+
export { CLI_SYNC_PERF_TELEMETRY_FLAG, isCliSyncPerfTelemetryEnabled };
|
|
238
|
+
/**
|
|
239
|
+
* Send one batch of validated sync-engine perf events (see
|
|
240
|
+
* lib/daemon/sync-perf-telemetry.ts) to hq-pro's usage ingest as
|
|
241
|
+
* `eventType: "perf"` rows on `POST /v1/usage`.
|
|
242
|
+
*
|
|
243
|
+
* Consent is checked on this machine first, like every other emitter in this
|
|
244
|
+
* file (owner decision 2026-11-21, "Gate on opt-in"): nothing is sent unless
|
|
245
|
+
* `hasCliTelemetryConsent` is true for this principal, so a person who opted
|
|
246
|
+
* out or never answered sends no rows at all. Agents and machine identities
|
|
247
|
+
* are always collected. hq-pro then applies its own ingest gates, the same as
|
|
248
|
+
* for token-usage rows. This client sends the cached identity token and, for a
|
|
249
|
+
* company vault, its company UID. `HQ_TELEMETRY` and the default-on kill switch
|
|
250
|
+
* `cli.sync-perf-telemetry-v1` are checked before consent. Uses the cached human or machine token, never
|
|
251
|
+
* refreshes, bounded by `timeoutMs`. Never throws.
|
|
252
|
+
*/
|
|
253
|
+
export async function emitSyncPerfEvents(events, timeoutMs = TELEMETRY_TIMEOUT_MS) {
|
|
254
|
+
try {
|
|
255
|
+
if (events.length === 0)
|
|
256
|
+
return;
|
|
257
|
+
// Same guard as feature-use telemetry: test runs never post to a live account.
|
|
258
|
+
if (process.env.NODE_ENV === "test")
|
|
259
|
+
return;
|
|
260
|
+
if (isCliTelemetryDisabled() || !isCliSyncPerfTelemetryEnabled())
|
|
261
|
+
return;
|
|
262
|
+
const machineIdentity = isMachineIdentity();
|
|
263
|
+
const cached = machineIdentity ? loadMachineCachedTokens() : loadCachedTokens();
|
|
264
|
+
if (!cached || isExpiring(cached, 120))
|
|
265
|
+
return;
|
|
266
|
+
const token = machineIdentity ? cached.idToken : cached.accessToken;
|
|
267
|
+
if (!token)
|
|
268
|
+
return;
|
|
269
|
+
const controller = new AbortController();
|
|
270
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
271
|
+
try {
|
|
272
|
+
if (!(await hasCliTelemetryConsent(token, machineIdentity, controller.signal)))
|
|
273
|
+
return;
|
|
274
|
+
await vaultApiFetch({
|
|
275
|
+
token,
|
|
276
|
+
path: SYNC_PERF_USAGE_PATH,
|
|
277
|
+
method: "POST",
|
|
278
|
+
body: {
|
|
279
|
+
cliVersion: CLI_VERSION.slice(0, 40),
|
|
280
|
+
events: events.slice(0, SYNC_PERF_USAGE_MAX_ROWS).map((event) => ({
|
|
281
|
+
eventType: SYNC_PERF_USAGE_EVENT_TYPE,
|
|
282
|
+
...event,
|
|
283
|
+
})),
|
|
284
|
+
},
|
|
285
|
+
signal: controller.signal,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
// Perf telemetry is best effort and must never affect sync.
|
|
290
|
+
}
|
|
291
|
+
finally {
|
|
292
|
+
clearTimeout(timeout);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
// Cached-token reads are also best effort (for example, a malformed cache).
|
|
297
|
+
}
|
|
298
|
+
}
|
|
231
299
|
/** Run one action and emit exactly one success/failure event without masking errors. */
|
|
232
300
|
export async function withCliFeatureUsed(kind, action, companyUid) {
|
|
233
301
|
let outcome = "success";
|
|
@@ -246,18 +314,7 @@ export async function withCliFeatureUsed(kind, action, companyUid) {
|
|
|
246
314
|
});
|
|
247
315
|
}
|
|
248
316
|
}
|
|
249
|
-
|
|
250
|
-
* `HQ_TELEMETRY=0` (also `false` and `off`, case-insensitive) disables every
|
|
251
|
-
* CLI POST to `/v1/telemetry/events`. `HQ_TELEMETRY_TIMEOUT_MS` is unchanged.
|
|
252
|
-
* It does not turn off the local command count (utils/command-usage.ts): that
|
|
253
|
-
* count is a file on this computer and sends nothing.
|
|
254
|
-
*/
|
|
255
|
-
export function isCliTelemetryDisabled(env = process.env) {
|
|
256
|
-
const raw = env.HQ_TELEMETRY?.trim().toLowerCase();
|
|
257
|
-
if (!raw)
|
|
258
|
-
return false;
|
|
259
|
-
return TELEMETRY_DISABLED_VALUES.has(raw);
|
|
260
|
-
}
|
|
317
|
+
export { isCliTelemetryDisabled };
|
|
261
318
|
/** Feature-use collection stays off until the HQ flag is explicitly enabled. */
|
|
262
319
|
export function isCliFeatureUsedTelemetryEnabled() {
|
|
263
320
|
return resolveProcessFlagGate(CLI_FEATURE_USED_TELEMETRY_FLAG, { fallback: false }, () => false);
|
package/dist/utils/git.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import simpleGit from 'simple-git';
|
|
3
|
+
import { simpleGit } from 'simple-git';
|
|
4
4
|
export async function cloneRepo(repoUrl, targetDir, branch) {
|
|
5
5
|
const git = simpleGit();
|
|
6
6
|
const options = branch ? ['--branch', branch] : [];
|
|
@@ -92,6 +92,7 @@ export const RESIDENT_PACKAGE_MODULES = {
|
|
|
92
92
|
"../lib/capacity/collect.js",
|
|
93
93
|
"../lib/capacity/accounts.js",
|
|
94
94
|
"../lib/core-utils/hook-timeout-debug-context-flag.js",
|
|
95
|
+
"../utils/cli-telemetry.js",
|
|
95
96
|
],
|
|
96
97
|
"daemon-logs-follow": [],
|
|
97
98
|
"mesh-daemon": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
|
|
@@ -317,6 +318,9 @@ const LOADERS = {
|
|
|
317
318
|
// Native Stop timeout diagnostics report through sentry-report, whose
|
|
318
319
|
// hook-timeout debug-context gate loads this flag module on demand.
|
|
319
320
|
() => import("../lib/core-utils/hook-timeout-debug-context-flag.js"),
|
|
321
|
+
// The sync perf forwarder sends its batches through cli-telemetry, loaded
|
|
322
|
+
// on the first send (lib/daemon/run.ts).
|
|
323
|
+
() => import("../utils/cli-telemetry.js"),
|
|
320
324
|
],
|
|
321
325
|
"daemon-logs-follow": [],
|
|
322
326
|
"mesh-daemon": [
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sync perf telemetry gate on its own, so the daemon can check it for
|
|
3
|
+
* every perf line without loading the whole telemetry module. Only the flag
|
|
4
|
+
* registry is imported; the daemon already loads it. `cli-telemetry.ts`
|
|
5
|
+
* re-exports these; there is one definition.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CLI_SYNC_PERF_TELEMETRY_FLAG = "cli.sync-perf-telemetry-v1";
|
|
8
|
+
/**
|
|
9
|
+
* `cli.sync-perf-telemetry-v1` is a default-on kill switch
|
|
10
|
+
* (indigo-feature-flags-default-on-as-fail-safes; owner go 2026-11-24): an
|
|
11
|
+
* absent, archived or unreadable row keeps collection on, and a row set to
|
|
12
|
+
* false turns it off. The daemon has no company context, so the read goes
|
|
13
|
+
* through `killSwitchWithoutCompany`, where any person or company snapshot
|
|
14
|
+
* holding false turns it off. Consent is separate: rows are sent only for a
|
|
15
|
+
* person who opted in (see `emitSyncPerfEvents`).
|
|
16
|
+
*/
|
|
17
|
+
export declare function isCliSyncPerfTelemetryEnabled(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the daemon should collect sync perf events at all: `HQ_TELEMETRY`
|
|
20
|
+
* is not off and the kill switch is not turned off. When this is false the
|
|
21
|
+
* forwarder queues and schedules nothing, and the telemetry module is never
|
|
22
|
+
* loaded. (The supervisor still checks each perf line against the schema
|
|
23
|
+
* before handing it to the forwarder.)
|
|
24
|
+
*/
|
|
25
|
+
export declare function isSyncPerfCollectionEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
26
|
+
//# sourceMappingURL=sync-perf-telemetry-flag.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sync perf telemetry gate on its own, so the daemon can check it for
|
|
3
|
+
* every perf line without loading the whole telemetry module. Only the flag
|
|
4
|
+
* registry is imported; the daemon already loads it. `cli-telemetry.ts`
|
|
5
|
+
* re-exports these; there is one definition.
|
|
6
|
+
*/
|
|
7
|
+
import { resolveProcessFlagGate } from "../lib/flag-registry.js";
|
|
8
|
+
import { isCliTelemetryDisabled } from "./telemetry-opt-out.js";
|
|
9
|
+
export const CLI_SYNC_PERF_TELEMETRY_FLAG = "cli.sync-perf-telemetry-v1";
|
|
10
|
+
/**
|
|
11
|
+
* `cli.sync-perf-telemetry-v1` is a default-on kill switch
|
|
12
|
+
* (indigo-feature-flags-default-on-as-fail-safes; owner go 2026-11-24): an
|
|
13
|
+
* absent, archived or unreadable row keeps collection on, and a row set to
|
|
14
|
+
* false turns it off. The daemon has no company context, so the read goes
|
|
15
|
+
* through `killSwitchWithoutCompany`, where any person or company snapshot
|
|
16
|
+
* holding false turns it off. Consent is separate: rows are sent only for a
|
|
17
|
+
* person who opted in (see `emitSyncPerfEvents`).
|
|
18
|
+
*/
|
|
19
|
+
export function isCliSyncPerfTelemetryEnabled() {
|
|
20
|
+
return resolveProcessFlagGate(CLI_SYNC_PERF_TELEMETRY_FLAG, { fallback: true }, () => true, undefined, { acceptStaleSnapshot: true, killSwitchWithoutCompany: true });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether the daemon should collect sync perf events at all: `HQ_TELEMETRY`
|
|
24
|
+
* is not off and the kill switch is not turned off. When this is false the
|
|
25
|
+
* forwarder queues and schedules nothing, and the telemetry module is never
|
|
26
|
+
* loaded. (The supervisor still checks each perf line against the schema
|
|
27
|
+
* before handing it to the forwarder.)
|
|
28
|
+
*/
|
|
29
|
+
export function isSyncPerfCollectionEnabled(env = process.env) {
|
|
30
|
+
return !isCliTelemetryDisabled(env) && isCliSyncPerfTelemetryEnabled();
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=sync-perf-telemetry-flag.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `HQ_TELEMETRY` opt-out on its own, with no imports, so long-running code
|
|
3
|
+
* such as the daemon supervisor can read it without loading the whole telemetry
|
|
4
|
+
* module. `cli-telemetry.ts` re-exports it; there is one definition.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* `HQ_TELEMETRY=0` (also `false` and `off`, case-insensitive) disables every
|
|
8
|
+
* CLI POST to `/v1/telemetry/events`. `HQ_TELEMETRY_TIMEOUT_MS` is unchanged.
|
|
9
|
+
* It does not turn off the local command count (utils/command-usage.ts): that
|
|
10
|
+
* count is a file on this computer and sends nothing.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isCliTelemetryDisabled(env?: NodeJS.ProcessEnv): boolean;
|
|
13
|
+
//# sourceMappingURL=telemetry-opt-out.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `HQ_TELEMETRY` opt-out on its own, with no imports, so long-running code
|
|
3
|
+
* such as the daemon supervisor can read it without loading the whole telemetry
|
|
4
|
+
* module. `cli-telemetry.ts` re-exports it; there is one definition.
|
|
5
|
+
*/
|
|
6
|
+
const TELEMETRY_DISABLED_VALUES = new Set(["0", "false", "off"]);
|
|
7
|
+
/**
|
|
8
|
+
* `HQ_TELEMETRY=0` (also `false` and `off`, case-insensitive) disables every
|
|
9
|
+
* CLI POST to `/v1/telemetry/events`. `HQ_TELEMETRY_TIMEOUT_MS` is unchanged.
|
|
10
|
+
* It does not turn off the local command count (utils/command-usage.ts): that
|
|
11
|
+
* count is a file on this computer and sends nothing.
|
|
12
|
+
*/
|
|
13
|
+
export function isCliTelemetryDisabled(env = process.env) {
|
|
14
|
+
const raw = env.HQ_TELEMETRY?.trim().toLowerCase();
|
|
15
|
+
if (!raw)
|
|
16
|
+
return false;
|
|
17
|
+
return TELEMETRY_DISABLED_VALUES.has(raw);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=telemetry-opt-out.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.257",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"open": "^10.1.0",
|
|
80
80
|
"pg": "^8.23.1",
|
|
81
81
|
"semver": "^7.8.5",
|
|
82
|
-
"simple-git": "^
|
|
82
|
+
"simple-git": "^4.1.0",
|
|
83
83
|
"smol-toml": "1.9.1",
|
|
84
84
|
"varlock": "1.24.0"
|
|
85
85
|
},
|
|
@@ -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.257",
|
|
132
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.257",
|
|
133
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.257",
|
|
134
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.257",
|
|
135
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.257",
|
|
136
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.257"
|
|
137
137
|
}
|
|
138
138
|
}
|