@atlaskit/editor-plugin-autocomplete 3.6.0 → 3.6.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/CANONICAL_FIX__DO_NOT_USE_ME_A/package.json +1 -8
- package/CANONICAL_FIX__DO_NOT_USE_ME_B/package.json +1 -8
- package/CANONICAL_FIX__DO_NOT_USE_ME_C/package.json +1 -8
- package/CHANGELOG.md +21 -0
- package/autocompletePlugin/package.json +1 -8
- package/autocompletePluginType/package.json +1 -8
- package/dist/cjs/pm-plugins/autocomplete-plugin.js +20 -2
- package/dist/cjs/pm-plugins/local-slow-lane-client.js +3 -1
- package/dist/cjs/pm-plugins/text-predictor.js +18 -4
- package/dist/es2019/pm-plugins/autocomplete-plugin.js +20 -2
- package/dist/es2019/pm-plugins/local-slow-lane-client.js +3 -1
- package/dist/es2019/pm-plugins/text-predictor.js +17 -3
- package/dist/esm/pm-plugins/autocomplete-plugin.js +20 -2
- package/dist/esm/pm-plugins/local-slow-lane-client.js +3 -1
- package/dist/esm/pm-plugins/text-predictor.js +18 -4
- package/dist/types/pm-plugins/local-slow-lane-client.d.ts +2 -2
- package/dist/types/pm-plugins/text-predictor.d.ts +4 -1
- package/package.json +2 -2
- package/src/pm-plugins/autocomplete-plugin/package.json +1 -8
- package/src/pm-plugins/autocomplete-plugin.ts +18 -2
- package/src/pm-plugins/local-slow-lane-client.ts +10 -17
- package/src/pm-plugins/slow-lane-client/package.json +1 -8
- package/src/pm-plugins/text-predictor/package.json +1 -8
- package/src/pm-plugins/text-predictor.ts +15 -6
- package/dist/types-ts4.5/analytics/ufo.d.ts +0 -38
- package/dist/types-ts4.5/autocompletePlugin.d.ts +0 -2
- package/dist/types-ts4.5/autocompletePluginType.d.ts +0 -10
- package/dist/types-ts4.5/entry-points/autocompletePlugin.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/autocompletePluginType.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/src-pm-plugins-autocomplete-plugin.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/src-pm-plugins-slow-lane-client.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/src-pm-plugins-text-predictor.d.ts +0 -2
- package/dist/types-ts4.5/index.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/autocomplete-plugin.d.ts +0 -49
- package/dist/types-ts4.5/pm-plugins/debug-mode.d.ts +0 -27
- package/dist/types-ts4.5/pm-plugins/ghost-text-decoration.d.ts +0 -7
- package/dist/types-ts4.5/pm-plugins/local-slow-lane-client.d.ts +0 -241
- package/dist/types-ts4.5/pm-plugins/scoring-pipeline.d.ts +0 -43
- package/dist/types-ts4.5/pm-plugins/slow-lane-client.d.ts +0 -46
- package/dist/types-ts4.5/pm-plugins/text-predictor.d.ts +0 -88
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../../../dist/esm/entry-points/src-pm-plugins-autocomplete-plugin.js",
|
|
5
5
|
"module:es2019": "../../../dist/es2019/entry-points/src-pm-plugins-autocomplete-plugin.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../../../dist/types/entry-points/src-pm-plugins-autocomplete-plugin.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../../../dist/types-ts4.5/entry-points/src-pm-plugins-autocomplete-plugin.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../../../dist/types/entry-points/src-pm-plugins-autocomplete-plugin.d.ts"
|
|
15
8
|
}
|
|
@@ -514,6 +514,19 @@ export const createAutocompletePlugin = (
|
|
|
514
514
|
return;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
+
// Suppress suggestions when the cursor is mid-word — only offer
|
|
518
|
+
// completions when the cursor is at the trailing edge of a token.
|
|
519
|
+
// nodeAfter correctly handles inline atoms (mentions, emojis) where
|
|
520
|
+
// parentOffset and textContent indices diverge.
|
|
521
|
+
const nodeAfter = selection.$from.nodeAfter;
|
|
522
|
+
const charAfterCursor = nodeAfter?.isText ? nodeAfter.text?.[0] : undefined;
|
|
523
|
+
// Only suppress for Unicode letters, digits, and underscore — hyphens,
|
|
524
|
+
// apostrophes, and similar punctuation are valid left-edge boundaries
|
|
525
|
+
// and should not block suggestions (e.g. cursor before '-' in compound-word).
|
|
526
|
+
if (charAfterCursor && /[\p{L}\p{N}_]/u.test(charAfterCursor)) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
|
|
517
530
|
const textBefore = getTextBeforeCursor(state);
|
|
518
531
|
|
|
519
532
|
// Suppress re-showing the same suggestion the user just dismissed.
|
|
@@ -681,12 +694,15 @@ export const createAutocompletePlugin = (
|
|
|
681
694
|
return false;
|
|
682
695
|
},
|
|
683
696
|
focus: () => {
|
|
684
|
-
loadDefaultVocabulary().catch((error) => {
|
|
697
|
+
loadDefaultVocabulary({ isLocalLLM: options?.useLocalModel ?? false }).catch((error) => {
|
|
685
698
|
logException(error as Error, {
|
|
686
699
|
location: 'editor-plugin-autocomplete/loadDefaultVocabulary',
|
|
687
700
|
});
|
|
688
701
|
});
|
|
689
|
-
loadVectorsAsync({
|
|
702
|
+
loadVectorsAsync({
|
|
703
|
+
getBinaryUrl: options?.getVectorsBinaryUrl,
|
|
704
|
+
isLocalLLM: options?.useLocalModel ?? false,
|
|
705
|
+
}).catch((error) => {
|
|
690
706
|
logException(error as Error, {
|
|
691
707
|
location: 'editor-plugin-autocomplete/loadVectorsAsync',
|
|
692
708
|
});
|
|
@@ -114,10 +114,10 @@ export type LocalSlowLaneLoadErrorReason =
|
|
|
114
114
|
|
|
115
115
|
/** Snapshot of the machine's WebGPU support, used to explain hardware limits. */
|
|
116
116
|
export interface WebGpuCapabilities {
|
|
117
|
-
/** GPU architecture reported by the adapter (e.g. "metal-3", "rdna2"). */
|
|
118
|
-
architecture?: string;
|
|
119
117
|
/** Whether `navigator.gpu.requestAdapter()` returned a usable adapter. */
|
|
120
118
|
adapterAvailable?: boolean;
|
|
119
|
+
/** GPU architecture reported by the adapter (e.g. "metal-3", "rdna2"). */
|
|
120
|
+
architecture?: string;
|
|
121
121
|
/** Whether `navigator.gpu` exists at all. */
|
|
122
122
|
available: boolean;
|
|
123
123
|
/** Largest single GPU buffer the adapter allows, in MB. */
|
|
@@ -367,16 +367,14 @@ let bePayloadDataPromise: Promise<void> | undefined;
|
|
|
367
367
|
* :param shape: `'object'` if the source JSON is `{...}`, `'array'` if `[...]`.
|
|
368
368
|
* :returns: The parsed JSON value, or `null` if neither interop mode applies.
|
|
369
369
|
*/
|
|
370
|
-
const unwrapJsonModule = <T
|
|
370
|
+
const unwrapJsonModule = <T>(mod: unknown, shape: 'object' | 'array'): T | null => {
|
|
371
371
|
if (mod == null || typeof mod !== 'object') {
|
|
372
372
|
return null;
|
|
373
373
|
}
|
|
374
374
|
const namespace = mod as Record<string, unknown> & { default?: unknown };
|
|
375
375
|
|
|
376
376
|
// Compute the named-export own-keys (strip synthetic markers).
|
|
377
|
-
const ownKeys = Object.keys(namespace).filter(
|
|
378
|
-
(k) => k !== 'default' && k !== '__esModule',
|
|
379
|
-
);
|
|
377
|
+
const ownKeys = Object.keys(namespace).filter((k) => k !== 'default' && k !== '__esModule');
|
|
380
378
|
|
|
381
379
|
// PREFER named exports when present — they always reflect the JSON's real
|
|
382
380
|
// top-level keys / indices, regardless of what `default` happens to be.
|
|
@@ -456,10 +454,7 @@ const loadBePayloadData = (): Promise<void> => {
|
|
|
456
454
|
}
|
|
457
455
|
|
|
458
456
|
firstTokenToWords = new Map(
|
|
459
|
-
Object.entries(firstTokenToWordsData).map(([tokenId, words]) => [
|
|
460
|
-
Number(tokenId),
|
|
461
|
-
words,
|
|
462
|
-
]),
|
|
457
|
+
Object.entries(firstTokenToWordsData).map(([tokenId, words]) => [Number(tokenId), words]),
|
|
463
458
|
);
|
|
464
459
|
l2Words = new Set(Object.keys(vocabularyData.words));
|
|
465
460
|
prefixMapTokenIds = Array.from(firstTokenToWords.keys());
|
|
@@ -519,7 +514,6 @@ export const computeBePayload = (
|
|
|
519
514
|
*/
|
|
520
515
|
validTokenIds: number[] = prefixMapTokenIds,
|
|
521
516
|
): Record<string, number> => {
|
|
522
|
-
|
|
523
517
|
// 1. Numerically-stable masked softmax over validTokenIds only.
|
|
524
518
|
let maxLogit = -Infinity;
|
|
525
519
|
for (const id of validTokenIds) {
|
|
@@ -773,7 +767,8 @@ export const createLocalSlowLaneClient = (
|
|
|
773
767
|
}
|
|
774
768
|
if (
|
|
775
769
|
lower.includes('out of memory') ||
|
|
776
|
-
|
|
770
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
771
|
+
/\boom\b/.test(lower) ||
|
|
777
772
|
lower.includes('allocation') ||
|
|
778
773
|
lower.includes('exceeds') ||
|
|
779
774
|
lower.includes('buffer size') ||
|
|
@@ -1005,7 +1000,7 @@ export const createLocalSlowLaneClient = (
|
|
|
1005
1000
|
const lmText = truncateToLastNWords(text, BE_PARITY.MAX_CONTEXT_TOKENS);
|
|
1006
1001
|
const semanticText = truncateToLastNWords(text, BE_PARITY.MAX_CONTEXT_WORDS);
|
|
1007
1002
|
const arcticInput = wrapForArctic(semanticText);
|
|
1008
|
-
const captureCompletionTime = <T
|
|
1003
|
+
const captureCompletionTime = <T>(
|
|
1009
1004
|
promise: Promise<T>,
|
|
1010
1005
|
onResolved: (resolvedAt: number) => void,
|
|
1011
1006
|
): Promise<T> =>
|
|
@@ -1042,8 +1037,7 @@ export const createLocalSlowLaneClient = (
|
|
|
1042
1037
|
max_tokens: 1,
|
|
1043
1038
|
temperature: 0,
|
|
1044
1039
|
logprobs: false,
|
|
1045
|
-
})
|
|
1046
|
-
,
|
|
1040
|
+
}),
|
|
1047
1041
|
(resolvedAt) => {
|
|
1048
1042
|
tLmDone = resolvedAt;
|
|
1049
1043
|
},
|
|
@@ -1052,8 +1046,7 @@ export const createLocalSlowLaneClient = (
|
|
|
1052
1046
|
engine.embeddings.create({
|
|
1053
1047
|
model: LOCAL_MLC_EMBEDDING_MODEL_ID,
|
|
1054
1048
|
input: arcticInput,
|
|
1055
|
-
})
|
|
1056
|
-
,
|
|
1049
|
+
}),
|
|
1057
1050
|
(resolvedAt) => {
|
|
1058
1051
|
tEmbDone = resolvedAt;
|
|
1059
1052
|
},
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../../../dist/esm/entry-points/src-pm-plugins-slow-lane-client.js",
|
|
5
5
|
"module:es2019": "../../../dist/es2019/entry-points/src-pm-plugins-slow-lane-client.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../../../dist/types/entry-points/src-pm-plugins-slow-lane-client.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../../../dist/types-ts4.5/entry-points/src-pm-plugins-slow-lane-client.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../../../dist/types/entry-points/src-pm-plugins-slow-lane-client.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../../../dist/esm/entry-points/src-pm-plugins-text-predictor.js",
|
|
5
5
|
"module:es2019": "../../../dist/es2019/entry-points/src-pm-plugins-text-predictor.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../../../dist/types/entry-points/src-pm-plugins-text-predictor.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../../../dist/types-ts4.5/entry-points/src-pm-plugins-text-predictor.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../../../dist/types/entry-points/src-pm-plugins-text-predictor.d.ts"
|
|
15
8
|
}
|
|
@@ -747,6 +747,7 @@ const unwrapJsonModule = <T>(mod: unknown, shape: 'object' | 'array'): T | null
|
|
|
747
747
|
|
|
748
748
|
export const loadVectorsAsync = async (options?: {
|
|
749
749
|
getBinaryUrl?: () => Promise<string>;
|
|
750
|
+
isLocalLLM?: boolean;
|
|
750
751
|
}): Promise<void> => {
|
|
751
752
|
if (vectorStore || vectorsLoadStarted) {
|
|
752
753
|
return;
|
|
@@ -758,15 +759,16 @@ export const loadVectorsAsync = async (options?: {
|
|
|
758
759
|
);
|
|
759
760
|
return;
|
|
760
761
|
}
|
|
762
|
+
const isLocalLLM = options?.isLocalLLM ?? false;
|
|
761
763
|
vectorsLoadStarted = true;
|
|
762
|
-
startExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton');
|
|
764
|
+
startExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', { isLocalLLM });
|
|
763
765
|
|
|
764
766
|
let url: string;
|
|
765
767
|
try {
|
|
766
768
|
url = await options.getBinaryUrl();
|
|
767
769
|
} catch (e) {
|
|
768
770
|
vectorsLoadStarted = false;
|
|
769
|
-
failExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', { errorType: 'resolve_url' });
|
|
771
|
+
failExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', { isLocalLLM, errorType: 'resolve_url' });
|
|
770
772
|
// eslint-disable-next-line no-console
|
|
771
773
|
console.warn('[text-predictor] Failed to resolve vectors URL:', e);
|
|
772
774
|
return;
|
|
@@ -777,6 +779,7 @@ export const loadVectorsAsync = async (options?: {
|
|
|
777
779
|
if (!res.ok) {
|
|
778
780
|
vectorsLoadStarted = false;
|
|
779
781
|
failExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', {
|
|
782
|
+
isLocalLLM,
|
|
780
783
|
status: res.status,
|
|
781
784
|
errorType: 'http_error',
|
|
782
785
|
});
|
|
@@ -809,6 +812,7 @@ export const loadVectorsAsync = async (options?: {
|
|
|
809
812
|
|
|
810
813
|
vectorStore = { float32, wordIndex, dim };
|
|
811
814
|
succeedExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', {
|
|
815
|
+
isLocalLLM,
|
|
812
816
|
wordCount: nWords,
|
|
813
817
|
dim,
|
|
814
818
|
sizeBytes: float32.byteLength,
|
|
@@ -823,7 +827,7 @@ export const loadVectorsAsync = async (options?: {
|
|
|
823
827
|
}
|
|
824
828
|
} catch (e) {
|
|
825
829
|
vectorsLoadStarted = false;
|
|
826
|
-
failExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', { errorType: 'network' });
|
|
830
|
+
failExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', { isLocalLLM, errorType: 'network' });
|
|
827
831
|
// eslint-disable-next-line no-console
|
|
828
832
|
console.warn('[text-predictor] Failed to load vectors:', e);
|
|
829
833
|
}
|
|
@@ -835,7 +839,7 @@ export const initVectors = (store: VectorStore): void => {
|
|
|
835
839
|
|
|
836
840
|
let vocabularyLoadPromise: Promise<void> | undefined;
|
|
837
841
|
|
|
838
|
-
export const loadDefaultVocabulary = (): Promise<void> => {
|
|
842
|
+
export const loadDefaultVocabulary = (options?: { isLocalLLM?: boolean }): Promise<void> => {
|
|
839
843
|
if (isInitialized) {
|
|
840
844
|
return Promise.resolve();
|
|
841
845
|
}
|
|
@@ -843,8 +847,9 @@ export const loadDefaultVocabulary = (): Promise<void> => {
|
|
|
843
847
|
return vocabularyLoadPromise;
|
|
844
848
|
}
|
|
845
849
|
|
|
850
|
+
const isLocalLLM = options?.isLocalLLM ?? false;
|
|
846
851
|
vocabularyLoadPromise = (async () => {
|
|
847
|
-
startExp(EXPERIENCE_NAME.LOAD_VOCABULARY, 'singleton');
|
|
852
|
+
startExp(EXPERIENCE_NAME.LOAD_VOCABULARY, 'singleton', { isLocalLLM });
|
|
848
853
|
|
|
849
854
|
try {
|
|
850
855
|
// The L2 vocabulary and L3 word list are code-split into their own async
|
|
@@ -879,11 +884,15 @@ export const loadDefaultVocabulary = (): Promise<void> => {
|
|
|
879
884
|
initVocabulary({ terms });
|
|
880
885
|
|
|
881
886
|
succeedExp(EXPERIENCE_NAME.LOAD_VOCABULARY, 'singleton', {
|
|
887
|
+
isLocalLLM,
|
|
882
888
|
l2WordCount: terms.length,
|
|
883
889
|
l3WordCount: l3VocabularyData.length,
|
|
884
890
|
});
|
|
885
891
|
} catch (e) {
|
|
886
|
-
failExp(EXPERIENCE_NAME.LOAD_VOCABULARY, 'singleton', {
|
|
892
|
+
failExp(EXPERIENCE_NAME.LOAD_VOCABULARY, 'singleton', {
|
|
893
|
+
isLocalLLM,
|
|
894
|
+
errorType: 'parse_error',
|
|
895
|
+
});
|
|
887
896
|
// Allow a later call to retry the load rather than caching the failure.
|
|
888
897
|
vocabularyLoadPromise = undefined;
|
|
889
898
|
throw e;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UFO experience tracking helpers for `@atlaskit/editor-plugin-autocomplete`.
|
|
3
|
-
*
|
|
4
|
-
* Pattern follows `packages/linking-platform/smart-card/src/state/analytics/ufoExperiences.ts`
|
|
5
|
-
* (ConcurrentExperience keyed per request/instance) plus a try/catch safety wrap
|
|
6
|
-
* inspired by `packages/editor/collab-provider/src/analytics/ufo.ts` so a UFO
|
|
7
|
-
* runtime error can never break the autocomplete feature.
|
|
8
|
-
*
|
|
9
|
-
* Experience names must be registered in DataPortal's `task` attribute before
|
|
10
|
-
* they can power FE Reliability SLOs:
|
|
11
|
-
* https://hello.atlassian.net/wiki/spaces/AA6/pages/3961393753
|
|
12
|
-
*/
|
|
13
|
-
import { type CustomData } from '@atlaskit/ufo';
|
|
14
|
-
/**
|
|
15
|
-
* Experience name strings are surfaced downstream by the UFO pipeline as
|
|
16
|
-
* `platform.fe.<type>.<platform.component>.<name>` (e.g.
|
|
17
|
-
* `platform.fe.operation.editor-plugin-autocomplete.slow-lane-fetch`), so
|
|
18
|
-
* names here should be short, dot-free, and must not repeat the component
|
|
19
|
-
* name. This matches the convention used by `@atlaskit/emoji`'s
|
|
20
|
-
* `ufoExperiences` map (e.g. `'emoji-rendered'`).
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Only experiences with meaningful async work and a real success/failure
|
|
24
|
-
* outcome belong on UFO (which measures latency and success rate for FE
|
|
25
|
-
* Reliability SLOs). Per-keystroke suggestion lifecycle counters (viewed /
|
|
26
|
-
* inserted / dismissed) are tracked via analytics-next instead — they would
|
|
27
|
-
* otherwise emit zero-duration events on every word boundary.
|
|
28
|
-
*/
|
|
29
|
-
export declare const EXPERIENCE_NAME: {
|
|
30
|
-
readonly SLOW_LANE_FETCH: "slow-lane-fetch";
|
|
31
|
-
readonly LOAD_VOCABULARY: "load-vocabulary";
|
|
32
|
-
readonly LOAD_VECTORS: "load-vectors";
|
|
33
|
-
};
|
|
34
|
-
export type AutocompleteExperienceName = (typeof EXPERIENCE_NAME)[keyof typeof EXPERIENCE_NAME];
|
|
35
|
-
export declare const startExp: (name: AutocompleteExperienceName, id: string, metadata?: CustomData) => void;
|
|
36
|
-
export declare const succeedExp: (name: AutocompleteExperienceName, id: string, metadata?: CustomData) => void;
|
|
37
|
-
export declare const failExp: (name: AutocompleteExperienceName, id: string, metadata?: CustomData) => void;
|
|
38
|
-
export declare const abortExp: (name: AutocompleteExperienceName, id: string, reason?: string) => void;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
-
import type { AutocompletePluginOptions, AutocompletePluginState } from './pm-plugins/autocomplete-plugin';
|
|
4
|
-
export type AutocompletePlugin = NextEditorPlugin<'autocomplete', {
|
|
5
|
-
pluginConfiguration?: AutocompletePluginOptions | undefined;
|
|
6
|
-
sharedState: AutocompletePluginState | undefined;
|
|
7
|
-
dependencies: [
|
|
8
|
-
OptionalPlugin<AnalyticsPlugin>
|
|
9
|
-
];
|
|
10
|
-
}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { autocompletePlugin } from '../autocompletePlugin';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { AutocompletePlugin } from '../autocompletePluginType';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { createSlowLaneClient, getStoredContextVector, getStoredLmLogits, isWordBoundary, setDefaultSlowLaneClient, } from '../pm-plugins/slow-lane-client';
|
|
2
|
-
export type { SlowLaneClientConfig, TypeaheadEncodingsRequest, TypeaheadEncodingsResponse, } from '../pm-plugins/slow-lane-client';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { getLastPredictionDebug, getPredictorStatus, incrementSessionFreq, ingestDocumentPage, initL3Vocabulary, initVectors, initVocabulary, loadDefaultVocabulary, loadVectorsAsync, predict, } from '../pm-plugins/text-predictor';
|
|
2
|
-
export type { TenantVocabulary, WeightedTerm } from '../pm-plugins/text-predictor';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { AutocompletePlugin } from '../autocompletePluginType';
|
|
6
|
-
export declare const autocompletePluginKey: PluginKey;
|
|
7
|
-
export interface AutocompletePluginState {
|
|
8
|
-
/** The decoration set containing the ghost text widget */
|
|
9
|
-
decorationSet: DecorationSet;
|
|
10
|
-
/** The document position where the ghost text should appear */
|
|
11
|
-
ghostPosition: number;
|
|
12
|
-
/** The predicted ghost text to display */
|
|
13
|
-
ghostText: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Context provided to the autocomplete plugin on first editor focus.
|
|
17
|
-
* Text fields are selectively ingested to boost word-frequency scoring for
|
|
18
|
-
* predictions, giving words already present in the document/thread an L1
|
|
19
|
-
* priority boost.
|
|
20
|
-
*/
|
|
21
|
-
export interface AutocompleteContext {
|
|
22
|
-
/** Full page content as a string (e.g. markdown). */
|
|
23
|
-
fullPageContent?: string;
|
|
24
|
-
/** The currently selected text on the page, if any. */
|
|
25
|
-
pageSelectionContent?: string;
|
|
26
|
-
/** Content of the parent comment when the editor is in reply or edit mode. */
|
|
27
|
-
parentCommentContent?: string;
|
|
28
|
-
/** Contents of sibling comments when the editor is in reply or edit mode. */
|
|
29
|
-
siblingCommentsContents?: string[];
|
|
30
|
-
}
|
|
31
|
-
export interface AutocompletePluginOptions {
|
|
32
|
-
/**
|
|
33
|
-
* Async function called once on first editor focus to retrieve context for
|
|
34
|
-
* word-frequency boosting. Called lazily so the preset can remain synchronous.
|
|
35
|
-
*/
|
|
36
|
-
getContext?: () => Promise<AutocompleteContext | undefined>;
|
|
37
|
-
/**
|
|
38
|
-
* Async function that resolves to a URL for the word vectors binary file.
|
|
39
|
-
* When provided, this takes precedence over the bundled asset URL.
|
|
40
|
-
* Use this to serve vectors from a CDN or media service in production.
|
|
41
|
-
*/
|
|
42
|
-
getVectorsBinaryUrl?: () => Promise<string>;
|
|
43
|
-
/**
|
|
44
|
-
* When true, uses on-device inference via WebGPU (MLC WebLLM) instead of
|
|
45
|
-
* the network-based slow-lane backend. Defaults to false (network client).
|
|
46
|
-
*/
|
|
47
|
-
useLocalModel?: boolean;
|
|
48
|
-
}
|
|
49
|
-
export declare const createAutocompletePlugin: (options?: AutocompletePluginOptions, api?: ExtractInjectionAPI<AutocompletePlugin>) => SafePlugin<AutocompletePluginState>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contextual Typeahead Completions (CTC) debug logging utility.
|
|
3
|
-
*
|
|
4
|
-
* Logs are silent by default. Enable in any environment (dev, staging, prod):
|
|
5
|
-
*
|
|
6
|
-
* // Live, for the current session (no reload required):
|
|
7
|
-
* __atlCtcDebug__.enable()
|
|
8
|
-
*
|
|
9
|
-
* // To disable:
|
|
10
|
-
* __atlCtcDebug__.disable()
|
|
11
|
-
*
|
|
12
|
-
* // From initial page load (survives reload) — append to the URL:
|
|
13
|
-
* ?atlCtcDebug=1
|
|
14
|
-
*
|
|
15
|
-
* Storage-free by design: avoids browser-storage consent controls (BSC), which can
|
|
16
|
-
* block uncategorized localStorage/sessionStorage/cookie writes in some products.
|
|
17
|
-
*/
|
|
18
|
-
declare global {
|
|
19
|
-
interface Window {
|
|
20
|
-
__atlCtcDebug__?: {
|
|
21
|
-
enable: () => void;
|
|
22
|
-
disable: () => void;
|
|
23
|
-
isEnabled: () => boolean;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export declare const isAutocompleteDebugEnabled: () => boolean;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a DecorationSet containing a ghost text widget at the given position.
|
|
5
|
-
* The ghost text is rendered as a styled <span> that appears after the cursor.
|
|
6
|
-
*/
|
|
7
|
-
export declare const createGhostTextDecorationSet: (state: EditorState, position: number, text: string) => DecorationSet;
|