Skip to content

armgit / crm

Public Imported from GitHub
0

Comp AI CRM is an open source, CRM designed for AI agents. Agentic-first CRM.

TypeScript

Remove telemetry-related components and references from the application

Lewis Carhartaba07b5ec716
diff --git a/.env.example b/.env.example
index 2b8fcda6..738995cc 100644
--- a/.env.example
+++ b/.env.example
@@ -150,8 +150,8 @@ GOOGLE_CLIENT_SECRET=""
# amount, prompt or key is ever sent, and neither is your IP: every event
# carries $ip: null with geoip off.
#
-# Settings → Telemetry shows your install ID and the full list either way.
-# docs/telemetry.md is the same list with every property named.
+# docs/telemetry.md names every event and every property that is sent, and
+# lists what never is.
# Turn it off. "1" is the whole interface, and DO_NOT_TRACK=1 does the same.
# When either is set no client is created, so nothing can be sent later.
diff --git a/apps/api/src/generated/server.ts b/apps/api/src/generated/server.ts
index 26410a91..69becaec 100644
--- a/apps/api/src/generated/server.ts
+++ b/apps/api/src/generated/server.ts
@@ -35,7 +35,6 @@ import type { GoogleRouter } from "../google/google.router";
import type { SearchRouter } from "../search/search.router";
import type { SettingsRouter } from "../settings/settings.router";
import type { SsoRouter } from "../sso/sso.router";
-import type { TelemetryRouter } from "../telemetry/telemetry.router";
import type { UsersRouter } from "../users/users.router";
import type { WorkspaceRouter } from "../workspace/workspace.router";
@@ -219,10 +218,6 @@ const appRouter = t.router({
.input(deleteSsoProviderInput)
.mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<SsoRouter["remove"]>>)
}),
- telemetry: t.router({
- status: publicProcedure
- .query(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<TelemetryRouter["status"]>>)
- }),
users: t.router({
me: publicProcedure
.query(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<UsersRouter["me"]>>),
diff --git a/apps/api/src/telemetry/telemetry.module.ts b/apps/api/src/telemetry/telemetry.module.ts
index 5b0e96b5..e4b62f26 100644
--- a/apps/api/src/telemetry/telemetry.module.ts
+++ b/apps/api/src/telemetry/telemetry.module.ts
@@ -1,15 +1,12 @@
import { Module } from "@nestjs/common";
-import { TrpcModule } from "../trpc/trpc.module";
import { FunnelService } from "./funnel.service";
import { RollupService } from "./rollup.service";
import { TelemetryController } from "./telemetry.controller";
-import { TelemetryRouter } from "./telemetry.router";
import { TelemetryService } from "./telemetry.service";
@Module({
- imports: [TrpcModule],
controllers: [TelemetryController],
- providers: [FunnelService, RollupService, TelemetryService, TelemetryRouter],
+ providers: [FunnelService, RollupService, TelemetryService],
exports: [TelemetryService],
})
export class TelemetryModule {}
diff --git a/apps/api/src/telemetry/telemetry.router.ts b/apps/api/src/telemetry/telemetry.router.ts
deleted file mode 100644
index d4c1d213..00000000
--- a/apps/api/src/telemetry/telemetry.router.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Inject } from "@nestjs/common";
-import { Query, Router, UseMiddlewares } from "nestjs-trpc";
-import { AuthMiddleware } from "../trpc/middlewares/auth.middleware";
-import { TelemetryService } from "./telemetry.service";
-
-@Router({ alias: "telemetry" })
-@UseMiddlewares(AuthMiddleware)
-export class TelemetryRouter {
- constructor(
- @Inject(TelemetryService) private readonly telemetry: TelemetryService,
- ) {}
-
- @Query()
- async status() {
- return this.telemetry.status();
- }
-}
diff --git a/apps/api/src/telemetry/telemetry.service.ts b/apps/api/src/telemetry/telemetry.service.ts
index 8a0c530d..67cda045 100644
--- a/apps/api/src/telemetry/telemetry.service.ts
+++ b/apps/api/src/telemetry/telemetry.service.ts
@@ -2,7 +2,6 @@ import {
crmVersion,
flushTelemetry,
onTelemetryProblem,
- readInstall,
shutdownTelemetry,
syncVersion,
telemetryDisabled,
@@ -41,22 +40,6 @@ export class TelemetryService implements OnModuleInit, OnApplicationShutdown {
void this.funnel.sweep().catch(() => {});
}
- async status(): Promise<{
- enabled: boolean;
- installId: string | null;
- crmVersion: string | null;
- lastSentAt: string | null;
- }> {
- const install = await readInstall();
-
- return {
- enabled: !telemetryDisabled(),
- installId: install?.uuid ?? null,
- crmVersion: install?.version ?? null,
- lastSentAt: install?.lastRollupAt?.toISOString() ?? null,
- };
- }
-
async onApplicationShutdown(): Promise<void> {
await flushTelemetry();
await shutdownTelemetry();
diff --git a/apps/app/app/(app)/[slug]/settings/settings-sidebar.tsx b/apps/app/app/(app)/[slug]/settings/settings-sidebar.tsx
index fde91357..062c2bc6 100644
--- a/apps/app/app/(app)/[slug]/settings/settings-sidebar.tsx
+++ b/apps/app/app/(app)/[slug]/settings/settings-sidebar.tsx
@@ -20,7 +20,6 @@ const ITEMS: SettingsNavItem[] = [
{ title: "Members", href: `${ROOT}/members` },
{ title: "SSO", href: `${ROOT}/sso` },
{ title: "Connections", href: `${ROOT}/connections` },
- { title: "Telemetry", href: `${ROOT}/telemetry` },
];
function isActive(href: string, root: string, pathname: string): boolean {
diff --git a/apps/app/app/(app)/[slug]/settings/telemetry/page.tsx b/apps/app/app/(app)/[slug]/settings/telemetry/page.tsx
deleted file mode 100644
index f3b01d8a..00000000
--- a/apps/app/app/(app)/[slug]/settings/telemetry/page.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import type { Metadata } from "next";
-import { Suspense } from "react";
-import {
- PageShell,
- PageShellContent,
- PageShellDescription,
- PageShellHeader,
- PageShellHeading,
- PageShellLoading,
- PageShellTitle,
-} from "@/components/page-shell";
-import { requireSession } from "@/lib/session";
-import { HydrateClient } from "@/lib/trpc/hydrate";
-import { getServerQueryClient, getServerTrpc } from "@/lib/trpc/server";
-import { TelemetryStatus } from "./telemetry-status";
-
-export const metadata: Metadata = {
- title: "Telemetry",
-};
-
-export default function TelemetrySettingsPage() {
- return (
- <PageShell>
- <PageShellHeader>
- <PageShellHeading>
- <PageShellTitle>Telemetry</PageShellTitle>
- <PageShellDescription>
- What this install reports about itself, and what it never will.
- </PageShellDescription>
- </PageShellHeading>
- </PageShellHeader>
-
- <PageShellContent>
- <Suspense fallback={<PageShellLoading />}>
- <Telemetry />
- </Suspense>
- </PageShellContent>
- </PageShell>
- );
-}
-
-async function Telemetry() {
- await requireSession();
-
- const trpc = getServerTrpc();
- const queryClient = getServerQueryClient();
-
- await queryClient.prefetchQuery(trpc.telemetry.status.queryOptions());
-
- return (
- <HydrateClient>
- <div className="flex max-w-3xl flex-col gap-6">
- <TelemetryStatus />
- </div>
- </HydrateClient>
- );
-}
diff --git a/apps/app/app/(app)/[slug]/settings/telemetry/telemetry-status.tsx b/apps/app/app/(app)/[slug]/settings/telemetry/telemetry-status.tsx
deleted file mode 100644
index 292907ac..00000000
--- a/apps/app/app/(app)/[slug]/settings/telemetry/telemetry-status.tsx
+++ /dev/null
@@ -1,134 +0,0 @@
-"use client";
-
-import {
- Card,
- CardAction,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
-} from "@crm/ui/components/card";
-import { StatusIndicator } from "@crm/ui/components/status-indicator";
-import { relativeTimeFromIso } from "@crm/ui/lib/format";
-import { useQuery } from "@tanstack/react-query";
-import { useTRPC } from "@/lib/trpc/client";
-
-const SENT = [
- "A single daily count of what exists: how many contacts, companies, deals and activities, in bands rather than exact numbers.",
- "Which of the agent's tools were called and how often, how many research sessions finished, and how many gave up.",
- "How the evidence ledger behaved: how many facts were applied, proposed or dismissed, and how long suggestions waited for a decision.",
- "Which optional keys are set — yes or no, never the values — the model you chose, your Node and Postgres versions, and this install's version.",
- "When something failed: the error's class and the tool or route it came from.",
-];
-
-const NEVER_SENT = [
- "Any name, email address, job title or photograph, of a contact or of you.",
- "Any company name, domain, industry or location.",
- "The content of a fact, a brief, a workspace profile, or anything the agent wrote about a person.",
- "Email subjects and bodies, meeting titles, attendees, deal names and deal amounts.",
- "Any prompt, completion, reasoning trace or agent conversation.",
- "Any key, secret, token or connection string — and your IP address, which is discarded rather than recorded.",
-];
-
-function List({ items }: { items: readonly string[] }) {
- return (
- <ul className="flex list-disc flex-col gap-2 pl-4 text-muted-foreground text-sm">
- {items.map((item) => (
- <li key={item}>{item}</li>
- ))}
- </ul>
- );
-}
-
-export function TelemetryStatus() {
- const trpc = useTRPC();
- const status = useQuery(trpc.telemetry.status.queryOptions());
-
- const enabled = status.data?.enabled ?? false;
-
- return (
- <div className="flex flex-col gap-6">
- <Card>
- <CardHeader>
- <CardTitle>Anonymous usage telemetry</CardTitle>
- <CardDescription>
- This repository is cloned rather than installed, so there is no
- other way to know which parts of it earn their place. Counts only,
- once a day, tied to a random identifier and nothing else.
- </CardDescription>
-
- <CardAction>
- <StatusIndicator
- size="sm"
- tone={enabled ? "success" : "neutral"}
- label={enabled ? "On" : "Off"}
- />
- </CardAction>
- </CardHeader>
-
- <CardContent className="flex flex-col gap-4">
- <dl className="grid gap-3 text-sm sm:grid-cols-3">
- <div className="flex flex-col gap-1">
- <dt className="text-muted-foreground text-xs">Install ID</dt>
- <dd className="font-mono text-xs">
- {status.data?.installId ?? "—"}
- </dd>
- </div>
-
- <div className="flex flex-col gap-1">
- <dt className="text-muted-foreground text-xs">Version</dt>
- <dd className="font-mono text-xs">
- {status.data?.crmVersion ?? "—"}
- </dd>
- </div>
-
- <div className="flex flex-col gap-1">
- <dt className="text-muted-foreground text-xs">Last sent</dt>
- <dd className="text-xs">
- {status.data?.lastSentAt
- ? relativeTimeFromIso(status.data.lastSentAt)
- : "Never"}
- </dd>
- </div>
- </dl>
-
- <p className="text-muted-foreground text-sm">
- To turn it off, set{" "}
- <code className="font-mono text-xs">CRM_TELEMETRY_DISABLED=1</code>{" "}
- in the root <code className="font-mono text-xs">.env</code> file and
- restart. <code className="font-mono text-xs">DO_NOT_TRACK=1</code>{" "}
- does the same. Nothing is sent while either is set, and no client is
- left running to send it later.
- </p>
- </CardContent>
- </Card>
-
- <Card>
- <CardHeader>
- <CardTitle>What is sent</CardTitle>
- <CardDescription>
- Every property is on a list in the source, and anything not on that
- list is dropped before the event is built.
- </CardDescription>
- </CardHeader>
-
- <CardContent>
- <List items={SENT} />
- </CardContent>
- </Card>
-
- <Card>
- <CardHeader>
- <CardTitle>What is never sent</CardTitle>
- <CardDescription>
- None of this leaves your database, whether telemetry is on or off.
- </CardDescription>
- </CardHeader>
-
- <CardContent>
- <List items={NEVER_SENT} />
- </CardContent>
- </Card>
- </div>
- );
-}
diff --git a/docs/telemetry.md b/docs/telemetry.md
index c3c57b06..c1900578 100644
--- a/docs/telemetry.md
+++ b/docs/telemetry.md
@@ -4,7 +4,8 @@ What this install reports about itself, in full. The decisions behind it are in
`adrs/telemetry.md`; this file is the list.
**Turn it off** with `CRM_TELEMETRY_DISABLED="1"` or `DO_NOT_TRACK=1` in the root `.env`, then
-restart. Settings → Telemetry shows your install ID and the same lists in the app.
+restart. This file is the full account of what is sent; there is no settings page for it, so
+this is the thing to read.
**Where it goes** is not configurable and deliberately so: the project key and host are constants
in `packages/telemetry/src/client.ts`. A `phc_` key is write-only — it sends events and reads