@widgetic/workflows 0.2.15 → 0.2.16
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/README.md +117 -3
- package/dist/api/types.d.ts +17 -0
- package/dist/api/workflowsApi.d.ts +12 -1
- package/dist/api/workflowsApi.js +37 -0
- package/dist/assistant/assistantEvents.d.ts +44 -2
- package/dist/assistant/assistantEvents.js +58 -2
- package/dist/assistant/assistantReferences.d.ts +66 -0
- package/dist/assistant/assistantReferences.js +109 -0
- package/dist/assistant/assistantSaveMode.d.ts +15 -3
- package/dist/assistant/assistantSaveMode.js +16 -2
- package/dist/assistant/assistantSeed.d.ts +55 -0
- package/dist/assistant/assistantSeed.js +90 -0
- package/dist/assistant/assistantStream.js +81 -3
- package/dist/assistant/assistantSuggest.d.ts +18 -0
- package/dist/assistant/assistantSuggest.js +21 -0
- package/dist/assistant/assistantTurns.d.ts +75 -0
- package/dist/assistant/assistantTurns.js +56 -0
- package/dist/assistant/attachmentUploads.d.ts +42 -0
- package/dist/assistant/attachmentUploads.js +69 -0
- package/dist/assistant/canvasLink.d.ts +30 -0
- package/dist/assistant/canvasLink.js +51 -0
- package/dist/assistant/compositionMention.d.ts +18 -0
- package/dist/assistant/compositionMention.js +47 -0
- package/dist/assistant/liveData.d.ts +150 -0
- package/dist/assistant/liveData.js +286 -0
- package/dist/assistant/mcpMention.d.ts +20 -0
- package/dist/assistant/mcpMention.js +30 -0
- package/dist/assistant/mentionEntries.d.ts +39 -0
- package/dist/assistant/mentionEntries.js +69 -0
- package/dist/assistant/planFlow.d.ts +26 -0
- package/dist/assistant/planFlow.js +57 -0
- package/dist/assistant/templateDestinations.d.ts +37 -0
- package/dist/assistant/templateDestinations.js +64 -0
- package/dist/assistant/types.d.ts +99 -2
- package/dist/assistant/workflowPlanViewModel.d.ts +13 -2
- package/dist/assistant/workflowPlanViewModel.js +9 -1
- package/dist/components/Workflows.svelte +7 -1
- package/dist/components/WorkflowsWorkspace.svelte +29 -1
- package/dist/components/WorkflowsWorkspace.svelte.d.ts +3 -0
- package/dist/components/assistant/AssistantPlanStepRow.svelte +56 -0
- package/dist/components/assistant/AssistantPlanStepRow.svelte.d.ts +9 -0
- package/dist/components/assistant/CompositionMentionMenu.svelte +135 -0
- package/dist/components/assistant/CompositionMentionMenu.svelte.d.ts +9 -0
- package/dist/components/assistant/DataPreviewCard.svelte +108 -0
- package/dist/components/assistant/DataPreviewCard.svelte.d.ts +7 -0
- package/dist/components/assistant/PlanBindingsBlock.svelte +200 -0
- package/dist/components/assistant/PlanBindingsBlock.svelte.d.ts +14 -0
- package/dist/components/assistant/TemplateProjectCard.svelte +81 -0
- package/dist/components/assistant/TemplateProjectCard.svelte.d.ts +14 -0
- package/dist/components/assistant/WorkflowAssistantPanel.svelte +1045 -147
- package/dist/components/assistant/WorkflowAssistantPanel.svelte.d.ts +5 -0
- package/dist/components/canvas/CanvasContextMenu.svelte +199 -0
- package/dist/components/canvas/CanvasContextMenu.svelte.d.ts +16 -0
- package/dist/components/canvas/CompositionNodeView.svelte +7 -2
- package/dist/components/canvas/ConditionNodeView.svelte +5 -1
- package/dist/components/canvas/HandlePoint.svelte +25 -3
- package/dist/components/canvas/WorkflowCanvas.svelte +351 -12
- package/dist/components/canvas/WorkflowCanvas.svelte.d.ts +12 -1
- package/dist/components/canvas/altDragDuplicateController.d.ts +29 -0
- package/dist/components/canvas/altDragDuplicateController.js +92 -0
- package/dist/components/canvas/connectionSnapController.d.ts +29 -0
- package/dist/components/canvas/connectionSnapController.js +182 -0
- package/dist/components/canvas/spacePanController.d.ts +16 -0
- package/dist/components/canvas/spacePanController.js +103 -0
- package/dist/components/editor/EditorCanvasArea.svelte +98 -4
- package/dist/components/editor/EditorCanvasArea.svelte.d.ts +5 -0
- package/dist/components/editor/EditorTopBar.svelte +53 -42
- package/dist/components/editor/WorkflowEditor.svelte +74 -41
- package/dist/components/editor/WorkflowEditor.svelte.d.ts +5 -0
- package/dist/components/editor/WorkflowNameControl.svelte +9 -8
- package/dist/components/editor/WorkflowNameControl.svelte.d.ts +3 -1
- package/dist/components/list/WorkflowList.svelte +34 -20
- package/dist/components/list/WorkflowList.svelte.d.ts +5 -0
- package/dist/components/panel/CompositionForm.svelte +3 -2
- package/dist/components/panel/CompositionPicker.svelte +15 -20
- package/dist/components/panel/CompositionPicker.svelte.d.ts +2 -2
- package/dist/components/panel/CompositionSelect.svelte +4 -4
- package/dist/components/panel/CompositionSelect.svelte.d.ts +2 -2
- package/dist/components/ui/icons.d.ts +8 -0
- package/dist/components/ui/icons.js +24 -1
- package/dist/editor/autoLayout.d.ts +38 -0
- package/dist/editor/autoLayout.js +403 -0
- package/dist/editor/blockClipboard.svelte.d.ts +9 -0
- package/dist/editor/blockClipboard.svelte.js +24 -0
- package/dist/editor/blockCopy.d.ts +39 -0
- package/dist/editor/blockCopy.js +137 -0
- package/dist/editor/canvasMenu.d.ts +45 -0
- package/dist/editor/canvasMenu.js +68 -0
- package/dist/editor/connectionSnap.d.ts +90 -0
- package/dist/editor/connectionSnap.js +98 -0
- package/dist/editor/editorState.svelte.d.ts +122 -13
- package/dist/editor/editorState.svelte.js +262 -22
- package/dist/editor/graphIssues.d.ts +5 -0
- package/dist/editor/graphIssues.js +18 -0
- package/dist/editor/graphModel.d.ts +6 -1
- package/dist/editor/graphModel.js +8 -1
- package/dist/editor/keyHints.d.ts +21 -0
- package/dist/editor/keyHints.js +30 -0
- package/dist/editor/listState.svelte.d.ts +4 -4
- package/dist/editor/staleGuard.d.ts +111 -0
- package/dist/editor/staleGuard.js +279 -0
- package/dist/i18n/language.d.ts +3 -3
- package/dist/i18n/messages.d.ts +84 -1
- package/dist/i18n/messages.js +97 -4
- package/dist/index.d.ts +1 -0
- package/dist/types/index.d.ts +19 -2
- package/package.json +10 -10
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The link a step of an approved plan offers once its widget is being built: it opens the widget's canvas in a tab of its own, where
|
|
3
|
+
* the build is already running, so the person watches it (and can take it over). One link per widget, so a plan that builds several
|
|
4
|
+
* gives several tabs to open.
|
|
5
|
+
*/
|
|
6
|
+
/** What an id the gateway hands out looks like (a UUID). Anything else is not a canvas the link may point to. */
|
|
7
|
+
const CANVAS_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
8
|
+
export function isCanvasId(value) {
|
|
9
|
+
return typeof value === 'string' && CANVAS_ID_PATTERN.test(value);
|
|
10
|
+
}
|
|
11
|
+
/** Where the Widgetic site opens a canvas. A page that is not the site gives its own address (`WorkflowAssistantConfig.canvasHref`). */
|
|
12
|
+
export function defaultCanvasHref(canvasId) {
|
|
13
|
+
return `/canvas/${canvasId}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The link of a step, or null when it has none: no canvas yet (the build has not started, or the widget is one the person already
|
|
17
|
+
* had), a build that failed (its canvas has nothing to watch), or an address that cannot be used. Never throws: a page's address builder
|
|
18
|
+
* that does is a missing link, not a broken card.
|
|
19
|
+
*
|
|
20
|
+
* @param step the step as the card holds it
|
|
21
|
+
* @param buildHref the page's own address builder, when it gave one
|
|
22
|
+
*/
|
|
23
|
+
export function canvasLinkOfStep(step, buildHref = undefined) {
|
|
24
|
+
if (!isCanvasId(step.canvasId))
|
|
25
|
+
return null;
|
|
26
|
+
if (step.status !== 'creating' && step.status !== 'done')
|
|
27
|
+
return null;
|
|
28
|
+
try {
|
|
29
|
+
const href = (buildHref ?? defaultCanvasHref)(step.canvasId);
|
|
30
|
+
if (typeof href !== 'string' || href.trim() === '')
|
|
31
|
+
return null;
|
|
32
|
+
return {
|
|
33
|
+
href,
|
|
34
|
+
labelKey: step.status === 'creating'
|
|
35
|
+
? 'workflows.assistant.watchBuild'
|
|
36
|
+
: 'workflows.assistant.openBuilt'
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.debug('[workflows-assistant] the page could not make an address for a canvas', error);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* True while a step of the card is being built and has a canvas to open: the card then says what its links are for (the build can
|
|
46
|
+
* be watched, and taken over, in the tab they open). Once every build is done the links only open the finished widgets, and the
|
|
47
|
+
* sentence goes.
|
|
48
|
+
*/
|
|
49
|
+
export function hasBuildToWatch(steps, buildHref = undefined) {
|
|
50
|
+
return steps.some((step) => step.status === 'creating' && canvasLinkOfStep(step, buildHref) !== null);
|
|
51
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CompositionOption } from '../api/types.js';
|
|
2
|
+
export interface CompositionReference {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const MAX_COMPOSITION_REFERENCES = 10;
|
|
7
|
+
export interface ActiveMentionTrigger {
|
|
8
|
+
readonly start: number;
|
|
9
|
+
readonly query: string;
|
|
10
|
+
}
|
|
11
|
+
/** Whether the caret sits inside an `@` mention (word boundary or start of text before `@`). */
|
|
12
|
+
export declare function findActiveMentionTrigger(text: string, caret: number): ActiveMentionTrigger | null;
|
|
13
|
+
export declare function filterCompositionOptions(options: readonly CompositionOption[], query: string): readonly CompositionOption[];
|
|
14
|
+
export declare function insertMentionText(text: string, triggerStart: number, caret: number, name: string): string;
|
|
15
|
+
export declare function caretAfterMentionInsert(triggerStart: number, name: string): number;
|
|
16
|
+
export declare function addCompositionReference(existing: readonly CompositionReference[], option: CompositionOption): readonly CompositionReference[];
|
|
17
|
+
export declare function removeCompositionReference(existing: readonly CompositionReference[], id: string): readonly CompositionReference[];
|
|
18
|
+
export declare function compositionReferencesForPayload(references: readonly CompositionReference[]): CompositionReference[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const MAX_COMPOSITION_REFERENCES = 10;
|
|
2
|
+
/** Whether the caret sits inside an `@` mention (word boundary or start of text before `@`). */
|
|
3
|
+
export function findActiveMentionTrigger(text, caret) {
|
|
4
|
+
const before = text.slice(0, caret);
|
|
5
|
+
const start = before.lastIndexOf('@');
|
|
6
|
+
if (start === -1)
|
|
7
|
+
return null;
|
|
8
|
+
if (start > 0) {
|
|
9
|
+
const previous = before[start - 1];
|
|
10
|
+
if (previous !== ' ' && previous !== '\n' && previous !== '\t')
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const query = before.slice(start + 1);
|
|
14
|
+
if (/[\s\n]/.test(query))
|
|
15
|
+
return null;
|
|
16
|
+
return { start, query };
|
|
17
|
+
}
|
|
18
|
+
export function filterCompositionOptions(options, query) {
|
|
19
|
+
const normalized = query.trim().toLowerCase();
|
|
20
|
+
if (normalized === '')
|
|
21
|
+
return options;
|
|
22
|
+
return options.filter((option) => option.name.toLowerCase().includes(normalized));
|
|
23
|
+
}
|
|
24
|
+
export function insertMentionText(text, triggerStart, caret, name) {
|
|
25
|
+
const before = text.slice(0, triggerStart);
|
|
26
|
+
const after = text.slice(caret);
|
|
27
|
+
return `${before}@${name} ${after}`;
|
|
28
|
+
}
|
|
29
|
+
export function caretAfterMentionInsert(triggerStart, name) {
|
|
30
|
+
return triggerStart + name.length + 2;
|
|
31
|
+
}
|
|
32
|
+
export function addCompositionReference(existing, option) {
|
|
33
|
+
if (existing.some((entry) => entry.id === option.id))
|
|
34
|
+
return existing;
|
|
35
|
+
if (existing.length >= MAX_COMPOSITION_REFERENCES)
|
|
36
|
+
return existing;
|
|
37
|
+
return [...existing, { id: option.id, name: option.name }];
|
|
38
|
+
}
|
|
39
|
+
export function removeCompositionReference(existing, id) {
|
|
40
|
+
return existing.filter((entry) => entry.id !== id);
|
|
41
|
+
}
|
|
42
|
+
export function compositionReferencesForPayload(references) {
|
|
43
|
+
return references.slice(0, MAX_COMPOSITION_REFERENCES).map((entry) => ({
|
|
44
|
+
id: entry.id,
|
|
45
|
+
name: entry.name
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live data in the assistant: what the person is shown to check a call of one of their Open MCPs before they approve it, and the
|
|
3
|
+
* block of the plan card that asks for their yes.
|
|
4
|
+
*
|
|
5
|
+
* The gateway sends two things for it. While the assistant works, a `data_preview` event: the values a composition would show
|
|
6
|
+
* for one read-only call (cut to a short length), for the person's eyes only (the model is told which fields were filled and
|
|
7
|
+
* never what is in them). With the plan, `dataBindings`: the exact call, where each part of the answer goes, and how often the
|
|
8
|
+
* call is repeated. After the person approves, `binding_status` events say how each one went.
|
|
9
|
+
*
|
|
10
|
+
* Nothing here decides anything. The call, the mapping and the preview are the gateway's, and the plan that goes back on
|
|
11
|
+
* approval is the one that came, untouched: this file only reads them for the screen.
|
|
12
|
+
*/
|
|
13
|
+
/** One step of a path into an answer: the name of a key, or a position in a list (from 0). */
|
|
14
|
+
export type BindingPathStep = string | number;
|
|
15
|
+
/** The paths of a mapping: where, in the answer of the call, each field of the composition gets its value. */
|
|
16
|
+
export interface BindingMappingWire {
|
|
17
|
+
readonly content: Readonly<Record<string, readonly BindingPathStep[]>>;
|
|
18
|
+
readonly list: {
|
|
19
|
+
readonly rows: readonly BindingPathStep[];
|
|
20
|
+
readonly fields: Readonly<Record<string, readonly BindingPathStep[]>>;
|
|
21
|
+
} | null;
|
|
22
|
+
}
|
|
23
|
+
/** One entry of the plan's `dataBindings`, as the gateway signs it. */
|
|
24
|
+
export interface PlanBindingWire {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly compositionId: string;
|
|
27
|
+
readonly compositionName: string;
|
|
28
|
+
readonly openMcpId: string;
|
|
29
|
+
readonly openMcpName: string;
|
|
30
|
+
readonly openMcpHost: string;
|
|
31
|
+
readonly tool: string;
|
|
32
|
+
/** What the server says about the tool: `true` it only reads, `false` it may change data, `null` it says nothing. */
|
|
33
|
+
readonly toolReadOnly: boolean | null;
|
|
34
|
+
readonly arguments: Readonly<Record<string, unknown>>;
|
|
35
|
+
readonly mapping: BindingMappingWire;
|
|
36
|
+
readonly ttlSeconds: number;
|
|
37
|
+
/** The `data_preview` that showed the person this call's first rows. */
|
|
38
|
+
readonly previewId: string;
|
|
39
|
+
}
|
|
40
|
+
/** Where the live data of a plan stands: `binding` while the call is made and checked, `done` once it is saved. */
|
|
41
|
+
export type PlanBindingStatus = 'waiting' | 'binding' | 'done' | 'failed';
|
|
42
|
+
export declare const PLAN_BINDING_STATUSES: readonly PlanBindingStatus[];
|
|
43
|
+
/** A field of a composition and the place in the answer it is filled from, both written for a person to read. */
|
|
44
|
+
export interface BindingMappingLine {
|
|
45
|
+
readonly field: string;
|
|
46
|
+
readonly path: string;
|
|
47
|
+
}
|
|
48
|
+
/** What the plan card shows for one binding. Nothing in it is a value of the answer. */
|
|
49
|
+
export interface AssistantPlanBindingCard {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly compositionName: string;
|
|
52
|
+
readonly openMcpName: string;
|
|
53
|
+
readonly openMcpHost: string;
|
|
54
|
+
readonly tool: string;
|
|
55
|
+
readonly toolReadOnly: boolean | null;
|
|
56
|
+
/** The arguments of the call as the gateway will send them, written out (a person reads exactly what is called). */
|
|
57
|
+
readonly callText: string;
|
|
58
|
+
readonly mapping: {
|
|
59
|
+
/** Fields of the whole composition (a headline, a button label): `field` is the key until the preview gives its label. */
|
|
60
|
+
readonly content: readonly BindingMappingLine[];
|
|
61
|
+
/** The list the call fills, when it fills one: where the rows are in the answer, and where each column of a row is. */
|
|
62
|
+
readonly list: {
|
|
63
|
+
readonly rowsPath: string;
|
|
64
|
+
readonly columns: readonly BindingMappingLine[];
|
|
65
|
+
} | null;
|
|
66
|
+
};
|
|
67
|
+
readonly ttlSeconds: number;
|
|
68
|
+
readonly previewId: string;
|
|
69
|
+
readonly status: PlanBindingStatus;
|
|
70
|
+
/** The gateway's sentence for a binding that failed, saying what to do; absent for the other states. */
|
|
71
|
+
readonly detail?: string;
|
|
72
|
+
/** How many rows the call gave when it was made for the approval (a count, never a value); absent until it is done. */
|
|
73
|
+
readonly rows?: number;
|
|
74
|
+
}
|
|
75
|
+
/** The values a composition would show for one call, for the person to check before they approve it. */
|
|
76
|
+
export interface AssistantDataPreview {
|
|
77
|
+
readonly previewId: string;
|
|
78
|
+
readonly compositionId: string;
|
|
79
|
+
readonly compositionName: string;
|
|
80
|
+
readonly openMcpName: string;
|
|
81
|
+
readonly tool: string;
|
|
82
|
+
readonly content: ReadonlyArray<{
|
|
83
|
+
readonly key: string;
|
|
84
|
+
readonly label: string;
|
|
85
|
+
readonly value: string;
|
|
86
|
+
}>;
|
|
87
|
+
readonly list: {
|
|
88
|
+
readonly columns: ReadonlyArray<{
|
|
89
|
+
readonly key: string;
|
|
90
|
+
readonly label: string;
|
|
91
|
+
}>;
|
|
92
|
+
/** The first rows: one text per column, in the order of `columns`. */
|
|
93
|
+
readonly rows: ReadonlyArray<readonly string[]>;
|
|
94
|
+
/** How many rows the composition would show in all. */
|
|
95
|
+
readonly rowCount: number;
|
|
96
|
+
/** How many rows of the answer did not fit the composition's list. */
|
|
97
|
+
readonly rowsLeftOut: number;
|
|
98
|
+
} | null;
|
|
99
|
+
/** How many values could not be used and were left out, and how many were cut or rounded to fit their field. */
|
|
100
|
+
readonly dropped: number;
|
|
101
|
+
readonly adjusted: number;
|
|
102
|
+
}
|
|
103
|
+
/** How many previews the panel keeps in view: the newest ones, so a long conversation does not pile up other people's data on the screen. */
|
|
104
|
+
export declare const MAX_DATA_PREVIEWS = 6;
|
|
105
|
+
/**
|
|
106
|
+
* Reads a `data_preview` event. A preview that does not read as one is `null` and is skipped: it is only a view for the person,
|
|
107
|
+
* and the plan is what they approve, so nothing is lost by leaving a view out that cannot be drawn.
|
|
108
|
+
*/
|
|
109
|
+
export declare function parseDataPreview(raw: unknown): AssistantDataPreview | null;
|
|
110
|
+
/**
|
|
111
|
+
* The previews with one more: a preview with the id of one that is there takes its place (the assistant tried the same call
|
|
112
|
+
* again), and only the newest few are kept.
|
|
113
|
+
*/
|
|
114
|
+
export declare function rememberDataPreview(previews: readonly AssistantDataPreview[], preview: AssistantDataPreview): readonly AssistantDataPreview[];
|
|
115
|
+
/** The preview that showed the person a binding's first rows, when it is still in view. */
|
|
116
|
+
export declare function previewOfBinding(previews: readonly AssistantDataPreview[], binding: Pick<AssistantPlanBindingCard, 'previewId'>): AssistantDataPreview | null;
|
|
117
|
+
/** The previews no binding of the plan card uses: they stay in the conversation, and the ones the card shows are not drawn twice. */
|
|
118
|
+
export declare function previewsOutsideCard(previews: readonly AssistantDataPreview[], bindings: readonly Pick<AssistantPlanBindingCard, 'previewId'>[]): readonly AssistantDataPreview[];
|
|
119
|
+
/**
|
|
120
|
+
* A path into an answer as a developer writes it: `rows[0].name`, `data["first name"]`. An empty path is the answer itself, and
|
|
121
|
+
* is written as an empty text (the screen says it in words).
|
|
122
|
+
*/
|
|
123
|
+
export declare function formatBindingPath(path: readonly BindingPathStep[]): string;
|
|
124
|
+
/**
|
|
125
|
+
* Reads the `dataBindings` of a plan. It answers `null` when any entry is not what the gateway writes: the card then cannot
|
|
126
|
+
* say everything the plan would do, and a plan the person cannot read in full is not offered for approval.
|
|
127
|
+
*/
|
|
128
|
+
export declare function parsePlanBindings(raw: unknown): PlanBindingWire[] | null;
|
|
129
|
+
/** The card of one binding, in the state the plan card starts in: not yet approved. */
|
|
130
|
+
export declare function bindingCardOf(wire: PlanBindingWire): AssistantPlanBindingCard;
|
|
131
|
+
/**
|
|
132
|
+
* The words a person knows a field by: the label the preview gave it, and the key when the preview is gone or did not fill it.
|
|
133
|
+
* The key is what the mapping is written in; the label is what the composition calls the field.
|
|
134
|
+
*/
|
|
135
|
+
export declare function labelledMappingLines(lines: readonly BindingMappingLine[], labels: ReadonlyArray<{
|
|
136
|
+
readonly key: string;
|
|
137
|
+
readonly label: string;
|
|
138
|
+
}> | undefined): BindingMappingLine[];
|
|
139
|
+
/** Moves one binding to a state the approval reported; the others are left as they are. */
|
|
140
|
+
export declare function withBindingStatus(bindings: readonly AssistantPlanBindingCard[], bindingId: string, status: PlanBindingStatus, detail: string | undefined, rows?: number): AssistantPlanBindingCard[];
|
|
141
|
+
/**
|
|
142
|
+
* Whether an approval that only turned live data on has finished well: the plan has bindings and nothing to build, and every
|
|
143
|
+
* binding is done. Such a plan saves no workflow, so no `workflow_saved` event ever says it is over.
|
|
144
|
+
*/
|
|
145
|
+
export declare function liveDataIsReady(card: {
|
|
146
|
+
readonly steps: readonly unknown[];
|
|
147
|
+
readonly bindings?: readonly Pick<AssistantPlanBindingCard, 'status'>[];
|
|
148
|
+
}): boolean;
|
|
149
|
+
/** Whether a status the gateway sent is one the card knows (a status it does not know is not shown as progress). */
|
|
150
|
+
export declare function isPlanBindingStatus(value: unknown): value is PlanBindingStatus;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live data in the assistant: what the person is shown to check a call of one of their Open MCPs before they approve it, and the
|
|
3
|
+
* block of the plan card that asks for their yes.
|
|
4
|
+
*
|
|
5
|
+
* The gateway sends two things for it. While the assistant works, a `data_preview` event: the values a composition would show
|
|
6
|
+
* for one read-only call (cut to a short length), for the person's eyes only (the model is told which fields were filled and
|
|
7
|
+
* never what is in them). With the plan, `dataBindings`: the exact call, where each part of the answer goes, and how often the
|
|
8
|
+
* call is repeated. After the person approves, `binding_status` events say how each one went.
|
|
9
|
+
*
|
|
10
|
+
* Nothing here decides anything. The call, the mapping and the preview are the gateway's, and the plan that goes back on
|
|
11
|
+
* approval is the one that came, untouched: this file only reads them for the screen.
|
|
12
|
+
*/
|
|
13
|
+
export const PLAN_BINDING_STATUSES = [
|
|
14
|
+
'waiting',
|
|
15
|
+
'binding',
|
|
16
|
+
'done',
|
|
17
|
+
'failed'
|
|
18
|
+
];
|
|
19
|
+
/** How many previews the panel keeps in view: the newest ones, so a long conversation does not pile up other people's data on the screen. */
|
|
20
|
+
export const MAX_DATA_PREVIEWS = 6;
|
|
21
|
+
/** What a preview shows is cut again here, so an answer that is longer than the gateway promised cannot swamp the panel. */
|
|
22
|
+
const MAX_PREVIEW_FIELDS = 40;
|
|
23
|
+
const MAX_PREVIEW_COLUMNS = 12;
|
|
24
|
+
const MAX_PREVIEW_ROWS = 20;
|
|
25
|
+
const MAX_PREVIEW_TEXT_LENGTH = 400;
|
|
26
|
+
function isRecord(value) {
|
|
27
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
28
|
+
}
|
|
29
|
+
function wholeNumberOrZero(value) {
|
|
30
|
+
return typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.floor(value) : 0;
|
|
31
|
+
}
|
|
32
|
+
function shownText(value) {
|
|
33
|
+
return typeof value === 'string' ? value.slice(0, MAX_PREVIEW_TEXT_LENGTH) : '';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Reads a `data_preview` event. A preview that does not read as one is `null` and is skipped: it is only a view for the person,
|
|
37
|
+
* and the plan is what they approve, so nothing is lost by leaving a view out that cannot be drawn.
|
|
38
|
+
*/
|
|
39
|
+
export function parseDataPreview(raw) {
|
|
40
|
+
if (!isRecord(raw))
|
|
41
|
+
return null;
|
|
42
|
+
const { previewId, compositionId, compositionName, openMcpName, tool } = raw;
|
|
43
|
+
if (typeof previewId !== 'string' || previewId === '')
|
|
44
|
+
return null;
|
|
45
|
+
if (typeof compositionId !== 'string' || typeof tool !== 'string')
|
|
46
|
+
return null;
|
|
47
|
+
if (!Array.isArray(raw.content))
|
|
48
|
+
return null;
|
|
49
|
+
const content = [];
|
|
50
|
+
for (const entry of raw.content.slice(0, MAX_PREVIEW_FIELDS)) {
|
|
51
|
+
if (!isRecord(entry) || typeof entry.key !== 'string')
|
|
52
|
+
continue;
|
|
53
|
+
content.push({
|
|
54
|
+
key: entry.key,
|
|
55
|
+
label: typeof entry.label === 'string' && entry.label !== '' ? shownText(entry.label) : entry.key,
|
|
56
|
+
value: shownText(entry.value)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
let list = null;
|
|
60
|
+
if (isRecord(raw.list) && Array.isArray(raw.list.columns) && Array.isArray(raw.list.rows)) {
|
|
61
|
+
const columns = [];
|
|
62
|
+
for (const column of raw.list.columns.slice(0, MAX_PREVIEW_COLUMNS)) {
|
|
63
|
+
if (!isRecord(column) || typeof column.key !== 'string')
|
|
64
|
+
continue;
|
|
65
|
+
columns.push({
|
|
66
|
+
key: column.key,
|
|
67
|
+
label: typeof column.label === 'string' && column.label !== ''
|
|
68
|
+
? shownText(column.label)
|
|
69
|
+
: column.key
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const rows = raw.list.rows.slice(0, MAX_PREVIEW_ROWS).map((row) =>
|
|
73
|
+
// A row is one text per column, padded or cut to the columns that are drawn, so a short or a long row never shifts a table.
|
|
74
|
+
columns.map((_, index) => (Array.isArray(row) ? shownText(row[index]) : '')));
|
|
75
|
+
list = {
|
|
76
|
+
columns,
|
|
77
|
+
rows,
|
|
78
|
+
rowCount: Math.max(wholeNumberOrZero(raw.list.rowCount), rows.length),
|
|
79
|
+
rowsLeftOut: wholeNumberOrZero(raw.list.rowsLeftOut)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
previewId,
|
|
84
|
+
compositionId,
|
|
85
|
+
compositionName: shownText(compositionName),
|
|
86
|
+
openMcpName: shownText(openMcpName),
|
|
87
|
+
tool: shownText(tool),
|
|
88
|
+
content,
|
|
89
|
+
list,
|
|
90
|
+
dropped: wholeNumberOrZero(raw.dropped),
|
|
91
|
+
adjusted: wholeNumberOrZero(raw.adjusted)
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The previews with one more: a preview with the id of one that is there takes its place (the assistant tried the same call
|
|
96
|
+
* again), and only the newest few are kept.
|
|
97
|
+
*/
|
|
98
|
+
export function rememberDataPreview(previews, preview) {
|
|
99
|
+
const others = previews.filter((entry) => entry.previewId !== preview.previewId);
|
|
100
|
+
return [...others, preview].slice(-MAX_DATA_PREVIEWS);
|
|
101
|
+
}
|
|
102
|
+
/** The preview that showed the person a binding's first rows, when it is still in view. */
|
|
103
|
+
export function previewOfBinding(previews, binding) {
|
|
104
|
+
return previews.find((entry) => entry.previewId === binding.previewId) ?? null;
|
|
105
|
+
}
|
|
106
|
+
/** The previews no binding of the plan card uses: they stay in the conversation, and the ones the card shows are not drawn twice. */
|
|
107
|
+
export function previewsOutsideCard(previews, bindings) {
|
|
108
|
+
const used = new Set(bindings.map((binding) => binding.previewId));
|
|
109
|
+
return previews.filter((entry) => !used.has(entry.previewId));
|
|
110
|
+
}
|
|
111
|
+
const PLAIN_KEY = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
112
|
+
/**
|
|
113
|
+
* A path into an answer as a developer writes it: `rows[0].name`, `data["first name"]`. An empty path is the answer itself, and
|
|
114
|
+
* is written as an empty text (the screen says it in words).
|
|
115
|
+
*/
|
|
116
|
+
export function formatBindingPath(path) {
|
|
117
|
+
let text = '';
|
|
118
|
+
for (const step of path) {
|
|
119
|
+
if (typeof step === 'number')
|
|
120
|
+
text += `[${step}]`;
|
|
121
|
+
else if (PLAIN_KEY.test(step))
|
|
122
|
+
text += text === '' ? step : `.${step}`;
|
|
123
|
+
else
|
|
124
|
+
text += `[${JSON.stringify(step)}]`;
|
|
125
|
+
}
|
|
126
|
+
return text;
|
|
127
|
+
}
|
|
128
|
+
function isPathStep(value) {
|
|
129
|
+
return (typeof value === 'string' ||
|
|
130
|
+
(typeof value === 'number' && Number.isInteger(value) && value >= 0));
|
|
131
|
+
}
|
|
132
|
+
function readPath(value) {
|
|
133
|
+
if (!Array.isArray(value) || !value.every(isPathStep))
|
|
134
|
+
return null;
|
|
135
|
+
return [...value];
|
|
136
|
+
}
|
|
137
|
+
function readPathRecord(value) {
|
|
138
|
+
if (!isRecord(value))
|
|
139
|
+
return null;
|
|
140
|
+
const record = {};
|
|
141
|
+
for (const [key, path] of Object.entries(value)) {
|
|
142
|
+
const readPathOfKey = readPath(path);
|
|
143
|
+
if (readPathOfKey === null)
|
|
144
|
+
return null;
|
|
145
|
+
record[key] = readPathOfKey;
|
|
146
|
+
}
|
|
147
|
+
return record;
|
|
148
|
+
}
|
|
149
|
+
function readMapping(value) {
|
|
150
|
+
if (!isRecord(value))
|
|
151
|
+
return null;
|
|
152
|
+
const content = readPathRecord(value.content);
|
|
153
|
+
if (content === null)
|
|
154
|
+
return null;
|
|
155
|
+
if (value.list === null)
|
|
156
|
+
return { content, list: null };
|
|
157
|
+
if (!isRecord(value.list))
|
|
158
|
+
return null;
|
|
159
|
+
const rows = readPath(value.list.rows);
|
|
160
|
+
const fields = readPathRecord(value.list.fields);
|
|
161
|
+
if (rows === null || fields === null)
|
|
162
|
+
return null;
|
|
163
|
+
return { content, list: { rows, fields } };
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Reads the `dataBindings` of a plan. It answers `null` when any entry is not what the gateway writes: the card then cannot
|
|
167
|
+
* say everything the plan would do, and a plan the person cannot read in full is not offered for approval.
|
|
168
|
+
*/
|
|
169
|
+
export function parsePlanBindings(raw) {
|
|
170
|
+
if (!Array.isArray(raw))
|
|
171
|
+
return null;
|
|
172
|
+
const bindings = [];
|
|
173
|
+
for (const entry of raw) {
|
|
174
|
+
if (!isRecord(entry))
|
|
175
|
+
return null;
|
|
176
|
+
const mapping = readMapping(entry.mapping);
|
|
177
|
+
const textKeys = [
|
|
178
|
+
'id',
|
|
179
|
+
'compositionId',
|
|
180
|
+
'compositionName',
|
|
181
|
+
'openMcpId',
|
|
182
|
+
'openMcpName',
|
|
183
|
+
'openMcpHost',
|
|
184
|
+
'tool',
|
|
185
|
+
'previewId'
|
|
186
|
+
];
|
|
187
|
+
if (mapping === null || !isRecord(entry.arguments))
|
|
188
|
+
return null;
|
|
189
|
+
if (!textKeys.every((key) => typeof entry[key] === 'string'))
|
|
190
|
+
return null;
|
|
191
|
+
if (typeof entry.ttlSeconds !== 'number' || !Number.isFinite(entry.ttlSeconds))
|
|
192
|
+
return null;
|
|
193
|
+
if (entry.toolReadOnly !== null && typeof entry.toolReadOnly !== 'boolean')
|
|
194
|
+
return null;
|
|
195
|
+
bindings.push({
|
|
196
|
+
id: entry.id,
|
|
197
|
+
compositionId: entry.compositionId,
|
|
198
|
+
compositionName: entry.compositionName,
|
|
199
|
+
openMcpId: entry.openMcpId,
|
|
200
|
+
openMcpName: entry.openMcpName,
|
|
201
|
+
openMcpHost: entry.openMcpHost,
|
|
202
|
+
tool: entry.tool,
|
|
203
|
+
toolReadOnly: entry.toolReadOnly,
|
|
204
|
+
arguments: entry.arguments,
|
|
205
|
+
mapping,
|
|
206
|
+
ttlSeconds: entry.ttlSeconds,
|
|
207
|
+
previewId: entry.previewId
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return bindings;
|
|
211
|
+
}
|
|
212
|
+
function linesOf(paths) {
|
|
213
|
+
return Object.entries(paths).map(([field, path]) => ({ field, path: formatBindingPath(path) }));
|
|
214
|
+
}
|
|
215
|
+
function callTextOf(argumentsOfCall) {
|
|
216
|
+
try {
|
|
217
|
+
return JSON.stringify(argumentsOfCall, null, 2);
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
// Arguments that came as JSON can be written as JSON again; this is only for a value that somehow cannot.
|
|
221
|
+
return '';
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/** The card of one binding, in the state the plan card starts in: not yet approved. */
|
|
225
|
+
export function bindingCardOf(wire) {
|
|
226
|
+
return {
|
|
227
|
+
id: wire.id,
|
|
228
|
+
compositionName: wire.compositionName,
|
|
229
|
+
openMcpName: wire.openMcpName,
|
|
230
|
+
openMcpHost: wire.openMcpHost,
|
|
231
|
+
tool: wire.tool,
|
|
232
|
+
toolReadOnly: wire.toolReadOnly,
|
|
233
|
+
callText: callTextOf(wire.arguments),
|
|
234
|
+
mapping: {
|
|
235
|
+
content: linesOf(wire.mapping.content),
|
|
236
|
+
list: wire.mapping.list === null
|
|
237
|
+
? null
|
|
238
|
+
: {
|
|
239
|
+
rowsPath: formatBindingPath(wire.mapping.list.rows),
|
|
240
|
+
columns: linesOf(wire.mapping.list.fields)
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
ttlSeconds: wire.ttlSeconds,
|
|
244
|
+
previewId: wire.previewId,
|
|
245
|
+
status: 'waiting'
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The words a person knows a field by: the label the preview gave it, and the key when the preview is gone or did not fill it.
|
|
250
|
+
* The key is what the mapping is written in; the label is what the composition calls the field.
|
|
251
|
+
*/
|
|
252
|
+
export function labelledMappingLines(lines, labels) {
|
|
253
|
+
const labelOfKey = new Map((labels ?? []).map((entry) => [entry.key, entry.label]));
|
|
254
|
+
return lines.map((line) => ({
|
|
255
|
+
field: labelOfKey.get(line.field) ?? line.field,
|
|
256
|
+
path: line.path
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
/** Moves one binding to a state the approval reported; the others are left as they are. */
|
|
260
|
+
export function withBindingStatus(bindings, bindingId, status, detail, rows) {
|
|
261
|
+
return bindings.map((binding) => binding.id === bindingId
|
|
262
|
+
? {
|
|
263
|
+
...binding,
|
|
264
|
+
status,
|
|
265
|
+
// A sentence about a failure belongs to the failure, and a count of rows to the call that gave them: any other state clears them.
|
|
266
|
+
detail: status === 'failed' && detail ? detail : undefined,
|
|
267
|
+
rows: status === 'done' && typeof rows === 'number' && Number.isFinite(rows) && rows >= 0
|
|
268
|
+
? Math.floor(rows)
|
|
269
|
+
: undefined
|
|
270
|
+
}
|
|
271
|
+
: binding);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Whether an approval that only turned live data on has finished well: the plan has bindings and nothing to build, and every
|
|
275
|
+
* binding is done. Such a plan saves no workflow, so no `workflow_saved` event ever says it is over.
|
|
276
|
+
*/
|
|
277
|
+
export function liveDataIsReady(card) {
|
|
278
|
+
const bindings = card.bindings ?? [];
|
|
279
|
+
return (bindings.length > 0 &&
|
|
280
|
+
card.steps.length === 0 &&
|
|
281
|
+
bindings.every((binding) => binding.status === 'done'));
|
|
282
|
+
}
|
|
283
|
+
/** Whether a status the gateway sent is one the card knows (a status it does not know is not shown as progress). */
|
|
284
|
+
export function isPlanBindingStatus(value) {
|
|
285
|
+
return typeof value === 'string' && PLAN_BINDING_STATUSES.includes(value);
|
|
286
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OpenMcpOption } from '../api/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* An Open MCP the person picked with `@` in the assistant composer. It is only the id and the name the person saw: the gateway
|
|
4
|
+
* looks the server up itself (their own, in this workspace), so nothing about the server travels with the message.
|
|
5
|
+
*/
|
|
6
|
+
export interface McpReference {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
}
|
|
10
|
+
/** The most Open MCPs one message may name: the gateway refuses a request that names more. */
|
|
11
|
+
export declare const MAX_MCP_REFERENCES = 5;
|
|
12
|
+
/** The longest name a reference may carry on the wire: a longer one is cut, so a long name never makes the gateway refuse the message. */
|
|
13
|
+
export declare const MAX_MCP_REFERENCE_NAME_LENGTH = 200;
|
|
14
|
+
/** The Open MCPs whose name or host holds what the person typed after `@`, in the order the API gave them. */
|
|
15
|
+
export declare function filterMcpOptions(options: readonly OpenMcpOption[], query: string): readonly OpenMcpOption[];
|
|
16
|
+
/** The references with one more, unless it is there already or the message already names as many as the gateway takes. */
|
|
17
|
+
export declare function addMcpReference(existing: readonly McpReference[], option: OpenMcpOption): readonly McpReference[];
|
|
18
|
+
export declare function removeMcpReference(existing: readonly McpReference[], id: string): readonly McpReference[];
|
|
19
|
+
/** What goes on the wire: the id and the name of each reference, at most as many as the gateway takes, each name cut to the length it takes. */
|
|
20
|
+
export declare function mcpReferencesForPayload(references: readonly McpReference[]): McpReference[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The most Open MCPs one message may name: the gateway refuses a request that names more. */
|
|
2
|
+
export const MAX_MCP_REFERENCES = 5;
|
|
3
|
+
/** The longest name a reference may carry on the wire: a longer one is cut, so a long name never makes the gateway refuse the message. */
|
|
4
|
+
export const MAX_MCP_REFERENCE_NAME_LENGTH = 200;
|
|
5
|
+
/** The Open MCPs whose name or host holds what the person typed after `@`, in the order the API gave them. */
|
|
6
|
+
export function filterMcpOptions(options, query) {
|
|
7
|
+
const normalized = query.trim().toLowerCase();
|
|
8
|
+
if (normalized === '')
|
|
9
|
+
return options;
|
|
10
|
+
return options.filter((option) => option.name.toLowerCase().includes(normalized) ||
|
|
11
|
+
option.host.toLowerCase().includes(normalized));
|
|
12
|
+
}
|
|
13
|
+
/** The references with one more, unless it is there already or the message already names as many as the gateway takes. */
|
|
14
|
+
export function addMcpReference(existing, option) {
|
|
15
|
+
if (existing.some((entry) => entry.id === option.id))
|
|
16
|
+
return existing;
|
|
17
|
+
if (existing.length >= MAX_MCP_REFERENCES)
|
|
18
|
+
return existing;
|
|
19
|
+
return [...existing, { id: option.id, name: option.name }];
|
|
20
|
+
}
|
|
21
|
+
export function removeMcpReference(existing, id) {
|
|
22
|
+
return existing.filter((entry) => entry.id !== id);
|
|
23
|
+
}
|
|
24
|
+
/** What goes on the wire: the id and the name of each reference, at most as many as the gateway takes, each name cut to the length it takes. */
|
|
25
|
+
export function mcpReferencesForPayload(references) {
|
|
26
|
+
return references.slice(0, MAX_MCP_REFERENCES).map((entry) => ({
|
|
27
|
+
id: entry.id,
|
|
28
|
+
name: entry.name.slice(0, MAX_MCP_REFERENCE_NAME_LENGTH)
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CompositionOption, OpenMcpOption } from '../api/types.js';
|
|
2
|
+
import type { WorkflowsMessageKey } from '../i18n/messages.js';
|
|
3
|
+
/**
|
|
4
|
+
* One row of the `@` menu: a composition, or one of the person's Open MCPs. The two are told apart by `kind`, never by an id
|
|
5
|
+
* (two ids of different kinds may look alike), so a pick always goes to the list it belongs to.
|
|
6
|
+
*/
|
|
7
|
+
export type MentionEntry = {
|
|
8
|
+
readonly kind: 'composition';
|
|
9
|
+
readonly option: CompositionOption;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'mcp';
|
|
12
|
+
readonly option: OpenMcpOption;
|
|
13
|
+
};
|
|
14
|
+
/** A key that is different for every row of the menu, whatever the kind. */
|
|
15
|
+
export declare function mentionEntryKey(entry: MentionEntry): string;
|
|
16
|
+
/**
|
|
17
|
+
* The rows of the menu for what the person typed after `@`: their Open MCPs first, then the compositions. The Open MCPs go first
|
|
18
|
+
* because there are few of them (a member keeps a handful) and the compositions can be fifty: put after them, the group would be
|
|
19
|
+
* out of sight behind a long scroll. Both groups are filtered by the same words, and a person with no Open MCP sees exactly the
|
|
20
|
+
* menu of compositions they saw before.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildMentionEntries(query: string, compositions: readonly CompositionOption[], mcps: readonly OpenMcpOption[]): readonly MentionEntry[];
|
|
23
|
+
/** Whether the menu has both kinds of row, which is when it labels its two groups (one group needs no label). */
|
|
24
|
+
export declare function mentionEntriesHaveTwoGroups(entries: readonly MentionEntry[]): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a row can be picked. A composition always can. A server can once it is connected and has a tool switched on: a
|
|
27
|
+
* message that names a server the assistant cannot call would only cost the person a turn to be told so, so the menu shows
|
|
28
|
+
* such a server with the reason (`mentionEntryUnavailableKey`) and does not take the pick.
|
|
29
|
+
*/
|
|
30
|
+
export declare function mentionEntryIsSelectable(entry: MentionEntry): boolean;
|
|
31
|
+
/** The words that say why a server cannot be picked yet, or `null` for a row that can be picked. */
|
|
32
|
+
export declare function mentionEntryUnavailableKey(entry: MentionEntry): WorkflowsMessageKey | null;
|
|
33
|
+
/** The row to highlight when the menu opens or its rows change: the first one that can be picked (0 when none can). */
|
|
34
|
+
export declare function firstSelectableIndex(entries: readonly MentionEntry[]): number;
|
|
35
|
+
/**
|
|
36
|
+
* The row an arrow key moves the highlight to: the next one that can be picked in that direction, going round at the ends. A row
|
|
37
|
+
* that cannot be picked is passed over, so Enter never lands on one. When none can be picked the highlight stays where it is.
|
|
38
|
+
*/
|
|
39
|
+
export declare function nextSelectableIndex(entries: readonly MentionEntry[], from: number, direction: 1 | -1): number;
|