@copilotkit/web-inspector 1.64.2-canary.perfall1 → 1.64.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 +81 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +17 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +82 -25
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +137 -56
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/telemetry.cjs +28 -5
- package/dist/lib/telemetry.cjs.map +1 -1
- package/dist/lib/telemetry.mjs +27 -6
- package/dist/lib/telemetry.mjs.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +2 -2
- package/src/__tests__/telemetry-egress-guard.spec.ts +41 -0
- package/src/__tests__/web-inspector.spec.ts +343 -3
- package/src/index.ts +137 -35
- package/src/lib/__tests__/telemetry.test.ts +97 -3
- package/src/lib/telemetry.ts +77 -4
- package/src/lib/testing/telemetry-egress-guard.ts +33 -0
- package/vitest.setup.ts +8 -0
package/dist/index.umd.js
CHANGED
|
@@ -191,13 +191,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
191
191
|
|
|
192
192
|
//#endregion
|
|
193
193
|
//#region package.json
|
|
194
|
-
var version = "1.64.2
|
|
194
|
+
var version = "1.64.2";
|
|
195
195
|
|
|
196
196
|
//#endregion
|
|
197
197
|
//#region src/lib/telemetry.ts
|
|
198
198
|
const TELEMETRY_EVENTS = {
|
|
199
|
+
opened: "oss.inspector.opened",
|
|
199
200
|
bannerViewed: "oss.inspector.banner_viewed",
|
|
200
201
|
bannerClicked: "oss.inspector.banner_clicked",
|
|
202
|
+
bannerDismissed: "oss.inspector.banner_dismissed",
|
|
201
203
|
threadsTabClicked: "oss.inspector.threads_tab_clicked",
|
|
202
204
|
threadsLockedViewed: "oss.inspector.threads_locked_viewed",
|
|
203
205
|
threadsIntelligenceSignupClicked: "oss.inspector.threads_intelligence_signup_clicked",
|
|
@@ -219,8 +221,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
219
221
|
const PACKAGE_NAME = "@copilotkit/web-inspector";
|
|
220
222
|
const PACKAGE_VERSION = version;
|
|
221
223
|
const FETCH_TIMEOUT_MS = 3e3;
|
|
222
|
-
function
|
|
223
|
-
return event === TELEMETRY_EVENTS.threadsTabClicked || event === TELEMETRY_EVENTS.threadsLockedViewed || event === TELEMETRY_EVENTS.threadsIntelligenceSignupClicked || event === TELEMETRY_EVENTS.threadsTalkToEngineerClicked || event === TELEMETRY_EVENTS.talkToEngineerClicked || event === TELEMETRY_EVENTS.threadsEmptyEnabledViewed || event === TELEMETRY_EVENTS.threadsEnabledViewed || event === TELEMETRY_EVENTS.threadsExampleViewed || event === TELEMETRY_EVENTS.threadsExampleSelected || event === TELEMETRY_EVENTS.threadsExampleTourStarted || event === TELEMETRY_EVENTS.threadsExampleTourStepViewed || event === TELEMETRY_EVENTS.threadsExampleTourDismissed || event === TELEMETRY_EVENTS.threadsExampleTourCompleted || event === TELEMETRY_EVENTS.threadsExampleTourReopened || event === TELEMETRY_EVENTS.memoriesTabClicked;
|
|
224
|
+
function isEnrichedTelemetryEvent(event) {
|
|
225
|
+
return event === TELEMETRY_EVENTS.opened || event === TELEMETRY_EVENTS.threadsTabClicked || event === TELEMETRY_EVENTS.threadsLockedViewed || event === TELEMETRY_EVENTS.threadsIntelligenceSignupClicked || event === TELEMETRY_EVENTS.threadsTalkToEngineerClicked || event === TELEMETRY_EVENTS.talkToEngineerClicked || event === TELEMETRY_EVENTS.threadsEmptyEnabledViewed || event === TELEMETRY_EVENTS.threadsEnabledViewed || event === TELEMETRY_EVENTS.threadsExampleViewed || event === TELEMETRY_EVENTS.threadsExampleSelected || event === TELEMETRY_EVENTS.threadsExampleTourStarted || event === TELEMETRY_EVENTS.threadsExampleTourStepViewed || event === TELEMETRY_EVENTS.threadsExampleTourDismissed || event === TELEMETRY_EVENTS.threadsExampleTourCompleted || event === TELEMETRY_EVENTS.threadsExampleTourReopened || event === TELEMETRY_EVENTS.memoriesTabClicked;
|
|
224
226
|
}
|
|
225
227
|
function getRuntimeUrlType(runtimeUrl) {
|
|
226
228
|
if (!runtimeUrl) return "missing";
|
|
@@ -247,7 +249,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
247
249
|
function track(event, properties = {}) {
|
|
248
250
|
if (isTelemetryOptedOut()) return;
|
|
249
251
|
const distinctId = getOrCreateTelemetryDistinctId();
|
|
250
|
-
const
|
|
252
|
+
const enrichedProperties = isEnrichedTelemetryEvent(event) ? {
|
|
251
253
|
package_name: PACKAGE_NAME,
|
|
252
254
|
package_version: PACKAGE_VERSION,
|
|
253
255
|
inspector_distinct_id: distinctId
|
|
@@ -258,12 +260,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
258
260
|
event,
|
|
259
261
|
properties: {
|
|
260
262
|
...properties,
|
|
261
|
-
...
|
|
263
|
+
...enrichedProperties,
|
|
262
264
|
distinct_id: distinctId
|
|
263
265
|
},
|
|
264
266
|
package: {
|
|
265
267
|
name: PACKAGE_NAME,
|
|
266
|
-
...
|
|
268
|
+
...isEnrichedTelemetryEvent(event) ? { version: PACKAGE_VERSION } : {}
|
|
267
269
|
},
|
|
268
270
|
ts: Math.floor(Date.now() / 1e3)
|
|
269
271
|
});
|
|
@@ -278,6 +280,25 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
278
280
|
function trackBannerClicked(props) {
|
|
279
281
|
track(TELEMETRY_EVENTS.bannerClicked, props);
|
|
280
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* First-class dismissal signal. Emitted *in addition to*
|
|
285
|
+
* `banner_clicked { cta: "dismiss" }` rather than replacing it — the
|
|
286
|
+
* existing dashboards read the `cta` value, so removing it would silently
|
|
287
|
+
* zero them out. New reporting should prefer this event, whose `surface`
|
|
288
|
+
* says whether the user swatted the bubble away or dismissed the card
|
|
289
|
+
* after opening the panel.
|
|
290
|
+
*/
|
|
291
|
+
function trackBannerDismissed(props) {
|
|
292
|
+
track(TELEMETRY_EVENTS.bannerDismissed, props);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Panel-open signal (OSS-566). Before this event, opens could only be
|
|
296
|
+
* inferred from in-panel activity (a floor) or from `banner_clicked`
|
|
297
|
+
* cta=`body` (which misses the floating-button path entirely).
|
|
298
|
+
*/
|
|
299
|
+
function trackInspectorOpened(props) {
|
|
300
|
+
track(TELEMETRY_EVENTS.opened, props);
|
|
301
|
+
}
|
|
281
302
|
function trackThreadsTabClicked(props = {}) {
|
|
282
303
|
track(TELEMETRY_EVENTS.threadsTabClicked, props);
|
|
283
304
|
}
|
|
@@ -413,6 +434,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
413
434
|
};
|
|
414
435
|
const DOCKED_LEFT_WIDTH = 500;
|
|
415
436
|
const MAX_AGENT_EVENTS = 200;
|
|
437
|
+
const MAX_PENDING_BANNER_VIEWED = 20;
|
|
416
438
|
const MAX_TOTAL_EVENTS = 500;
|
|
417
439
|
const INTELLIGENCE_SIGNUP_URL = "https://go.copilotkit.ai/intelligence-signup";
|
|
418
440
|
const THREADS_INTELLIGENCE_SIGNIN_URL = "https://dashboard.operations.copilotkit.ai/sign-in";
|
|
@@ -3951,8 +3973,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(stateValue))}</p
|
|
|
3951
3973
|
this.announcementPromise = null;
|
|
3952
3974
|
this.showAnnouncementPreview = true;
|
|
3953
3975
|
this.announcementExpanded = false;
|
|
3954
|
-
this.
|
|
3955
|
-
this.pendingBannerViewed =
|
|
3976
|
+
this.viewedBannerSurfaces = /* @__PURE__ */ new Set();
|
|
3977
|
+
this.pendingBannerViewed = [];
|
|
3956
3978
|
this.clickedBannerIds = /* @__PURE__ */ new Set();
|
|
3957
3979
|
this.viewedThreadsTelemetryStates = /* @__PURE__ */ new Set();
|
|
3958
3980
|
this.viewedExampleThreadIds = /* @__PURE__ */ new Set();
|
|
@@ -4066,7 +4088,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(stateValue))}</p
|
|
|
4066
4088
|
this.hasCustomPosition.button = true;
|
|
4067
4089
|
if (this.draggedDuringInteraction) this.ignoreNextButtonClick = true;
|
|
4068
4090
|
}
|
|
4069
|
-
} else if (context === "button" && !this.isOpen && !this.draggedDuringInteraction) this.openInspector();
|
|
4091
|
+
} else if (context === "button" && !this.isOpen && !this.draggedDuringInteraction) this.openInspector("floating_button");
|
|
4070
4092
|
this.resetPointerTracking();
|
|
4071
4093
|
};
|
|
4072
4094
|
this.handlePointerCancel = (event) => {
|
|
@@ -4087,7 +4109,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(stateValue))}</p
|
|
|
4087
4109
|
}
|
|
4088
4110
|
if (!this.isOpen) {
|
|
4089
4111
|
event.preventDefault();
|
|
4090
|
-
this.openInspector();
|
|
4112
|
+
this.openInspector("floating_button");
|
|
4091
4113
|
}
|
|
4092
4114
|
};
|
|
4093
4115
|
this.handleClosePointerDown = (event) => {
|
|
@@ -4248,11 +4270,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(stateValue))}</p
|
|
|
4248
4270
|
};
|
|
4249
4271
|
this.handleDismissAnnouncementPreview = (event) => {
|
|
4250
4272
|
event.stopPropagation();
|
|
4251
|
-
this.
|
|
4252
|
-
};
|
|
4253
|
-
this.handleDismissAnnouncement = () => {
|
|
4254
|
-
this.trackBannerClickedOnce({ cta: "dismiss" });
|
|
4255
|
-
this.markAnnouncementSeen();
|
|
4273
|
+
this.dismissAnnouncement("collapsed_preview");
|
|
4256
4274
|
};
|
|
4257
4275
|
this.copyResetTimeouts = /* @__PURE__ */ new WeakMap();
|
|
4258
4276
|
this.handleAnnouncementContentClick = (event) => {
|
|
@@ -5680,12 +5698,15 @@ ${argsString}</pre
|
|
|
5680
5698
|
this.setDragging(false);
|
|
5681
5699
|
this.draggedDuringInteraction = false;
|
|
5682
5700
|
}
|
|
5683
|
-
openInspector() {
|
|
5701
|
+
openInspector(source) {
|
|
5684
5702
|
if (this.isOpen) return;
|
|
5703
|
+
const hadUnseenAnnouncement = this.hasUnseenAnnouncement;
|
|
5685
5704
|
this.showAnnouncementPreview = false;
|
|
5686
5705
|
this.ensureAnnouncementLoading();
|
|
5687
5706
|
this.isOpen = true;
|
|
5688
5707
|
this.persistState();
|
|
5708
|
+
this.trackOpened(source, hadUnseenAnnouncement);
|
|
5709
|
+
this.maybeTrackBannerViewed();
|
|
5689
5710
|
if (this.dockMode !== "floating") this.applyDockStyles();
|
|
5690
5711
|
this.ensureWindowPlacement();
|
|
5691
5712
|
this.requestUpdate();
|
|
@@ -5963,9 +5984,36 @@ ${argsString}</pre
|
|
|
5963
5984
|
</div>
|
|
5964
5985
|
`;
|
|
5965
5986
|
}
|
|
5966
|
-
|
|
5967
|
-
var _this$core14, _this$
|
|
5987
|
+
trackOpened(source, hadUnseenAnnouncement) {
|
|
5988
|
+
var _this$core14, _this$core$licenseSta2, _this$core15, _this$core$runtimeMod2, _this$core16, _this$core17;
|
|
5968
5989
|
if ((_this$core14 = this.core) === null || _this$core14 === void 0 ? void 0 : _this$core14.telemetryDisabled) return;
|
|
5990
|
+
trackInspectorOpened({
|
|
5991
|
+
open_source: source,
|
|
5992
|
+
...this.runtimeStatus === "connected" ? {
|
|
5993
|
+
license_status: (_this$core$licenseSta2 = (_this$core15 = this.core) === null || _this$core15 === void 0 ? void 0 : _this$core15.licenseStatus) !== null && _this$core$licenseSta2 !== void 0 ? _this$core$licenseSta2 : void 0,
|
|
5994
|
+
runtime_mode: (_this$core$runtimeMod2 = (_this$core16 = this.core) === null || _this$core16 === void 0 ? void 0 : _this$core16.runtimeMode) !== null && _this$core$runtimeMod2 !== void 0 ? _this$core$runtimeMod2 : void 0
|
|
5995
|
+
} : {},
|
|
5996
|
+
runtime_url_type: getRuntimeUrlType((_this$core17 = this.core) === null || _this$core17 === void 0 ? void 0 : _this$core17.runtimeUrl),
|
|
5997
|
+
has_unseen_announcement: hadUnseenAnnouncement
|
|
5998
|
+
});
|
|
5999
|
+
}
|
|
6000
|
+
trackBannerDismissedOnce(surface) {
|
|
6001
|
+
var _this$core18, _this$announcementCta;
|
|
6002
|
+
if ((_this$core18 = this.core) === null || _this$core18 === void 0 ? void 0 : _this$core18.telemetryDisabled) return;
|
|
6003
|
+
const id = this.announcementTimestamp;
|
|
6004
|
+
if (!id) return;
|
|
6005
|
+
const key = `${id}:dismissed:${surface}`;
|
|
6006
|
+
if (this.clickedBannerIds.has(key)) return;
|
|
6007
|
+
this.clickedBannerIds.add(key);
|
|
6008
|
+
trackBannerDismissed({
|
|
6009
|
+
banner_id: id,
|
|
6010
|
+
surface,
|
|
6011
|
+
cta_label: (_this$announcementCta = this.announcementCtaLabel) !== null && _this$announcementCta !== void 0 ? _this$announcementCta : void 0
|
|
6012
|
+
});
|
|
6013
|
+
}
|
|
6014
|
+
trackBannerClickedOnce(opts) {
|
|
6015
|
+
var _this$core19, _this$announcementCta2;
|
|
6016
|
+
if ((_this$core19 = this.core) === null || _this$core19 === void 0 ? void 0 : _this$core19.telemetryDisabled) return;
|
|
5969
6017
|
const id = this.announcementTimestamp;
|
|
5970
6018
|
if (!id) return;
|
|
5971
6019
|
const key = `${id}:${opts.cta}`;
|
|
@@ -5974,12 +6022,12 @@ ${argsString}</pre
|
|
|
5974
6022
|
trackBannerClicked({
|
|
5975
6023
|
banner_id: id,
|
|
5976
6024
|
cta: opts.cta,
|
|
5977
|
-
cta_label: (_this$
|
|
6025
|
+
cta_label: (_this$announcementCta2 = this.announcementCtaLabel) !== null && _this$announcementCta2 !== void 0 ? _this$announcementCta2 : void 0
|
|
5978
6026
|
});
|
|
5979
6027
|
}
|
|
5980
6028
|
trackThreadsViewStateOnce(state, threadCount) {
|
|
5981
|
-
var _this$
|
|
5982
|
-
if ((_this$
|
|
6029
|
+
var _this$core20;
|
|
6030
|
+
if ((_this$core20 = this.core) === null || _this$core20 === void 0 ? void 0 : _this$core20.telemetryDisabled) return;
|
|
5983
6031
|
const key = `${state}:${this.getThreadServiceStatus()}`;
|
|
5984
6032
|
if (this.viewedThreadsTelemetryStates.has(key)) return;
|
|
5985
6033
|
this.viewedThreadsTelemetryStates.add(key);
|
|
@@ -6028,8 +6076,8 @@ ${argsString}</pre
|
|
|
6028
6076
|
return provider;
|
|
6029
6077
|
}
|
|
6030
6078
|
trackThreadsExampleViewedOnce() {
|
|
6031
|
-
var _this$
|
|
6032
|
-
if ((_this$
|
|
6079
|
+
var _this$core21;
|
|
6080
|
+
if ((_this$core21 = this.core) === null || _this$core21 === void 0 ? void 0 : _this$core21.telemetryDisabled) return;
|
|
6033
6081
|
for (const thread of THREADS_EXAMPLE_THREADS) {
|
|
6034
6082
|
if (this.viewedExampleThreadIds.has(thread.id)) continue;
|
|
6035
6083
|
this.viewedExampleThreadIds.add(thread.id);
|
|
@@ -6040,8 +6088,8 @@ ${argsString}</pre
|
|
|
6040
6088
|
}
|
|
6041
6089
|
}
|
|
6042
6090
|
trackThreadsExampleSelectedOnce(threadId) {
|
|
6043
|
-
var _this$
|
|
6044
|
-
if ((_this$
|
|
6091
|
+
var _this$core22;
|
|
6092
|
+
if ((_this$core22 = this.core) === null || _this$core22 === void 0 ? void 0 : _this$core22.telemetryDisabled) return;
|
|
6045
6093
|
if (this.selectedExampleThreadIds.has(threadId)) return;
|
|
6046
6094
|
this.selectedExampleThreadIds.add(threadId);
|
|
6047
6095
|
trackThreadsExampleSelected(this.getThreadsTelemetryProps({
|
|
@@ -6060,8 +6108,8 @@ ${argsString}</pre
|
|
|
6060
6108
|
});
|
|
6061
6109
|
}
|
|
6062
6110
|
trackThreadsExampleTourStepViewedOnce() {
|
|
6063
|
-
var _this$
|
|
6064
|
-
if (((_this$
|
|
6111
|
+
var _this$core23, _THREADS_EXAMPLE_TOUR2;
|
|
6112
|
+
if (((_this$core23 = this.core) === null || _this$core23 === void 0 ? void 0 : _this$core23.telemetryDisabled) || !this.selectedThreadId) return;
|
|
6065
6113
|
if (!((_THREADS_EXAMPLE_TOUR2 = THREADS_EXAMPLE_TOUR_STEPS[this.exampleTourStep]) !== null && _THREADS_EXAMPLE_TOUR2 !== void 0 ? _THREADS_EXAMPLE_TOUR2 : THREADS_EXAMPLE_TOUR_STEPS[0])) return;
|
|
6066
6114
|
const key = `${this.selectedThreadId}:${this.exampleTourStep}`;
|
|
6067
6115
|
if (this.viewedExampleTourSteps.has(key)) return;
|
|
@@ -6079,15 +6127,15 @@ ${argsString}</pre
|
|
|
6079
6127
|
});
|
|
6080
6128
|
}
|
|
6081
6129
|
startExampleTour(autoStarted) {
|
|
6082
|
-
var _this$
|
|
6130
|
+
var _this$core25;
|
|
6083
6131
|
if (!this.selectedThreadId) return;
|
|
6084
6132
|
this.exampleTourActive = true;
|
|
6085
6133
|
this.exampleTourStep = 0;
|
|
6086
6134
|
if (autoStarted) {
|
|
6087
|
-
var _this$
|
|
6135
|
+
var _this$core24;
|
|
6088
6136
|
this.exampleTourAutoShown = true;
|
|
6089
|
-
if (!((_this$
|
|
6090
|
-
} else if (!((_this$
|
|
6137
|
+
if (!((_this$core24 = this.core) === null || _this$core24 === void 0 ? void 0 : _this$core24.telemetryDisabled)) trackThreadsExampleTourStarted(this.getCurrentExampleTourProps());
|
|
6138
|
+
} else if (!((_this$core25 = this.core) === null || _this$core25 === void 0 ? void 0 : _this$core25.telemetryDisabled)) trackThreadsExampleTourReopened(this.getCurrentExampleTourProps());
|
|
6091
6139
|
this.trackThreadsExampleTourStepViewedOnce();
|
|
6092
6140
|
this.syncExampleTourTab();
|
|
6093
6141
|
this.requestUpdate();
|
|
@@ -6099,7 +6147,7 @@ ${argsString}</pre
|
|
|
6099
6147
|
this.requestUpdate();
|
|
6100
6148
|
}
|
|
6101
6149
|
dismissExampleTour(method) {
|
|
6102
|
-
var _this$
|
|
6150
|
+
var _this$core26;
|
|
6103
6151
|
if (!this.selectedThreadId) return;
|
|
6104
6152
|
const props = {
|
|
6105
6153
|
...this.getCurrentExampleTourProps(),
|
|
@@ -6108,7 +6156,7 @@ ${argsString}</pre
|
|
|
6108
6156
|
this.exampleTourActive = false;
|
|
6109
6157
|
this.exampleTourDismissed = true;
|
|
6110
6158
|
this.writeThreadsExampleTourDismissed();
|
|
6111
|
-
if (!((_this$
|
|
6159
|
+
if (!((_this$core26 = this.core) === null || _this$core26 === void 0 ? void 0 : _this$core26.telemetryDisabled)) if (method === "done") trackThreadsExampleTourCompleted(props);
|
|
6112
6160
|
else trackThreadsExampleTourDismissed(props);
|
|
6113
6161
|
this.requestUpdate();
|
|
6114
6162
|
}
|
|
@@ -6682,8 +6730,8 @@ ${argsString}</pre
|
|
|
6682
6730
|
`;
|
|
6683
6731
|
}
|
|
6684
6732
|
renderMemoriesView() {
|
|
6685
|
-
var _this$
|
|
6686
|
-
if (!((_this$
|
|
6733
|
+
var _this$core27;
|
|
6734
|
+
if (!((_this$core27 = this.core) === null || _this$core27 === void 0 ? void 0 : _this$core27.intelligence) || !this._memoriesAvailable) return lit.html`
|
|
6687
6735
|
<div
|
|
6688
6736
|
style="
|
|
6689
6737
|
position: relative;
|
|
@@ -7576,14 +7624,14 @@ ${prettyEvent}</pre
|
|
|
7576
7624
|
if (this.contextOptions.filter((opt) => opt.key !== "all-agents").length > 1) this.selectedContext = "all-agents";
|
|
7577
7625
|
}
|
|
7578
7626
|
if (key === "threads") {
|
|
7579
|
-
var _this$
|
|
7580
|
-
if (previousMenu !== "threads" && !((_this$
|
|
7627
|
+
var _this$core28;
|
|
7628
|
+
if (previousMenu !== "threads" && !((_this$core28 = this.core) === null || _this$core28 === void 0 ? void 0 : _this$core28.telemetryDisabled)) trackThreadsTabClicked(this.getThreadsTelemetryProps());
|
|
7581
7629
|
this.autoSelectLatestThread();
|
|
7582
7630
|
}
|
|
7583
7631
|
if (key === "memories") {
|
|
7584
|
-
var _this$
|
|
7632
|
+
var _this$core29;
|
|
7585
7633
|
this.ensureMemorySubscription();
|
|
7586
|
-
if (previousMenu !== "memories" && !((_this$
|
|
7634
|
+
if (previousMenu !== "memories" && !((_this$core29 = this.core) === null || _this$core29 === void 0 ? void 0 : _this$core29.telemetryDisabled)) trackMemoriesTabClicked(this.getMemoriesTelemetryProps());
|
|
7587
7635
|
}
|
|
7588
7636
|
if (key === "ag-ui-events" || key === "agents") requestAnimationFrame(() => {
|
|
7589
7637
|
var _this$shadowRoot3;
|
|
@@ -8229,7 +8277,7 @@ ${prettyEvent}</pre
|
|
|
8229
8277
|
<button
|
|
8230
8278
|
class="announcement-dismiss ml-auto"
|
|
8231
8279
|
type="button"
|
|
8232
|
-
@click=${this.
|
|
8280
|
+
@click=${() => this.dismissAnnouncement("expanded_card")}
|
|
8233
8281
|
aria-label="Dismiss announcement"
|
|
8234
8282
|
>
|
|
8235
8283
|
${this.renderIcon("X")}
|
|
@@ -8260,15 +8308,50 @@ ${prettyEvent}</pre
|
|
|
8260
8308
|
</button>
|
|
8261
8309
|
</div>`;
|
|
8262
8310
|
}
|
|
8311
|
+
/**
|
|
8312
|
+
* Which announcement surface is on screen right now, or null when the
|
|
8313
|
+
* announcement isn't visible. Mirrors the render gates in
|
|
8314
|
+
* `renderAnnouncementPreview` (bubble) and `renderAnnouncementBanner`
|
|
8315
|
+
* (in-panel card) — opening the panel clears `showAnnouncementPreview`, so
|
|
8316
|
+
* the two are mutually exclusive.
|
|
8317
|
+
*/
|
|
8318
|
+
getVisibleBannerSurface() {
|
|
8319
|
+
if (!this.hasUnseenAnnouncement) return null;
|
|
8320
|
+
if (this.isOpen) return this.announcementHtml ? "expanded_card" : null;
|
|
8321
|
+
return this.showAnnouncementPreview && this.announcementPreviewText ? "collapsed_preview" : null;
|
|
8322
|
+
}
|
|
8323
|
+
/**
|
|
8324
|
+
* Records a `banner_viewed` impression for whichever surface is currently
|
|
8325
|
+
* visible, once per announcement per surface.
|
|
8326
|
+
*/
|
|
8327
|
+
maybeTrackBannerViewed() {
|
|
8328
|
+
var _this$announcementCta3;
|
|
8329
|
+
const id = this.announcementTimestamp;
|
|
8330
|
+
if (!id) return;
|
|
8331
|
+
const surface = this.getVisibleBannerSurface();
|
|
8332
|
+
if (!surface) return;
|
|
8333
|
+
const key = `${id}:${surface}`;
|
|
8334
|
+
if (this.viewedBannerSurfaces.has(key)) return;
|
|
8335
|
+
if (this.pendingBannerViewed.length >= MAX_PENDING_BANNER_VIEWED) return;
|
|
8336
|
+
this.viewedBannerSurfaces.add(key);
|
|
8337
|
+
this.pendingBannerViewed.push({
|
|
8338
|
+
banner_id: id,
|
|
8339
|
+
surface,
|
|
8340
|
+
cta_label: (_this$announcementCta3 = this.announcementCtaLabel) !== null && _this$announcementCta3 !== void 0 ? _this$announcementCta3 : void 0
|
|
8341
|
+
});
|
|
8342
|
+
this.flushPendingBannerViewed();
|
|
8343
|
+
}
|
|
8263
8344
|
flushPendingBannerViewed() {
|
|
8264
|
-
var _this$
|
|
8265
|
-
if (
|
|
8266
|
-
|
|
8345
|
+
var _this$core30;
|
|
8346
|
+
if (this.pendingBannerViewed.length === 0) return;
|
|
8347
|
+
if ((_this$core30 = this.core) === null || _this$core30 === void 0 ? void 0 : _this$core30.telemetryDisabled) {
|
|
8348
|
+
this.pendingBannerViewed = [];
|
|
8267
8349
|
return;
|
|
8268
8350
|
}
|
|
8269
8351
|
if (this.runtimeStatus !== "connected") return;
|
|
8270
|
-
|
|
8271
|
-
this.pendingBannerViewed =
|
|
8352
|
+
const queued = this.pendingBannerViewed;
|
|
8353
|
+
this.pendingBannerViewed = [];
|
|
8354
|
+
for (const props of queued) trackBannerViewed(props);
|
|
8272
8355
|
}
|
|
8273
8356
|
ensureAnnouncementLoading() {
|
|
8274
8357
|
if (this.announcementPromise || typeof window === "undefined" || typeof fetch === "undefined") return;
|
|
@@ -8296,7 +8379,12 @@ ${prettyEvent}</pre
|
|
|
8296
8379
|
}
|
|
8297
8380
|
handleAnnouncementPreviewClick() {
|
|
8298
8381
|
this.showAnnouncementPreview = false;
|
|
8299
|
-
this.openInspector();
|
|
8382
|
+
this.openInspector("announcement_preview");
|
|
8383
|
+
}
|
|
8384
|
+
dismissAnnouncement(surface) {
|
|
8385
|
+
this.trackBannerClickedOnce({ cta: "dismiss" });
|
|
8386
|
+
this.trackBannerDismissedOnce(surface);
|
|
8387
|
+
this.markAnnouncementSeen();
|
|
8300
8388
|
}
|
|
8301
8389
|
async fetchAnnouncement() {
|
|
8302
8390
|
try {
|
|
@@ -8316,14 +8404,7 @@ ${prettyEvent}</pre
|
|
|
8316
8404
|
this.showAnnouncementPreview = this.hasUnseenAnnouncement;
|
|
8317
8405
|
this.announcementHtml = await this.convertMarkdownToHtml(markdown);
|
|
8318
8406
|
this.announcementLoaded = true;
|
|
8319
|
-
|
|
8320
|
-
this.viewedBannerTimestamps.add(timestamp);
|
|
8321
|
-
this.pendingBannerViewed = {
|
|
8322
|
-
banner_id: timestamp,
|
|
8323
|
-
cta_label: ctaLabel !== null && ctaLabel !== void 0 ? ctaLabel : void 0
|
|
8324
|
-
};
|
|
8325
|
-
this.flushPendingBannerViewed();
|
|
8326
|
-
}
|
|
8407
|
+
this.maybeTrackBannerViewed();
|
|
8327
8408
|
this.requestUpdate();
|
|
8328
8409
|
} catch (error) {
|
|
8329
8410
|
console.warn("[CopilotKit Inspector] Failed to load announcement", error);
|
|
@@ -8370,11 +8451,11 @@ ${prettyEvent}</pre
|
|
|
8370
8451
|
}
|
|
8371
8452
|
appendRefParam(href, ref = "cpk-inspector") {
|
|
8372
8453
|
try {
|
|
8373
|
-
var _this$
|
|
8454
|
+
var _this$core31;
|
|
8374
8455
|
const isRootRelative = href.startsWith("/") && !href.startsWith("//");
|
|
8375
8456
|
const url = new URL(href, typeof window !== "undefined" ? window.location.href : "https://copilotkit.ai");
|
|
8376
8457
|
if (!url.searchParams.has("ref")) url.searchParams.append("ref", ref);
|
|
8377
|
-
if (!url.searchParams.has("posthog_distinct_id") && !((_this$
|
|
8458
|
+
if (!url.searchParams.has("posthog_distinct_id") && !((_this$core31 = this.core) === null || _this$core31 === void 0 ? void 0 : _this$core31.telemetryDisabled) && this.isCopilotKitDestination(url)) {
|
|
8378
8459
|
const distinctId = getTelemetryDistinctIdForUrl();
|
|
8379
8460
|
if (distinctId) url.searchParams.append("posthog_distinct_id", distinctId);
|
|
8380
8461
|
}
|