feat: implement app-side telemetry sender

Add the shared telemetry sender, wire the CLI/server emit points,
and cover the config and completion behavior with tests.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta 2026-03-31 08:08:18 -05:00
parent ca5659f734
commit 34044cdfce
29 changed files with 670 additions and 5 deletions

View file

@ -0,0 +1,49 @@
import type { TelemetryClient } from "./client.js";
export function trackInstallStarted(client: TelemetryClient, dims: { setupMode: string }): void {
client.track("install.started", dims);
}
export function trackInstallCompleted(
client: TelemetryClient,
dims: { setupMode: string; dbMode: string; deploymentMode: string },
): void {
client.track("install.completed", dims);
}
export function trackCompanyImported(
client: TelemetryClient,
dims: { sourceType: string; sourceRef: string; isPrivate: boolean },
): void {
const ref = dims.isPrivate ? client.hashPrivateRef(dims.sourceRef) : dims.sourceRef;
client.track("company.imported", {
sourceType: dims.sourceType,
sourceRef: ref,
sourceRefHashed: dims.isPrivate,
});
}
export function trackAgentFirstHeartbeat(
client: TelemetryClient,
dims: { adapterType: string },
): void {
client.track("agent.first_heartbeat", dims);
}
export function trackAgentTaskCompleted(
client: TelemetryClient,
dims: { adapterType: string },
): void {
client.track("agent.task_completed", dims);
}
export function trackErrorHandlerCrash(
client: TelemetryClient,
dims: { errorName: string; route: string; method: string },
): void {
client.track("error.handler_crash", {
errorName: dims.errorName,
route: dims.route,
method: dims.method,
});
}