YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
ui(settings): move admin team API token to Privacy → Security
Louis Beaumont280cb2985180
diff --git a/apps/screenpipe-app-tauri/components/settings/general-settings.tsx b/apps/screenpipe-app-tauri/components/settings/general-settings.tsxindex 5afbde025..94967f4a1 100644--- a/apps/screenpipe-app-tauri/components/settings/general-settings.tsx+++ b/apps/screenpipe-app-tauri/components/settings/general-settings.tsx@@ -10,7 +10,7 @@ import { Switch } from "@/components/ui/switch";import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";import { Label } from "@/components/ui/label";import { Separator } from "@/components/ui/separator";-import { Rocket, Moon, Sun, Monitor, FlaskConical, Shield, ExternalLink, Layers, RefreshCw, MessageSquare, Sparkles } from "lucide-react";+import { Rocket, Moon, Sun, Monitor, FlaskConical, ExternalLink, Layers, RefreshCw, MessageSquare, Sparkles } from "lucide-react";import { HelpTooltip } from "@/components/ui/help-tooltip";import { useToast } from "@/components/ui/use-toast";import { Button } from "@/components/ui/button";@@ -153,8 +153,6 @@ export default function GeneralSettings() {</CardContent></Card>- {isEnterprise && <EnterpriseAdminTokenCard />}-<Card className="border-border bg-card"><CardContent className="px-3 py-2.5"><div className="flex items-center justify-between">@@ -252,153 +250,3 @@ export default function GeneralSettings() {);}-/**- * Admin API token card — only rendered in enterprise builds.- *- * Background: org-wide team-query auth has two intentionally separate- * pieces. `license_key` is org-level and lives on every employee's- * machine (deployed by IT). `team_api_token` is per-admin: it grants- * the `read:devices` / `read:search` / `read:records` scopes and is- * what the `screenpipe-team` pi skill curls v1 endpoints with. An- * admin mints one at https://screenpi.pe/enterprise?tab=tokens, pastes- * it here once, and the desktop persists it to- * ~/.screenpipe/enterprise.json so the next pi-agent boot can install- * the skill. Revoke from the same dashboard page to kill team access.- *- * Loads the current token (server returns nothing sensitive — just- * presence) and shows the first/last few chars so the admin can tell- * "yes I have one configured" without us round-tripping the plaintext.- */-function EnterpriseAdminTokenCard() {- const { toast } = useToast();- const [token, setToken] = useState("");- const [hasExisting, setHasExisting] = useState(false);- const [saving, setSaving] = useState(false);-- useEffect(() => {- (async () => {- try {- const cur = await commands.getEnterpriseTeamApiToken();- setHasExisting(Boolean(cur && cur.length > 0));- } catch {- /* command may not exist yet on older binaries — silent */- }- })();- }, []);-- const handleSave = async () => {- const trimmed = token.trim();- if (!trimmed) {- toast({ title: "paste a token first" });- return;- }- if (!trimmed.startsWith("sk_ent_")) {- toast({- title: "that doesn't look like an admin token",- description: "expected format: sk_ent_...",- });- return;- }- setSaving(true);- try {- const res = await commands.saveEnterpriseTeamConfig(null, null, trimmed);- if (res.status === "error") throw new Error(res.error);- setHasExisting(true);- setToken("");- toast({- title: "admin token saved",- description:- "restart the app to install the screenpipe-team skill for the pi agent.",- });- } catch (e) {- toast({- title: "failed to save",- description: e instanceof Error ? e.message : String(e),- });- } finally {- setSaving(false);- }- };-- const handleClear = async () => {- setSaving(true);- try {- // Passing an empty string clears the field (see- // save_enterprise_team_config implementation in commands.rs).- const res = await commands.saveEnterpriseTeamConfig(null, null, "");- if (res.status === "error") throw new Error(res.error);- setHasExisting(false);- setToken("");- toast({ title: "admin token cleared" });- } catch (e) {- toast({- title: "failed to clear",- description: e instanceof Error ? e.message : String(e),- });- } finally {- setSaving(false);- }- };-- return (- <Card className="border-border bg-card">- <CardContent className="px-3 py-2.5 space-y-2">- <div className="flex items-center space-x-2.5">- <Shield className="h-4 w-4 text-muted-foreground shrink-0" />- <div className="flex-1 min-w-0">- <h3 className="text-sm font-medium text-foreground">- Admin API token- </h3>- <p className="text-xs text-muted-foreground">- Lets the pi agent query org-wide team data. Mint at{" "}- <button- className="underline text-foreground hover:text-foreground/80"- onClick={() =>- openUrl("https://screenpi.pe/enterprise?tab=tokens")- }- >- screenpi.pe/enterprise → api tokens- </button>{" "}- with scopes read:devices, read:search, read:records.- </p>- </div>- {hasExisting && (- <span className="text-[10px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 shrink-0">- configured- </span>- )}- </div>- <div className="flex items-center gap-2">- <input- type="password"- value={token}- onChange={(e) => setToken(e.target.value)}- placeholder={hasExisting ? "sk_ent_… (replace)" : "sk_ent_…"}- className="flex-1 h-7 px-2 text-xs font-mono rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring"- spellCheck={false}- autoComplete="off"- />- <Button- size="sm"- disabled={saving || !token.trim()}- onClick={handleSave}- className="h-7 text-xs"- >- save- </Button>- {hasExisting && (- <Button- size="sm"- variant="outline"- disabled={saving}- onClick={handleClear}- className="h-7 text-xs"- >- clear- </Button>- )}- </div>- </CardContent>- </Card>- );-}diff --git a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsxindex 1c9a195d1..436aefac1 100644--- a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx@@ -32,6 +32,8 @@ import { MultiSelect } from "@/components/ui/multi-select";import { useSettings, Settings } from "@/lib/hooks/use-settings";import { ScheduleSettings } from "./schedule-settings";import { useTeam } from "@/lib/hooks/use-team";+import { useIsEnterpriseBuild } from "@/lib/hooks/use-is-enterprise-build";+import { open as openUrl } from "@tauri-apps/plugin-shell";import { useToast } from "@/components/ui/use-toast";import { useSqlAutocomplete } from "@/lib/hooks/use-sql-autocomplete";import { commands } from "@/lib/utils/tauri";@@ -209,6 +211,7 @@ export function PrivacySection() {const { settings, updateSettings } = useSettings();const team = useTeam();const isTeamAdmin = !!team.team && team.role === "admin";+ const isEnterprise = useIsEnterpriseBuild();const { toast } = useToast();const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);@@ -753,6 +756,8 @@ export function PrivacySection() {</Card></LockedSetting>+ {isEnterprise && <AdminTeamTokenCard />}+{/* LAN access — off by default. Toggling on force-enables api_auth(the backend mirrors this guard in RecordingConfig::from_settingsso the API is never exposed to the network unauthenticated). */}@@ -1624,3 +1629,217 @@ export function PrivacySection() {</div>);}++/**+ * Admin team API token — enterprise builds only.+ *+ * Org-wide team-query auth has two intentionally separate pieces:+ * `license_key` is org-level (every employee's machine, deployed by IT);+ * `team_api_token` is per-admin and grants the `read:devices` /+ * `read:search` / `read:records` scopes that the `screenpipe-team` pi+ * skill calls v1 endpoints with. An admin mints one at+ * https://screenpi.pe/enterprise?tab=tokens, pastes it here, and the+ * desktop persists it to ~/.screenpipe/enterprise.json. Every new pi+ * chat reads that file at boot and (un)installs the skill accordingly —+ * no app restart needed, just open a new chat. Revoke from the same+ * dashboard page to kill team access immediately.+ *+ * UX mirrors the local API key card above (Input + Eye reveal + Copy).+ */+function AdminTeamTokenCard() {+ const { toast } = useToast();+ const [liveToken, setLiveToken] = useState<string | null>(null);+ const [revealToken, setRevealToken] = useState(false);+ const [pendingToken, setPendingToken] = useState<string | null>(null);+ const [saving, setSaving] = useState(false);++ const reload = useCallback(async () => {+ try {+ const cur = await commands.getEnterpriseTeamApiToken();+ setLiveToken(cur ?? null);+ } catch {+ setLiveToken(null);+ }+ }, []);++ useEffect(() => {+ void reload();+ }, [reload]);++ const handleSave = useCallback(async () => {+ const trimmed = (pendingToken ?? "").trim();+ if (!trimmed) {+ toast({ title: "paste a token first" });+ return;+ }+ if (!trimmed.startsWith("sk_ent_")) {+ toast({+ title: "that doesn't look like an admin token",+ description: "expected format: sk_ent_…",+ });+ return;+ }+ setSaving(true);+ try {+ const res = await commands.saveEnterpriseTeamConfig(null, null, trimmed);+ if (res.status === "error") throw new Error(res.error);+ setLiveToken(trimmed);+ setPendingToken(null);+ toast({+ title: "admin token saved",+ description: "open a new pi chat to use it — no app restart needed",+ });+ } catch (e) {+ toast({+ title: "failed to save",+ description: e instanceof Error ? e.message : String(e),+ variant: "destructive",+ });+ } finally {+ setSaving(false);+ }+ }, [pendingToken, toast]);++ const handleClear = useCallback(async () => {+ setSaving(true);+ try {+ const res = await commands.saveEnterpriseTeamConfig(null, null, "");+ if (res.status === "error") throw new Error(res.error);+ setLiveToken(null);+ setPendingToken(null);+ setRevealToken(false);+ toast({ title: "admin token cleared" });+ } catch (e) {+ toast({+ title: "failed to clear",+ description: e instanceof Error ? e.message : String(e),+ variant: "destructive",+ });+ } finally {+ setSaving(false);+ }+ }, [toast]);++ const displayValue =+ pendingToken !== null+ ? pendingToken+ : liveToken+ ? revealToken+ ? liveToken+ : "•".repeat(Math.min(liveToken.length, 32))+ : "";+ const hasPending = pendingToken !== null && pendingToken !== (liveToken ?? "");++ return (+ <Card className="border-border bg-card">+ <CardContent className="px-3 py-2.5">+ <div className="flex items-center justify-between">+ <div className="flex items-center space-x-2.5">+ <Shield className="h-4 w-4 text-muted-foreground shrink-0" />+ <div>+ <h3 className="text-sm font-medium text-foreground">+ Admin Team API Token+ </h3>+ <p className="text-xs text-muted-foreground mt-0.5">+ Lets the pi agent query org-wide team data (devices, search,+ records). Mint at{" "}+ <button+ className="underline text-foreground hover:text-foreground/80"+ onClick={() =>+ openUrl("https://screenpi.pe/enterprise?tab=tokens")+ }+ >+ screenpi.pe/enterprise → api tokens+ </button>+ .+ </p>+ </div>+ </div>+ </div>+ <div className="mt-2.5 flex items-center space-x-2.5 pl-6.5">+ <Input+ type="text"+ readOnly={!revealToken && pendingToken === null}+ placeholder="sk_ent_…"+ data-testid="privacy-admin-token-input"+ value={displayValue}+ onChange={(e) => {+ if (!revealToken && pendingToken === null) return;+ setPendingToken(e.target.value);+ }}+ onKeyDown={(e) => {+ if (e.key === "Enter" && hasPending) {+ void handleSave();+ }+ }}+ onClick={(e) => (e.target as HTMLInputElement).select()}+ className="h-8 text-xs font-mono cursor-text select-all"+ />+ <Button+ variant="outline"+ size="sm"+ className="h-8 px-2 shrink-0"+ title={revealToken ? "Hide token" : "Reveal token"}+ onClick={() => {+ setRevealToken((v) => !v);+ if (pendingToken === null && liveToken) setPendingToken(liveToken);+ }}+ disabled={!liveToken && pendingToken === null}+ data-testid="privacy-admin-token-reveal"+ >+ {revealToken ? <EyeOff className="h-3.5 w-3.5" /> : <Eye className="h-3.5 w-3.5" />}+ </Button>+ <Button+ variant="outline"+ size="sm"+ className="h-8 px-2 shrink-0"+ title="Copy token"+ disabled={!liveToken}+ data-testid="privacy-admin-token-copy"+ onClick={async () => {+ if (!liveToken) return;+ try {+ await navigator.clipboard.writeText(liveToken);+ } catch {+ const el = document.createElement("textarea");+ el.value = liveToken;+ el.style.position = "fixed";+ el.style.opacity = "0";+ document.body.appendChild(el);+ el.select();+ document.execCommand("copy");+ document.body.removeChild(el);+ }+ toast({ title: "admin token copied to clipboard" });+ }}+ >+ <Copy className="h-3.5 w-3.5" />+ </Button>+ {hasPending && (+ <Button+ size="sm"+ className="h-8 text-xs"+ disabled={saving}+ onClick={handleSave}+ data-testid="privacy-admin-token-save"+ >+ save+ </Button>+ )}+ {!hasPending && liveToken && (+ <Button+ size="sm"+ variant="outline"+ className="h-8 text-xs"+ disabled={saving}+ onClick={handleClear}+ data-testid="privacy-admin-token-clear"+ >+ clear+ </Button>+ )}+ </div>+ </CardContent>+ </Card>+ );+}diff --git a/crates/screenpipe-core/assets/skills/screenpipe-team/SKILL.md b/crates/screenpipe-core/assets/skills/screenpipe-team/SKILL.mdindex b0685838a..cf0b771bd 100644--- a/crates/screenpipe-core/assets/skills/screenpipe-team/SKILL.md+++ b/crates/screenpipe-core/assets/skills/screenpipe-team/SKILL.md@@ -9,7 +9,7 @@ Query the customer's team telemetry. Data lives in the customer's own Azure Blob## Auth-The skill authenticates with an **enterprise admin API token** the admin minted once on `https://screenpi.pe/enterprise?tab=tokens` (with scopes `read:devices`, `read:search`, `read:records`) and pasted into Settings → Enterprise → Admin API token. The desktop stored it in `~/.screenpipe/enterprise.json` under `team_api_token`.+The skill authenticates with an **enterprise admin API token** the admin minted once on `https://screenpi.pe/enterprise?tab=tokens` (with scopes `read:devices`, `read:search`, `read:records`) and pasted into Settings → Privacy → Admin Team API Token. The desktop stored it in `~/.screenpipe/enterprise.json` under `team_api_token`.License-key + token are intentionally separate concerns:- `license_key` proves *which org* this machine belongs to (deployed by IT, same on every employee's device).@@ -26,7 +26,7 @@ If `TEAM_TOKEN` is empty / null, tell the user verbatim:> I need an admin API token to query team data. Open> https://screenpi.pe/enterprise?tab=tokens, create one with the> `read:devices`, `read:search`, `read:records` scopes, then paste it-> into Settings → Enterprise → Admin API token. Token can be rotated+> into Settings → Privacy → Admin Team API Token. Token can be rotated> or revoked any time from the same page.Then stop. Don't try to call the endpoints.