@copilotkit/web-inspector 1.69.1 → 1.69.2
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/dist/index.cjs +36 -634
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -44
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -44
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +39 -634
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +85 -1253
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/inspector-nav.cjs +0 -1
- package/dist/lib/inspector-nav.cjs.map +1 -1
- package/dist/lib/inspector-nav.mjs +0 -1
- package/dist/lib/inspector-nav.mjs.map +1 -1
- package/dist/lib/telemetry.cjs +1 -19
- package/dist/lib/telemetry.cjs.map +1 -1
- package/dist/lib/telemetry.d.cts.map +1 -1
- package/dist/lib/telemetry.d.mts.map +1 -1
- package/dist/lib/telemetry.mjs +2 -18
- package/dist/lib/telemetry.mjs.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/styles/generated.cjs +1 -1
- package/dist/styles/generated.cjs.map +1 -1
- package/dist/styles/generated.mjs +1 -1
- package/dist/styles/generated.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/lib/event-snippets.cjs +0 -559
- package/dist/lib/event-snippets.cjs.map +0 -1
- package/dist/lib/event-snippets.d.cts +0 -61
- package/dist/lib/event-snippets.d.cts.map +0 -1
- package/dist/lib/event-snippets.d.mts +0 -61
- package/dist/lib/event-snippets.d.mts.map +0 -1
- package/dist/lib/event-snippets.mjs +0 -537
- package/dist/lib/event-snippets.mjs.map +0 -1
- package/dist/lib/inspector-nav.d.cts +0 -11
- package/dist/lib/inspector-nav.d.cts.map +0 -1
- package/dist/lib/inspector-nav.d.mts +0 -11
- package/dist/lib/inspector-nav.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspector-nav.cjs","names":[],"sources":["../../src/lib/inspector-nav.ts"],"sourcesContent":["import type { InspectorLeafKey } from \"./telemetry.js\";\n\nexport type ShellGroupKey = \"home\" | \"workbench\" | \"inspect\";\n\nexport const INSPECTOR_GROUPS = {\n home: [\"home\", \"whats-new\"],\n workbench: [\"playground\", \"threads\", \"memories\"],\n inspect: [\n \"agents\",\n \"ag-ui-events\",\n \"
|
|
1
|
+
{"version":3,"file":"inspector-nav.cjs","names":[],"sources":["../../src/lib/inspector-nav.ts"],"sourcesContent":["import type { InspectorLeafKey } from \"./telemetry.js\";\n\nexport type ShellGroupKey = \"home\" | \"workbench\" | \"inspect\";\n\nexport const INSPECTOR_GROUPS = {\n home: [\"home\", \"whats-new\"],\n workbench: [\"playground\", \"threads\", \"memories\"],\n inspect: [\n \"agents\",\n \"ag-ui-events\",\n \"frontend-tools\",\n \"capabilities\",\n \"agent-context\",\n ],\n} as const satisfies Record<ShellGroupKey, readonly InspectorLeafKey[]>;\n\nexport type InspectorNavGroupKey = keyof typeof INSPECTOR_GROUPS;\nexport type MenuKey = (typeof INSPECTOR_GROUPS)[InspectorNavGroupKey][number];\n\nexport const INSPECTOR_MENU_KEYS: ReadonlyArray<MenuKey> = [\n ...INSPECTOR_GROUPS.home,\n ...INSPECTOR_GROUPS.workbench,\n ...INSPECTOR_GROUPS.inspect,\n];\n\nexport const INSPECTOR_NAV_SECTIONS: ReadonlyArray<{\n group: InspectorNavGroupKey;\n label: string | null;\n}> = [\n { group: \"home\", label: null },\n { group: \"workbench\", label: \"Workbench\" },\n { group: \"inspect\", label: \"Inspect\" },\n];\n\nexport const ICON_RAIL_MAX_WIDTH_PX = 720;\n\n/** Return whether persisted state names a known Inspector leaf. */\nexport function isInspectorMenuKey(value: unknown): value is MenuKey {\n return (\n typeof value === \"string\" &&\n INSPECTOR_MENU_KEYS.some((menuKey) => menuKey === value)\n );\n}\n\n/** Return the sidebar group that owns a leaf. */\nexport function getGroupForMenu(key: MenuKey): InspectorNavGroupKey {\n for (const group of Object.keys(INSPECTOR_GROUPS) as InspectorNavGroupKey[]) {\n if (INSPECTOR_GROUPS[group].some((menuKey) => menuKey === key)) {\n return group;\n }\n }\n\n return \"workbench\";\n}\n\n/** Return whether the sidebar should collapse to an icon rail. */\nexport function shouldUseIconRail(args: {\n dockedLeft: boolean;\n width: number;\n}): boolean {\n return args.dockedLeft || args.width < ICON_RAIL_MAX_WIDTH_PX;\n}\n"],"mappings":";;AAIA,MAAa,mBAAmB;CAC9B,MAAM,CAAC,QAAQ,YAAY;CAC3B,WAAW;EAAC;EAAc;EAAW;EAAW;CAChD,SAAS;EACP;EACA;EACA;EACA;EACA;EACD;CACF;AAKD,MAAa,sBAA8C;CACzD,GAAG,iBAAiB;CACpB,GAAG,iBAAiB;CACpB,GAAG,iBAAiB;CACrB;AAED,MAAa,yBAGR;CACH;EAAE,OAAO;EAAQ,OAAO;EAAM;CAC9B;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAW,OAAO;EAAW;CACvC;AAED,MAAa,yBAAyB;;AAGtC,SAAgB,mBAAmB,OAAkC;AACnE,QACE,OAAO,UAAU,YACjB,oBAAoB,MAAM,YAAY,YAAY,MAAM;;;AAK5D,SAAgB,gBAAgB,KAAoC;AAClE,MAAK,MAAM,SAAS,OAAO,KAAK,iBAAiB,CAC/C,KAAI,iBAAiB,OAAO,MAAM,YAAY,YAAY,IAAI,CAC5D,QAAO;AAIX,QAAO;;;AAIT,SAAgB,kBAAkB,MAGtB;AACV,QAAO,KAAK,cAAc,KAAK,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspector-nav.mjs","names":[],"sources":["../../src/lib/inspector-nav.ts"],"sourcesContent":["import type { InspectorLeafKey } from \"./telemetry.js\";\n\nexport type ShellGroupKey = \"home\" | \"workbench\" | \"inspect\";\n\nexport const INSPECTOR_GROUPS = {\n home: [\"home\", \"whats-new\"],\n workbench: [\"playground\", \"threads\", \"memories\"],\n inspect: [\n \"agents\",\n \"ag-ui-events\",\n \"
|
|
1
|
+
{"version":3,"file":"inspector-nav.mjs","names":[],"sources":["../../src/lib/inspector-nav.ts"],"sourcesContent":["import type { InspectorLeafKey } from \"./telemetry.js\";\n\nexport type ShellGroupKey = \"home\" | \"workbench\" | \"inspect\";\n\nexport const INSPECTOR_GROUPS = {\n home: [\"home\", \"whats-new\"],\n workbench: [\"playground\", \"threads\", \"memories\"],\n inspect: [\n \"agents\",\n \"ag-ui-events\",\n \"frontend-tools\",\n \"capabilities\",\n \"agent-context\",\n ],\n} as const satisfies Record<ShellGroupKey, readonly InspectorLeafKey[]>;\n\nexport type InspectorNavGroupKey = keyof typeof INSPECTOR_GROUPS;\nexport type MenuKey = (typeof INSPECTOR_GROUPS)[InspectorNavGroupKey][number];\n\nexport const INSPECTOR_MENU_KEYS: ReadonlyArray<MenuKey> = [\n ...INSPECTOR_GROUPS.home,\n ...INSPECTOR_GROUPS.workbench,\n ...INSPECTOR_GROUPS.inspect,\n];\n\nexport const INSPECTOR_NAV_SECTIONS: ReadonlyArray<{\n group: InspectorNavGroupKey;\n label: string | null;\n}> = [\n { group: \"home\", label: null },\n { group: \"workbench\", label: \"Workbench\" },\n { group: \"inspect\", label: \"Inspect\" },\n];\n\nexport const ICON_RAIL_MAX_WIDTH_PX = 720;\n\n/** Return whether persisted state names a known Inspector leaf. */\nexport function isInspectorMenuKey(value: unknown): value is MenuKey {\n return (\n typeof value === \"string\" &&\n INSPECTOR_MENU_KEYS.some((menuKey) => menuKey === value)\n );\n}\n\n/** Return the sidebar group that owns a leaf. */\nexport function getGroupForMenu(key: MenuKey): InspectorNavGroupKey {\n for (const group of Object.keys(INSPECTOR_GROUPS) as InspectorNavGroupKey[]) {\n if (INSPECTOR_GROUPS[group].some((menuKey) => menuKey === key)) {\n return group;\n }\n }\n\n return \"workbench\";\n}\n\n/** Return whether the sidebar should collapse to an icon rail. */\nexport function shouldUseIconRail(args: {\n dockedLeft: boolean;\n width: number;\n}): boolean {\n return args.dockedLeft || args.width < ICON_RAIL_MAX_WIDTH_PX;\n}\n"],"mappings":";AAIA,MAAa,mBAAmB;CAC9B,MAAM,CAAC,QAAQ,YAAY;CAC3B,WAAW;EAAC;EAAc;EAAW;EAAW;CAChD,SAAS;EACP;EACA;EACA;EACA;EACA;EACD;CACF;AAKD,MAAa,sBAA8C;CACzD,GAAG,iBAAiB;CACpB,GAAG,iBAAiB;CACpB,GAAG,iBAAiB;CACrB;AAED,MAAa,yBAGR;CACH;EAAE,OAAO;EAAQ,OAAO;EAAM;CAC9B;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAW,OAAO;EAAW;CACvC;AAED,MAAa,yBAAyB;;AAGtC,SAAgB,mBAAmB,OAAkC;AACnE,QACE,OAAO,UAAU,YACjB,oBAAoB,MAAM,YAAY,YAAY,MAAM;;;AAK5D,SAAgB,gBAAgB,KAAoC;AAClE,MAAK,MAAM,SAAS,OAAO,KAAK,iBAAiB,CAC/C,KAAI,iBAAiB,OAAO,MAAM,YAAY,YAAY,IAAI,CAC5D,QAAO;AAIX,QAAO;;;AAIT,SAAgB,kBAAkB,MAGtB;AACV,QAAO,KAAK,cAAc,KAAK,QAAQ"}
|
package/dist/lib/telemetry.cjs
CHANGED
|
@@ -26,9 +26,7 @@ const TELEMETRY_EVENTS = {
|
|
|
26
26
|
homeViewed: "oss.inspector.home_viewed",
|
|
27
27
|
homeCtaClicked: "oss.inspector.home_cta_clicked",
|
|
28
28
|
metadataModuleViewed: "oss.inspector.metadata_module_viewed",
|
|
29
|
-
metadataActionClicked: "oss.inspector.metadata_action_clicked"
|
|
30
|
-
eventSnippetsRun: "oss.inspector.event_snippets_run",
|
|
31
|
-
eventSnippetsSaved: "oss.inspector.event_snippets_saved"
|
|
29
|
+
metadataActionClicked: "oss.inspector.metadata_action_clicked"
|
|
32
30
|
};
|
|
33
31
|
const TELEMETRY_INGEST_URL = "https://telemetry.copilotkit.ai/ingest";
|
|
34
32
|
const TELEMETRY_DOCS_URL = "https://docs.copilotkit.ai/telemetry";
|
|
@@ -273,20 +271,6 @@ function trackMetadataActionClicked(props) {
|
|
|
273
271
|
...metadataCoarseProperties(props)
|
|
274
272
|
});
|
|
275
273
|
}
|
|
276
|
-
function trackEventSnippetsRun(props) {
|
|
277
|
-
track(TELEMETRY_EVENTS.eventSnippetsRun, {
|
|
278
|
-
recipe: props.recipe,
|
|
279
|
-
source: props.source,
|
|
280
|
-
success: props.success
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
function trackEventSnippetsSaved(props) {
|
|
284
|
-
track(TELEMETRY_EVENTS.eventSnippetsSaved, {
|
|
285
|
-
recipe: props.recipe,
|
|
286
|
-
source: props.source,
|
|
287
|
-
success: props.success
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
274
|
/**
|
|
291
275
|
* Returns the inspector's anonymous distinct-ID for cross-domain
|
|
292
276
|
* propagation onto outbound announcement-CTA links, or `null` when the user
|
|
@@ -357,8 +341,6 @@ exports.getRuntimeUrlType = getRuntimeUrlType;
|
|
|
357
341
|
exports.getTelemetryDistinctIdForUrl = getTelemetryDistinctIdForUrl;
|
|
358
342
|
exports.maybeShowDisclosure = maybeShowDisclosure;
|
|
359
343
|
exports.trackErrorSignalViewed = trackErrorSignalViewed;
|
|
360
|
-
exports.trackEventSnippetsRun = trackEventSnippetsRun;
|
|
361
|
-
exports.trackEventSnippetsSaved = trackEventSnippetsSaved;
|
|
362
344
|
exports.trackHomeCtaClicked = trackHomeCtaClicked;
|
|
363
345
|
exports.trackHomeViewed = trackHomeViewed;
|
|
364
346
|
exports.trackInspectorOpened = trackInspectorOpened;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.cjs","names":["isTelemetryOptedOut","getOrCreateTelemetryDistinctId","hasTelemetryDisclosureBeenShown"],"sources":["../../src/lib/telemetry.ts"],"sourcesContent":["// Inspector-side anonymous telemetry. V1 events fire from index.ts for\n// What's new and thread-inspection interactions. POSTs directly from the\n// browser to the CopilotKit telemetry sink at\n// `telemetry.copilotkit.ai/ingest`, where a Lambda fan-out forwards events to\n// PostHog / Reo / Scarf.\n//\n// The endpoint URL is intentionally clearly named so it's obvious in\n// DevTools / Network tab — transparency for opt-in users.\n//\n// Privacy invariants enforced here:\n// - We never send message content, agent state, prompts, completions,\n// or announcement markdown. Feature-specific properties are scoped to\n// event metadata only (banner_id/timestamp, cta location). Reviewers\n// should grep call sites for any unintended payload.\n// - The opt-out short-circuits before any network call. There is no\n// buffer, no retry queue.\n// - All errors are swallowed; telemetry must never break the host app.\n\nimport {\n getOrCreateTelemetryDistinctId,\n hasTelemetryDisclosureBeenShown,\n isTelemetryOptedOut,\n markTelemetryDisclosureShown,\n} from \"./persistence.js\";\nimport packageJson from \"../../package.json\" with { type: \"json\" };\n\n// V1 funnel events. Namespaced `oss.inspector.*` so the lambda's\n// owned-prefix gate (oss-path-to-production) can accept them server-side\n// without a per-event sink deploy.\nexport const TELEMETRY_EVENTS = {\n opened: \"oss.inspector.opened\",\n whatsNewViewed: \"oss.inspector.whats_new_viewed\",\n whatsNewSignalViewed: \"oss.inspector.whats_new_signal_viewed\",\n errorSignalViewed: \"oss.inspector.error_signal_viewed\",\n whatsNewClicked: \"oss.inspector.whats_new_clicked\",\n threadsTabClicked: \"oss.inspector.threads_tab_clicked\",\n threadsLockedViewed: \"oss.inspector.threads_locked_viewed\",\n threadsIntelligenceSignupClicked:\n \"oss.inspector.threads_intelligence_signup_clicked\",\n threadsTalkToEngineerClicked:\n \"oss.inspector.threads_talk_to_engineer_clicked\",\n talkToEngineerClicked: \"oss.inspector.talk_to_engineer_clicked\",\n threadsEmptyEnabledViewed: \"oss.inspector.threads_empty_enabled_viewed\",\n threadsEnabledViewed: \"oss.inspector.threads_enabled_viewed\",\n threadsExampleViewed: \"oss.inspector.threads_example_viewed\",\n threadsExampleSelected: \"oss.inspector.threads_example_selected\",\n threadsExampleTourStarted: \"oss.inspector.threads_example_tour_started\",\n threadsExampleTourStepViewed:\n \"oss.inspector.threads_example_tour_step_viewed\",\n threadsExampleTourDismissed: \"oss.inspector.threads_example_tour_dismissed\",\n threadsExampleTourCompleted: \"oss.inspector.threads_example_tour_completed\",\n threadsExampleTourReopened: \"oss.inspector.threads_example_tour_reopened\",\n memoriesTabClicked: \"oss.inspector.memories_tab_clicked\",\n homeViewed: \"oss.inspector.home_viewed\",\n homeCtaClicked: \"oss.inspector.home_cta_clicked\",\n metadataModuleViewed: \"oss.inspector.metadata_module_viewed\",\n metadataActionClicked: \"oss.inspector.metadata_action_clicked\",\n eventSnippetsRun: \"oss.inspector.event_snippets_run\",\n eventSnippetsSaved: \"oss.inspector.event_snippets_saved\",\n} as const;\n\nexport type TelemetryEvent =\n (typeof TELEMETRY_EVENTS)[keyof typeof TELEMETRY_EVENTS];\n\n// Per the OSS-96 ticket — the URL is intentionally clearly named for\n// transparency in the network tab.\nexport const TELEMETRY_INGEST_URL = \"https://telemetry.copilotkit.ai/ingest\";\n\n// Surfaced in console disclosure and the in-product opt-out panel.\n// Keep in sync with the live shell-docs telemetry page\n// (`showcase/shell-docs/src/content/docs/integrations/built-in-agent/telemetry.mdx`).\n// Mirror constant: packages/runtime/src/v1-deprecated/lib/telemetry-disclosure.ts\nexport const TELEMETRY_DOCS_URL = \"https://docs.copilotkit.ai/telemetry\";\n\nconst PACKAGE_NAME = \"@copilotkit/web-inspector\";\nconst PACKAGE_VERSION = packageJson.version;\n\n// 3-second cap so a slow gateway can't hang the host app. Matches the\n// runtime's existing scarf-client convention.\nconst FETCH_TIMEOUT_MS = 3000;\n\nexport type RuntimeUrlType =\n | \"missing\"\n | \"relative\"\n | \"localhost\"\n | \"same_origin\"\n | \"remote\"\n | \"invalid\";\n\nexport function getRuntimeUrlType(\n runtimeUrl: string | undefined,\n): RuntimeUrlType {\n if (!runtimeUrl) return \"missing\";\n if (runtimeUrl.startsWith(\"/\") && !runtimeUrl.startsWith(\"//\")) {\n return \"relative\";\n }\n\n try {\n const baseHref =\n typeof window !== \"undefined\"\n ? window.location.href\n : \"https://copilotkit.ai\";\n const url = new URL(runtimeUrl, baseHref);\n const baseUrl = new URL(baseHref);\n const hostname = url.hostname.toLowerCase();\n\n if (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n ) {\n return \"localhost\";\n }\n\n return url.origin === baseUrl.origin ? \"same_origin\" : \"remote\";\n } catch {\n return \"invalid\";\n }\n}\n\n/**\n * Fire-and-forget telemetry send. Returns synchronously; the network\n * call is dispatched in the background and any failure is swallowed.\n *\n * Short-circuits when the user has opted out. Does NOT itself trigger\n * the first-run disclosure — call `maybeShowDisclosure()` from the\n * inspector's mount lifecycle instead.\n */\nexport function track(\n event: TelemetryEvent,\n properties: Record<string, unknown> = {},\n): void {\n if (isTelemetryOptedOut()) return;\n\n try {\n const distinctId = getOrCreateTelemetryDistinctId();\n // Every event carries package identity and the inspector's anonymous\n // distinct-ID, so any of them can be segmented by inspector version.\n const body = JSON.stringify({\n event,\n properties: {\n ...properties,\n package_name: PACKAGE_NAME,\n package_version: PACKAGE_VERSION,\n inspector_distinct_id: distinctId,\n distinct_id: distinctId,\n },\n package: {\n name: PACKAGE_NAME,\n version: PACKAGE_VERSION,\n },\n ts: Math.floor(Date.now() / 1000),\n });\n void postBestEffort(TELEMETRY_INGEST_URL, body, distinctId);\n } catch {\n // Identity and serialization failures are best-effort too.\n }\n}\n\n// --- Typed per-event helpers ---\n// These enforce the known property shape for each V1 event at the call\n// site, so callers can't accidentally include PII under a wrong key.\n\n/**\n * Where an announcement was rendered when the event fired. What's new is the\n * only surface that carries one, so the value is currently a constant — it\n * stays a stamped property rather than an inferred one so a second surface\n * can be added without changing the event's shape.\n */\nexport type WhatsNewSurface = \"whats_new\";\n\n/**\n * Whether a launcher signal was animated, or held static because the reader\n * asked for reduced motion. Shared by every launcher signal so an\n * accessibility setting is never mistaken for disinterest.\n */\nexport type LauncherSignalPresentation = \"animated\" | \"reduced_motion\";\n\nexport type WhatsNewSignalPresentation = LauncherSignalPresentation;\n\n/**\n * Which failure class raised the launcher's error signal. A closed enum: the\n * failure *message* is never transmitted, so prompts, URLs and identifiers\n * embedded in an error cannot leave the browser.\n *\n * `connection` and `threads` are wiring *state*. `run`, `tool` and `memory`\n * are unread *events* that clear when their landing view is read.\n */\nexport type InspectorWiringErrorSource = \"connection\" | \"threads\";\nexport type InspectorEventErrorSource = \"run\" | \"tool\" | \"memory\";\nexport type InspectorErrorSignalSource =\n | InspectorWiringErrorSource\n | InspectorEventErrorSource;\n\n/**\n * Fires when What's new has rendered *with content*. A loading state is not\n * an impression, so the metric cannot inflate itself by counting readers who\n * arrived before the feed resolved.\n */\nexport function trackWhatsNewViewed(props: {\n banner_id: string;\n surface: WhatsNewSurface;\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewViewed, props);\n}\n\n/** Fires when the unread launcher signal is presented in a visible tab. */\nexport function trackWhatsNewSignalViewed(props: {\n banner_id: string;\n surface: \"launcher\";\n presentation: WhatsNewSignalPresentation;\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewSignalViewed, props);\n}\n\n/**\n * Whether the launcher opened its pill for this outage, or suppressed it.\n *\n * `suppressed` means no pill was shown. In practice that is the no-room\n * fallback — neither side of the launcher had space for the label — because\n * every other path to a visible error signal opens one.\n */\nexport type InspectorErrorSignalLabel = \"shown\" | \"suppressed\";\n\n/**\n * Fires when the launcher's error signal becomes *visible* — not when it arms.\n * Arming can happen with the panel open or the tab hidden, where there is no\n * launcher to look at, so counting arms would inflate the denominator this\n * event exists to provide.\n *\n * Deliberately carries three fixed enum values and nothing else. This is the\n * one place a later change could casually attach a free-text field, and the\n * failure message must never be transmitted.\n *\n * `label` is deliberately not a new event: the catalogue's size is asserted\n * and spelled out in a test title, and a property answers the one open\n * question — how often the no-room fallback fires — without touching either.\n *\n * The pill's own marginal effect cannot be measured here and must not be\n * reverse-engineered from this data: it ships together with the dot and the\n * beat, so there is no period with one and not the other.\n */\nexport function trackErrorSignalViewed(props: {\n source: InspectorErrorSignalSource;\n presentation: LauncherSignalPresentation;\n label: InspectorErrorSignalLabel;\n}): void {\n track(TELEMETRY_EVENTS.errorSignalViewed, {\n source: props.source,\n presentation: props.presentation,\n label: props.label,\n });\n}\n\n/**\n * Fires for links followed inside the announcement body. `body` is the only\n * call-to-action left: dismissal no longer exists, so there is nothing else a\n * click on this surface can mean.\n */\nexport function trackWhatsNewClicked(props: {\n banner_id: string;\n cta: \"body\";\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewClicked, props);\n}\n\n/**\n * How the panel was opened. Restoring a persisted-open panel on mount is\n * deliberately NOT a source: it is not an open *intent*, and counting it\n * would turn every dev-server hot reload into an \"open\".\n */\nexport type InspectorOpenSource = \"floating_button\" | \"message_toolbar\";\n\nexport type InspectorOpenedTelemetryProps = {\n open_source: InspectorOpenSource;\n package_name?: typeof PACKAGE_NAME;\n package_version?: string;\n inspector_distinct_id?: string;\n license_status?:\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n runtime_mode?: \"sse\" | \"intelligence\";\n runtime_url_type?: RuntimeUrlType;\n /** True when an unseen announcement was on screen at open time. */\n has_unseen_announcement?: boolean;\n /** True when an error signal was on the launcher at open time. */\n has_error_signal?: boolean;\n /** Which failure class was signalling at open time, when one was. */\n error_signal_source?: InspectorErrorSignalSource;\n /** True when this is the first Inspector open after install or upgrade. */\n first_open?: boolean;\n};\n\n/**\n * Panel-open signal (OSS-566). Before this event, opens could only be\n * inferred from in-panel activity (a floor) or from the announcement's own\n * click event (which misses the floating-button path entirely).\n */\nexport function trackInspectorOpened(\n props: InspectorOpenedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.opened, props);\n}\n\nexport type ExampleKind = \"realtime_sync\" | \"manage_history\" | \"inspect_runs\";\nexport type ThreadsUsageBucket =\n | \"absent\"\n | \"empty\"\n | \"within_limit\"\n | \"at_or_over_limit\"\n | \"unlimited\"\n | \"unknown_limit\";\nexport type ThreadsExpiryBucket = \"unavailable\" | \"zero\" | \"positive\";\nexport type InspectorGroupKey = \"home\" | \"workbench\" | \"inspect\";\nexport type InspectorLeafKey =\n | \"home\"\n | \"whats-new\"\n | \"playground\"\n | \"threads\"\n | \"ag-ui-events\"\n | \"event-snippets\"\n | \"agents\"\n | \"frontend-tools\"\n | \"capabilities\"\n | \"agent-context\"\n | \"memories\";\nexport type MetadataActionPlacement = \"threads_footer\" | \"threads_locked\";\nexport type ExampleTourStep = 1 | 2 | 3;\nexport type ExampleTourTab = \"timeline\" | \"raw-events\" | \"state\";\n\nexport type InspectorThreadTelemetryProps = Readonly<{\n posthog_distinct_id?: string;\n intelligence_status?:\n | \"intelligence_not_enabled\"\n | \"intelligence_enabled\"\n | \"unknown\";\n thread_service_status?: \"unavailable\" | \"available\" | \"unknown\" | \"error\";\n license_status?:\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n runtime_mode?: \"sse\" | \"intelligence\";\n runtime_url_type?: RuntimeUrlType;\n cta_surface?:\n | \"threads_locked\"\n | \"threads_header\"\n | \"threads_empty\"\n | \"threads_populated\"\n | \"sidebar_footer\";\n cta?: \"signup\" | \"talk_to_engineer\";\n telemetry_disabled?: boolean;\n has_threads?: boolean;\n usage_bucket?: ThreadsUsageBucket;\n expiry_bucket?: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n example_kind?: ExampleKind;\n tour_step?: ExampleTourStep;\n tour_tab?: ExampleTourTab;\n dismiss_method?: \"skip\" | \"done\";\n}>;\n\n/** Rebuild the common Thread payload from its closed coarse allowlist. */\nfunction threadCommonProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...(props.intelligence_status === undefined\n ? {}\n : { intelligence_status: props.intelligence_status }),\n ...(props.thread_service_status === undefined\n ? {}\n : { thread_service_status: props.thread_service_status }),\n ...(props.license_status === undefined\n ? {}\n : { license_status: props.license_status }),\n ...(props.runtime_mode === undefined\n ? {}\n : { runtime_mode: props.runtime_mode }),\n ...(props.runtime_url_type === undefined\n ? {}\n : { runtime_url_type: props.runtime_url_type }),\n ...(props.telemetry_disabled === undefined\n ? {}\n : { telemetry_disabled: props.telemetry_disabled }),\n ...(props.has_threads === undefined\n ? {}\n : { has_threads: props.has_threads }),\n ...(props.usage_bucket === undefined\n ? {}\n : { usage_bucket: props.usage_bucket }),\n ...(props.expiry_bucket === undefined\n ? {}\n : { expiry_bucket: props.expiry_bucket }),\n ...(props.group_key === undefined ? {} : { group_key: props.group_key }),\n ...(props.leaf_key === undefined ? {} : { leaf_key: props.leaf_key }),\n };\n}\n\n/** Add only the fields used by the three Thread CTA funnels. */\nfunction threadCtaProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadCommonProperties(props),\n ...(props.cta === undefined ? {} : { cta: props.cta }),\n ...(props.cta_surface === undefined\n ? {}\n : { cta_surface: props.cta_surface }),\n ...(props.posthog_distinct_id === undefined\n ? {}\n : { posthog_distinct_id: props.posthog_distinct_id }),\n };\n}\n\n/** Add only the closed example kind used by example impressions/selections. */\nfunction threadExampleProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadCommonProperties(props),\n ...(props.example_kind === undefined\n ? {}\n : { example_kind: props.example_kind }),\n };\n}\n\n/** Add only a bounded example kind and tour step/tab pair. */\nfunction threadTourProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadExampleProperties(props),\n ...(props.tour_step === undefined ? {} : { tour_step: props.tour_step }),\n ...(props.tour_tab === undefined ? {} : { tour_tab: props.tour_tab }),\n };\n}\n\n/** Add the bounded dismissal leaf used only by terminal tour events. */\nfunction threadTourTerminalProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadTourProperties(props),\n ...(props.dismiss_method === undefined\n ? {}\n : { dismiss_method: props.dismiss_method }),\n };\n}\n\nexport function trackThreadsTabClicked(\n props: InspectorThreadTelemetryProps = {},\n): void {\n track(TELEMETRY_EVENTS.threadsTabClicked, threadCommonProperties(props));\n}\n\nexport function trackThreadsLockedViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsLockedViewed, threadCommonProperties(props));\n}\n\nexport function trackThreadsIntelligenceSignupClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsIntelligenceSignupClicked,\n threadCtaProperties(props),\n );\n}\n\nexport function trackThreadsTalkToEngineerClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsTalkToEngineerClicked,\n threadCtaProperties(props),\n );\n}\n\nexport function trackTalkToEngineerClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.talkToEngineerClicked, threadCtaProperties(props));\n}\n\nexport function trackThreadsEmptyEnabledViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsEmptyEnabledViewed,\n threadCommonProperties(props),\n );\n}\n\nexport function trackThreadsEnabledViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsEnabledViewed, threadCommonProperties(props));\n}\n\nexport function trackThreadsExampleViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsExampleViewed, threadExampleProperties(props));\n}\n\nexport function trackThreadsExampleSelected(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleSelected,\n threadExampleProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourStarted(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourStarted,\n threadTourProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourStepViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourStepViewed,\n threadTourProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourDismissed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourDismissed,\n threadTourTerminalProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourCompleted(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourCompleted,\n threadTourTerminalProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourReopened(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourReopened,\n threadTourProperties(props),\n );\n}\n\nexport type InspectorMemoryTelemetryProps = {\n package_name?: typeof PACKAGE_NAME;\n package_version?: string;\n inspector_distinct_id?: string;\n posthog_distinct_id?: string;\n memory_count?: number;\n available?: boolean;\n};\n\nexport function trackMemoriesTabClicked(\n props: InspectorMemoryTelemetryProps = {},\n): void {\n track(TELEMETRY_EVENTS.memoriesTabClicked, props);\n}\n\nexport type InspectorMetadataTelemetryModule = \"identity\" | \"plan\" | \"action\";\nexport type InspectorMetadataLicenseBucket =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"unknown\";\nexport type InspectorMetadataActionKind =\n | \"manage_plan\"\n | \"renew\"\n | \"enable_intelligence\";\n\nexport type InspectorHomeTelemetryProps = Readonly<{\n action_kind?: InspectorMetadataActionKind;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n}>;\n\nexport function trackHomeViewed(props: InspectorHomeTelemetryProps = {}): void {\n track(TELEMETRY_EVENTS.homeViewed, {\n group_key: props.group_key ?? \"home\",\n leaf_key: props.leaf_key ?? \"home\",\n });\n}\n\nexport function trackHomeCtaClicked(props: InspectorHomeTelemetryProps): void {\n track(TELEMETRY_EVENTS.homeCtaClicked, {\n action_kind: props.action_kind,\n group_key: props.group_key ?? \"home\",\n leaf_key: props.leaf_key ?? \"home\",\n });\n}\n\nexport type InspectorMetadataModuleViewedTelemetryProps = Readonly<{\n module: InspectorMetadataTelemetryModule;\n license_bucket: InspectorMetadataLicenseBucket;\n action_kind?: InspectorMetadataActionKind;\n usage_bucket: ThreadsUsageBucket;\n expiry_bucket: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n action_placement?: MetadataActionPlacement;\n}>;\n\nexport type InspectorMetadataActionClickedTelemetryProps = Readonly<{\n action_kind: Exclude<InspectorMetadataActionKind, \"enable_intelligence\">;\n license_bucket: InspectorMetadataLicenseBucket;\n usage_bucket: ThreadsUsageBucket;\n expiry_bucket: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n action_placement?: MetadataActionPlacement;\n}>;\n\nfunction metadataCoarseProperties(\n props:\n | InspectorMetadataModuleViewedTelemetryProps\n | InspectorMetadataActionClickedTelemetryProps,\n) {\n const navigation =\n props.group_key === undefined || props.leaf_key === undefined\n ? {}\n : { group_key: props.group_key, leaf_key: props.leaf_key };\n return {\n license_bucket: props.license_bucket,\n usage_bucket: props.usage_bucket,\n expiry_bucket: props.expiry_bucket,\n ...navigation,\n ...(props.action_placement === undefined\n ? {}\n : { action_placement: props.action_placement }),\n };\n}\n\n/**\n * Tracks one visible Inspector metadata module using coarse fields only.\n * Rebuilding the payload here prevents local labels, IDs, URLs, and usage\n * values from crossing the telemetry boundary through extra object fields.\n */\nexport function trackMetadataModuleViewed(\n props: InspectorMetadataModuleViewedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.metadataModuleViewed, {\n module: props.module,\n ...(props.action_kind === undefined\n ? {}\n : { action_kind: props.action_kind }),\n ...metadataCoarseProperties(props),\n });\n}\n\n/**\n * Tracks clicks for managed plan and renewal actions. The existing\n * Intelligence-enable funnel keeps its original event and never calls this\n * helper, which prevents a single click from producing two wire events.\n */\nexport function trackMetadataActionClicked(\n props: InspectorMetadataActionClickedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.metadataActionClicked, {\n module: \"action\",\n action_kind: props.action_kind,\n ...metadataCoarseProperties(props),\n });\n}\n\nexport type EventSnippetRecipeKind =\n | \"tool-call\"\n | \"reasoning\"\n | \"text\"\n | \"activity\"\n | \"raw\";\n\nexport type EventSnippetSource = \"chat\" | \"pane\";\n\nexport function trackEventSnippetsRun(props: {\n recipe: EventSnippetRecipeKind;\n source: EventSnippetSource;\n success: boolean;\n}): void {\n track(TELEMETRY_EVENTS.eventSnippetsRun, {\n recipe: props.recipe,\n source: props.source,\n success: props.success,\n });\n}\n\nexport function trackEventSnippetsSaved(props: {\n recipe: EventSnippetRecipeKind;\n source: EventSnippetSource;\n success: boolean;\n}): void {\n track(TELEMETRY_EVENTS.eventSnippetsSaved, {\n recipe: props.recipe,\n source: props.source,\n success: props.success,\n });\n}\n\n/**\n * Returns the inspector's anonymous distinct-ID for cross-domain\n * propagation onto outbound announcement-CTA links, or `null` when the user\n * is opted out.\n *\n * The website / Ops API reads this query param on signup-flow landing\n * pages and calls `posthog.alias(...)` to merge the inspector's anon\n * ID with the website's anon ID, enabling the\n * `whats_new_viewed → whats_new_clicked → signup_attributed` funnel.\n * `identify()` itself is out of scope here (it happens on signup, in\n * the website / Ops API).\n *\n * Opt-out short-circuits this too: if the user has opted out, we do\n * NOT leak an anon ID across domains.\n */\nexport function getTelemetryDistinctIdForUrl(): string | null {\n if (isTelemetryOptedOut()) return null;\n return getOrCreateTelemetryDistinctId();\n}\n\n/**\n * Seeds the anonymous distinct-ID into localStorage on inspector mount\n * so it is ready for cross-domain propagation onto announcement-CTA links\n * even before the first event fires. No-op when the user has opted out.\n */\nexport function ensureTelemetryDistinctId(): void {\n if (isTelemetryOptedOut()) return;\n getOrCreateTelemetryDistinctId();\n}\n\n/**\n * Fires the one-time console disclosure on inspector mount, when the\n * user is not opted out and hasn't seen it before. Idempotent across\n * calls within a single session because `markTelemetryDisclosureShown`\n * persists to localStorage.\n *\n * If the user is opted out, we deliberately do nothing and do NOT mark\n * the flag — so a future opt-in flips back to \"first run\" behavior.\n */\nexport function maybeShowDisclosure(): void {\n if (isTelemetryOptedOut()) return;\n if (hasTelemetryDisclosureBeenShown()) return;\n // eslint-disable-next-line no-console\n console.info(\n `[CopilotKit Inspector] anonymous interaction telemetry enabled — see ${TELEMETRY_DOCS_URL} to opt out.`,\n );\n markTelemetryDisclosureShown();\n}\n\nexport { isTelemetryOptedOut };\n\nasync function postBestEffort(\n url: string,\n body: string,\n distinctId: string,\n): Promise<void> {\n if (typeof fetch === \"undefined\") return;\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n try {\n const controller = new AbortController();\n timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);\n await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-CopilotKit-Telemetry-Id\": distinctId,\n },\n body,\n signal: controller.signal,\n // No credentials / no Authorization header — anonymous endpoint.\n });\n } catch {\n // Silent failure — telemetry must not break the application.\n } finally {\n if (timeoutId !== undefined) clearTimeout(timeoutId);\n }\n}\n"],"mappings":";;;;AA6BA,MAAa,mBAAmB;CAC9B,QAAQ;CACR,gBAAgB;CAChB,sBAAsB;CACtB,mBAAmB;CACnB,iBAAiB;CACjB,mBAAmB;CACnB,qBAAqB;CACrB,kCACE;CACF,8BACE;CACF,uBAAuB;CACvB,2BAA2B;CAC3B,sBAAsB;CACtB,sBAAsB;CACtB,wBAAwB;CACxB,2BAA2B;CAC3B,8BACE;CACF,6BAA6B;CAC7B,6BAA6B;CAC7B,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;CACZ,gBAAgB;CAChB,sBAAsB;CACtB,uBAAuB;CACvB,kBAAkB;CAClB,oBAAoB;CACrB;AAOD,MAAa,uBAAuB;AAMpC,MAAa,qBAAqB;AAElC,MAAM,eAAe;AACrB,MAAM;AAIN,MAAM,mBAAmB;AAUzB,SAAgB,kBACd,YACgB;AAChB,KAAI,CAAC,WAAY,QAAO;AACxB,KAAI,WAAW,WAAW,IAAI,IAAI,CAAC,WAAW,WAAW,KAAK,CAC5D,QAAO;AAGT,KAAI;EACF,MAAM,WACJ,OAAO,WAAW,cACd,OAAO,SAAS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O;AAClC,QAAOC,oDAAgC;;;;;;;AAQzC,SAAgB,4BAAkC;AAChD,KAAID,yCAAqB,CAAE;AAC3B,qDAAgC;;;;;;;;;;;AAYlC,SAAgB,sBAA4B;AAC1C,KAAIA,yCAAqB,CAAE;AAC3B,KAAIE,qDAAiC,CAAE;AAEvC,SAAQ,KACN,wEAAwE,mBAAmB,cAC5F;AACD,mDAA8B;;AAKhC,eAAe,eACb,KACA,MACA,YACe;AACf,KAAI,OAAO,UAAU,YAAa;CAClC,IAAI;AACJ,KAAI;EACF,MAAM,aAAa,IAAI,iBAAiB;AACxC,cAAY,iBAAiB,WAAW,OAAO,EAAE,iBAAiB;AAClE,QAAM,MAAM,KAAK;GACf,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,6BAA6B;IAC9B;GACD;GACA,QAAQ,WAAW;GAEpB,CAAC;SACI,WAEE;AACR,MAAI,cAAc,OAAW,cAAa,UAAU"}
|
|
1
|
+
{"version":3,"file":"telemetry.cjs","names":["isTelemetryOptedOut","getOrCreateTelemetryDistinctId","hasTelemetryDisclosureBeenShown"],"sources":["../../src/lib/telemetry.ts"],"sourcesContent":["// Inspector-side anonymous telemetry. V1 events fire from index.ts for\n// What's new and thread-inspection interactions. POSTs directly from the\n// browser to the CopilotKit telemetry sink at\n// `telemetry.copilotkit.ai/ingest`, where a Lambda fan-out forwards events to\n// PostHog / Reo / Scarf.\n//\n// The endpoint URL is intentionally clearly named so it's obvious in\n// DevTools / Network tab — transparency for opt-in users.\n//\n// Privacy invariants enforced here:\n// - We never send message content, agent state, prompts, completions,\n// or announcement markdown. Feature-specific properties are scoped to\n// event metadata only (banner_id/timestamp, cta location). Reviewers\n// should grep call sites for any unintended payload.\n// - The opt-out short-circuits before any network call. There is no\n// buffer, no retry queue.\n// - All errors are swallowed; telemetry must never break the host app.\n\nimport {\n getOrCreateTelemetryDistinctId,\n hasTelemetryDisclosureBeenShown,\n isTelemetryOptedOut,\n markTelemetryDisclosureShown,\n} from \"./persistence.js\";\nimport packageJson from \"../../package.json\" with { type: \"json\" };\n\n// V1 funnel events. Namespaced `oss.inspector.*` so the lambda's\n// owned-prefix gate (oss-path-to-production) can accept them server-side\n// without a per-event sink deploy.\nexport const TELEMETRY_EVENTS = {\n opened: \"oss.inspector.opened\",\n whatsNewViewed: \"oss.inspector.whats_new_viewed\",\n whatsNewSignalViewed: \"oss.inspector.whats_new_signal_viewed\",\n errorSignalViewed: \"oss.inspector.error_signal_viewed\",\n whatsNewClicked: \"oss.inspector.whats_new_clicked\",\n threadsTabClicked: \"oss.inspector.threads_tab_clicked\",\n threadsLockedViewed: \"oss.inspector.threads_locked_viewed\",\n threadsIntelligenceSignupClicked:\n \"oss.inspector.threads_intelligence_signup_clicked\",\n threadsTalkToEngineerClicked:\n \"oss.inspector.threads_talk_to_engineer_clicked\",\n talkToEngineerClicked: \"oss.inspector.talk_to_engineer_clicked\",\n threadsEmptyEnabledViewed: \"oss.inspector.threads_empty_enabled_viewed\",\n threadsEnabledViewed: \"oss.inspector.threads_enabled_viewed\",\n threadsExampleViewed: \"oss.inspector.threads_example_viewed\",\n threadsExampleSelected: \"oss.inspector.threads_example_selected\",\n threadsExampleTourStarted: \"oss.inspector.threads_example_tour_started\",\n threadsExampleTourStepViewed:\n \"oss.inspector.threads_example_tour_step_viewed\",\n threadsExampleTourDismissed: \"oss.inspector.threads_example_tour_dismissed\",\n threadsExampleTourCompleted: \"oss.inspector.threads_example_tour_completed\",\n threadsExampleTourReopened: \"oss.inspector.threads_example_tour_reopened\",\n memoriesTabClicked: \"oss.inspector.memories_tab_clicked\",\n homeViewed: \"oss.inspector.home_viewed\",\n homeCtaClicked: \"oss.inspector.home_cta_clicked\",\n metadataModuleViewed: \"oss.inspector.metadata_module_viewed\",\n metadataActionClicked: \"oss.inspector.metadata_action_clicked\",\n} as const;\n\nexport type TelemetryEvent =\n (typeof TELEMETRY_EVENTS)[keyof typeof TELEMETRY_EVENTS];\n\n// Per the OSS-96 ticket — the URL is intentionally clearly named for\n// transparency in the network tab.\nexport const TELEMETRY_INGEST_URL = \"https://telemetry.copilotkit.ai/ingest\";\n\n// Surfaced in console disclosure and the in-product opt-out panel.\n// Keep in sync with the live shell-docs telemetry page\n// (`showcase/shell-docs/src/content/docs/integrations/built-in-agent/telemetry.mdx`).\n// Mirror constant: packages/runtime/src/v1-deprecated/lib/telemetry-disclosure.ts\nexport const TELEMETRY_DOCS_URL = \"https://docs.copilotkit.ai/telemetry\";\n\nconst PACKAGE_NAME = \"@copilotkit/web-inspector\";\nconst PACKAGE_VERSION = packageJson.version;\n\n// 3-second cap so a slow gateway can't hang the host app. Matches the\n// runtime's existing scarf-client convention.\nconst FETCH_TIMEOUT_MS = 3000;\n\nexport type RuntimeUrlType =\n | \"missing\"\n | \"relative\"\n | \"localhost\"\n | \"same_origin\"\n | \"remote\"\n | \"invalid\";\n\nexport function getRuntimeUrlType(\n runtimeUrl: string | undefined,\n): RuntimeUrlType {\n if (!runtimeUrl) return \"missing\";\n if (runtimeUrl.startsWith(\"/\") && !runtimeUrl.startsWith(\"//\")) {\n return \"relative\";\n }\n\n try {\n const baseHref =\n typeof window !== \"undefined\"\n ? window.location.href\n : \"https://copilotkit.ai\";\n const url = new URL(runtimeUrl, baseHref);\n const baseUrl = new URL(baseHref);\n const hostname = url.hostname.toLowerCase();\n\n if (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n ) {\n return \"localhost\";\n }\n\n return url.origin === baseUrl.origin ? \"same_origin\" : \"remote\";\n } catch {\n return \"invalid\";\n }\n}\n\n/**\n * Fire-and-forget telemetry send. Returns synchronously; the network\n * call is dispatched in the background and any failure is swallowed.\n *\n * Short-circuits when the user has opted out. Does NOT itself trigger\n * the first-run disclosure — call `maybeShowDisclosure()` from the\n * inspector's mount lifecycle instead.\n */\nexport function track(\n event: TelemetryEvent,\n properties: Record<string, unknown> = {},\n): void {\n if (isTelemetryOptedOut()) return;\n\n try {\n const distinctId = getOrCreateTelemetryDistinctId();\n // Every event carries package identity and the inspector's anonymous\n // distinct-ID, so any of them can be segmented by inspector version.\n const body = JSON.stringify({\n event,\n properties: {\n ...properties,\n package_name: PACKAGE_NAME,\n package_version: PACKAGE_VERSION,\n inspector_distinct_id: distinctId,\n distinct_id: distinctId,\n },\n package: {\n name: PACKAGE_NAME,\n version: PACKAGE_VERSION,\n },\n ts: Math.floor(Date.now() / 1000),\n });\n void postBestEffort(TELEMETRY_INGEST_URL, body, distinctId);\n } catch {\n // Identity and serialization failures are best-effort too.\n }\n}\n\n// --- Typed per-event helpers ---\n// These enforce the known property shape for each V1 event at the call\n// site, so callers can't accidentally include PII under a wrong key.\n\n/**\n * Where an announcement was rendered when the event fired. What's new is the\n * only surface that carries one, so the value is currently a constant — it\n * stays a stamped property rather than an inferred one so a second surface\n * can be added without changing the event's shape.\n */\nexport type WhatsNewSurface = \"whats_new\";\n\n/**\n * Whether a launcher signal was animated, or held static because the reader\n * asked for reduced motion. Shared by every launcher signal so an\n * accessibility setting is never mistaken for disinterest.\n */\nexport type LauncherSignalPresentation = \"animated\" | \"reduced_motion\";\n\nexport type WhatsNewSignalPresentation = LauncherSignalPresentation;\n\n/**\n * Which failure class raised the launcher's error signal. A closed enum: the\n * failure *message* is never transmitted, so prompts, URLs and identifiers\n * embedded in an error cannot leave the browser.\n *\n * `connection` and `threads` are wiring *state*. `run`, `tool` and `memory`\n * are unread *events* that clear when their landing view is read.\n */\nexport type InspectorWiringErrorSource = \"connection\" | \"threads\";\nexport type InspectorEventErrorSource = \"run\" | \"tool\" | \"memory\";\nexport type InspectorErrorSignalSource =\n | InspectorWiringErrorSource\n | InspectorEventErrorSource;\n\n/**\n * Fires when What's new has rendered *with content*. A loading state is not\n * an impression, so the metric cannot inflate itself by counting readers who\n * arrived before the feed resolved.\n */\nexport function trackWhatsNewViewed(props: {\n banner_id: string;\n surface: WhatsNewSurface;\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewViewed, props);\n}\n\n/** Fires when the unread launcher signal is presented in a visible tab. */\nexport function trackWhatsNewSignalViewed(props: {\n banner_id: string;\n surface: \"launcher\";\n presentation: WhatsNewSignalPresentation;\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewSignalViewed, props);\n}\n\n/**\n * Whether the launcher opened its pill for this outage, or suppressed it.\n *\n * `suppressed` means no pill was shown. In practice that is the no-room\n * fallback — neither side of the launcher had space for the label — because\n * every other path to a visible error signal opens one.\n */\nexport type InspectorErrorSignalLabel = \"shown\" | \"suppressed\";\n\n/**\n * Fires when the launcher's error signal becomes *visible* — not when it arms.\n * Arming can happen with the panel open or the tab hidden, where there is no\n * launcher to look at, so counting arms would inflate the denominator this\n * event exists to provide.\n *\n * Deliberately carries three fixed enum values and nothing else. This is the\n * one place a later change could casually attach a free-text field, and the\n * failure message must never be transmitted.\n *\n * `label` is deliberately not a new event: the catalogue's size is asserted\n * and spelled out in a test title, and a property answers the one open\n * question — how often the no-room fallback fires — without touching either.\n *\n * The pill's own marginal effect cannot be measured here and must not be\n * reverse-engineered from this data: it ships together with the dot and the\n * beat, so there is no period with one and not the other.\n */\nexport function trackErrorSignalViewed(props: {\n source: InspectorErrorSignalSource;\n presentation: LauncherSignalPresentation;\n label: InspectorErrorSignalLabel;\n}): void {\n track(TELEMETRY_EVENTS.errorSignalViewed, {\n source: props.source,\n presentation: props.presentation,\n label: props.label,\n });\n}\n\n/**\n * Fires for links followed inside the announcement body. `body` is the only\n * call-to-action left: dismissal no longer exists, so there is nothing else a\n * click on this surface can mean.\n */\nexport function trackWhatsNewClicked(props: {\n banner_id: string;\n cta: \"body\";\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewClicked, props);\n}\n\n/**\n * How the panel was opened. Restoring a persisted-open panel on mount is\n * deliberately NOT a source: it is not an open *intent*, and counting it\n * would turn every dev-server hot reload into an \"open\".\n */\nexport type InspectorOpenSource = \"floating_button\" | \"message_toolbar\";\n\nexport type InspectorOpenedTelemetryProps = {\n open_source: InspectorOpenSource;\n package_name?: typeof PACKAGE_NAME;\n package_version?: string;\n inspector_distinct_id?: string;\n license_status?:\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n runtime_mode?: \"sse\" | \"intelligence\";\n runtime_url_type?: RuntimeUrlType;\n /** True when an unseen announcement was on screen at open time. */\n has_unseen_announcement?: boolean;\n /** True when an error signal was on the launcher at open time. */\n has_error_signal?: boolean;\n /** Which failure class was signalling at open time, when one was. */\n error_signal_source?: InspectorErrorSignalSource;\n /** True when this is the first Inspector open after install or upgrade. */\n first_open?: boolean;\n};\n\n/**\n * Panel-open signal (OSS-566). Before this event, opens could only be\n * inferred from in-panel activity (a floor) or from the announcement's own\n * click event (which misses the floating-button path entirely).\n */\nexport function trackInspectorOpened(\n props: InspectorOpenedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.opened, props);\n}\n\nexport type ExampleKind = \"realtime_sync\" | \"manage_history\" | \"inspect_runs\";\nexport type ThreadsUsageBucket =\n | \"absent\"\n | \"empty\"\n | \"within_limit\"\n | \"at_or_over_limit\"\n | \"unlimited\"\n | \"unknown_limit\";\nexport type ThreadsExpiryBucket = \"unavailable\" | \"zero\" | \"positive\";\nexport type InspectorGroupKey = \"home\" | \"workbench\" | \"inspect\";\nexport type InspectorLeafKey =\n | \"home\"\n | \"whats-new\"\n | \"playground\"\n | \"threads\"\n | \"ag-ui-events\"\n | \"agents\"\n | \"frontend-tools\"\n | \"capabilities\"\n | \"agent-context\"\n | \"memories\";\nexport type MetadataActionPlacement = \"threads_footer\" | \"threads_locked\";\nexport type ExampleTourStep = 1 | 2 | 3;\nexport type ExampleTourTab = \"timeline\" | \"raw-events\" | \"state\";\n\nexport type InspectorThreadTelemetryProps = Readonly<{\n posthog_distinct_id?: string;\n intelligence_status?:\n | \"intelligence_not_enabled\"\n | \"intelligence_enabled\"\n | \"unknown\";\n thread_service_status?: \"unavailable\" | \"available\" | \"unknown\" | \"error\";\n license_status?:\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n runtime_mode?: \"sse\" | \"intelligence\";\n runtime_url_type?: RuntimeUrlType;\n cta_surface?:\n | \"threads_locked\"\n | \"threads_header\"\n | \"threads_empty\"\n | \"threads_populated\"\n | \"sidebar_footer\";\n cta?: \"signup\" | \"talk_to_engineer\";\n telemetry_disabled?: boolean;\n has_threads?: boolean;\n usage_bucket?: ThreadsUsageBucket;\n expiry_bucket?: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n example_kind?: ExampleKind;\n tour_step?: ExampleTourStep;\n tour_tab?: ExampleTourTab;\n dismiss_method?: \"skip\" | \"done\";\n}>;\n\n/** Rebuild the common Thread payload from its closed coarse allowlist. */\nfunction threadCommonProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...(props.intelligence_status === undefined\n ? {}\n : { intelligence_status: props.intelligence_status }),\n ...(props.thread_service_status === undefined\n ? {}\n : { thread_service_status: props.thread_service_status }),\n ...(props.license_status === undefined\n ? {}\n : { license_status: props.license_status }),\n ...(props.runtime_mode === undefined\n ? {}\n : { runtime_mode: props.runtime_mode }),\n ...(props.runtime_url_type === undefined\n ? {}\n : { runtime_url_type: props.runtime_url_type }),\n ...(props.telemetry_disabled === undefined\n ? {}\n : { telemetry_disabled: props.telemetry_disabled }),\n ...(props.has_threads === undefined\n ? {}\n : { has_threads: props.has_threads }),\n ...(props.usage_bucket === undefined\n ? {}\n : { usage_bucket: props.usage_bucket }),\n ...(props.expiry_bucket === undefined\n ? {}\n : { expiry_bucket: props.expiry_bucket }),\n ...(props.group_key === undefined ? {} : { group_key: props.group_key }),\n ...(props.leaf_key === undefined ? {} : { leaf_key: props.leaf_key }),\n };\n}\n\n/** Add only the fields used by the three Thread CTA funnels. */\nfunction threadCtaProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadCommonProperties(props),\n ...(props.cta === undefined ? {} : { cta: props.cta }),\n ...(props.cta_surface === undefined\n ? {}\n : { cta_surface: props.cta_surface }),\n ...(props.posthog_distinct_id === undefined\n ? {}\n : { posthog_distinct_id: props.posthog_distinct_id }),\n };\n}\n\n/** Add only the closed example kind used by example impressions/selections. */\nfunction threadExampleProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadCommonProperties(props),\n ...(props.example_kind === undefined\n ? {}\n : { example_kind: props.example_kind }),\n };\n}\n\n/** Add only a bounded example kind and tour step/tab pair. */\nfunction threadTourProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadExampleProperties(props),\n ...(props.tour_step === undefined ? {} : { tour_step: props.tour_step }),\n ...(props.tour_tab === undefined ? {} : { tour_tab: props.tour_tab }),\n };\n}\n\n/** Add the bounded dismissal leaf used only by terminal tour events. */\nfunction threadTourTerminalProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadTourProperties(props),\n ...(props.dismiss_method === undefined\n ? {}\n : { dismiss_method: props.dismiss_method }),\n };\n}\n\nexport function trackThreadsTabClicked(\n props: InspectorThreadTelemetryProps = {},\n): void {\n track(TELEMETRY_EVENTS.threadsTabClicked, threadCommonProperties(props));\n}\n\nexport function trackThreadsLockedViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsLockedViewed, threadCommonProperties(props));\n}\n\nexport function trackThreadsIntelligenceSignupClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsIntelligenceSignupClicked,\n threadCtaProperties(props),\n );\n}\n\nexport function trackThreadsTalkToEngineerClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsTalkToEngineerClicked,\n threadCtaProperties(props),\n );\n}\n\nexport function trackTalkToEngineerClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.talkToEngineerClicked, threadCtaProperties(props));\n}\n\nexport function trackThreadsEmptyEnabledViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsEmptyEnabledViewed,\n threadCommonProperties(props),\n );\n}\n\nexport function trackThreadsEnabledViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsEnabledViewed, threadCommonProperties(props));\n}\n\nexport function trackThreadsExampleViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsExampleViewed, threadExampleProperties(props));\n}\n\nexport function trackThreadsExampleSelected(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleSelected,\n threadExampleProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourStarted(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourStarted,\n threadTourProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourStepViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourStepViewed,\n threadTourProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourDismissed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourDismissed,\n threadTourTerminalProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourCompleted(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourCompleted,\n threadTourTerminalProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourReopened(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourReopened,\n threadTourProperties(props),\n );\n}\n\nexport type InspectorMemoryTelemetryProps = {\n package_name?: typeof PACKAGE_NAME;\n package_version?: string;\n inspector_distinct_id?: string;\n posthog_distinct_id?: string;\n memory_count?: number;\n available?: boolean;\n};\n\nexport function trackMemoriesTabClicked(\n props: InspectorMemoryTelemetryProps = {},\n): void {\n track(TELEMETRY_EVENTS.memoriesTabClicked, props);\n}\n\nexport type InspectorMetadataTelemetryModule = \"identity\" | \"plan\" | \"action\";\nexport type InspectorMetadataLicenseBucket =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"unknown\";\nexport type InspectorMetadataActionKind =\n | \"manage_plan\"\n | \"renew\"\n | \"enable_intelligence\";\n\nexport type InspectorHomeTelemetryProps = Readonly<{\n action_kind?: InspectorMetadataActionKind;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n}>;\n\nexport function trackHomeViewed(props: InspectorHomeTelemetryProps = {}): void {\n track(TELEMETRY_EVENTS.homeViewed, {\n group_key: props.group_key ?? \"home\",\n leaf_key: props.leaf_key ?? \"home\",\n });\n}\n\nexport function trackHomeCtaClicked(props: InspectorHomeTelemetryProps): void {\n track(TELEMETRY_EVENTS.homeCtaClicked, {\n action_kind: props.action_kind,\n group_key: props.group_key ?? \"home\",\n leaf_key: props.leaf_key ?? \"home\",\n });\n}\n\nexport type InspectorMetadataModuleViewedTelemetryProps = Readonly<{\n module: InspectorMetadataTelemetryModule;\n license_bucket: InspectorMetadataLicenseBucket;\n action_kind?: InspectorMetadataActionKind;\n usage_bucket: ThreadsUsageBucket;\n expiry_bucket: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n action_placement?: MetadataActionPlacement;\n}>;\n\nexport type InspectorMetadataActionClickedTelemetryProps = Readonly<{\n action_kind: Exclude<InspectorMetadataActionKind, \"enable_intelligence\">;\n license_bucket: InspectorMetadataLicenseBucket;\n usage_bucket: ThreadsUsageBucket;\n expiry_bucket: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n action_placement?: MetadataActionPlacement;\n}>;\n\nfunction metadataCoarseProperties(\n props:\n | InspectorMetadataModuleViewedTelemetryProps\n | InspectorMetadataActionClickedTelemetryProps,\n) {\n const navigation =\n props.group_key === undefined || props.leaf_key === undefined\n ? {}\n : { group_key: props.group_key, leaf_key: props.leaf_key };\n return {\n license_bucket: props.license_bucket,\n usage_bucket: props.usage_bucket,\n expiry_bucket: props.expiry_bucket,\n ...navigation,\n ...(props.action_placement === undefined\n ? {}\n : { action_placement: props.action_placement }),\n };\n}\n\n/**\n * Tracks one visible Inspector metadata module using coarse fields only.\n * Rebuilding the payload here prevents local labels, IDs, URLs, and usage\n * values from crossing the telemetry boundary through extra object fields.\n */\nexport function trackMetadataModuleViewed(\n props: InspectorMetadataModuleViewedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.metadataModuleViewed, {\n module: props.module,\n ...(props.action_kind === undefined\n ? {}\n : { action_kind: props.action_kind }),\n ...metadataCoarseProperties(props),\n });\n}\n\n/**\n * Tracks clicks for managed plan and renewal actions. The existing\n * Intelligence-enable funnel keeps its original event and never calls this\n * helper, which prevents a single click from producing two wire events.\n */\nexport function trackMetadataActionClicked(\n props: InspectorMetadataActionClickedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.metadataActionClicked, {\n module: \"action\",\n action_kind: props.action_kind,\n ...metadataCoarseProperties(props),\n });\n}\n\n/**\n * Returns the inspector's anonymous distinct-ID for cross-domain\n * propagation onto outbound announcement-CTA links, or `null` when the user\n * is opted out.\n *\n * The website / Ops API reads this query param on signup-flow landing\n * pages and calls `posthog.alias(...)` to merge the inspector's anon\n * ID with the website's anon ID, enabling the\n * `whats_new_viewed → whats_new_clicked → signup_attributed` funnel.\n * `identify()` itself is out of scope here (it happens on signup, in\n * the website / Ops API).\n *\n * Opt-out short-circuits this too: if the user has opted out, we do\n * NOT leak an anon ID across domains.\n */\nexport function getTelemetryDistinctIdForUrl(): string | null {\n if (isTelemetryOptedOut()) return null;\n return getOrCreateTelemetryDistinctId();\n}\n\n/**\n * Seeds the anonymous distinct-ID into localStorage on inspector mount\n * so it is ready for cross-domain propagation onto announcement-CTA links\n * even before the first event fires. No-op when the user has opted out.\n */\nexport function ensureTelemetryDistinctId(): void {\n if (isTelemetryOptedOut()) return;\n getOrCreateTelemetryDistinctId();\n}\n\n/**\n * Fires the one-time console disclosure on inspector mount, when the\n * user is not opted out and hasn't seen it before. Idempotent across\n * calls within a single session because `markTelemetryDisclosureShown`\n * persists to localStorage.\n *\n * If the user is opted out, we deliberately do nothing and do NOT mark\n * the flag — so a future opt-in flips back to \"first run\" behavior.\n */\nexport function maybeShowDisclosure(): void {\n if (isTelemetryOptedOut()) return;\n if (hasTelemetryDisclosureBeenShown()) return;\n // eslint-disable-next-line no-console\n console.info(\n `[CopilotKit Inspector] anonymous interaction telemetry enabled — see ${TELEMETRY_DOCS_URL} to opt out.`,\n );\n markTelemetryDisclosureShown();\n}\n\nexport { isTelemetryOptedOut };\n\nasync function postBestEffort(\n url: string,\n body: string,\n distinctId: string,\n): Promise<void> {\n if (typeof fetch === \"undefined\") return;\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n try {\n const controller = new AbortController();\n timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);\n await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-CopilotKit-Telemetry-Id\": distinctId,\n },\n body,\n signal: controller.signal,\n // No credentials / no Authorization header — anonymous endpoint.\n });\n } catch {\n // Silent failure — telemetry must not break the application.\n } finally {\n if (timeoutId !== undefined) clearTimeout(timeoutId);\n }\n}\n"],"mappings":";;;;AA6BA,MAAa,mBAAmB;CAC9B,QAAQ;CACR,gBAAgB;CAChB,sBAAsB;CACtB,mBAAmB;CACnB,iBAAiB;CACjB,mBAAmB;CACnB,qBAAqB;CACrB,kCACE;CACF,8BACE;CACF,uBAAuB;CACvB,2BAA2B;CAC3B,sBAAsB;CACtB,sBAAsB;CACtB,wBAAwB;CACxB,2BAA2B;CAC3B,8BACE;CACF,6BAA6B;CAC7B,6BAA6B;CAC7B,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;CACZ,gBAAgB;CAChB,sBAAsB;CACtB,uBAAuB;CACxB;AAOD,MAAa,uBAAuB;AAMpC,MAAa,qBAAqB;AAElC,MAAM,eAAe;AACrB,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,SAAgB,4BAAkC;AAChD,KAAID,yCAAqB,CAAE;AAC3B,qDAAgC;;;;;;;;;;;AAYlC,SAAgB,sBAA4B;AAC1C,KAAIA,yCAAqB,CAAE;AAC3B,KAAIE,qDAAiC,CAAE;AAEvC,SAAQ,KACN,wEAAwE,mBAAmB,cAC5F;AACD,mDAA8B;;AAKhC,eAAe,eACb,KACA,MACA,YACe;AACf,KAAI,OAAO,UAAU,YAAa;CAClC,IAAI;AACJ,KAAI;EACF,MAAM,aAAa,IAAI,iBAAiB;AACxC,cAAY,iBAAiB,WAAW,OAAO,EAAE,iBAAiB;AAClE,QAAM,MAAM,KAAK;GACf,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,6BAA6B;IAC9B;GACD;GACA,QAAQ,WAAW;GAEpB,CAAC;SACI,WAEE;AACR,MAAI,cAAc,OAAW,cAAa,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.cts","names":[],"sources":["../../src/lib/telemetry.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"telemetry.d.cts","names":[],"sources":["../../src/lib/telemetry.ts"],"mappings":";;;;;;KAgRY,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.mts","names":[],"sources":["../../src/lib/telemetry.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"telemetry.d.mts","names":[],"sources":["../../src/lib/telemetry.ts"],"mappings":";;;;;;KAgRY,mBAAA"}
|
package/dist/lib/telemetry.mjs
CHANGED
|
@@ -26,9 +26,7 @@ const TELEMETRY_EVENTS = {
|
|
|
26
26
|
homeViewed: "oss.inspector.home_viewed",
|
|
27
27
|
homeCtaClicked: "oss.inspector.home_cta_clicked",
|
|
28
28
|
metadataModuleViewed: "oss.inspector.metadata_module_viewed",
|
|
29
|
-
metadataActionClicked: "oss.inspector.metadata_action_clicked"
|
|
30
|
-
eventSnippetsRun: "oss.inspector.event_snippets_run",
|
|
31
|
-
eventSnippetsSaved: "oss.inspector.event_snippets_saved"
|
|
29
|
+
metadataActionClicked: "oss.inspector.metadata_action_clicked"
|
|
32
30
|
};
|
|
33
31
|
const TELEMETRY_INGEST_URL = "https://telemetry.copilotkit.ai/ingest";
|
|
34
32
|
const TELEMETRY_DOCS_URL = "https://docs.copilotkit.ai/telemetry";
|
|
@@ -273,20 +271,6 @@ function trackMetadataActionClicked(props) {
|
|
|
273
271
|
...metadataCoarseProperties(props)
|
|
274
272
|
});
|
|
275
273
|
}
|
|
276
|
-
function trackEventSnippetsRun(props) {
|
|
277
|
-
track(TELEMETRY_EVENTS.eventSnippetsRun, {
|
|
278
|
-
recipe: props.recipe,
|
|
279
|
-
source: props.source,
|
|
280
|
-
success: props.success
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
function trackEventSnippetsSaved(props) {
|
|
284
|
-
track(TELEMETRY_EVENTS.eventSnippetsSaved, {
|
|
285
|
-
recipe: props.recipe,
|
|
286
|
-
source: props.source,
|
|
287
|
-
success: props.success
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
274
|
/**
|
|
291
275
|
* Returns the inspector's anonymous distinct-ID for cross-domain
|
|
292
276
|
* propagation onto outbound announcement-CTA links, or `null` when the user
|
|
@@ -351,5 +335,5 @@ async function postBestEffort(url, body, distinctId) {
|
|
|
351
335
|
}
|
|
352
336
|
|
|
353
337
|
//#endregion
|
|
354
|
-
export { TELEMETRY_DOCS_URL, ensureTelemetryDistinctId, getRuntimeUrlType, getTelemetryDistinctIdForUrl, maybeShowDisclosure, trackErrorSignalViewed,
|
|
338
|
+
export { TELEMETRY_DOCS_URL, ensureTelemetryDistinctId, getRuntimeUrlType, getTelemetryDistinctIdForUrl, maybeShowDisclosure, trackErrorSignalViewed, trackHomeCtaClicked, trackHomeViewed, trackInspectorOpened, trackMemoriesTabClicked, trackMetadataActionClicked, trackMetadataModuleViewed, trackTalkToEngineerClicked, trackThreadsEmptyEnabledViewed, trackThreadsEnabledViewed, trackThreadsExampleSelected, trackThreadsExampleTourCompleted, trackThreadsExampleTourDismissed, trackThreadsExampleTourReopened, trackThreadsExampleTourStarted, trackThreadsExampleTourStepViewed, trackThreadsExampleViewed, trackThreadsIntelligenceSignupClicked, trackThreadsLockedViewed, trackThreadsTabClicked, trackThreadsTalkToEngineerClicked, trackWhatsNewClicked, trackWhatsNewSignalViewed, trackWhatsNewViewed };
|
|
355
339
|
//# sourceMappingURL=telemetry.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.mjs","names":["packageJson.version"],"sources":["../../src/lib/telemetry.ts"],"sourcesContent":["// Inspector-side anonymous telemetry. V1 events fire from index.ts for\n// What's new and thread-inspection interactions. POSTs directly from the\n// browser to the CopilotKit telemetry sink at\n// `telemetry.copilotkit.ai/ingest`, where a Lambda fan-out forwards events to\n// PostHog / Reo / Scarf.\n//\n// The endpoint URL is intentionally clearly named so it's obvious in\n// DevTools / Network tab — transparency for opt-in users.\n//\n// Privacy invariants enforced here:\n// - We never send message content, agent state, prompts, completions,\n// or announcement markdown. Feature-specific properties are scoped to\n// event metadata only (banner_id/timestamp, cta location). Reviewers\n// should grep call sites for any unintended payload.\n// - The opt-out short-circuits before any network call. There is no\n// buffer, no retry queue.\n// - All errors are swallowed; telemetry must never break the host app.\n\nimport {\n getOrCreateTelemetryDistinctId,\n hasTelemetryDisclosureBeenShown,\n isTelemetryOptedOut,\n markTelemetryDisclosureShown,\n} from \"./persistence.js\";\nimport packageJson from \"../../package.json\" with { type: \"json\" };\n\n// V1 funnel events. Namespaced `oss.inspector.*` so the lambda's\n// owned-prefix gate (oss-path-to-production) can accept them server-side\n// without a per-event sink deploy.\nexport const TELEMETRY_EVENTS = {\n opened: \"oss.inspector.opened\",\n whatsNewViewed: \"oss.inspector.whats_new_viewed\",\n whatsNewSignalViewed: \"oss.inspector.whats_new_signal_viewed\",\n errorSignalViewed: \"oss.inspector.error_signal_viewed\",\n whatsNewClicked: \"oss.inspector.whats_new_clicked\",\n threadsTabClicked: \"oss.inspector.threads_tab_clicked\",\n threadsLockedViewed: \"oss.inspector.threads_locked_viewed\",\n threadsIntelligenceSignupClicked:\n \"oss.inspector.threads_intelligence_signup_clicked\",\n threadsTalkToEngineerClicked:\n \"oss.inspector.threads_talk_to_engineer_clicked\",\n talkToEngineerClicked: \"oss.inspector.talk_to_engineer_clicked\",\n threadsEmptyEnabledViewed: \"oss.inspector.threads_empty_enabled_viewed\",\n threadsEnabledViewed: \"oss.inspector.threads_enabled_viewed\",\n threadsExampleViewed: \"oss.inspector.threads_example_viewed\",\n threadsExampleSelected: \"oss.inspector.threads_example_selected\",\n threadsExampleTourStarted: \"oss.inspector.threads_example_tour_started\",\n threadsExampleTourStepViewed:\n \"oss.inspector.threads_example_tour_step_viewed\",\n threadsExampleTourDismissed: \"oss.inspector.threads_example_tour_dismissed\",\n threadsExampleTourCompleted: \"oss.inspector.threads_example_tour_completed\",\n threadsExampleTourReopened: \"oss.inspector.threads_example_tour_reopened\",\n memoriesTabClicked: \"oss.inspector.memories_tab_clicked\",\n homeViewed: \"oss.inspector.home_viewed\",\n homeCtaClicked: \"oss.inspector.home_cta_clicked\",\n metadataModuleViewed: \"oss.inspector.metadata_module_viewed\",\n metadataActionClicked: \"oss.inspector.metadata_action_clicked\",\n eventSnippetsRun: \"oss.inspector.event_snippets_run\",\n eventSnippetsSaved: \"oss.inspector.event_snippets_saved\",\n} as const;\n\nexport type TelemetryEvent =\n (typeof TELEMETRY_EVENTS)[keyof typeof TELEMETRY_EVENTS];\n\n// Per the OSS-96 ticket — the URL is intentionally clearly named for\n// transparency in the network tab.\nexport const TELEMETRY_INGEST_URL = \"https://telemetry.copilotkit.ai/ingest\";\n\n// Surfaced in console disclosure and the in-product opt-out panel.\n// Keep in sync with the live shell-docs telemetry page\n// (`showcase/shell-docs/src/content/docs/integrations/built-in-agent/telemetry.mdx`).\n// Mirror constant: packages/runtime/src/v1-deprecated/lib/telemetry-disclosure.ts\nexport const TELEMETRY_DOCS_URL = \"https://docs.copilotkit.ai/telemetry\";\n\nconst PACKAGE_NAME = \"@copilotkit/web-inspector\";\nconst PACKAGE_VERSION = packageJson.version;\n\n// 3-second cap so a slow gateway can't hang the host app. Matches the\n// runtime's existing scarf-client convention.\nconst FETCH_TIMEOUT_MS = 3000;\n\nexport type RuntimeUrlType =\n | \"missing\"\n | \"relative\"\n | \"localhost\"\n | \"same_origin\"\n | \"remote\"\n | \"invalid\";\n\nexport function getRuntimeUrlType(\n runtimeUrl: string | undefined,\n): RuntimeUrlType {\n if (!runtimeUrl) return \"missing\";\n if (runtimeUrl.startsWith(\"/\") && !runtimeUrl.startsWith(\"//\")) {\n return \"relative\";\n }\n\n try {\n const baseHref =\n typeof window !== \"undefined\"\n ? window.location.href\n : \"https://copilotkit.ai\";\n const url = new URL(runtimeUrl, baseHref);\n const baseUrl = new URL(baseHref);\n const hostname = url.hostname.toLowerCase();\n\n if (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n ) {\n return \"localhost\";\n }\n\n return url.origin === baseUrl.origin ? \"same_origin\" : \"remote\";\n } catch {\n return \"invalid\";\n }\n}\n\n/**\n * Fire-and-forget telemetry send. Returns synchronously; the network\n * call is dispatched in the background and any failure is swallowed.\n *\n * Short-circuits when the user has opted out. Does NOT itself trigger\n * the first-run disclosure — call `maybeShowDisclosure()` from the\n * inspector's mount lifecycle instead.\n */\nexport function track(\n event: TelemetryEvent,\n properties: Record<string, unknown> = {},\n): void {\n if (isTelemetryOptedOut()) return;\n\n try {\n const distinctId = getOrCreateTelemetryDistinctId();\n // Every event carries package identity and the inspector's anonymous\n // distinct-ID, so any of them can be segmented by inspector version.\n const body = JSON.stringify({\n event,\n properties: {\n ...properties,\n package_name: PACKAGE_NAME,\n package_version: PACKAGE_VERSION,\n inspector_distinct_id: distinctId,\n distinct_id: distinctId,\n },\n package: {\n name: PACKAGE_NAME,\n version: PACKAGE_VERSION,\n },\n ts: Math.floor(Date.now() / 1000),\n });\n void postBestEffort(TELEMETRY_INGEST_URL, body, distinctId);\n } catch {\n // Identity and serialization failures are best-effort too.\n }\n}\n\n// --- Typed per-event helpers ---\n// These enforce the known property shape for each V1 event at the call\n// site, so callers can't accidentally include PII under a wrong key.\n\n/**\n * Where an announcement was rendered when the event fired. What's new is the\n * only surface that carries one, so the value is currently a constant — it\n * stays a stamped property rather than an inferred one so a second surface\n * can be added without changing the event's shape.\n */\nexport type WhatsNewSurface = \"whats_new\";\n\n/**\n * Whether a launcher signal was animated, or held static because the reader\n * asked for reduced motion. Shared by every launcher signal so an\n * accessibility setting is never mistaken for disinterest.\n */\nexport type LauncherSignalPresentation = \"animated\" | \"reduced_motion\";\n\nexport type WhatsNewSignalPresentation = LauncherSignalPresentation;\n\n/**\n * Which failure class raised the launcher's error signal. A closed enum: the\n * failure *message* is never transmitted, so prompts, URLs and identifiers\n * embedded in an error cannot leave the browser.\n *\n * `connection` and `threads` are wiring *state*. `run`, `tool` and `memory`\n * are unread *events* that clear when their landing view is read.\n */\nexport type InspectorWiringErrorSource = \"connection\" | \"threads\";\nexport type InspectorEventErrorSource = \"run\" | \"tool\" | \"memory\";\nexport type InspectorErrorSignalSource =\n | InspectorWiringErrorSource\n | InspectorEventErrorSource;\n\n/**\n * Fires when What's new has rendered *with content*. A loading state is not\n * an impression, so the metric cannot inflate itself by counting readers who\n * arrived before the feed resolved.\n */\nexport function trackWhatsNewViewed(props: {\n banner_id: string;\n surface: WhatsNewSurface;\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewViewed, props);\n}\n\n/** Fires when the unread launcher signal is presented in a visible tab. */\nexport function trackWhatsNewSignalViewed(props: {\n banner_id: string;\n surface: \"launcher\";\n presentation: WhatsNewSignalPresentation;\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewSignalViewed, props);\n}\n\n/**\n * Whether the launcher opened its pill for this outage, or suppressed it.\n *\n * `suppressed` means no pill was shown. In practice that is the no-room\n * fallback — neither side of the launcher had space for the label — because\n * every other path to a visible error signal opens one.\n */\nexport type InspectorErrorSignalLabel = \"shown\" | \"suppressed\";\n\n/**\n * Fires when the launcher's error signal becomes *visible* — not when it arms.\n * Arming can happen with the panel open or the tab hidden, where there is no\n * launcher to look at, so counting arms would inflate the denominator this\n * event exists to provide.\n *\n * Deliberately carries three fixed enum values and nothing else. This is the\n * one place a later change could casually attach a free-text field, and the\n * failure message must never be transmitted.\n *\n * `label` is deliberately not a new event: the catalogue's size is asserted\n * and spelled out in a test title, and a property answers the one open\n * question — how often the no-room fallback fires — without touching either.\n *\n * The pill's own marginal effect cannot be measured here and must not be\n * reverse-engineered from this data: it ships together with the dot and the\n * beat, so there is no period with one and not the other.\n */\nexport function trackErrorSignalViewed(props: {\n source: InspectorErrorSignalSource;\n presentation: LauncherSignalPresentation;\n label: InspectorErrorSignalLabel;\n}): void {\n track(TELEMETRY_EVENTS.errorSignalViewed, {\n source: props.source,\n presentation: props.presentation,\n label: props.label,\n });\n}\n\n/**\n * Fires for links followed inside the announcement body. `body` is the only\n * call-to-action left: dismissal no longer exists, so there is nothing else a\n * click on this surface can mean.\n */\nexport function trackWhatsNewClicked(props: {\n banner_id: string;\n cta: \"body\";\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewClicked, props);\n}\n\n/**\n * How the panel was opened. Restoring a persisted-open panel on mount is\n * deliberately NOT a source: it is not an open *intent*, and counting it\n * would turn every dev-server hot reload into an \"open\".\n */\nexport type InspectorOpenSource = \"floating_button\" | \"message_toolbar\";\n\nexport type InspectorOpenedTelemetryProps = {\n open_source: InspectorOpenSource;\n package_name?: typeof PACKAGE_NAME;\n package_version?: string;\n inspector_distinct_id?: string;\n license_status?:\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n runtime_mode?: \"sse\" | \"intelligence\";\n runtime_url_type?: RuntimeUrlType;\n /** True when an unseen announcement was on screen at open time. */\n has_unseen_announcement?: boolean;\n /** True when an error signal was on the launcher at open time. */\n has_error_signal?: boolean;\n /** Which failure class was signalling at open time, when one was. */\n error_signal_source?: InspectorErrorSignalSource;\n /** True when this is the first Inspector open after install or upgrade. */\n first_open?: boolean;\n};\n\n/**\n * Panel-open signal (OSS-566). Before this event, opens could only be\n * inferred from in-panel activity (a floor) or from the announcement's own\n * click event (which misses the floating-button path entirely).\n */\nexport function trackInspectorOpened(\n props: InspectorOpenedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.opened, props);\n}\n\nexport type ExampleKind = \"realtime_sync\" | \"manage_history\" | \"inspect_runs\";\nexport type ThreadsUsageBucket =\n | \"absent\"\n | \"empty\"\n | \"within_limit\"\n | \"at_or_over_limit\"\n | \"unlimited\"\n | \"unknown_limit\";\nexport type ThreadsExpiryBucket = \"unavailable\" | \"zero\" | \"positive\";\nexport type InspectorGroupKey = \"home\" | \"workbench\" | \"inspect\";\nexport type InspectorLeafKey =\n | \"home\"\n | \"whats-new\"\n | \"playground\"\n | \"threads\"\n | \"ag-ui-events\"\n | \"event-snippets\"\n | \"agents\"\n | \"frontend-tools\"\n | \"capabilities\"\n | \"agent-context\"\n | \"memories\";\nexport type MetadataActionPlacement = \"threads_footer\" | \"threads_locked\";\nexport type ExampleTourStep = 1 | 2 | 3;\nexport type ExampleTourTab = \"timeline\" | \"raw-events\" | \"state\";\n\nexport type InspectorThreadTelemetryProps = Readonly<{\n posthog_distinct_id?: string;\n intelligence_status?:\n | \"intelligence_not_enabled\"\n | \"intelligence_enabled\"\n | \"unknown\";\n thread_service_status?: \"unavailable\" | \"available\" | \"unknown\" | \"error\";\n license_status?:\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n runtime_mode?: \"sse\" | \"intelligence\";\n runtime_url_type?: RuntimeUrlType;\n cta_surface?:\n | \"threads_locked\"\n | \"threads_header\"\n | \"threads_empty\"\n | \"threads_populated\"\n | \"sidebar_footer\";\n cta?: \"signup\" | \"talk_to_engineer\";\n telemetry_disabled?: boolean;\n has_threads?: boolean;\n usage_bucket?: ThreadsUsageBucket;\n expiry_bucket?: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n example_kind?: ExampleKind;\n tour_step?: ExampleTourStep;\n tour_tab?: ExampleTourTab;\n dismiss_method?: \"skip\" | \"done\";\n}>;\n\n/** Rebuild the common Thread payload from its closed coarse allowlist. */\nfunction threadCommonProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...(props.intelligence_status === undefined\n ? {}\n : { intelligence_status: props.intelligence_status }),\n ...(props.thread_service_status === undefined\n ? {}\n : { thread_service_status: props.thread_service_status }),\n ...(props.license_status === undefined\n ? {}\n : { license_status: props.license_status }),\n ...(props.runtime_mode === undefined\n ? {}\n : { runtime_mode: props.runtime_mode }),\n ...(props.runtime_url_type === undefined\n ? {}\n : { runtime_url_type: props.runtime_url_type }),\n ...(props.telemetry_disabled === undefined\n ? {}\n : { telemetry_disabled: props.telemetry_disabled }),\n ...(props.has_threads === undefined\n ? {}\n : { has_threads: props.has_threads }),\n ...(props.usage_bucket === undefined\n ? {}\n : { usage_bucket: props.usage_bucket }),\n ...(props.expiry_bucket === undefined\n ? {}\n : { expiry_bucket: props.expiry_bucket }),\n ...(props.group_key === undefined ? {} : { group_key: props.group_key }),\n ...(props.leaf_key === undefined ? {} : { leaf_key: props.leaf_key }),\n };\n}\n\n/** Add only the fields used by the three Thread CTA funnels. */\nfunction threadCtaProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadCommonProperties(props),\n ...(props.cta === undefined ? {} : { cta: props.cta }),\n ...(props.cta_surface === undefined\n ? {}\n : { cta_surface: props.cta_surface }),\n ...(props.posthog_distinct_id === undefined\n ? {}\n : { posthog_distinct_id: props.posthog_distinct_id }),\n };\n}\n\n/** Add only the closed example kind used by example impressions/selections. */\nfunction threadExampleProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadCommonProperties(props),\n ...(props.example_kind === undefined\n ? {}\n : { example_kind: props.example_kind }),\n };\n}\n\n/** Add only a bounded example kind and tour step/tab pair. */\nfunction threadTourProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadExampleProperties(props),\n ...(props.tour_step === undefined ? {} : { tour_step: props.tour_step }),\n ...(props.tour_tab === undefined ? {} : { tour_tab: props.tour_tab }),\n };\n}\n\n/** Add the bounded dismissal leaf used only by terminal tour events. */\nfunction threadTourTerminalProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadTourProperties(props),\n ...(props.dismiss_method === undefined\n ? {}\n : { dismiss_method: props.dismiss_method }),\n };\n}\n\nexport function trackThreadsTabClicked(\n props: InspectorThreadTelemetryProps = {},\n): void {\n track(TELEMETRY_EVENTS.threadsTabClicked, threadCommonProperties(props));\n}\n\nexport function trackThreadsLockedViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsLockedViewed, threadCommonProperties(props));\n}\n\nexport function trackThreadsIntelligenceSignupClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsIntelligenceSignupClicked,\n threadCtaProperties(props),\n );\n}\n\nexport function trackThreadsTalkToEngineerClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsTalkToEngineerClicked,\n threadCtaProperties(props),\n );\n}\n\nexport function trackTalkToEngineerClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.talkToEngineerClicked, threadCtaProperties(props));\n}\n\nexport function trackThreadsEmptyEnabledViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsEmptyEnabledViewed,\n threadCommonProperties(props),\n );\n}\n\nexport function trackThreadsEnabledViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsEnabledViewed, threadCommonProperties(props));\n}\n\nexport function trackThreadsExampleViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsExampleViewed, threadExampleProperties(props));\n}\n\nexport function trackThreadsExampleSelected(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleSelected,\n threadExampleProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourStarted(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourStarted,\n threadTourProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourStepViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourStepViewed,\n threadTourProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourDismissed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourDismissed,\n threadTourTerminalProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourCompleted(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourCompleted,\n threadTourTerminalProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourReopened(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourReopened,\n threadTourProperties(props),\n );\n}\n\nexport type InspectorMemoryTelemetryProps = {\n package_name?: typeof PACKAGE_NAME;\n package_version?: string;\n inspector_distinct_id?: string;\n posthog_distinct_id?: string;\n memory_count?: number;\n available?: boolean;\n};\n\nexport function trackMemoriesTabClicked(\n props: InspectorMemoryTelemetryProps = {},\n): void {\n track(TELEMETRY_EVENTS.memoriesTabClicked, props);\n}\n\nexport type InspectorMetadataTelemetryModule = \"identity\" | \"plan\" | \"action\";\nexport type InspectorMetadataLicenseBucket =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"unknown\";\nexport type InspectorMetadataActionKind =\n | \"manage_plan\"\n | \"renew\"\n | \"enable_intelligence\";\n\nexport type InspectorHomeTelemetryProps = Readonly<{\n action_kind?: InspectorMetadataActionKind;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n}>;\n\nexport function trackHomeViewed(props: InspectorHomeTelemetryProps = {}): void {\n track(TELEMETRY_EVENTS.homeViewed, {\n group_key: props.group_key ?? \"home\",\n leaf_key: props.leaf_key ?? \"home\",\n });\n}\n\nexport function trackHomeCtaClicked(props: InspectorHomeTelemetryProps): void {\n track(TELEMETRY_EVENTS.homeCtaClicked, {\n action_kind: props.action_kind,\n group_key: props.group_key ?? \"home\",\n leaf_key: props.leaf_key ?? \"home\",\n });\n}\n\nexport type InspectorMetadataModuleViewedTelemetryProps = Readonly<{\n module: InspectorMetadataTelemetryModule;\n license_bucket: InspectorMetadataLicenseBucket;\n action_kind?: InspectorMetadataActionKind;\n usage_bucket: ThreadsUsageBucket;\n expiry_bucket: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n action_placement?: MetadataActionPlacement;\n}>;\n\nexport type InspectorMetadataActionClickedTelemetryProps = Readonly<{\n action_kind: Exclude<InspectorMetadataActionKind, \"enable_intelligence\">;\n license_bucket: InspectorMetadataLicenseBucket;\n usage_bucket: ThreadsUsageBucket;\n expiry_bucket: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n action_placement?: MetadataActionPlacement;\n}>;\n\nfunction metadataCoarseProperties(\n props:\n | InspectorMetadataModuleViewedTelemetryProps\n | InspectorMetadataActionClickedTelemetryProps,\n) {\n const navigation =\n props.group_key === undefined || props.leaf_key === undefined\n ? {}\n : { group_key: props.group_key, leaf_key: props.leaf_key };\n return {\n license_bucket: props.license_bucket,\n usage_bucket: props.usage_bucket,\n expiry_bucket: props.expiry_bucket,\n ...navigation,\n ...(props.action_placement === undefined\n ? {}\n : { action_placement: props.action_placement }),\n };\n}\n\n/**\n * Tracks one visible Inspector metadata module using coarse fields only.\n * Rebuilding the payload here prevents local labels, IDs, URLs, and usage\n * values from crossing the telemetry boundary through extra object fields.\n */\nexport function trackMetadataModuleViewed(\n props: InspectorMetadataModuleViewedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.metadataModuleViewed, {\n module: props.module,\n ...(props.action_kind === undefined\n ? {}\n : { action_kind: props.action_kind }),\n ...metadataCoarseProperties(props),\n });\n}\n\n/**\n * Tracks clicks for managed plan and renewal actions. The existing\n * Intelligence-enable funnel keeps its original event and never calls this\n * helper, which prevents a single click from producing two wire events.\n */\nexport function trackMetadataActionClicked(\n props: InspectorMetadataActionClickedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.metadataActionClicked, {\n module: \"action\",\n action_kind: props.action_kind,\n ...metadataCoarseProperties(props),\n });\n}\n\nexport type EventSnippetRecipeKind =\n | \"tool-call\"\n | \"reasoning\"\n | \"text\"\n | \"activity\"\n | \"raw\";\n\nexport type EventSnippetSource = \"chat\" | \"pane\";\n\nexport function trackEventSnippetsRun(props: {\n recipe: EventSnippetRecipeKind;\n source: EventSnippetSource;\n success: boolean;\n}): void {\n track(TELEMETRY_EVENTS.eventSnippetsRun, {\n recipe: props.recipe,\n source: props.source,\n success: props.success,\n });\n}\n\nexport function trackEventSnippetsSaved(props: {\n recipe: EventSnippetRecipeKind;\n source: EventSnippetSource;\n success: boolean;\n}): void {\n track(TELEMETRY_EVENTS.eventSnippetsSaved, {\n recipe: props.recipe,\n source: props.source,\n success: props.success,\n });\n}\n\n/**\n * Returns the inspector's anonymous distinct-ID for cross-domain\n * propagation onto outbound announcement-CTA links, or `null` when the user\n * is opted out.\n *\n * The website / Ops API reads this query param on signup-flow landing\n * pages and calls `posthog.alias(...)` to merge the inspector's anon\n * ID with the website's anon ID, enabling the\n * `whats_new_viewed → whats_new_clicked → signup_attributed` funnel.\n * `identify()` itself is out of scope here (it happens on signup, in\n * the website / Ops API).\n *\n * Opt-out short-circuits this too: if the user has opted out, we do\n * NOT leak an anon ID across domains.\n */\nexport function getTelemetryDistinctIdForUrl(): string | null {\n if (isTelemetryOptedOut()) return null;\n return getOrCreateTelemetryDistinctId();\n}\n\n/**\n * Seeds the anonymous distinct-ID into localStorage on inspector mount\n * so it is ready for cross-domain propagation onto announcement-CTA links\n * even before the first event fires. No-op when the user has opted out.\n */\nexport function ensureTelemetryDistinctId(): void {\n if (isTelemetryOptedOut()) return;\n getOrCreateTelemetryDistinctId();\n}\n\n/**\n * Fires the one-time console disclosure on inspector mount, when the\n * user is not opted out and hasn't seen it before. Idempotent across\n * calls within a single session because `markTelemetryDisclosureShown`\n * persists to localStorage.\n *\n * If the user is opted out, we deliberately do nothing and do NOT mark\n * the flag — so a future opt-in flips back to \"first run\" behavior.\n */\nexport function maybeShowDisclosure(): void {\n if (isTelemetryOptedOut()) return;\n if (hasTelemetryDisclosureBeenShown()) return;\n // eslint-disable-next-line no-console\n console.info(\n `[CopilotKit Inspector] anonymous interaction telemetry enabled — see ${TELEMETRY_DOCS_URL} to opt out.`,\n );\n markTelemetryDisclosureShown();\n}\n\nexport { isTelemetryOptedOut };\n\nasync function postBestEffort(\n url: string,\n body: string,\n distinctId: string,\n): Promise<void> {\n if (typeof fetch === \"undefined\") return;\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n try {\n const controller = new AbortController();\n timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);\n await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-CopilotKit-Telemetry-Id\": distinctId,\n },\n body,\n signal: controller.signal,\n // No credentials / no Authorization header — anonymous endpoint.\n });\n } catch {\n // Silent failure — telemetry must not break the application.\n } finally {\n if (timeoutId !== undefined) clearTimeout(timeoutId);\n }\n}\n"],"mappings":";;;;AA6BA,MAAa,mBAAmB;CAC9B,QAAQ;CACR,gBAAgB;CAChB,sBAAsB;CACtB,mBAAmB;CACnB,iBAAiB;CACjB,mBAAmB;CACnB,qBAAqB;CACrB,kCACE;CACF,8BACE;CACF,uBAAuB;CACvB,2BAA2B;CAC3B,sBAAsB;CACtB,sBAAsB;CACtB,wBAAwB;CACx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,CAAC;;;;;;;AAQJ,SAAgB,2BACd,OACM;AACN,OAAM,iBAAiB,uBAAuB;EAC5C,QAAQ;EACR,aAAa,MAAM;EACnB,GAAG,yBAAyB,MAAM;EACnC,CAAC;;AAYJ,SAAgB,sBAAsB,OAI7B;AACP,OAAM,iBAAiB,kBAAkB;EACvC,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,SAAS,MAAM;EAChB,CAAC;;AAGJ,SAAgB,wBAAwB,OAI/B;AACP,OAAM,iBAAiB,oBAAoB;EACzC,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,SAAS,MAAM;EAChB,CAAC;;;;;;;;;;;;;;;;;AAkBJ,SAAgB,+BAA8C;AAC5D,KAAI,qBAAqB,CAAE,QAAO;AAClC,QAAO,gCAAgC;;;;;;;AAQzC,SAAgB,4BAAkC;AAChD,KAAI,qBAAqB,CAAE;AAC3B,iCAAgC;;;;;;;;;;;AAYlC,SAAgB,sBAA4B;AAC1C,KAAI,qBAAqB,CAAE;AAC3B,KAAI,iCAAiC,CAAE;AAEvC,SAAQ,KACN,wEAAwE,mBAAmB,cAC5F;AACD,+BAA8B;;AAKhC,eAAe,eACb,KACA,MACA,YACe;AACf,KAAI,OAAO,UAAU,YAAa;CAClC,IAAI;AACJ,KAAI;EACF,MAAM,aAAa,IAAI,iBAAiB;AACxC,cAAY,iBAAiB,WAAW,OAAO,EAAE,iBAAiB;AAClE,QAAM,MAAM,KAAK;GACf,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,6BAA6B;IAC9B;GACD;GACA,QAAQ,WAAW;GAEpB,CAAC;SACI,WAEE;AACR,MAAI,cAAc,OAAW,cAAa,UAAU"}
|
|
1
|
+
{"version":3,"file":"telemetry.mjs","names":["packageJson.version"],"sources":["../../src/lib/telemetry.ts"],"sourcesContent":["// Inspector-side anonymous telemetry. V1 events fire from index.ts for\n// What's new and thread-inspection interactions. POSTs directly from the\n// browser to the CopilotKit telemetry sink at\n// `telemetry.copilotkit.ai/ingest`, where a Lambda fan-out forwards events to\n// PostHog / Reo / Scarf.\n//\n// The endpoint URL is intentionally clearly named so it's obvious in\n// DevTools / Network tab — transparency for opt-in users.\n//\n// Privacy invariants enforced here:\n// - We never send message content, agent state, prompts, completions,\n// or announcement markdown. Feature-specific properties are scoped to\n// event metadata only (banner_id/timestamp, cta location). Reviewers\n// should grep call sites for any unintended payload.\n// - The opt-out short-circuits before any network call. There is no\n// buffer, no retry queue.\n// - All errors are swallowed; telemetry must never break the host app.\n\nimport {\n getOrCreateTelemetryDistinctId,\n hasTelemetryDisclosureBeenShown,\n isTelemetryOptedOut,\n markTelemetryDisclosureShown,\n} from \"./persistence.js\";\nimport packageJson from \"../../package.json\" with { type: \"json\" };\n\n// V1 funnel events. Namespaced `oss.inspector.*` so the lambda's\n// owned-prefix gate (oss-path-to-production) can accept them server-side\n// without a per-event sink deploy.\nexport const TELEMETRY_EVENTS = {\n opened: \"oss.inspector.opened\",\n whatsNewViewed: \"oss.inspector.whats_new_viewed\",\n whatsNewSignalViewed: \"oss.inspector.whats_new_signal_viewed\",\n errorSignalViewed: \"oss.inspector.error_signal_viewed\",\n whatsNewClicked: \"oss.inspector.whats_new_clicked\",\n threadsTabClicked: \"oss.inspector.threads_tab_clicked\",\n threadsLockedViewed: \"oss.inspector.threads_locked_viewed\",\n threadsIntelligenceSignupClicked:\n \"oss.inspector.threads_intelligence_signup_clicked\",\n threadsTalkToEngineerClicked:\n \"oss.inspector.threads_talk_to_engineer_clicked\",\n talkToEngineerClicked: \"oss.inspector.talk_to_engineer_clicked\",\n threadsEmptyEnabledViewed: \"oss.inspector.threads_empty_enabled_viewed\",\n threadsEnabledViewed: \"oss.inspector.threads_enabled_viewed\",\n threadsExampleViewed: \"oss.inspector.threads_example_viewed\",\n threadsExampleSelected: \"oss.inspector.threads_example_selected\",\n threadsExampleTourStarted: \"oss.inspector.threads_example_tour_started\",\n threadsExampleTourStepViewed:\n \"oss.inspector.threads_example_tour_step_viewed\",\n threadsExampleTourDismissed: \"oss.inspector.threads_example_tour_dismissed\",\n threadsExampleTourCompleted: \"oss.inspector.threads_example_tour_completed\",\n threadsExampleTourReopened: \"oss.inspector.threads_example_tour_reopened\",\n memoriesTabClicked: \"oss.inspector.memories_tab_clicked\",\n homeViewed: \"oss.inspector.home_viewed\",\n homeCtaClicked: \"oss.inspector.home_cta_clicked\",\n metadataModuleViewed: \"oss.inspector.metadata_module_viewed\",\n metadataActionClicked: \"oss.inspector.metadata_action_clicked\",\n} as const;\n\nexport type TelemetryEvent =\n (typeof TELEMETRY_EVENTS)[keyof typeof TELEMETRY_EVENTS];\n\n// Per the OSS-96 ticket — the URL is intentionally clearly named for\n// transparency in the network tab.\nexport const TELEMETRY_INGEST_URL = \"https://telemetry.copilotkit.ai/ingest\";\n\n// Surfaced in console disclosure and the in-product opt-out panel.\n// Keep in sync with the live shell-docs telemetry page\n// (`showcase/shell-docs/src/content/docs/integrations/built-in-agent/telemetry.mdx`).\n// Mirror constant: packages/runtime/src/v1-deprecated/lib/telemetry-disclosure.ts\nexport const TELEMETRY_DOCS_URL = \"https://docs.copilotkit.ai/telemetry\";\n\nconst PACKAGE_NAME = \"@copilotkit/web-inspector\";\nconst PACKAGE_VERSION = packageJson.version;\n\n// 3-second cap so a slow gateway can't hang the host app. Matches the\n// runtime's existing scarf-client convention.\nconst FETCH_TIMEOUT_MS = 3000;\n\nexport type RuntimeUrlType =\n | \"missing\"\n | \"relative\"\n | \"localhost\"\n | \"same_origin\"\n | \"remote\"\n | \"invalid\";\n\nexport function getRuntimeUrlType(\n runtimeUrl: string | undefined,\n): RuntimeUrlType {\n if (!runtimeUrl) return \"missing\";\n if (runtimeUrl.startsWith(\"/\") && !runtimeUrl.startsWith(\"//\")) {\n return \"relative\";\n }\n\n try {\n const baseHref =\n typeof window !== \"undefined\"\n ? window.location.href\n : \"https://copilotkit.ai\";\n const url = new URL(runtimeUrl, baseHref);\n const baseUrl = new URL(baseHref);\n const hostname = url.hostname.toLowerCase();\n\n if (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n ) {\n return \"localhost\";\n }\n\n return url.origin === baseUrl.origin ? \"same_origin\" : \"remote\";\n } catch {\n return \"invalid\";\n }\n}\n\n/**\n * Fire-and-forget telemetry send. Returns synchronously; the network\n * call is dispatched in the background and any failure is swallowed.\n *\n * Short-circuits when the user has opted out. Does NOT itself trigger\n * the first-run disclosure — call `maybeShowDisclosure()` from the\n * inspector's mount lifecycle instead.\n */\nexport function track(\n event: TelemetryEvent,\n properties: Record<string, unknown> = {},\n): void {\n if (isTelemetryOptedOut()) return;\n\n try {\n const distinctId = getOrCreateTelemetryDistinctId();\n // Every event carries package identity and the inspector's anonymous\n // distinct-ID, so any of them can be segmented by inspector version.\n const body = JSON.stringify({\n event,\n properties: {\n ...properties,\n package_name: PACKAGE_NAME,\n package_version: PACKAGE_VERSION,\n inspector_distinct_id: distinctId,\n distinct_id: distinctId,\n },\n package: {\n name: PACKAGE_NAME,\n version: PACKAGE_VERSION,\n },\n ts: Math.floor(Date.now() / 1000),\n });\n void postBestEffort(TELEMETRY_INGEST_URL, body, distinctId);\n } catch {\n // Identity and serialization failures are best-effort too.\n }\n}\n\n// --- Typed per-event helpers ---\n// These enforce the known property shape for each V1 event at the call\n// site, so callers can't accidentally include PII under a wrong key.\n\n/**\n * Where an announcement was rendered when the event fired. What's new is the\n * only surface that carries one, so the value is currently a constant — it\n * stays a stamped property rather than an inferred one so a second surface\n * can be added without changing the event's shape.\n */\nexport type WhatsNewSurface = \"whats_new\";\n\n/**\n * Whether a launcher signal was animated, or held static because the reader\n * asked for reduced motion. Shared by every launcher signal so an\n * accessibility setting is never mistaken for disinterest.\n */\nexport type LauncherSignalPresentation = \"animated\" | \"reduced_motion\";\n\nexport type WhatsNewSignalPresentation = LauncherSignalPresentation;\n\n/**\n * Which failure class raised the launcher's error signal. A closed enum: the\n * failure *message* is never transmitted, so prompts, URLs and identifiers\n * embedded in an error cannot leave the browser.\n *\n * `connection` and `threads` are wiring *state*. `run`, `tool` and `memory`\n * are unread *events* that clear when their landing view is read.\n */\nexport type InspectorWiringErrorSource = \"connection\" | \"threads\";\nexport type InspectorEventErrorSource = \"run\" | \"tool\" | \"memory\";\nexport type InspectorErrorSignalSource =\n | InspectorWiringErrorSource\n | InspectorEventErrorSource;\n\n/**\n * Fires when What's new has rendered *with content*. A loading state is not\n * an impression, so the metric cannot inflate itself by counting readers who\n * arrived before the feed resolved.\n */\nexport function trackWhatsNewViewed(props: {\n banner_id: string;\n surface: WhatsNewSurface;\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewViewed, props);\n}\n\n/** Fires when the unread launcher signal is presented in a visible tab. */\nexport function trackWhatsNewSignalViewed(props: {\n banner_id: string;\n surface: \"launcher\";\n presentation: WhatsNewSignalPresentation;\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewSignalViewed, props);\n}\n\n/**\n * Whether the launcher opened its pill for this outage, or suppressed it.\n *\n * `suppressed` means no pill was shown. In practice that is the no-room\n * fallback — neither side of the launcher had space for the label — because\n * every other path to a visible error signal opens one.\n */\nexport type InspectorErrorSignalLabel = \"shown\" | \"suppressed\";\n\n/**\n * Fires when the launcher's error signal becomes *visible* — not when it arms.\n * Arming can happen with the panel open or the tab hidden, where there is no\n * launcher to look at, so counting arms would inflate the denominator this\n * event exists to provide.\n *\n * Deliberately carries three fixed enum values and nothing else. This is the\n * one place a later change could casually attach a free-text field, and the\n * failure message must never be transmitted.\n *\n * `label` is deliberately not a new event: the catalogue's size is asserted\n * and spelled out in a test title, and a property answers the one open\n * question — how often the no-room fallback fires — without touching either.\n *\n * The pill's own marginal effect cannot be measured here and must not be\n * reverse-engineered from this data: it ships together with the dot and the\n * beat, so there is no period with one and not the other.\n */\nexport function trackErrorSignalViewed(props: {\n source: InspectorErrorSignalSource;\n presentation: LauncherSignalPresentation;\n label: InspectorErrorSignalLabel;\n}): void {\n track(TELEMETRY_EVENTS.errorSignalViewed, {\n source: props.source,\n presentation: props.presentation,\n label: props.label,\n });\n}\n\n/**\n * Fires for links followed inside the announcement body. `body` is the only\n * call-to-action left: dismissal no longer exists, so there is nothing else a\n * click on this surface can mean.\n */\nexport function trackWhatsNewClicked(props: {\n banner_id: string;\n cta: \"body\";\n cta_label?: string;\n}): void {\n track(TELEMETRY_EVENTS.whatsNewClicked, props);\n}\n\n/**\n * How the panel was opened. Restoring a persisted-open panel on mount is\n * deliberately NOT a source: it is not an open *intent*, and counting it\n * would turn every dev-server hot reload into an \"open\".\n */\nexport type InspectorOpenSource = \"floating_button\" | \"message_toolbar\";\n\nexport type InspectorOpenedTelemetryProps = {\n open_source: InspectorOpenSource;\n package_name?: typeof PACKAGE_NAME;\n package_version?: string;\n inspector_distinct_id?: string;\n license_status?:\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n runtime_mode?: \"sse\" | \"intelligence\";\n runtime_url_type?: RuntimeUrlType;\n /** True when an unseen announcement was on screen at open time. */\n has_unseen_announcement?: boolean;\n /** True when an error signal was on the launcher at open time. */\n has_error_signal?: boolean;\n /** Which failure class was signalling at open time, when one was. */\n error_signal_source?: InspectorErrorSignalSource;\n /** True when this is the first Inspector open after install or upgrade. */\n first_open?: boolean;\n};\n\n/**\n * Panel-open signal (OSS-566). Before this event, opens could only be\n * inferred from in-panel activity (a floor) or from the announcement's own\n * click event (which misses the floating-button path entirely).\n */\nexport function trackInspectorOpened(\n props: InspectorOpenedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.opened, props);\n}\n\nexport type ExampleKind = \"realtime_sync\" | \"manage_history\" | \"inspect_runs\";\nexport type ThreadsUsageBucket =\n | \"absent\"\n | \"empty\"\n | \"within_limit\"\n | \"at_or_over_limit\"\n | \"unlimited\"\n | \"unknown_limit\";\nexport type ThreadsExpiryBucket = \"unavailable\" | \"zero\" | \"positive\";\nexport type InspectorGroupKey = \"home\" | \"workbench\" | \"inspect\";\nexport type InspectorLeafKey =\n | \"home\"\n | \"whats-new\"\n | \"playground\"\n | \"threads\"\n | \"ag-ui-events\"\n | \"agents\"\n | \"frontend-tools\"\n | \"capabilities\"\n | \"agent-context\"\n | \"memories\";\nexport type MetadataActionPlacement = \"threads_footer\" | \"threads_locked\";\nexport type ExampleTourStep = 1 | 2 | 3;\nexport type ExampleTourTab = \"timeline\" | \"raw-events\" | \"state\";\n\nexport type InspectorThreadTelemetryProps = Readonly<{\n posthog_distinct_id?: string;\n intelligence_status?:\n | \"intelligence_not_enabled\"\n | \"intelligence_enabled\"\n | \"unknown\";\n thread_service_status?: \"unavailable\" | \"available\" | \"unknown\" | \"error\";\n license_status?:\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n runtime_mode?: \"sse\" | \"intelligence\";\n runtime_url_type?: RuntimeUrlType;\n cta_surface?:\n | \"threads_locked\"\n | \"threads_header\"\n | \"threads_empty\"\n | \"threads_populated\"\n | \"sidebar_footer\";\n cta?: \"signup\" | \"talk_to_engineer\";\n telemetry_disabled?: boolean;\n has_threads?: boolean;\n usage_bucket?: ThreadsUsageBucket;\n expiry_bucket?: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n example_kind?: ExampleKind;\n tour_step?: ExampleTourStep;\n tour_tab?: ExampleTourTab;\n dismiss_method?: \"skip\" | \"done\";\n}>;\n\n/** Rebuild the common Thread payload from its closed coarse allowlist. */\nfunction threadCommonProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...(props.intelligence_status === undefined\n ? {}\n : { intelligence_status: props.intelligence_status }),\n ...(props.thread_service_status === undefined\n ? {}\n : { thread_service_status: props.thread_service_status }),\n ...(props.license_status === undefined\n ? {}\n : { license_status: props.license_status }),\n ...(props.runtime_mode === undefined\n ? {}\n : { runtime_mode: props.runtime_mode }),\n ...(props.runtime_url_type === undefined\n ? {}\n : { runtime_url_type: props.runtime_url_type }),\n ...(props.telemetry_disabled === undefined\n ? {}\n : { telemetry_disabled: props.telemetry_disabled }),\n ...(props.has_threads === undefined\n ? {}\n : { has_threads: props.has_threads }),\n ...(props.usage_bucket === undefined\n ? {}\n : { usage_bucket: props.usage_bucket }),\n ...(props.expiry_bucket === undefined\n ? {}\n : { expiry_bucket: props.expiry_bucket }),\n ...(props.group_key === undefined ? {} : { group_key: props.group_key }),\n ...(props.leaf_key === undefined ? {} : { leaf_key: props.leaf_key }),\n };\n}\n\n/** Add only the fields used by the three Thread CTA funnels. */\nfunction threadCtaProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadCommonProperties(props),\n ...(props.cta === undefined ? {} : { cta: props.cta }),\n ...(props.cta_surface === undefined\n ? {}\n : { cta_surface: props.cta_surface }),\n ...(props.posthog_distinct_id === undefined\n ? {}\n : { posthog_distinct_id: props.posthog_distinct_id }),\n };\n}\n\n/** Add only the closed example kind used by example impressions/selections. */\nfunction threadExampleProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadCommonProperties(props),\n ...(props.example_kind === undefined\n ? {}\n : { example_kind: props.example_kind }),\n };\n}\n\n/** Add only a bounded example kind and tour step/tab pair. */\nfunction threadTourProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadExampleProperties(props),\n ...(props.tour_step === undefined ? {} : { tour_step: props.tour_step }),\n ...(props.tour_tab === undefined ? {} : { tour_tab: props.tour_tab }),\n };\n}\n\n/** Add the bounded dismissal leaf used only by terminal tour events. */\nfunction threadTourTerminalProperties(props: InspectorThreadTelemetryProps) {\n return {\n ...threadTourProperties(props),\n ...(props.dismiss_method === undefined\n ? {}\n : { dismiss_method: props.dismiss_method }),\n };\n}\n\nexport function trackThreadsTabClicked(\n props: InspectorThreadTelemetryProps = {},\n): void {\n track(TELEMETRY_EVENTS.threadsTabClicked, threadCommonProperties(props));\n}\n\nexport function trackThreadsLockedViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsLockedViewed, threadCommonProperties(props));\n}\n\nexport function trackThreadsIntelligenceSignupClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsIntelligenceSignupClicked,\n threadCtaProperties(props),\n );\n}\n\nexport function trackThreadsTalkToEngineerClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsTalkToEngineerClicked,\n threadCtaProperties(props),\n );\n}\n\nexport function trackTalkToEngineerClicked(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.talkToEngineerClicked, threadCtaProperties(props));\n}\n\nexport function trackThreadsEmptyEnabledViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsEmptyEnabledViewed,\n threadCommonProperties(props),\n );\n}\n\nexport function trackThreadsEnabledViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsEnabledViewed, threadCommonProperties(props));\n}\n\nexport function trackThreadsExampleViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.threadsExampleViewed, threadExampleProperties(props));\n}\n\nexport function trackThreadsExampleSelected(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleSelected,\n threadExampleProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourStarted(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourStarted,\n threadTourProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourStepViewed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourStepViewed,\n threadTourProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourDismissed(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourDismissed,\n threadTourTerminalProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourCompleted(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourCompleted,\n threadTourTerminalProperties(props),\n );\n}\n\nexport function trackThreadsExampleTourReopened(\n props: InspectorThreadTelemetryProps,\n): void {\n track(\n TELEMETRY_EVENTS.threadsExampleTourReopened,\n threadTourProperties(props),\n );\n}\n\nexport type InspectorMemoryTelemetryProps = {\n package_name?: typeof PACKAGE_NAME;\n package_version?: string;\n inspector_distinct_id?: string;\n posthog_distinct_id?: string;\n memory_count?: number;\n available?: boolean;\n};\n\nexport function trackMemoriesTabClicked(\n props: InspectorMemoryTelemetryProps = {},\n): void {\n track(TELEMETRY_EVENTS.memoriesTabClicked, props);\n}\n\nexport type InspectorMetadataTelemetryModule = \"identity\" | \"plan\" | \"action\";\nexport type InspectorMetadataLicenseBucket =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"unknown\";\nexport type InspectorMetadataActionKind =\n | \"manage_plan\"\n | \"renew\"\n | \"enable_intelligence\";\n\nexport type InspectorHomeTelemetryProps = Readonly<{\n action_kind?: InspectorMetadataActionKind;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n}>;\n\nexport function trackHomeViewed(props: InspectorHomeTelemetryProps = {}): void {\n track(TELEMETRY_EVENTS.homeViewed, {\n group_key: props.group_key ?? \"home\",\n leaf_key: props.leaf_key ?? \"home\",\n });\n}\n\nexport function trackHomeCtaClicked(props: InspectorHomeTelemetryProps): void {\n track(TELEMETRY_EVENTS.homeCtaClicked, {\n action_kind: props.action_kind,\n group_key: props.group_key ?? \"home\",\n leaf_key: props.leaf_key ?? \"home\",\n });\n}\n\nexport type InspectorMetadataModuleViewedTelemetryProps = Readonly<{\n module: InspectorMetadataTelemetryModule;\n license_bucket: InspectorMetadataLicenseBucket;\n action_kind?: InspectorMetadataActionKind;\n usage_bucket: ThreadsUsageBucket;\n expiry_bucket: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n action_placement?: MetadataActionPlacement;\n}>;\n\nexport type InspectorMetadataActionClickedTelemetryProps = Readonly<{\n action_kind: Exclude<InspectorMetadataActionKind, \"enable_intelligence\">;\n license_bucket: InspectorMetadataLicenseBucket;\n usage_bucket: ThreadsUsageBucket;\n expiry_bucket: ThreadsExpiryBucket;\n group_key?: InspectorGroupKey;\n leaf_key?: InspectorLeafKey;\n action_placement?: MetadataActionPlacement;\n}>;\n\nfunction metadataCoarseProperties(\n props:\n | InspectorMetadataModuleViewedTelemetryProps\n | InspectorMetadataActionClickedTelemetryProps,\n) {\n const navigation =\n props.group_key === undefined || props.leaf_key === undefined\n ? {}\n : { group_key: props.group_key, leaf_key: props.leaf_key };\n return {\n license_bucket: props.license_bucket,\n usage_bucket: props.usage_bucket,\n expiry_bucket: props.expiry_bucket,\n ...navigation,\n ...(props.action_placement === undefined\n ? {}\n : { action_placement: props.action_placement }),\n };\n}\n\n/**\n * Tracks one visible Inspector metadata module using coarse fields only.\n * Rebuilding the payload here prevents local labels, IDs, URLs, and usage\n * values from crossing the telemetry boundary through extra object fields.\n */\nexport function trackMetadataModuleViewed(\n props: InspectorMetadataModuleViewedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.metadataModuleViewed, {\n module: props.module,\n ...(props.action_kind === undefined\n ? {}\n : { action_kind: props.action_kind }),\n ...metadataCoarseProperties(props),\n });\n}\n\n/**\n * Tracks clicks for managed plan and renewal actions. The existing\n * Intelligence-enable funnel keeps its original event and never calls this\n * helper, which prevents a single click from producing two wire events.\n */\nexport function trackMetadataActionClicked(\n props: InspectorMetadataActionClickedTelemetryProps,\n): void {\n track(TELEMETRY_EVENTS.metadataActionClicked, {\n module: \"action\",\n action_kind: props.action_kind,\n ...metadataCoarseProperties(props),\n });\n}\n\n/**\n * Returns the inspector's anonymous distinct-ID for cross-domain\n * propagation onto outbound announcement-CTA links, or `null` when the user\n * is opted out.\n *\n * The website / Ops API reads this query param on signup-flow landing\n * pages and calls `posthog.alias(...)` to merge the inspector's anon\n * ID with the website's anon ID, enabling the\n * `whats_new_viewed → whats_new_clicked → signup_attributed` funnel.\n * `identify()` itself is out of scope here (it happens on signup, in\n * the website / Ops API).\n *\n * Opt-out short-circuits this too: if the user has opted out, we do\n * NOT leak an anon ID across domains.\n */\nexport function getTelemetryDistinctIdForUrl(): string | null {\n if (isTelemetryOptedOut()) return null;\n return getOrCreateTelemetryDistinctId();\n}\n\n/**\n * Seeds the anonymous distinct-ID into localStorage on inspector mount\n * so it is ready for cross-domain propagation onto announcement-CTA links\n * even before the first event fires. No-op when the user has opted out.\n */\nexport function ensureTelemetryDistinctId(): void {\n if (isTelemetryOptedOut()) return;\n getOrCreateTelemetryDistinctId();\n}\n\n/**\n * Fires the one-time console disclosure on inspector mount, when the\n * user is not opted out and hasn't seen it before. Idempotent across\n * calls within a single session because `markTelemetryDisclosureShown`\n * persists to localStorage.\n *\n * If the user is opted out, we deliberately do nothing and do NOT mark\n * the flag — so a future opt-in flips back to \"first run\" behavior.\n */\nexport function maybeShowDisclosure(): void {\n if (isTelemetryOptedOut()) return;\n if (hasTelemetryDisclosureBeenShown()) return;\n // eslint-disable-next-line no-console\n console.info(\n `[CopilotKit Inspector] anonymous interaction telemetry enabled — see ${TELEMETRY_DOCS_URL} to opt out.`,\n );\n markTelemetryDisclosureShown();\n}\n\nexport { isTelemetryOptedOut };\n\nasync function postBestEffort(\n url: string,\n body: string,\n distinctId: string,\n): Promise<void> {\n if (typeof fetch === \"undefined\") return;\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n try {\n const controller = new AbortController();\n timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);\n await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-CopilotKit-Telemetry-Id\": distinctId,\n },\n body,\n signal: controller.signal,\n // No credentials / no Authorization header — anonymous endpoint.\n });\n } catch {\n // Silent failure — telemetry must not break the application.\n } finally {\n if (timeoutId !== undefined) clearTimeout(timeoutId);\n }\n}\n"],"mappings":";;;;AA6BA,MAAa,mBAAmB;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