@modelnex/sdk 0.1.1 → 0.5.3
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 +104 -30
- package/dist/aom-HDYNCIOY.mjs +10 -0
- package/dist/{aom-J6NYMGDW.mjs → chunk-N65UEB6X.mjs} +3 -2
- package/dist/index.d.mts +334 -16
- package/dist/index.d.ts +334 -16
- package/dist/index.js +8121 -3068
- package/dist/index.mjs +8089 -3052
- package/package.json +19 -7
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,40 @@ import React$1 from 'react';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
|
-
type
|
|
5
|
+
type ExperienceType = 'tour' | 'onboarding';
|
|
6
|
+
type TourStepType = 'narrate' | 'act' | 'input' | 'ask_and_fill' | 'user_input' | 'ask_or_fill' | 'wait_then_act';
|
|
7
|
+
type TourUserActionEvent = 'click' | 'input' | 'change' | 'blur';
|
|
8
|
+
interface TourActionTarget {
|
|
9
|
+
uid?: string;
|
|
10
|
+
testId?: string;
|
|
11
|
+
fingerprint?: string;
|
|
12
|
+
textContaining?: string;
|
|
13
|
+
}
|
|
14
|
+
interface TourReplyGate {
|
|
15
|
+
type: 'none' | 'user_action';
|
|
16
|
+
event?: TourUserActionEvent;
|
|
17
|
+
target?: TourActionTarget;
|
|
18
|
+
}
|
|
19
|
+
interface TourReply {
|
|
20
|
+
id?: string;
|
|
21
|
+
text: string;
|
|
22
|
+
delayMs?: number;
|
|
23
|
+
gate?: TourReplyGate;
|
|
24
|
+
}
|
|
25
|
+
interface TourPathPolicy {
|
|
26
|
+
/** Relative path captured at record time and used for validation/recovery */
|
|
27
|
+
recordedPath: string;
|
|
28
|
+
/** Whether the runtime should attempt to recover by navigating back to the recorded path */
|
|
29
|
+
recoverOnMismatch?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface TourExecutionPolicy {
|
|
32
|
+
/** Clicks and route-changing actions end the current execution cycle */
|
|
33
|
+
clickIsTerminal?: boolean;
|
|
34
|
+
/** Capture a screenshot after a terminal action before the next LLM turn */
|
|
35
|
+
screenshotAfterTerminal?: boolean;
|
|
36
|
+
/** Start fetching the next speech chunk this long before the current clip ends */
|
|
37
|
+
ttsPrefetchLeadMs?: number;
|
|
38
|
+
}
|
|
6
39
|
interface TourStepElement {
|
|
7
40
|
/** data-testid value — primary anchor; survives DOM restructuring */
|
|
8
41
|
testId?: string;
|
|
@@ -11,13 +44,77 @@ interface TourStepElement {
|
|
|
11
44
|
/** Visible label at record time — second fallback */
|
|
12
45
|
textContaining: string;
|
|
13
46
|
}
|
|
47
|
+
interface TourRecordedClick {
|
|
48
|
+
/** Relative URL where the click was captured, including search/hash when present */
|
|
49
|
+
url: string;
|
|
50
|
+
/** Human-readable label captured from the clicked element */
|
|
51
|
+
label: string;
|
|
52
|
+
/** Tag name of the clicked element */
|
|
53
|
+
tagName: string;
|
|
54
|
+
/** data-testid value if available */
|
|
55
|
+
testId?: string;
|
|
56
|
+
/** DOM fingerprint captured at record time */
|
|
57
|
+
fingerprint: string;
|
|
58
|
+
/** Visible text or placeholder captured at record time */
|
|
59
|
+
textContaining: string;
|
|
60
|
+
}
|
|
61
|
+
type TourCaptureEventType = 'session_start' | 'route' | 'hover' | 'click' | 'input' | 'note';
|
|
62
|
+
interface TourCaptureEvent {
|
|
63
|
+
id: string;
|
|
64
|
+
type: TourCaptureEventType;
|
|
65
|
+
order: number;
|
|
66
|
+
timestamp: string;
|
|
67
|
+
url: string;
|
|
68
|
+
label?: string;
|
|
69
|
+
tagName?: string;
|
|
70
|
+
testId?: string;
|
|
71
|
+
fingerprint?: string;
|
|
72
|
+
textContaining?: string;
|
|
73
|
+
fieldType?: string;
|
|
74
|
+
valueSample?: string;
|
|
75
|
+
note?: string;
|
|
76
|
+
stepTypeHint?: TourStepType;
|
|
77
|
+
metadata?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
interface TourGenerationMetadata {
|
|
80
|
+
mode: 'capture_v1';
|
|
81
|
+
generatedAt: string;
|
|
82
|
+
eventCount: number;
|
|
83
|
+
noteCount: number;
|
|
84
|
+
generatedStepCount: number;
|
|
85
|
+
}
|
|
86
|
+
interface OnboardingStepWaitCondition {
|
|
87
|
+
mode: 'any_input' | 'specific_action' | 'manual_continue';
|
|
88
|
+
event?: TourUserActionEvent;
|
|
89
|
+
target?: TourActionTarget;
|
|
90
|
+
helperText?: string;
|
|
91
|
+
}
|
|
92
|
+
interface OnboardingStepMetadata {
|
|
93
|
+
expectedUserAction?: 'click' | 'input' | 'change' | 'submit';
|
|
94
|
+
waitTarget?: TourActionTarget;
|
|
95
|
+
completionSignal?: 'url_change' | 'modal_open' | 'field_populated' | 'toast_visible' | 'manual_continue';
|
|
96
|
+
required?: boolean;
|
|
97
|
+
successStateHint?: string;
|
|
98
|
+
manualTakeover?: boolean;
|
|
99
|
+
waitCondition?: OnboardingStepWaitCondition;
|
|
100
|
+
}
|
|
101
|
+
interface TourStepSource {
|
|
102
|
+
origin: 'generated' | 'manual_note';
|
|
103
|
+
captureEventIds?: string[];
|
|
104
|
+
confidence?: number;
|
|
105
|
+
note?: string;
|
|
106
|
+
}
|
|
14
107
|
interface TourStep {
|
|
15
108
|
order: number;
|
|
16
109
|
type: TourStepType;
|
|
17
|
-
/**
|
|
110
|
+
/** Relative URL for the recorded page state (for example "/documents?tab=drafts#filters") */
|
|
18
111
|
url?: string;
|
|
112
|
+
/** Path validation / recovery metadata */
|
|
113
|
+
path?: TourPathPolicy;
|
|
19
114
|
/** Target element for highlight / interaction */
|
|
20
115
|
element?: TourStepElement;
|
|
116
|
+
/** Raw click trail captured while the subscriber recorded this step */
|
|
117
|
+
recordedClicks?: TourRecordedClick[];
|
|
21
118
|
/** LLM-polished narration spoken via TTS to end user */
|
|
22
119
|
narration: string;
|
|
23
120
|
/** Subscriber's original spoken words — stored for re-editing */
|
|
@@ -28,20 +125,72 @@ interface TourStep {
|
|
|
28
125
|
goal?: string;
|
|
29
126
|
/** Pacing for narrate steps */
|
|
30
127
|
waitFor?: 'voice_next' | 'auto_advance';
|
|
31
|
-
|
|
32
|
-
|
|
128
|
+
/** Optional queued replies with delays and gating rules */
|
|
129
|
+
replies?: TourReply[];
|
|
130
|
+
/** Optional per-step execution overrides */
|
|
131
|
+
execution?: TourExecutionPolicy;
|
|
132
|
+
/** How this step was produced during V1 workflow capture */
|
|
133
|
+
source?: TourStepSource;
|
|
134
|
+
/** Optional onboarding-specific step metadata */
|
|
135
|
+
onboarding?: OnboardingStepMetadata;
|
|
136
|
+
}
|
|
137
|
+
type TourTrigger = 'first_visit' | 'feature_launch' | 'feature_unlocked' | 'feature_unlock' | 'new_feature' | 'manual';
|
|
138
|
+
type TourStartPolicy = 'immediate_start' | 'prompt_only' | 'manual_only';
|
|
139
|
+
type TourNotificationType = 'bubble_card' | 'modal';
|
|
33
140
|
interface TourVoiceConfig {
|
|
34
141
|
language: string;
|
|
35
142
|
ttsVoice?: string;
|
|
143
|
+
ttsPrefetchLeadMs?: number;
|
|
144
|
+
}
|
|
145
|
+
interface ExperienceModalConfig {
|
|
146
|
+
title?: string;
|
|
147
|
+
description?: string;
|
|
148
|
+
buttonText?: string;
|
|
149
|
+
cancelButtonText?: string;
|
|
150
|
+
backgroundColor?: string;
|
|
151
|
+
textColor?: string;
|
|
152
|
+
}
|
|
153
|
+
interface ExperiencePresentation {
|
|
154
|
+
theme?: {
|
|
155
|
+
tone?: 'guide' | 'coach' | 'operator';
|
|
156
|
+
accentColor?: string;
|
|
157
|
+
icon?: string;
|
|
158
|
+
};
|
|
159
|
+
modalConfig?: ExperienceModalConfig;
|
|
160
|
+
}
|
|
161
|
+
interface ExperienceGoal {
|
|
162
|
+
primaryAction?: string;
|
|
163
|
+
successMetric?: 'completed' | 'activated_feature' | 'submitted_input';
|
|
36
164
|
}
|
|
37
165
|
interface Tour {
|
|
38
166
|
id: string;
|
|
167
|
+
type?: ExperienceType;
|
|
39
168
|
name: string;
|
|
40
169
|
websiteId: string;
|
|
41
170
|
targetUserTypes: string[];
|
|
42
171
|
trigger: TourTrigger;
|
|
172
|
+
startPolicy?: TourStartPolicy;
|
|
173
|
+
notificationType?: TourNotificationType;
|
|
174
|
+
featureKey?: string;
|
|
43
175
|
voice: TourVoiceConfig;
|
|
176
|
+
execution?: TourExecutionPolicy;
|
|
44
177
|
steps: TourStep[];
|
|
178
|
+
presentation?: ExperiencePresentation;
|
|
179
|
+
goal?: ExperienceGoal;
|
|
180
|
+
capture?: {
|
|
181
|
+
experienceType?: ExperienceType;
|
|
182
|
+
instructions?: {
|
|
183
|
+
transcript?: string;
|
|
184
|
+
noteEvents?: TourCaptureEvent[];
|
|
185
|
+
};
|
|
186
|
+
notes?: RecordingStep[];
|
|
187
|
+
onboardingHints?: {
|
|
188
|
+
inferredWaitTargets?: number;
|
|
189
|
+
inferredCompletionSignals?: number;
|
|
190
|
+
};
|
|
191
|
+
events?: TourCaptureEvent[];
|
|
192
|
+
generation?: TourGenerationMetadata;
|
|
193
|
+
};
|
|
45
194
|
status: 'draft' | 'published';
|
|
46
195
|
createdAt: string;
|
|
47
196
|
updatedAt: string;
|
|
@@ -55,21 +204,32 @@ interface UserProfile {
|
|
|
55
204
|
/** User ID for per-user completion state */
|
|
56
205
|
userId?: string;
|
|
57
206
|
}
|
|
207
|
+
interface TourFacts {
|
|
208
|
+
/** Feature keys currently available to the user, used for feature_unlocked tours */
|
|
209
|
+
features?: string[];
|
|
210
|
+
}
|
|
58
211
|
/** Playback state machine states */
|
|
59
|
-
type TourPlaybackState = 'idle' | 'intro' | 'executing' | 'waiting_voice' | 'waiting_input' | 'complete';
|
|
212
|
+
type TourPlaybackState = 'idle' | 'intro' | 'executing' | 'thinking' | 'waiting_voice' | 'waiting_input' | 'paused' | 'complete';
|
|
60
213
|
/** Internal recording step being built */
|
|
61
214
|
interface RecordingStep {
|
|
62
215
|
order: number;
|
|
63
216
|
type: TourStepType;
|
|
217
|
+
/** Relative URL for the recorded page state (for example "/documents?tab=drafts#filters") */
|
|
64
218
|
url: string;
|
|
219
|
+
path?: TourPathPolicy;
|
|
65
220
|
element?: TourStepElement & {
|
|
66
221
|
label?: string;
|
|
67
222
|
};
|
|
223
|
+
recordedClicks?: TourRecordedClick[];
|
|
68
224
|
rawNarration: string;
|
|
69
225
|
narration: string;
|
|
70
226
|
ask?: string;
|
|
71
227
|
goal?: string;
|
|
72
228
|
waitFor?: 'voice_next' | 'auto_advance';
|
|
229
|
+
replies?: TourReply[];
|
|
230
|
+
execution?: TourExecutionPolicy;
|
|
231
|
+
source?: TourStepSource;
|
|
232
|
+
onboarding?: OnboardingStepMetadata;
|
|
73
233
|
}
|
|
74
234
|
|
|
75
235
|
/**
|
|
@@ -321,15 +481,36 @@ interface ModelNexChatBubbleProps {
|
|
|
321
481
|
}>;
|
|
322
482
|
/** Welcome message when chat is empty */
|
|
323
483
|
welcomeMessage?: string;
|
|
484
|
+
/** Name of the AI agent displayed in the header */
|
|
485
|
+
agentName?: string;
|
|
324
486
|
/** Display name of the app — used in tour intro narration */
|
|
325
487
|
appName?: string;
|
|
488
|
+
/** Save recorded flows as tours or onboarding without changing the recorder UX */
|
|
489
|
+
recordingExperienceType?: ExperienceType;
|
|
490
|
+
/** Custom theme overrides */
|
|
491
|
+
theme?: {
|
|
492
|
+
accentColor?: string;
|
|
493
|
+
accentForeground?: string;
|
|
494
|
+
panelWidth?: string;
|
|
495
|
+
panelMaxHeight?: string;
|
|
496
|
+
bubbleSize?: string;
|
|
497
|
+
bubbleIconSize?: string;
|
|
498
|
+
borderRadius?: string;
|
|
499
|
+
zIndex?: number;
|
|
500
|
+
};
|
|
326
501
|
}
|
|
327
502
|
/**
|
|
328
503
|
* Chat interface for natural language commands.
|
|
329
504
|
* Shows conversation history; on exit, the agent summarizes what it did and suggests next steps.
|
|
330
505
|
* Use within ModelNexProvider. Omit to use your own UI with useRunCommand.
|
|
331
506
|
*/
|
|
332
|
-
declare function ModelNexChatBubble({ placeholder, defaultCommand, className, onCommand, welcomeMessage, appName, }: ModelNexChatBubbleProps):
|
|
507
|
+
declare function ModelNexChatBubble({ placeholder, defaultCommand, className, onCommand, welcomeMessage, agentName, appName, recordingExperienceType, theme, }: ModelNexChatBubbleProps): React$1.ReactPortal | null;
|
|
508
|
+
|
|
509
|
+
interface ModelNexOnboardingPanelProps {
|
|
510
|
+
appName?: string;
|
|
511
|
+
title?: string;
|
|
512
|
+
}
|
|
513
|
+
declare function ModelNexOnboardingPanel({ appName, title, }: ModelNexOnboardingPanelProps): react_jsx_runtime.JSX.Element;
|
|
333
514
|
|
|
334
515
|
/**
|
|
335
516
|
* Toggle and read the action-highlight overlay state.
|
|
@@ -388,14 +569,25 @@ declare global {
|
|
|
388
569
|
}
|
|
389
570
|
}
|
|
390
571
|
interface VoiceHook {
|
|
391
|
-
/** Speak text via Deepgram TTS (proxied through server). Uses WebRTC loopback for AEC when available.
|
|
392
|
-
|
|
572
|
+
/** Speak text via Deepgram TTS (proxied through server). Uses WebRTC loopback for AEC when available.
|
|
573
|
+
* The returned promise always settles when the scheduled playback settles; callers can choose whether to await it.
|
|
574
|
+
*/
|
|
575
|
+
speak: (text: string, voiceId?: string, options?: {
|
|
576
|
+
onNearEnd?: () => void;
|
|
577
|
+
prefetchLeadMs?: number;
|
|
578
|
+
waitForCompletion?: boolean;
|
|
579
|
+
interrupt?: boolean;
|
|
580
|
+
}) => Promise<void>;
|
|
393
581
|
/** Stop any in-progress TTS playback immediately */
|
|
394
582
|
stopSpeaking: () => void;
|
|
583
|
+
/** Warm a TTS clip into the local cache so playback can start with less latency */
|
|
584
|
+
prefetchSpeech: (text: string, voiceId?: string) => Promise<void>;
|
|
395
585
|
/** Start STT listening — Deepgram STT with AEC when supported, else Web Speech API */
|
|
396
586
|
startListening: (onResult: (transcript: string) => void, onInterruption?: (transcript: string) => void, onError?: (err: string) => void, options?: {
|
|
397
587
|
continuous?: boolean;
|
|
398
588
|
lang?: string;
|
|
589
|
+
onSpeechStarted?: () => void;
|
|
590
|
+
onInterimResult?: (transcript: string) => void;
|
|
399
591
|
}) => void;
|
|
400
592
|
/** Stop STT listening */
|
|
401
593
|
stopListening: () => void;
|
|
@@ -409,6 +601,10 @@ interface VoiceHook {
|
|
|
409
601
|
}
|
|
410
602
|
declare function useVoice(serverUrl: string): VoiceHook;
|
|
411
603
|
|
|
604
|
+
interface StartTourOptions {
|
|
605
|
+
reviewMode?: boolean;
|
|
606
|
+
reviewMetadata?: Record<string, unknown>;
|
|
607
|
+
}
|
|
412
608
|
interface TourPlaybackHook {
|
|
413
609
|
/** Whether a tour is currently running */
|
|
414
610
|
isActive: boolean;
|
|
@@ -420,18 +616,57 @@ interface TourPlaybackHook {
|
|
|
420
616
|
activeTour: Tour | null;
|
|
421
617
|
/** Playback state */
|
|
422
618
|
playbackState: TourPlaybackState;
|
|
619
|
+
/** Whether current playback is a review/test preview */
|
|
620
|
+
isReviewMode: boolean;
|
|
621
|
+
/** Active preview run id if review mode is enabled */
|
|
622
|
+
previewRunId: string | null;
|
|
623
|
+
/** Whether a correction is being submitted */
|
|
624
|
+
reviewSubmitting: boolean;
|
|
625
|
+
/** Status message for the latest review action */
|
|
626
|
+
reviewStatusMessage: string | null;
|
|
627
|
+
/** Prompted tour awaiting user confirmation */
|
|
628
|
+
pendingTour: Tour | null;
|
|
629
|
+
/** Latest server-authored state snapshot for this experience */
|
|
630
|
+
serverState: TourServerState | null;
|
|
423
631
|
/** Start a specific tour manually */
|
|
424
|
-
startTour: (tour: Tour) => void;
|
|
632
|
+
startTour: (tour: Tour, options?: StartTourOptions) => void;
|
|
633
|
+
/** Accept the currently pending prompt and start playback */
|
|
634
|
+
acceptPendingTour: () => void;
|
|
635
|
+
/** Dismiss the currently pending prompt */
|
|
636
|
+
dismissPendingTour: () => void;
|
|
425
637
|
/** Advance to next step (voice "next" command) */
|
|
426
638
|
advanceStep: () => void;
|
|
427
639
|
/** Skip the entire tour */
|
|
428
640
|
skipTour: () => void;
|
|
641
|
+
/** Explicitly pause the tour agent (for feedback/review) */
|
|
642
|
+
pauseTour: () => void;
|
|
643
|
+
/** Resume the tour agent after a pause */
|
|
644
|
+
resumeTour: () => void;
|
|
429
645
|
/** Repeat current step narration */
|
|
430
646
|
repeatStep: () => void;
|
|
431
647
|
/** Handle a voice input during the tour */
|
|
432
648
|
handleVoiceInput: (transcript: string) => void;
|
|
433
649
|
/** Handle a text input during an ask step */
|
|
434
650
|
handleTextInput: (text: string) => void;
|
|
651
|
+
/** Save a correction against the current preview step */
|
|
652
|
+
submitReviewFeedback: (utterance: string, apply?: boolean) => Promise<void>;
|
|
653
|
+
}
|
|
654
|
+
interface TourServerState {
|
|
655
|
+
runId: number | null;
|
|
656
|
+
turnId: string | null;
|
|
657
|
+
stepIndex: number;
|
|
658
|
+
phase: string;
|
|
659
|
+
isActive: boolean;
|
|
660
|
+
isPaused: boolean;
|
|
661
|
+
awaitingUserInput: boolean;
|
|
662
|
+
pendingCommandId: string | null;
|
|
663
|
+
pendingCommandBatch: {
|
|
664
|
+
commandBatchId: string | null;
|
|
665
|
+
stepIndex: number | null;
|
|
666
|
+
turnId: string | null;
|
|
667
|
+
} | null;
|
|
668
|
+
currentUrl?: string | null;
|
|
669
|
+
reason?: string;
|
|
435
670
|
}
|
|
436
671
|
interface UseTourPlaybackOptions {
|
|
437
672
|
serverUrl: string;
|
|
@@ -443,16 +678,34 @@ interface UseTourPlaybackOptions {
|
|
|
443
678
|
socketId?: string | null;
|
|
444
679
|
websiteId?: string;
|
|
445
680
|
userProfile?: UserProfile;
|
|
681
|
+
tourFacts?: TourFacts;
|
|
446
682
|
voice: VoiceHook;
|
|
447
683
|
appName?: string;
|
|
448
684
|
/** Pass the page's current state to the LLM agent */
|
|
449
685
|
extractedElements?: any[];
|
|
686
|
+
/** Shared tag store for resilient selector/text fallback resolution */
|
|
687
|
+
tagStore?: TagStore | null;
|
|
450
688
|
/** Called when a tour step changes — for updating progress panel */
|
|
451
689
|
onStepChange?: (stepIndex: number, total: number, tour: Tour) => void;
|
|
452
690
|
/** Called when tour completes or is skipped */
|
|
453
691
|
onTourEnd?: () => void;
|
|
454
|
-
|
|
455
|
-
|
|
692
|
+
/** Disable tour autoplay/playback while another mode owns voice I/O */
|
|
693
|
+
disabled?: boolean;
|
|
694
|
+
/** Shared runtime, but allow a distinct product surface such as onboarding */
|
|
695
|
+
experienceType?: ExperienceType;
|
|
696
|
+
/** Whether to show global floating captions (usually true when bubble is minimized, false when expanded) */
|
|
697
|
+
showCaptions?: boolean;
|
|
698
|
+
/** Disable internal pending prompt/query discovery when a higher-level controller owns it */
|
|
699
|
+
enableAutoDiscovery?: boolean;
|
|
700
|
+
}
|
|
701
|
+
declare function useTourPlayback({ serverUrl, commandUrl, toursApiBase, socketId, websiteId, userProfile, tourFacts, voice, appName, extractedElements, tagStore, onStepChange, onTourEnd, disabled, experienceType, showCaptions, enableAutoDiscovery, }: UseTourPlaybackOptions): TourPlaybackHook;
|
|
702
|
+
|
|
703
|
+
type ExperiencePlaybackHook = TourPlaybackHook;
|
|
704
|
+
declare function useExperiencePlayback(...args: Parameters<typeof useTourPlayback>): TourPlaybackHook;
|
|
705
|
+
|
|
706
|
+
type UseOnboardingPlaybackOptions = Omit<Parameters<typeof useTourPlayback>[0], 'experienceType'>;
|
|
707
|
+
type OnboardingPlaybackHook = TourPlaybackHook;
|
|
708
|
+
declare function useOnboardingPlayback(options: UseOnboardingPlaybackOptions): TourPlaybackHook;
|
|
456
709
|
|
|
457
710
|
interface RecordedElement {
|
|
458
711
|
el: HTMLElement;
|
|
@@ -467,6 +720,9 @@ interface RecordingModeHook {
|
|
|
467
720
|
phase: RecordingPhase;
|
|
468
721
|
steps: RecordingStep[];
|
|
469
722
|
stepCount: number;
|
|
723
|
+
captureEventCount: number;
|
|
724
|
+
capturedTranscript: string;
|
|
725
|
+
isVoiceCaptureActive: boolean;
|
|
470
726
|
isRecording: boolean;
|
|
471
727
|
selectedElement: RecordedElement | null;
|
|
472
728
|
pendingNarration: string;
|
|
@@ -479,6 +735,7 @@ interface RecordingModeHook {
|
|
|
479
735
|
cancelSelection: () => void;
|
|
480
736
|
setStepType: (type: TourStepType) => void;
|
|
481
737
|
startNarration: () => void;
|
|
738
|
+
finishNarration: () => Promise<void>;
|
|
482
739
|
submitTextNarration: (text: string) => Promise<void>;
|
|
483
740
|
approveNarration: () => void;
|
|
484
741
|
redoNarration: () => void;
|
|
@@ -486,18 +743,43 @@ interface RecordingModeHook {
|
|
|
486
743
|
continueRecording: () => void;
|
|
487
744
|
undoLastStep: () => void;
|
|
488
745
|
previewSteps: () => void;
|
|
746
|
+
prepareToStopRecording: () => void;
|
|
489
747
|
stopRecording: (tourName: string, targetUserTypes: string[]) => Promise<string | null>;
|
|
748
|
+
toggleVoiceCapture: () => void;
|
|
490
749
|
/** Abandon recording — discard all steps and exit recording mode */
|
|
491
750
|
cancelRecording: () => void;
|
|
492
751
|
handleVoiceCommand: (transcript: string) => void;
|
|
493
752
|
}
|
|
494
753
|
interface UseRecordingModeOptions {
|
|
495
754
|
serverUrl: string;
|
|
755
|
+
toursApiBase?: string;
|
|
496
756
|
websiteId?: string;
|
|
497
757
|
voice: VoiceHook;
|
|
498
758
|
onPreview?: (steps: RecordingStep[]) => void;
|
|
499
|
-
|
|
500
|
-
|
|
759
|
+
experienceType?: ExperienceType;
|
|
760
|
+
}
|
|
761
|
+
declare function buildRecordingCapturePayload({ experienceType, steps, captureEvents, capturedTranscript, }: {
|
|
762
|
+
experienceType?: ExperienceType;
|
|
763
|
+
steps?: RecordingStep[];
|
|
764
|
+
captureEvents?: TourCaptureEvent[];
|
|
765
|
+
capturedTranscript?: string;
|
|
766
|
+
}): {
|
|
767
|
+
generation: {
|
|
768
|
+
mode: "capture_v1";
|
|
769
|
+
generatedAt: string;
|
|
770
|
+
eventCount: number;
|
|
771
|
+
noteCount: number;
|
|
772
|
+
generatedStepCount: number;
|
|
773
|
+
};
|
|
774
|
+
instructions?: {
|
|
775
|
+
noteEvents?: TourCaptureEvent[] | undefined;
|
|
776
|
+
transcript?: string | undefined;
|
|
777
|
+
} | undefined;
|
|
778
|
+
experienceType: ExperienceType;
|
|
779
|
+
events: TourCaptureEvent[];
|
|
780
|
+
notes: RecordingStep[];
|
|
781
|
+
};
|
|
782
|
+
declare function useRecordingMode({ serverUrl, toursApiBase, websiteId, voice, onPreview, experienceType, }: UseRecordingModeOptions): RecordingModeHook;
|
|
501
783
|
|
|
502
784
|
interface TourProgressPanelProps {
|
|
503
785
|
tour: Tour;
|
|
@@ -512,11 +794,15 @@ declare function TourProgressPanel({ tour, currentStepIndex, onSkip, voiceOnly }
|
|
|
512
794
|
interface RecordingOverlayProps {
|
|
513
795
|
stepIndex: number;
|
|
514
796
|
stepCount: number;
|
|
797
|
+
captureEventCount: number;
|
|
798
|
+
capturedTranscript: string;
|
|
799
|
+
isVoiceCaptureActive: boolean;
|
|
515
800
|
phase: RecordingPhase;
|
|
516
801
|
pendingNarration: string;
|
|
517
802
|
polishedNarration: string;
|
|
518
803
|
isListening: boolean;
|
|
519
804
|
onMarkStep: () => void;
|
|
805
|
+
onToggleVoiceCapture: () => void;
|
|
520
806
|
onElementSelected: (recorded: RecordedElement) => void;
|
|
521
807
|
onPageLevelStep: () => void;
|
|
522
808
|
onStepTypeConfirmed: (type: TourStepType) => void;
|
|
@@ -531,13 +817,43 @@ interface RecordingOverlayProps {
|
|
|
531
817
|
onCancelRecording: () => void;
|
|
532
818
|
onStopRecording: () => void;
|
|
533
819
|
}
|
|
534
|
-
declare function RecordingOverlay({ stepIndex, stepCount, phase, pendingNarration, polishedNarration, isListening, onMarkStep, onElementSelected, onPageLevelStep, onStepTypeConfirmed, onStartNarration, onSubmitTextNarration, onNarrationApprove, onNarrationRedo, onNarrationEdit, onAddNextStep, onDoneRecording, onCancel, onCancelRecording, onStopRecording, }: RecordingOverlayProps): react_jsx_runtime.JSX.Element;
|
|
820
|
+
declare function RecordingOverlay({ stepIndex, stepCount, captureEventCount, capturedTranscript, isVoiceCaptureActive, phase, pendingNarration, polishedNarration, isListening, onMarkStep, onToggleVoiceCapture, onElementSelected, onPageLevelStep, onStepTypeConfirmed, onStartNarration, onSubmitTextNarration, onNarrationApprove, onNarrationRedo, onNarrationEdit, onAddNextStep, onDoneRecording, onCancel, onCancelRecording, onStopRecording, }: RecordingOverlayProps): react_jsx_runtime.JSX.Element;
|
|
821
|
+
|
|
822
|
+
declare function isAskDrivenInputStepType(stepType?: string | null): boolean;
|
|
823
|
+
declare function isInteractiveInputStepType(stepType?: string | null): boolean;
|
|
824
|
+
declare function isManualOnboardingStep(step?: Pick<TourStep, 'type' | 'onboarding'> | null): boolean;
|
|
825
|
+
declare function buildRecordingStepGoal(stepType: TourStepType, selectedElement: {
|
|
826
|
+
label?: string;
|
|
827
|
+
textContaining?: string;
|
|
828
|
+
} | null, recordedClicks?: Array<{
|
|
829
|
+
label?: string;
|
|
830
|
+
}>): string | undefined;
|
|
831
|
+
declare function inferOnboardingMetadataForStep(step: Pick<TourStep, 'type' | 'element' | 'goal' | 'ask'>): OnboardingStepMetadata | undefined;
|
|
832
|
+
|
|
833
|
+
declare function shouldShowRecordingOverlay(phase: RecordingPhase): boolean;
|
|
834
|
+
declare function isRecordingDraftGenerating(phase: RecordingPhase): boolean;
|
|
835
|
+
declare function getRecordingDraftActionLabel(phase: RecordingPhase): string;
|
|
836
|
+
declare function getRecordingDraftStatusMessage(phase: RecordingPhase, experienceType: ExperienceType): string;
|
|
837
|
+
|
|
838
|
+
interface SavedDraftPreview {
|
|
839
|
+
id: string;
|
|
840
|
+
experienceType: ExperienceType;
|
|
841
|
+
}
|
|
842
|
+
type PreviewLaunchSource = 'standard' | 'query_param';
|
|
843
|
+
declare function getPreviewQueryParamName(experienceType: ExperienceType): 'modelnex_test_tour' | 'modelnex_test_onboarding';
|
|
844
|
+
declare function buildDraftPreviewUrl(currentUrl: string, draft: SavedDraftPreview): string;
|
|
845
|
+
declare function shouldPromptForPreviewStart(notificationType: TourNotificationType | undefined, _source: PreviewLaunchSource): boolean;
|
|
846
|
+
declare function persistActiveDraftPreview(draft: SavedDraftPreview): void;
|
|
847
|
+
declare function readActiveDraftPreview(): SavedDraftPreview | null;
|
|
848
|
+
declare function clearActiveDraftPreview(experienceType?: ExperienceType): void;
|
|
535
849
|
|
|
536
850
|
interface ModelNexProviderProps {
|
|
537
|
-
children
|
|
851
|
+
children?: unknown;
|
|
538
852
|
serverUrl?: string;
|
|
539
853
|
/** Base URL for agent commands. Use same-origin path (e.g. /api/modelnex) to avoid CORS. Default: serverUrl */
|
|
540
854
|
commandUrl?: string;
|
|
855
|
+
/** Disable the realtime socket connection while still rendering the SDK UI */
|
|
856
|
+
disableSocket?: boolean;
|
|
541
857
|
/** Identifier for the integrated website, for multi-tenancy */
|
|
542
858
|
websiteId?: string;
|
|
543
859
|
/**
|
|
@@ -547,6 +863,8 @@ interface ModelNexProviderProps {
|
|
|
547
863
|
* userId — used for per-user tour completion state
|
|
548
864
|
*/
|
|
549
865
|
userProfile?: UserProfile;
|
|
866
|
+
/** Optional product facts used for feature-triggered tours */
|
|
867
|
+
tourFacts?: TourFacts;
|
|
550
868
|
/**
|
|
551
869
|
* Same-origin base for tour API (e.g. /api/modelnex/api).
|
|
552
870
|
* When set, ?modelnex_test_tour= fetches via this path to avoid CORS.
|
|
@@ -559,4 +877,4 @@ interface ModelNexProviderProps {
|
|
|
559
877
|
}
|
|
560
878
|
declare const ModelNexProvider: React$1.FC<ModelNexProviderProps>;
|
|
561
879
|
|
|
562
|
-
export { type AgentDebug, type AgentTraceLlmInput, type AgentTraceStep, type ChatMessage, type ExtractedElement, ModelNexChatBubble, type ModelNexChatBubbleProps, ModelNexProvider, type ModelNexProviderProps, type RecordingModeHook, RecordingOverlay, type RunCommandResult, StudioOverlay, type TagData, type TagStore, type Tour, type TourPlaybackHook, type TourPlaybackState, TourProgressPanel, type TourStep, type TourStepType, type TourTrigger, UIStateProvider, type UseRegisterActionOptions, type UserProfile, type VoiceHook, extractInteractiveElements, generateFingerprint, useActionHighlight, useAgentViewport, useAutoExtract, useRecordingMode, useRegisterAction, useRunCommand, useTagStore, useTourPlayback, useUIState, useViewportTrack, useVisibleIds, useVoice };
|
|
880
|
+
export { type AgentDebug, type AgentTraceLlmInput, type AgentTraceStep, type ChatMessage, type ExperienceGoal, type ExperiencePlaybackHook, type ExperiencePresentation, type ExperienceType, type ExtractedElement, ModelNexChatBubble, type ModelNexChatBubbleProps, ModelNexOnboardingPanel, type ModelNexOnboardingPanelProps, ModelNexProvider, type ModelNexProviderProps, type OnboardingPlaybackHook, type OnboardingStepMetadata, type PreviewLaunchSource, type RecordingModeHook, RecordingOverlay, type RunCommandResult, type SavedDraftPreview, StudioOverlay, type TagData, type TagStore, type Tour, type TourFacts, type TourNotificationType, type TourPlaybackHook, type TourPlaybackState, TourProgressPanel, type TourStartPolicy, type TourStep, type TourStepType, type TourTrigger, UIStateProvider, type UseRegisterActionOptions, type UserProfile, type VoiceHook, buildDraftPreviewUrl, buildRecordingCapturePayload, buildRecordingStepGoal, clearActiveDraftPreview, extractInteractiveElements, generateFingerprint, getPreviewQueryParamName, getRecordingDraftActionLabel, getRecordingDraftStatusMessage, inferOnboardingMetadataForStep, isAskDrivenInputStepType, isInteractiveInputStepType, isManualOnboardingStep, isRecordingDraftGenerating, persistActiveDraftPreview, readActiveDraftPreview, shouldPromptForPreviewStart, shouldShowRecordingOverlay, useActionHighlight, useAgentViewport, useAutoExtract, useExperiencePlayback, useOnboardingPlayback, useRecordingMode, useRegisterAction, useRunCommand, useTagStore, useTourPlayback, useUIState, useViewportTrack, useVisibleIds, useVoice };
|