import type { EnvVar } from "../internals/envfile.js"; /** * The Claude Code Analytics Admin API usage endpoint. The generated fetcher * targets this URL but never calls it at generation time — it is a tool the * operator runs on demand (see {@link fetchAnalyticsScript}). */ export declare const ANALYTICS_ENDPOINT = "https://api.anthropic.com/v1/organizations/usage_report/claude_code"; /** * The Claude Code Skill Usage Analytics Admin API endpoint (Enterprise plan). * Ranks which skills the org leans on most — the leads' #1 metric — which is why * the fetcher now queries it alongside {@link ANALYTICS_ENDPOINT}. Same contract: * operator-run, never called at generation time. */ export declare const SKILLS_ENDPOINT = "https://api.anthropic.com/v1/organizations/analytics/skills"; /** * Claude Code's telemetry event types — the OTel log-record names the collector * and any downstream backend key off of, stored as bare suffixes (the wire name * is `claude_code.`). Mirrors the Events section of * code.claude.com/docs/en/monitoring-usage in published order, so the generated * operator doc stays byte-stable. `skill_activated` is the per-skill usage * signal the org analytics work keys on. */ export declare const EVENT_TYPES: readonly ["user_prompt", "tool_result", "api_request", "api_error", "api_refusal", "api_request_body", "api_response_body", "tool_decision", "permission_mode_changed", "auth", "mcp_server_connection", "internal_error", "plugin_installed", "plugin_loaded", "skill_activated", "at_mention", "api_retries_exhausted", "hook_registered", "hook_execution_start", "hook_execution_complete", "hook_plugin_metrics", "compaction", "feedback_survey"]; /** * Opt-in switches for the two privacy-sensitive telemetry streams. Both default * to OFF: raw prompt bodies and tool inputs/outputs routinely carry source code, * customer data, ticket details, and secrets, so the harness must not export them * unless an operator explicitly asks. The collector's redaction is regex-based and * cannot reliably scrub free-form PII, so default-off is the only safe posture. */ export interface OtelLoggingOptions { /** Export full user-prompt bodies (`OTEL_LOG_USER_PROMPTS`). */ logPrompts?: boolean; /** Export full tool inputs/outputs (`OTEL_LOG_TOOL_DETAILS`). */ logToolDetails?: boolean; } export declare function normalizeOtelEndpoint(endpoint: string, fallback?: string): string; /** * OpenTelemetry environment for Claude Code, exported into the shell profile. * Faithful to the blueprint: gRPC OTLP transport to `endpoint`, the metrics and * logs exporters both pinned to `otlp` (Claude Code exports nothing without them * — both default to off), and the master telemetry switch on. Prompt- and * tool-detail logging are **off by default** (privacy-first); they flip on only * when `logging.logPrompts` / `logging.logToolDetails` are set — see * {@link OtelLoggingOptions}. Order is deterministic so the managed block is * byte-stable across runs. */ export declare function otelEnvVars(endpoint: string, logging?: OtelLoggingOptions): EnvVar[]; /** * A hand-written Bindplane/OpenTelemetry Collector config. No YAML library is * used (and none is available), so the document is assembled deterministically * from string fragments. The pipeline redacts secrets and PII before anything * leaves the host: * * - `receivers.otlp` accepts the agent's gRPC + HTTP OTLP feed; * - `processors.redaction` blocks values matching common secret/PII shapes and * `processors.attributes` drops known-sensitive keys outright; * - `exporters.otlphttp` forwards the scrubbed signal to the backend; * - `service.pipelines` wires traces/metrics/logs through the scrubbers. */ export declare function collectorYaml(endpoint: string): string; /** * A standalone Node ESM script that *would* query the Claude Code Analytics * Admin API. It reads `ANTHROPIC_ADMIN_KEY` from the environment and by default * only PRINTS the equivalent `curl` commands — it does not call the API. A live * fetch happens only when the operator passes `--run`, so generating this file * never touches the network. On `--run` it queries BOTH the usage report and the * skill-usage endpoint and emits `{ usage_report, skills }` — the exact shape * `aih report --org ` reads. */ export declare function fetchAnalyticsScript(): string;