@atlaskit/editor-plugin-autocomplete 3.4.0 → 3.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-autocomplete
2
2
 
3
+ ## 3.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4129a00a1ae04`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4129a00a1ae04) -
8
+ Add `completionSource` attribute to contextual typeahead analytics events to distinguish between
9
+ cold (frequency-only), server slow-lane, and on-device local LLM scoring paths
10
+ - Updated dependencies
11
+
3
12
  ## 3.4.0
4
13
 
5
14
  ### Minor Changes
@@ -223,6 +223,18 @@ var createAutocompletePlugin = exports.createAutocompletePlugin = function creat
223
223
  var dismissedContext = null;
224
224
  var lastSuggestionTypedLength = 0;
225
225
  var lastSuggestionLength = 0;
226
+
227
+ /**
228
+ * cold → no slow-lane vector received yet; frequency-only trie scoring
229
+ * server → server slow-lane API returned the context vector
230
+ * localLlm → on-device WebGPU/MLC model returned the context vector
231
+ */
232
+ var getCompletionSource = function getCompletionSource() {
233
+ if (!slowLaneClient.getContextVector()) {
234
+ return 'cold';
235
+ }
236
+ return options !== null && options !== void 0 && options.useLocalModel ? 'localLlm' : 'server';
237
+ };
226
238
  var fireSuggestionDismissedAnalytics = function fireSuggestionDismissedAnalytics(reason) {
227
239
  var _api$analytics;
228
240
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
@@ -230,6 +242,7 @@ var createAutocompletePlugin = exports.createAutocompletePlugin = function creat
230
242
  actionSubject: _analytics.ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
231
243
  eventType: _analytics.EVENT_TYPE.TRACK,
232
244
  attributes: {
245
+ completionSource: getCompletionSource(),
233
246
  reason: reason
234
247
  }
235
248
  });
@@ -244,6 +257,7 @@ var createAutocompletePlugin = exports.createAutocompletePlugin = function creat
244
257
  actionSubject: _analytics.ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
245
258
  eventType: _analytics.EVENT_TYPE.TRACK,
246
259
  attributes: {
260
+ completionSource: getCompletionSource(),
247
261
  suggestionLength: suggestionLength,
248
262
  typedLength: typedLength,
249
263
  kssDelta: kssDelta
@@ -410,7 +424,10 @@ var createAutocompletePlugin = exports.createAutocompletePlugin = function creat
410
424
  api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.fireAnalyticsEvent({
411
425
  action: _analytics.ACTION.SUGGESTION_VIEWED,
412
426
  actionSubject: _analytics.ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
413
- eventType: _analytics.EVENT_TYPE.TRACK
427
+ eventType: _analytics.EVENT_TYPE.TRACK,
428
+ attributes: {
429
+ completionSource: getCompletionSource()
430
+ }
414
431
  });
415
432
  }
416
433
  }
@@ -211,6 +211,18 @@ export const createAutocompletePlugin = (options, api) => {
211
211
  let dismissedContext = null;
212
212
  let lastSuggestionTypedLength = 0;
213
213
  let lastSuggestionLength = 0;
214
+
215
+ /**
216
+ * cold → no slow-lane vector received yet; frequency-only trie scoring
217
+ * server → server slow-lane API returned the context vector
218
+ * localLlm → on-device WebGPU/MLC model returned the context vector
219
+ */
220
+ const getCompletionSource = () => {
221
+ if (!slowLaneClient.getContextVector()) {
222
+ return 'cold';
223
+ }
224
+ return options !== null && options !== void 0 && options.useLocalModel ? 'localLlm' : 'server';
225
+ };
214
226
  const fireSuggestionDismissedAnalytics = reason => {
215
227
  var _api$analytics;
216
228
  api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
@@ -218,6 +230,7 @@ export const createAutocompletePlugin = (options, api) => {
218
230
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
219
231
  eventType: EVENT_TYPE.TRACK,
220
232
  attributes: {
233
+ completionSource: getCompletionSource(),
221
234
  reason
222
235
  }
223
236
  });
@@ -232,6 +245,7 @@ export const createAutocompletePlugin = (options, api) => {
232
245
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
233
246
  eventType: EVENT_TYPE.TRACK,
234
247
  attributes: {
248
+ completionSource: getCompletionSource(),
235
249
  suggestionLength,
236
250
  typedLength,
237
251
  kssDelta
@@ -392,7 +406,10 @@ export const createAutocompletePlugin = (options, api) => {
392
406
  api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent({
393
407
  action: ACTION.SUGGESTION_VIEWED,
394
408
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
395
- eventType: EVENT_TYPE.TRACK
409
+ eventType: EVENT_TYPE.TRACK,
410
+ attributes: {
411
+ completionSource: getCompletionSource()
412
+ }
396
413
  });
397
414
  }
398
415
  }
@@ -216,6 +216,18 @@ export var createAutocompletePlugin = function createAutocompletePlugin(options,
216
216
  var dismissedContext = null;
217
217
  var lastSuggestionTypedLength = 0;
218
218
  var lastSuggestionLength = 0;
219
+
220
+ /**
221
+ * cold → no slow-lane vector received yet; frequency-only trie scoring
222
+ * server → server slow-lane API returned the context vector
223
+ * localLlm → on-device WebGPU/MLC model returned the context vector
224
+ */
225
+ var getCompletionSource = function getCompletionSource() {
226
+ if (!slowLaneClient.getContextVector()) {
227
+ return 'cold';
228
+ }
229
+ return options !== null && options !== void 0 && options.useLocalModel ? 'localLlm' : 'server';
230
+ };
219
231
  var fireSuggestionDismissedAnalytics = function fireSuggestionDismissedAnalytics(reason) {
220
232
  var _api$analytics;
221
233
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
@@ -223,6 +235,7 @@ export var createAutocompletePlugin = function createAutocompletePlugin(options,
223
235
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
224
236
  eventType: EVENT_TYPE.TRACK,
225
237
  attributes: {
238
+ completionSource: getCompletionSource(),
226
239
  reason: reason
227
240
  }
228
241
  });
@@ -237,6 +250,7 @@ export var createAutocompletePlugin = function createAutocompletePlugin(options,
237
250
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
238
251
  eventType: EVENT_TYPE.TRACK,
239
252
  attributes: {
253
+ completionSource: getCompletionSource(),
240
254
  suggestionLength: suggestionLength,
241
255
  typedLength: typedLength,
242
256
  kssDelta: kssDelta
@@ -403,7 +417,10 @@ export var createAutocompletePlugin = function createAutocompletePlugin(options,
403
417
  api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.fireAnalyticsEvent({
404
418
  action: ACTION.SUGGESTION_VIEWED,
405
419
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
406
- eventType: EVENT_TYPE.TRACK
420
+ eventType: EVENT_TYPE.TRACK,
421
+ attributes: {
422
+ completionSource: getCompletionSource()
423
+ }
407
424
  });
408
425
  }
409
426
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-autocomplete",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "Client-side text autocomplete plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "wink-nlp": "^2.4.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^115.7.0",
38
+ "@atlaskit/editor-common": "^115.8.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^11.0.0",
40
40
  "react": "^18.2.0"
41
41
  },
@@ -277,12 +277,24 @@ export const createAutocompletePlugin = (
277
277
  let lastSuggestionTypedLength = 0;
278
278
  let lastSuggestionLength = 0;
279
279
 
280
+ /**
281
+ * cold → no slow-lane vector received yet; frequency-only trie scoring
282
+ * server → server slow-lane API returned the context vector
283
+ * localLlm → on-device WebGPU/MLC model returned the context vector
284
+ */
285
+ const getCompletionSource = (): 'cold' | 'server' | 'localLlm' => {
286
+ if (!slowLaneClient.getContextVector()) {
287
+ return 'cold';
288
+ }
289
+ return options?.useLocalModel ? 'localLlm' : 'server';
290
+ };
291
+
280
292
  const fireSuggestionDismissedAnalytics = (reason: 'escape' | 'blur'): void => {
281
293
  api?.analytics?.actions.fireAnalyticsEvent({
282
294
  action: ACTION.SUGGESTION_DISMISSED,
283
295
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
284
296
  eventType: EVENT_TYPE.TRACK,
285
- attributes: { reason },
297
+ attributes: { completionSource: getCompletionSource(), reason },
286
298
  });
287
299
  };
288
300
 
@@ -296,6 +308,7 @@ export const createAutocompletePlugin = (
296
308
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
297
309
  eventType: EVENT_TYPE.TRACK,
298
310
  attributes: {
311
+ completionSource: getCompletionSource(),
299
312
  suggestionLength,
300
313
  typedLength,
301
314
  kssDelta,
@@ -484,6 +497,7 @@ export const createAutocompletePlugin = (
484
497
  action: ACTION.SUGGESTION_VIEWED,
485
498
  actionSubject: ACTION_SUBJECT.CONTEXTUAL_TYPEAHEAD,
486
499
  eventType: EVENT_TYPE.TRACK,
500
+ attributes: { completionSource: getCompletionSource() },
487
501
  });
488
502
  }
489
503
  }