@legioncodeinc/hive 0.1.0
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/LICENSE +661 -0
- package/README.md +262 -0
- package/dist/cli-commands.d.ts +41 -0
- package/dist/cli-commands.js +76 -0
- package/dist/cli-commands.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +46 -0
- package/dist/cli.js.map +1 -0
- package/dist/daemon/dashboard/app.js +118 -0
- package/dist/daemon/dashboard/host.d.ts +90 -0
- package/dist/daemon/dashboard/host.js +172 -0
- package/dist/daemon/dashboard/host.js.map +1 -0
- package/dist/daemon/dashboard/web-assets.d.ts +88 -0
- package/dist/daemon/dashboard/web-assets.js +195 -0
- package/dist/daemon/dashboard/web-assets.js.map +1 -0
- package/dist/daemon/fleet-status.d.ts +15 -0
- package/dist/daemon/fleet-status.js +56 -0
- package/dist/daemon/fleet-status.js.map +1 -0
- package/dist/daemon/gate.d.ts +55 -0
- package/dist/daemon/gate.js +128 -0
- package/dist/daemon/gate.js.map +1 -0
- package/dist/daemon/proxy.d.ts +38 -0
- package/dist/daemon/proxy.js +126 -0
- package/dist/daemon/proxy.js.map +1 -0
- package/dist/daemon/registry.d.ts +31 -0
- package/dist/daemon/registry.js +120 -0
- package/dist/daemon/registry.js.map +1 -0
- package/dist/daemon/server.d.ts +41 -0
- package/dist/daemon/server.js +126 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/setup-auth.d.ts +37 -0
- package/dist/daemon/setup-auth.js +51 -0
- package/dist/daemon/setup-auth.js.map +1 -0
- package/dist/daemon/telemetry-proxy.d.ts +47 -0
- package/dist/daemon/telemetry-proxy.js +63 -0
- package/dist/daemon/telemetry-proxy.js.map +1 -0
- package/dist/dashboard/contracts.d.ts +235 -0
- package/dist/dashboard/contracts.js +43 -0
- package/dist/dashboard/contracts.js.map +1 -0
- package/dist/dashboard/web/app.d.ts +44 -0
- package/dist/dashboard/web/app.js +179 -0
- package/dist/dashboard/web/app.js.map +1 -0
- package/dist/dashboard/web/boot-route.d.ts +23 -0
- package/dist/dashboard/web/boot-route.js +29 -0
- package/dist/dashboard/web/boot-route.js.map +1 -0
- package/dist/dashboard/web/build-graph-button.d.ts +46 -0
- package/dist/dashboard/web/build-graph-button.js +81 -0
- package/dist/dashboard/web/build-graph-button.js.map +1 -0
- package/dist/dashboard/web/buzzing-screen.d.ts +30 -0
- package/dist/dashboard/web/buzzing-screen.js +135 -0
- package/dist/dashboard/web/buzzing-screen.js.map +1 -0
- package/dist/dashboard/web/folder-picker.d.ts +54 -0
- package/dist/dashboard/web/folder-picker.js +125 -0
- package/dist/dashboard/web/folder-picker.js.map +1 -0
- package/dist/dashboard/web/graph-layout.d.ts +101 -0
- package/dist/dashboard/web/graph-layout.js +0 -0
- package/dist/dashboard/web/graph-layout.js.map +1 -0
- package/dist/dashboard/web/harness-strip.d.ts +38 -0
- package/dist/dashboard/web/harness-strip.js +65 -0
- package/dist/dashboard/web/harness-strip.js.map +1 -0
- package/dist/dashboard/web/health-rail.d.ts +26 -0
- package/dist/dashboard/web/health-rail.js +61 -0
- package/dist/dashboard/web/health-rail.js.map +1 -0
- package/dist/dashboard/web/main.d.ts +22 -0
- package/dist/dashboard/web/main.js +51 -0
- package/dist/dashboard/web/main.js.map +1 -0
- package/dist/dashboard/web/needs-project.d.ts +51 -0
- package/dist/dashboard/web/needs-project.js +69 -0
- package/dist/dashboard/web/needs-project.js.map +1 -0
- package/dist/dashboard/web/page-frame.d.ts +95 -0
- package/dist/dashboard/web/page-frame.js +98 -0
- package/dist/dashboard/web/page-frame.js.map +1 -0
- package/dist/dashboard/web/pages/coming-soon.d.ts +23 -0
- package/dist/dashboard/web/pages/coming-soon.js +19 -0
- package/dist/dashboard/web/pages/coming-soon.js.map +1 -0
- package/dist/dashboard/web/pages/dashboard.d.ts +32 -0
- package/dist/dashboard/web/pages/dashboard.js +205 -0
- package/dist/dashboard/web/pages/dashboard.js.map +1 -0
- package/dist/dashboard/web/pages/graph.d.ts +72 -0
- package/dist/dashboard/web/pages/graph.js +362 -0
- package/dist/dashboard/web/pages/graph.js.map +1 -0
- package/dist/dashboard/web/pages/harnesses.d.ts +65 -0
- package/dist/dashboard/web/pages/harnesses.js +210 -0
- package/dist/dashboard/web/pages/harnesses.js.map +1 -0
- package/dist/dashboard/web/pages/health.d.ts +22 -0
- package/dist/dashboard/web/pages/health.js +91 -0
- package/dist/dashboard/web/pages/health.js.map +1 -0
- package/dist/dashboard/web/pages/lifecycle-panel.d.ts +60 -0
- package/dist/dashboard/web/pages/lifecycle-panel.js +187 -0
- package/dist/dashboard/web/pages/lifecycle-panel.js.map +1 -0
- package/dist/dashboard/web/pages/logs.d.ts +55 -0
- package/dist/dashboard/web/pages/logs.js +311 -0
- package/dist/dashboard/web/pages/logs.js.map +1 -0
- package/dist/dashboard/web/pages/memories.d.ts +35 -0
- package/dist/dashboard/web/pages/memories.js +439 -0
- package/dist/dashboard/web/pages/memories.js.map +1 -0
- package/dist/dashboard/web/pages/projects.d.ts +38 -0
- package/dist/dashboard/web/pages/projects.js +325 -0
- package/dist/dashboard/web/pages/projects.js.map +1 -0
- package/dist/dashboard/web/pages/roi-chart.d.ts +52 -0
- package/dist/dashboard/web/pages/roi-chart.js +133 -0
- package/dist/dashboard/web/pages/roi-chart.js.map +1 -0
- package/dist/dashboard/web/pages/roi.d.ts +93 -0
- package/dist/dashboard/web/pages/roi.js +375 -0
- package/dist/dashboard/web/pages/roi.js.map +1 -0
- package/dist/dashboard/web/pages/settings.d.ts +103 -0
- package/dist/dashboard/web/pages/settings.js +420 -0
- package/dist/dashboard/web/pages/settings.js.map +1 -0
- package/dist/dashboard/web/pages/sync.d.ts +59 -0
- package/dist/dashboard/web/pages/sync.js +280 -0
- package/dist/dashboard/web/pages/sync.js.map +1 -0
- package/dist/dashboard/web/panels.d.ts +178 -0
- package/dist/dashboard/web/panels.js +471 -0
- package/dist/dashboard/web/panels.js.map +1 -0
- package/dist/dashboard/web/primitives.d.ts +80 -0
- package/dist/dashboard/web/primitives.js +208 -0
- package/dist/dashboard/web/primitives.js.map +1 -0
- package/dist/dashboard/web/readiness-splash.d.ts +39 -0
- package/dist/dashboard/web/readiness-splash.js +201 -0
- package/dist/dashboard/web/readiness-splash.js.map +1 -0
- package/dist/dashboard/web/registry.d.ts +96 -0
- package/dist/dashboard/web/registry.js +99 -0
- package/dist/dashboard/web/registry.js.map +1 -0
- package/dist/dashboard/web/router.d.ts +48 -0
- package/dist/dashboard/web/router.js +76 -0
- package/dist/dashboard/web/router.js.map +1 -0
- package/dist/dashboard/web/scope-context.d.ts +155 -0
- package/dist/dashboard/web/scope-context.js +266 -0
- package/dist/dashboard/web/scope-context.js.map +1 -0
- package/dist/dashboard/web/service-icons.d.ts +33 -0
- package/dist/dashboard/web/service-icons.js +80 -0
- package/dist/dashboard/web/service-icons.js.map +1 -0
- package/dist/dashboard/web/setup-gate.d.ts +116 -0
- package/dist/dashboard/web/setup-gate.js +272 -0
- package/dist/dashboard/web/setup-gate.js.map +1 -0
- package/dist/dashboard/web/sidebar.d.ts +63 -0
- package/dist/dashboard/web/sidebar.js +91 -0
- package/dist/dashboard/web/sidebar.js.map +1 -0
- package/dist/dashboard/web/use-fleet-telemetry.d.ts +111 -0
- package/dist/dashboard/web/use-fleet-telemetry.js +278 -0
- package/dist/dashboard/web/use-fleet-telemetry.js.map +1 -0
- package/dist/dashboard/web/wire.d.ts +1937 -0
- package/dist/dashboard/web/wire.js +1837 -0
- package/dist/dashboard/web/wire.js.map +1 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -0
- package/dist/install/registry.d.ts +35 -0
- package/dist/install/registry.js +110 -0
- package/dist/install/registry.js.map +1 -0
- package/dist/lock.d.ts +10 -0
- package/dist/lock.js +87 -0
- package/dist/lock.js.map +1 -0
- package/dist/service/commands.d.ts +15 -0
- package/dist/service/commands.js +49 -0
- package/dist/service/commands.js.map +1 -0
- package/dist/service/index.d.ts +38 -0
- package/dist/service/index.js +174 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/platform.d.ts +37 -0
- package/dist/service/platform.js +67 -0
- package/dist/service/platform.js.map +1 -0
- package/dist/service/templates.d.ts +10 -0
- package/dist/service/templates.js +120 -0
- package/dist/service/templates.js.map +1 -0
- package/dist/shared/constants.d.ts +15 -0
- package/dist/shared/constants.js +19 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/daemon-routing.d.ts +11 -0
- package/dist/shared/daemon-routing.js +38 -0
- package/dist/shared/daemon-routing.js.map +1 -0
- package/dist/shared/fleet-readiness.d.ts +18 -0
- package/dist/shared/fleet-readiness.js +9 -0
- package/dist/shared/fleet-readiness.js.map +1 -0
- package/dist/shared/fleet-telemetry.d.ts +68 -0
- package/dist/shared/fleet-telemetry.js +61 -0
- package/dist/shared/fleet-telemetry.js.map +1 -0
- package/dist/shared/lifecycle-flags.d.ts +34 -0
- package/dist/shared/lifecycle-flags.js +39 -0
- package/dist/shared/lifecycle-flags.js.map +1 -0
- package/dist/shared/memory-types.d.ts +55 -0
- package/dist/shared/memory-types.js +75 -0
- package/dist/shared/memory-types.js.map +1 -0
- package/dist/shared/service-status.d.ts +82 -0
- package/dist/shared/service-status.js +97 -0
- package/dist/shared/service-status.js.map +1 -0
- package/dist/telemetry/emit.d.ts +197 -0
- package/dist/telemetry/emit.js +196 -0
- package/dist/telemetry/emit.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hive's SINGLE telemetry-egress chokepoint.
|
|
3
|
+
*
|
|
4
|
+
* `emitTelemetry(event, opts, deps?)` is the ONLY place in this package that posts to the PostHog
|
|
5
|
+
* capture endpoint. The four lifecycle emit sites (install-service -> `hive_installed`,
|
|
6
|
+
* uninstall-service -> `hive_uninstalled`, first `start` -> `hive_first_run`, version change on
|
|
7
|
+
* `start` -> `hive_updated`) all funnel through here, so the allow-list, the opt-out gates, the
|
|
8
|
+
* dedupe ledger, and the bounded fire-and-forget POST posture live in ONE module. Mirrors the posture
|
|
9
|
+
* of honeycomb's `src/daemon/runtime/telemetry/emit.ts` and doctor's `src/telemetry/emit.ts`.
|
|
10
|
+
*
|
|
11
|
+
* Gates, in order (a return is silent; telemetry NEVER throws):
|
|
12
|
+
* 1. Build-injected `__HONEYCOMB_POSTHOG_KEY__` empty -> hard-disabled (unkeyed dev build).
|
|
13
|
+
* 2. `HONEYCOMB_TELEMETRY=0` or `DO_NOT_TRACK` truthy -> opted out.
|
|
14
|
+
* 3. Dedupe key already in the JSON ledger -> already sent.
|
|
15
|
+
* Only past all three does a single bounded-timeout POST fire; on a 2xx the dedupe key (when one was
|
|
16
|
+
* supplied) is recorded in the ledger and persisted.
|
|
17
|
+
*
|
|
18
|
+
* The payload is BUILT FROM A CLOSED ALLOW-LIST: exactly `{package, version, os, arch, node}`. There
|
|
19
|
+
* is no free-form property path, so a leak is structurally impossible. `distinct_id` prefers the
|
|
20
|
+
* shared `~/.honeycomb/install-id` written by the honeycomb installer (correlates the funnel across
|
|
21
|
+
* products); when absent, a UUID is generated once and persisted in hive's own state dir
|
|
22
|
+
* (`~/.honeycomb/hive/`, mode 0o700).
|
|
23
|
+
*
|
|
24
|
+
* Fail-soft everywhere: the POST is wrapped in a 2s AbortController timeout and a try/catch that
|
|
25
|
+
* swallows EVERYTHING (timeout, network error, 4xx, 5xx, ledger IO). `emitTelemetry` resolves to a
|
|
26
|
+
* structured {@link EmitOutcome} for tests; it NEVER rejects and NEVER changes a CLI verb's exit code.
|
|
27
|
+
*
|
|
28
|
+
* This module carries NO secret: the PostHog project key (`phc_...`) is a PUBLIC write-only ingest
|
|
29
|
+
* key, baked at build time via esbuild `define` (never a runtime env read, never logged).
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* The PostHog project write-only ingest key (`phc_...`), build-injected via esbuild `define`. The
|
|
33
|
+
* `typeof` guard means a tsc-only dev/test build (no define pass) falls through to `""`, which Gate 1
|
|
34
|
+
* treats as HARD-DISABLED: an unkeyed build emits nothing, ever.
|
|
35
|
+
*/
|
|
36
|
+
export declare const POSTHOG_KEY: string;
|
|
37
|
+
/**
|
|
38
|
+
* The PostHog ingest host, build-injected via esbuild `define`. Defaults to the US cloud when the
|
|
39
|
+
* define is absent or empty. {@link POSTHOG_CAPTURE_PATH} is appended to this host and that is the
|
|
40
|
+
* ONLY URL this module ever posts to.
|
|
41
|
+
*/
|
|
42
|
+
export declare const POSTHOG_HOST: string;
|
|
43
|
+
/** The pinned PostHog capture path. The full ingest URL is `${host}${POSTHOG_CAPTURE_PATH}`. */
|
|
44
|
+
export declare const POSTHOG_CAPTURE_PATH: "/i/v0/e/";
|
|
45
|
+
/** Build the full capture URL (`${host}${path}`), tolerating a trailing slash on the host. */
|
|
46
|
+
export declare function captureUrl(host?: string): string;
|
|
47
|
+
/** The Honeycomb-wide opt-out env var. `HONEYCOMB_TELEMETRY=0` silences ALL telemetry. */
|
|
48
|
+
export declare const ENV_TELEMETRY: "HONEYCOMB_TELEMETRY";
|
|
49
|
+
/** The cross-tool opt-out standard. Any value other than empty or "0" silences ALL telemetry. */
|
|
50
|
+
export declare const ENV_DO_NOT_TRACK: "DO_NOT_TRACK";
|
|
51
|
+
/**
|
|
52
|
+
* True when the user has opted out via either env var. Mirrors honeycomb's and doctor's
|
|
53
|
+
* `isOptedOut` so all three chokepoints agree on the same env contract.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isOptedOut(env?: NodeJS.ProcessEnv): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* hive's own state dir. hive already keeps per-product state under
|
|
58
|
+
* `~/.honeycomb/hive/` (the staged Windows service unit lives there), so the telemetry install-id
|
|
59
|
+
* fallback and the dedupe ledger live beside it. Created lazily with mode 0o700.
|
|
60
|
+
*/
|
|
61
|
+
export declare const HIVE_STATE_DIR: string;
|
|
62
|
+
/**
|
|
63
|
+
* The shared install-id written by the honeycomb installer. When present, its contents are used as
|
|
64
|
+
* `distinct_id` so hive's lifecycle events correlate with the installer funnel.
|
|
65
|
+
*/
|
|
66
|
+
export declare const SHARED_INSTALL_ID_PATH: string;
|
|
67
|
+
/** Filename of hive's own generated install-id inside {@link HIVE_STATE_DIR}. */
|
|
68
|
+
export declare const INSTALL_ID_FILENAME: "install-id";
|
|
69
|
+
/** Filename of the dedupe ledger inside {@link HIVE_STATE_DIR}. */
|
|
70
|
+
export declare const LEDGER_FILENAME: "telemetry.json";
|
|
71
|
+
/**
|
|
72
|
+
* The CLOSED allow-list of property keys that may leave the machine. The payload is BUILT from
|
|
73
|
+
* exactly these five keys by {@link buildAllowedProperties}; there is no caller-supplied property
|
|
74
|
+
* path at all, so nothing else can egress.
|
|
75
|
+
*/
|
|
76
|
+
export declare const ALLOWED_PROPERTY_KEYS: readonly ["package", "version", "os", "arch", "node"];
|
|
77
|
+
/** One allow-listed property key. */
|
|
78
|
+
export type AllowedPropertyKey = (typeof ALLOWED_PROPERTY_KEYS)[number];
|
|
79
|
+
/** The allow-listed property bag: the EXACT shape that may leave the machine. */
|
|
80
|
+
export type AllowedProperties = Record<AllowedPropertyKey, string>;
|
|
81
|
+
/**
|
|
82
|
+
* Assemble the allow-listed payload: the package name, the build version, and coarse platform facts
|
|
83
|
+
* (OS family, CPU arch, node version). Never a hostname, a path, or any machine-identifying string.
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildAllowedProperties(version: string): AllowedProperties;
|
|
86
|
+
/** The four hive lifecycle events. This union is the whole event vocabulary of this module. */
|
|
87
|
+
export type HiveTelemetryEvent = "hive_installed" | "hive_uninstalled" | "hive_first_run" | "hive_updated";
|
|
88
|
+
/**
|
|
89
|
+
* The dedupe ledger persisted at `${stateDir}/telemetry.json`. `reported` maps a dedupe key (an event
|
|
90
|
+
* name, or `event@version` for `hive_updated`) to the ISO timestamp it was sent. `lastSeenVersion`
|
|
91
|
+
* is the version observed on the most recent lifecycle-recorded `start`, used to detect upgrades.
|
|
92
|
+
*/
|
|
93
|
+
export interface TelemetryLedger {
|
|
94
|
+
readonly reported: Record<string, string>;
|
|
95
|
+
readonly lastSeenVersion?: string;
|
|
96
|
+
}
|
|
97
|
+
/** Load the ledger from `${stateDir}/telemetry.json`. Any IO/parse problem yields an empty ledger. */
|
|
98
|
+
export declare function loadLedger(stateDir: string): TelemetryLedger;
|
|
99
|
+
/**
|
|
100
|
+
* Persist the ledger, creating the state dir (mode 0o700) when needed. Throws on IO failure; callers
|
|
101
|
+
* inside the chokepoint wrap it in the fail-soft try/catch.
|
|
102
|
+
*/
|
|
103
|
+
export declare function saveLedger(stateDir: string, ledger: TelemetryLedger): void;
|
|
104
|
+
/**
|
|
105
|
+
* Resolve the anonymized `distinct_id`, in preference order:
|
|
106
|
+
* 1. The shared `~/.honeycomb/install-id` (honeycomb installer funnel correlation), when present.
|
|
107
|
+
* 2. hive's own previously generated id at `${stateDir}/install-id`.
|
|
108
|
+
* 3. A fresh UUID, persisted best-effort at `${stateDir}/install-id` (dir mode 0o700).
|
|
109
|
+
* Never an email, account id, hostname, or path. Never throws: a persist failure still returns the
|
|
110
|
+
* generated id (that emit just will not correlate with later ones).
|
|
111
|
+
*/
|
|
112
|
+
export declare function resolveDistinctId(deps?: EmitDeps): string;
|
|
113
|
+
/** The minimal fetch response shape the chokepoint reads. */
|
|
114
|
+
export interface TelemetryFetchResponse {
|
|
115
|
+
readonly ok: boolean;
|
|
116
|
+
readonly status: number;
|
|
117
|
+
}
|
|
118
|
+
/** The minimal request init the chokepoint passes (POST + JSON body + abort signal). */
|
|
119
|
+
export interface TelemetryFetchRequestInit {
|
|
120
|
+
readonly method: string;
|
|
121
|
+
readonly headers: Record<string, string>;
|
|
122
|
+
readonly body: string;
|
|
123
|
+
readonly signal?: AbortSignal;
|
|
124
|
+
}
|
|
125
|
+
/** The injectable fetch seam. Tests pass a recorder so no real network is ever hit. */
|
|
126
|
+
export type TelemetryFetch = (url: string, init: TelemetryFetchRequestInit) => Promise<TelemetryFetchResponse>;
|
|
127
|
+
/** The injectable deps the chokepoint runs against. All default to the production seams. */
|
|
128
|
+
export interface EmitDeps {
|
|
129
|
+
/** The network seam (defaults to the global `fetch`). */
|
|
130
|
+
readonly fetch?: TelemetryFetch;
|
|
131
|
+
/** The env the opt-out gate reads (defaults to `process.env`). */
|
|
132
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
133
|
+
/** Override the build-injected key (tests force the keyed/unkeyed branch without a rebuild). */
|
|
134
|
+
readonly posthogKey?: string;
|
|
135
|
+
/** Override the capture host (tests assert the posted URL without a rebuild). */
|
|
136
|
+
readonly posthogHost?: string;
|
|
137
|
+
/** Override the version stamped into the payload (defaults to {@link HIVE_VERSION}). */
|
|
138
|
+
readonly version?: string;
|
|
139
|
+
/** Override hive's state dir (tests point this at a temp dir). */
|
|
140
|
+
readonly stateDir?: string;
|
|
141
|
+
/** Override the shared install-id path (tests point this at a temp file). */
|
|
142
|
+
readonly sharedInstallIdPath?: string;
|
|
143
|
+
/** The bounded POST timeout in ms (defaults to {@link DEFAULT_EMIT_TIMEOUT_MS}). */
|
|
144
|
+
readonly timeoutMs?: number;
|
|
145
|
+
/** The clock stamping ledger entries (defaults to `new Date().toISOString()`). */
|
|
146
|
+
readonly clock?: () => string;
|
|
147
|
+
}
|
|
148
|
+
/** The default bounded POST timeout: a telemetry POST never hangs a verb longer than this. */
|
|
149
|
+
export declare const DEFAULT_EMIT_TIMEOUT_MS: 2000;
|
|
150
|
+
/** Why an emit did NOT send. NEVER thrown: a gate or failure resolves to one of these. */
|
|
151
|
+
export type EmitSkipReason = "disabled" | "opted_out" | "already_reported" | "send_failed";
|
|
152
|
+
/** The outcome of an {@link emitTelemetry} call (resolved, never rejected). */
|
|
153
|
+
export interface EmitOutcome {
|
|
154
|
+
/** True iff a 2xx came back. */
|
|
155
|
+
readonly sent: boolean;
|
|
156
|
+
/** When `sent` is false, why. Absent when `sent` is true. */
|
|
157
|
+
readonly skipped?: EmitSkipReason;
|
|
158
|
+
/** The allow-listed payload that was built (present whether or not it was sent). */
|
|
159
|
+
readonly properties: AllowedProperties;
|
|
160
|
+
}
|
|
161
|
+
/** The per-emit options. */
|
|
162
|
+
export interface EmitOptions {
|
|
163
|
+
/**
|
|
164
|
+
* When supplied, the emit is deduped: a ledger hit skips the send, and a successful send records
|
|
165
|
+
* this key. Plain event names dedupe once per machine; `hive_updated@<version>` dedupes per
|
|
166
|
+
* version. Omit for events that may fire more than once (`hive_uninstalled`).
|
|
167
|
+
*/
|
|
168
|
+
readonly dedupeKey?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* THE SINGLE TELEMETRY CHOKEPOINT. Emit `event` with the allow-listed payload, applying, in order,
|
|
172
|
+
* the disabled / opted-out / already-reported gates, then a single bounded fire-and-forget POST. On a
|
|
173
|
+
* 2xx the dedupe key (when supplied) is recorded in the ledger. NEVER throws and NEVER changes a CLI
|
|
174
|
+
* verb's exit code: it resolves an {@link EmitOutcome} the caller may inspect or ignore.
|
|
175
|
+
*/
|
|
176
|
+
export declare function emitTelemetry(event: HiveTelemetryEvent, opts?: EmitOptions, deps?: EmitDeps): Promise<EmitOutcome>;
|
|
177
|
+
/** Emit `hive_installed` after a successful `install-service`. Deduped once per machine. */
|
|
178
|
+
export declare function emitInstalled(deps?: EmitDeps): Promise<EmitOutcome>;
|
|
179
|
+
/**
|
|
180
|
+
* Emit `hive_uninstalled` on `uninstall-service`. Fired BEFORE teardown, fire-and-forget, and
|
|
181
|
+
* deliberately NOT deduped: an install/uninstall/reinstall cycle legitimately fires it again.
|
|
182
|
+
*/
|
|
183
|
+
export declare function emitUninstalled(deps?: EmitDeps): Promise<EmitOutcome>;
|
|
184
|
+
/** The outcome of the `start` lifecycle recording: the first-run emit plus the optional update emit. */
|
|
185
|
+
export interface StartLifecycleOutcome {
|
|
186
|
+
readonly firstRun: EmitOutcome;
|
|
187
|
+
/** Null when no version change was detected (or when the gates blocked everything). */
|
|
188
|
+
readonly updated: EmitOutcome | null;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Record the `start` lifecycle: emit `hive_first_run` once per machine, and emit
|
|
192
|
+
* `hive_updated` when the persisted last-seen version differs from the current version (deduped
|
|
193
|
+
* per version via `hive_updated@<version>`), then advance the persisted version. Capturing the
|
|
194
|
+
* upgrade on `start` means an npm reinstall is detected without any updater. Fail-soft: never throws
|
|
195
|
+
* and never blocks the daemon (the caller invokes it after the listen line).
|
|
196
|
+
*/
|
|
197
|
+
export declare function recordStartLifecycle(deps?: EmitDeps): Promise<StartLifecycleOutcome>;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { arch, platform } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { HONEYCOMB_HOME_DIR, HIVE_VERSION } from "../shared/constants.js";
|
|
6
|
+
const POSTHOG_KEY = true ? "" : "";
|
|
7
|
+
const POSTHOG_HOST = "".length > 0 ? "" : "https://us.i.posthog.com";
|
|
8
|
+
const POSTHOG_CAPTURE_PATH = "/i/v0/e/";
|
|
9
|
+
function captureUrl(host = POSTHOG_HOST) {
|
|
10
|
+
return `${host.replace(/\/+$/, "")}${POSTHOG_CAPTURE_PATH}`;
|
|
11
|
+
}
|
|
12
|
+
const ENV_TELEMETRY = "HONEYCOMB_TELEMETRY";
|
|
13
|
+
const ENV_DO_NOT_TRACK = "DO_NOT_TRACK";
|
|
14
|
+
function isOptedOut(env = process.env) {
|
|
15
|
+
if (env[ENV_TELEMETRY] === "0")
|
|
16
|
+
return true;
|
|
17
|
+
const dnt = env[ENV_DO_NOT_TRACK];
|
|
18
|
+
return dnt !== void 0 && dnt !== "" && dnt !== "0";
|
|
19
|
+
}
|
|
20
|
+
const HIVE_STATE_DIR = join(HONEYCOMB_HOME_DIR, "hive");
|
|
21
|
+
const SHARED_INSTALL_ID_PATH = join(HONEYCOMB_HOME_DIR, "install-id");
|
|
22
|
+
const INSTALL_ID_FILENAME = "install-id";
|
|
23
|
+
const LEDGER_FILENAME = "telemetry.json";
|
|
24
|
+
const ALLOWED_PROPERTY_KEYS = ["package", "version", "os", "arch", "node"];
|
|
25
|
+
function buildAllowedProperties(version) {
|
|
26
|
+
return {
|
|
27
|
+
package: "hive",
|
|
28
|
+
version,
|
|
29
|
+
os: platform(),
|
|
30
|
+
arch: arch(),
|
|
31
|
+
node: process.version
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function emptyLedger() {
|
|
35
|
+
return { reported: {} };
|
|
36
|
+
}
|
|
37
|
+
function loadLedger(stateDir) {
|
|
38
|
+
try {
|
|
39
|
+
const raw = JSON.parse(readFileSync(join(stateDir, LEDGER_FILENAME), "utf8"));
|
|
40
|
+
if (typeof raw !== "object" || raw === null)
|
|
41
|
+
return emptyLedger();
|
|
42
|
+
const record = raw;
|
|
43
|
+
const reported = {};
|
|
44
|
+
if (typeof record["reported"] === "object" && record["reported"] !== null) {
|
|
45
|
+
for (const [key, value] of Object.entries(record["reported"])) {
|
|
46
|
+
if (typeof value === "string")
|
|
47
|
+
reported[key] = value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const lastSeenVersion = typeof record["lastSeenVersion"] === "string" ? record["lastSeenVersion"] : void 0;
|
|
51
|
+
return lastSeenVersion === void 0 ? { reported } : { reported, lastSeenVersion };
|
|
52
|
+
} catch {
|
|
53
|
+
return emptyLedger();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function saveLedger(stateDir, ledger) {
|
|
57
|
+
mkdirSync(stateDir, { recursive: true, mode: 448 });
|
|
58
|
+
writeFileSync(join(stateDir, LEDGER_FILENAME), `${JSON.stringify(ledger, null, 2)}
|
|
59
|
+
`, "utf8");
|
|
60
|
+
}
|
|
61
|
+
function resolveDistinctId(deps = {}) {
|
|
62
|
+
const sharedPath = deps.sharedInstallIdPath ?? SHARED_INSTALL_ID_PATH;
|
|
63
|
+
try {
|
|
64
|
+
const shared = readFileSync(sharedPath, "utf8").trim();
|
|
65
|
+
if (shared.length > 0)
|
|
66
|
+
return shared;
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
const stateDir = deps.stateDir ?? HIVE_STATE_DIR;
|
|
70
|
+
const ownPath = join(stateDir, INSTALL_ID_FILENAME);
|
|
71
|
+
try {
|
|
72
|
+
const own = readFileSync(ownPath, "utf8").trim();
|
|
73
|
+
if (own.length > 0)
|
|
74
|
+
return own;
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
const generated = randomUUID();
|
|
78
|
+
try {
|
|
79
|
+
mkdirSync(stateDir, { recursive: true, mode: 448 });
|
|
80
|
+
writeFileSync(ownPath, `${generated}
|
|
81
|
+
`, "utf8");
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
return generated;
|
|
85
|
+
}
|
|
86
|
+
const DEFAULT_EMIT_TIMEOUT_MS = 2e3;
|
|
87
|
+
async function emitTelemetry(event, opts = {}, deps = {}) {
|
|
88
|
+
const env = deps.env ?? process.env;
|
|
89
|
+
const key = deps.posthogKey ?? POSTHOG_KEY;
|
|
90
|
+
const version = deps.version ?? HIVE_VERSION;
|
|
91
|
+
const properties = buildAllowedProperties(version);
|
|
92
|
+
if (key.length === 0)
|
|
93
|
+
return { sent: false, skipped: "disabled", properties };
|
|
94
|
+
if (isOptedOut(env))
|
|
95
|
+
return { sent: false, skipped: "opted_out", properties };
|
|
96
|
+
try {
|
|
97
|
+
const stateDir = deps.stateDir ?? HIVE_STATE_DIR;
|
|
98
|
+
const ledger = loadLedger(stateDir);
|
|
99
|
+
if (opts.dedupeKey !== void 0 && ledger.reported[opts.dedupeKey] !== void 0) {
|
|
100
|
+
return { sent: false, skipped: "already_reported", properties };
|
|
101
|
+
}
|
|
102
|
+
const distinctId = resolveDistinctId(deps);
|
|
103
|
+
const ok = await postCapture(event, properties, distinctId, key, deps);
|
|
104
|
+
if (!ok)
|
|
105
|
+
return { sent: false, skipped: "send_failed", properties };
|
|
106
|
+
if (opts.dedupeKey !== void 0) {
|
|
107
|
+
const clock = deps.clock ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
108
|
+
try {
|
|
109
|
+
const fresh = loadLedger(stateDir);
|
|
110
|
+
saveLedger(stateDir, {
|
|
111
|
+
...fresh,
|
|
112
|
+
reported: { ...fresh.reported, [opts.dedupeKey]: clock() }
|
|
113
|
+
});
|
|
114
|
+
} catch {
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return { sent: true, properties };
|
|
118
|
+
} catch {
|
|
119
|
+
return { sent: false, skipped: "send_failed", properties };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function postCapture(event, properties, distinctId, key, deps) {
|
|
123
|
+
const doFetch = deps.fetch ?? globalThis.fetch;
|
|
124
|
+
const host = deps.posthogHost ?? POSTHOG_HOST;
|
|
125
|
+
const timeoutMs = deps.timeoutMs ?? DEFAULT_EMIT_TIMEOUT_MS;
|
|
126
|
+
const body = { api_key: key, event, properties, distinct_id: distinctId };
|
|
127
|
+
const controller = new AbortController();
|
|
128
|
+
const timer = setTimeout(() => {
|
|
129
|
+
controller.abort();
|
|
130
|
+
}, timeoutMs);
|
|
131
|
+
try {
|
|
132
|
+
const resp = await doFetch(captureUrl(host), {
|
|
133
|
+
method: "POST",
|
|
134
|
+
headers: { "Content-Type": "application/json" },
|
|
135
|
+
body: JSON.stringify(body),
|
|
136
|
+
signal: controller.signal
|
|
137
|
+
});
|
|
138
|
+
return resp.ok;
|
|
139
|
+
} catch {
|
|
140
|
+
return false;
|
|
141
|
+
} finally {
|
|
142
|
+
clearTimeout(timer);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function emitInstalled(deps = {}) {
|
|
146
|
+
return emitTelemetry("hive_installed", { dedupeKey: "hive_installed" }, deps);
|
|
147
|
+
}
|
|
148
|
+
async function emitUninstalled(deps = {}) {
|
|
149
|
+
return emitTelemetry("hive_uninstalled", {}, deps);
|
|
150
|
+
}
|
|
151
|
+
async function recordStartLifecycle(deps = {}) {
|
|
152
|
+
const version = deps.version ?? HIVE_VERSION;
|
|
153
|
+
const firstRun = await emitTelemetry("hive_first_run", { dedupeKey: "hive_first_run" }, deps);
|
|
154
|
+
if (firstRun.skipped === "disabled" || firstRun.skipped === "opted_out") {
|
|
155
|
+
return { firstRun, updated: null };
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
const stateDir = deps.stateDir ?? HIVE_STATE_DIR;
|
|
159
|
+
const lastSeen = loadLedger(stateDir).lastSeenVersion;
|
|
160
|
+
let updated = null;
|
|
161
|
+
if (lastSeen !== void 0 && lastSeen !== version) {
|
|
162
|
+
updated = await emitTelemetry("hive_updated", { dedupeKey: `hive_updated@${version}` }, deps);
|
|
163
|
+
}
|
|
164
|
+
const advance = lastSeen === void 0 || updated !== null && (updated.sent || updated.skipped === "already_reported");
|
|
165
|
+
if (advance) {
|
|
166
|
+
const fresh = loadLedger(stateDir);
|
|
167
|
+
saveLedger(stateDir, { ...fresh, lastSeenVersion: version });
|
|
168
|
+
}
|
|
169
|
+
return { firstRun, updated };
|
|
170
|
+
} catch {
|
|
171
|
+
return { firstRun, updated: null };
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
ALLOWED_PROPERTY_KEYS,
|
|
176
|
+
DEFAULT_EMIT_TIMEOUT_MS,
|
|
177
|
+
ENV_DO_NOT_TRACK,
|
|
178
|
+
ENV_TELEMETRY,
|
|
179
|
+
HIVE_STATE_DIR,
|
|
180
|
+
INSTALL_ID_FILENAME,
|
|
181
|
+
LEDGER_FILENAME,
|
|
182
|
+
POSTHOG_CAPTURE_PATH,
|
|
183
|
+
POSTHOG_HOST,
|
|
184
|
+
POSTHOG_KEY,
|
|
185
|
+
SHARED_INSTALL_ID_PATH,
|
|
186
|
+
buildAllowedProperties,
|
|
187
|
+
captureUrl,
|
|
188
|
+
emitInstalled,
|
|
189
|
+
emitTelemetry,
|
|
190
|
+
emitUninstalled,
|
|
191
|
+
isOptedOut,
|
|
192
|
+
loadLedger,
|
|
193
|
+
recordStartLifecycle,
|
|
194
|
+
resolveDistinctId,
|
|
195
|
+
saveLedger
|
|
196
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/telemetry/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE1E,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,OAAO,yBAAyB,KAAK,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC;AAElH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GACvB,OAAO,0BAA0B,KAAK,QAAQ,IAAI,0BAA0B,CAAC,MAAM,GAAG,CAAC;IACrF,CAAC,CAAC,0BAA0B;IAC5B,CAAC,CAAC,0BAA0B,CAAC;AAEjC,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAmB,CAAC;AAExD,8FAA8F;AAC9F,MAAM,UAAU,UAAU,CAAC,OAAe,YAAY;IACpD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,oBAAoB,EAAE,CAAC;AAC9D,CAAC;AAED,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,0FAA0F;A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AC;IACrC,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@legioncodeinc/hive",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Hive portal daemon",
|
|
5
|
+
"license": "AGPL-3.0-or-later",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"//publishConfig": "PRD-001c: minimum fix needed for a valid scoped-package publish, mirroring honeycomb/doctor. `access: public` is required because scoped packages default to restricted; `provenance` pairs with release.yaml's `id-token: write` OIDC identity.",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"provenance": true
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22"
|
|
14
|
+
},
|
|
15
|
+
"main": "dist/cli.js",
|
|
16
|
+
"bin": {
|
|
17
|
+
"hive": "dist/cli.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc && node esbuild.config.mjs",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"start": "node dist/cli.js start",
|
|
27
|
+
"prepack": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@hono/node-server": "^2.0.6",
|
|
31
|
+
"hono": "^4.12.27",
|
|
32
|
+
"react": "18.3.1",
|
|
33
|
+
"react-dom": "18.3.1",
|
|
34
|
+
"zod": "^4.4.3"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@testing-library/dom": "^10.4.1",
|
|
38
|
+
"@testing-library/react": "^16.3.2",
|
|
39
|
+
"@types/node": "^26.0.1",
|
|
40
|
+
"@types/react": "^18.3.31",
|
|
41
|
+
"@types/react-dom": "^18.3.7",
|
|
42
|
+
"esbuild": "^0.28.1",
|
|
43
|
+
"jsdom": "^29.1.1",
|
|
44
|
+
"typescript": "^6.0.3",
|
|
45
|
+
"vitest": "^4.1.9"
|
|
46
|
+
},
|
|
47
|
+
"allowScripts": {
|
|
48
|
+
"esbuild@0.28.1": true
|
|
49
|
+
}
|
|
50
|
+
}
|