guideai-app 0.5.1 → 0.5.4-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +179 -80
- package/dist/GuideAI.d.ts +1 -1
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.LICENSE.txt +7 -0
- package/dist/GuideAI.js.map +1 -1
- package/dist/__mocks__/fileMock.d.ts +2 -0
- package/dist/components/AudioConfigDialog.d.ts +22 -0
- package/dist/components/DeveloperTools.d.ts +36 -0
- package/dist/components/MicGlyphs.d.ts +9 -0
- package/dist/components/Microphone.d.ts +4 -2
- package/dist/components/NoisyPresetSuggestBanner.d.ts +12 -0
- package/dist/components/PlaybackInterruptLockDebugOverlay.d.ts +19 -0
- package/dist/components/PlaybackLockDebugOverlayRoot.d.ts +14 -0
- package/dist/components/ResetGlyph.d.ts +5 -0
- package/dist/components/SpeakerGlyphs.d.ts +9 -0
- package/dist/components/TranscriptBox.d.ts +65 -8
- package/dist/components/TranscriptMessages.d.ts +8 -1
- package/dist/components/TranscriptTextInput.d.ts +41 -2
- package/dist/components/TranscriptToolbar.d.ts +23 -0
- package/dist/components/TranscriptWorkflowDrawer.d.ts +39 -0
- package/dist/components/WelcomeBubble.d.ts +6 -1
- package/dist/components/WorkspaceStubIcon.d.ts +6 -0
- package/dist/contexts/AdminToolDiagnosticsContext.d.ts +6 -0
- package/dist/devtools/adminToolDiagnostics/AdminToolDiagnosticsPanel.d.ts +16 -0
- package/dist/devtools/adminToolDiagnostics/adminToolDiagnosticsPanelUtils.d.ts +8 -0
- package/dist/devtools/adminToolDiagnostics/adminToolDiagnosticsStyles.d.ts +5 -0
- package/dist/devtools/adminToolDiagnostics/buildDiagnosticsToolNameList.d.ts +6 -0
- package/dist/devtools/adminToolDiagnostics/getIdOrFallbackSelectorForDiagnostics.d.ts +5 -0
- package/dist/devtools/adminToolDiagnostics/index.d.ts +2 -0
- package/dist/devtools/useDraggableDialog.d.ts +23 -0
- package/dist/devtools/visualContextInspector/BufferIndicator.d.ts +15 -0
- package/dist/devtools/visualContextInspector/ConfigSection.d.ts +18 -0
- package/dist/devtools/visualContextInspector/ScreenshotList.d.ts +13 -0
- package/dist/devtools/visualContextInspector/VisualContextInspector.d.ts +36 -0
- package/dist/devtools/visualContextInspector/fieldInfo.d.ts +7 -0
- package/dist/devtools/visualContextInspector/index.d.ts +13 -0
- package/dist/devtools/visualContextInspector/inspectorStore.d.ts +35 -0
- package/dist/devtools/visualContextInspector/inspectorStyles.d.ts +13 -0
- package/dist/devtools/visualContextInspector/types.d.ts +27 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/useAssistantPlaybackMute.d.ts +16 -0
- package/dist/hooks/useAudioConfigSurface.d.ts +20 -0
- package/dist/hooks/useConversationSession.d.ts +69 -0
- package/dist/hooks/useDocToFormDropFlow.d.ts +31 -0
- package/dist/hooks/useGuideAIAPI.d.ts +3 -6
- package/dist/hooks/useGuideAILayout.d.ts +38 -0
- package/dist/hooks/useGuideAILocalStorageSync.d.ts +17 -0
- package/dist/hooks/useHiddenRealtimeSteers.d.ts +22 -0
- package/dist/hooks/useMicMute.d.ts +20 -0
- package/dist/hooks/useMicPreset.d.ts +19 -0
- package/dist/hooks/useMicPromptHook.d.ts +28 -0
- package/dist/hooks/useNoisyPresetSuggest.d.ts +19 -0
- package/dist/hooks/usePlaybackLockDebugOverlay.d.ts +12 -0
- package/dist/hooks/useProtectedPlayback.d.ts +36 -0
- package/dist/hooks/useTranscriptChrome.d.ts +39 -0
- package/dist/hooks/useTranscriptState.d.ts +1 -1
- package/dist/hooks/useWebRTC.d.ts +41 -6
- package/dist/hooks/useWidgetWorkflowSession.d.ts +35 -0
- package/dist/hooks/useWorkspaceCatalog.d.ts +32 -0
- package/dist/index.d.ts +6 -1
- package/dist/lib/workspaceEmbedIcons.d.ts +57 -0
- package/dist/micPrompt.defaults.d.ts +25 -0
- package/dist/playwrightToolHarness.d.ts +8 -0
- package/dist/playwrightToolHarness.js +3 -0
- package/dist/playwrightToolHarness.js.LICENSE.txt +16 -0
- package/dist/playwrightToolHarness.js.map +1 -0
- package/dist/staticContext/collectContext.d.ts +28 -0
- package/dist/staticContext/index.d.ts +8 -0
- package/dist/staticContext/types.d.ts +176 -0
- package/dist/staticContext/useStaticContext.d.ts +32 -0
- package/dist/stubs/workspaces.d.ts +36 -0
- package/dist/styles/GuideAI.styles.d.ts +2 -6
- package/dist/styles/GuideAI.styles.types.d.ts +6 -0
- package/dist/styles/guideAIStylesCore.d.ts +2 -0
- package/dist/styles/guideAIStylesDialogs.d.ts +2 -0
- package/dist/styles/guideAIStylesMicPrompt.d.ts +2 -0
- package/dist/styles/guideAIStylesTranscript.d.ts +2 -0
- package/dist/types/GuideAI.types.d.ts +63 -2
- package/dist/types/audioConfig.types.d.ts +78 -0
- package/dist/utils/api.d.ts +61 -15
- package/dist/utils/confettiBurst.d.ts +6 -0
- package/dist/utils/constants.d.ts +7 -1
- package/dist/utils/conversationManager.d.ts +20 -2
- package/dist/utils/dataChannel.d.ts +56 -6
- package/dist/utils/dataChannelHelpers.d.ts +28 -0
- package/dist/utils/dataTransferHasFiles.d.ts +2 -0
- package/dist/utils/date.d.ts +11 -0
- package/dist/utils/embedConversationNamespace.d.ts +10 -0
- package/dist/utils/isMobileBrowser.d.ts +5 -0
- package/dist/utils/lastSystemToolCall.d.ts +6 -0
- package/dist/utils/localStorageHelper.d.ts +84 -0
- package/dist/utils/logger.d.ts +17 -20
- package/dist/utils/messageStorage.d.ts +16 -11
- package/dist/utils/micPromptThrottle.d.ts +13 -0
- package/dist/utils/positionUtils.d.ts +8 -7
- package/dist/utils/reactHooks.d.ts +14 -0
- package/dist/utils/reducedMotion.d.ts +17 -0
- package/dist/utils/tools/back.d.ts +19 -0
- package/dist/utils/tools/clickElement.d.ts +32 -0
- package/dist/utils/tools/cssPathForElement.d.ts +2 -0
- package/dist/utils/tools/descriptionToHighlightSelector.d.ts +2 -0
- package/dist/utils/tools/docToForm.d.ts +54 -0
- package/dist/utils/tools/docUploadPrompt.d.ts +11 -0
- package/dist/utils/tools/elementInteractions.d.ts +40 -0
- package/dist/utils/tools/fillField.d.ts +41 -0
- package/dist/utils/tools/fillForm.d.ts +49 -0
- package/dist/utils/tools/goToAElmLink.d.ts +27 -0
- package/dist/utils/tools/highlight.d.ts +23 -0
- package/dist/utils/tools/highlightThenClick.d.ts +31 -0
- package/dist/utils/tools/hover.d.ts +23 -0
- package/dist/utils/tools/hoverThenClick.d.ts +37 -0
- package/dist/utils/tools/markWorkflowComplete.d.ts +18 -0
- package/dist/utils/tools/navigateTo.d.ts +23 -0
- package/dist/utils/tools/refresh.d.ts +19 -0
- package/dist/utils/tools/sampleToolArgsJson.d.ts +1 -0
- package/dist/utils/tools/scroll.d.ts +32 -0
- package/dist/utils/tools/toolRegistry.d.ts +55 -0
- package/dist/utils/tools/workflowToolBridge.d.ts +15 -0
- package/dist/utils/webrtcConnection.d.ts +9 -2
- package/dist/utils/widgetAuthStore.d.ts +9 -0
- package/dist/utils/widgetBearerStorage.d.ts +26 -0
- package/dist/utils/widgetSession.d.ts +20 -0
- package/dist/utils/widgetWorkspaces.d.ts +10 -0
- package/dist/utils/workflowSteer.d.ts +6 -0
- package/dist/utils/workspaceCatalog.d.ts +24 -0
- package/dist/visualContext/VisualContextScheduler.d.ts +48 -2
- package/dist/visualContext/domChangeTracker.d.ts +29 -0
- package/dist/visualContext/imageHash.d.ts +19 -0
- package/dist/visualContext/index.d.ts +3 -3
- package/dist/visualContext/types.d.ts +48 -2
- package/dist/visualContext/useVisualContext.d.ts +23 -8
- package/package.json +3 -1
- package/dist/components/AnimatedSettingsItem.d.ts +0 -9
- package/dist/components/MuteButton.d.ts +0 -11
- package/dist/components/ResetButton.d.ts +0 -9
- package/dist/components/SettingsMenu.d.ts +0 -16
- package/dist/components/SettingsToggle.d.ts +0 -7
- package/dist/components/TranscriptToggle.d.ts +0 -7
- package/dist/utils/elementInteractions.d.ts +0 -127
- package/dist/utils/goToAElmLink.d.ts +0 -1
- package/dist/utils/highlightThenClick.d.ts +0 -2
- package/dist/utils/hover.d.ts +0 -2
- package/dist/utils/hoverThenClick.d.ts +0 -2
- package/dist/utils/toolRegistry.d.ts +0 -33
- package/dist/utils/workflow.d.ts +0 -62
- package/dist/visualContext/debug-overlay.d.ts +0 -10
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny event bus + in-memory log that the Visual Context Inspector dev-tool uses.
|
|
3
|
+
*
|
|
4
|
+
* Listens to the two `window` events dispatched by the visual-context module:
|
|
5
|
+
* - `guideai:screenshot` — a frame was captured and dispatched to the hook.
|
|
6
|
+
* - `guideai:vc:send` — a send decision was made (sent OR skipped with a gate).
|
|
7
|
+
*
|
|
8
|
+
* Matches captures to send-decisions by `frame.timestamp` (unique per capture) and
|
|
9
|
+
* notifies subscribers. Ring-buffers to `MAX_ENTRIES` so long sessions don't leak.
|
|
10
|
+
*
|
|
11
|
+
* This file is Inspector-only. `VisualContextInspector` calls `start()` on mount and
|
|
12
|
+
* `stop()` on unmount so window listeners are not left attached after the panel closes.
|
|
13
|
+
* Main VC code still dispatches the events unconditionally (cheap when nothing listens).
|
|
14
|
+
*/
|
|
15
|
+
import type { CaptureLogEntry } from './types';
|
|
16
|
+
type Listener = () => void;
|
|
17
|
+
declare class InspectorStore {
|
|
18
|
+
private entries;
|
|
19
|
+
private listeners;
|
|
20
|
+
private nextId;
|
|
21
|
+
private started;
|
|
22
|
+
private onScreenshotBound;
|
|
23
|
+
private onSendBound;
|
|
24
|
+
start(): void;
|
|
25
|
+
stop(): void;
|
|
26
|
+
clear(): void;
|
|
27
|
+
getEntries(): CaptureLogEntry[];
|
|
28
|
+
subscribe(listener: Listener): () => void;
|
|
29
|
+
private appendCapture;
|
|
30
|
+
private applySendDecision;
|
|
31
|
+
private trim;
|
|
32
|
+
private notify;
|
|
33
|
+
}
|
|
34
|
+
export declare const inspectorStore: InspectorStore;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inspector-only CSS. Concatenated into the main package stylesheet by
|
|
3
|
+
* `src/styles/GuideAI.styles.ts`, so the rules are visible both in the light DOM
|
|
4
|
+
* and (via the Chrome extension's `syncGuideAIStylesToShadow`) inside Shadow DOM.
|
|
5
|
+
*
|
|
6
|
+
* All class names are `guideai-vci-*` so the dev-tool does NOT share stylesheet
|
|
7
|
+
* naming with the rest of the package. Visuals intentionally resemble the Audio
|
|
8
|
+
* Configuration dialog, but the rules are independent.
|
|
9
|
+
*
|
|
10
|
+
* Deleting `devtools/visualContextInspector/` also requires removing the one-liner
|
|
11
|
+
* append in `GuideAI.styles.ts` that pulls this in.
|
|
12
|
+
*/
|
|
13
|
+
export declare const visualContextInspectorStyles: () => string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types used by the Visual Context Inspector dev-tool.
|
|
3
|
+
*
|
|
4
|
+
* This folder is intentionally self-contained — it can be deleted without breaking
|
|
5
|
+
* anything outside of `GuideAI.tsx` (which mounts the panel conditionally on
|
|
6
|
+
* `visualContext.inspector === true`). See `./VisualContextInspector.tsx`.
|
|
7
|
+
*/
|
|
8
|
+
import type { ScreenshotFrame, ScreenshotReason } from '../../visualContext/types';
|
|
9
|
+
/** One row in the Inspector's capture/send log. */
|
|
10
|
+
export interface CaptureLogEntry {
|
|
11
|
+
/** Monotonic id for list keys. */
|
|
12
|
+
id: number;
|
|
13
|
+
/** Frame as dispatched by the scheduler. */
|
|
14
|
+
frame: ScreenshotFrame;
|
|
15
|
+
/** `guideai:screenshot` event time. */
|
|
16
|
+
capturedAt: number;
|
|
17
|
+
/** `guideai:vc:send` event info; undefined until the hook decides. */
|
|
18
|
+
send?: {
|
|
19
|
+
sent: boolean;
|
|
20
|
+
gate?: string;
|
|
21
|
+
at: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface InspectorSnapshot {
|
|
25
|
+
entries: CaptureLogEntry[];
|
|
26
|
+
}
|
|
27
|
+
export type CaptureReason = ScreenshotReason;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export { useGuideAIAPI } from './useGuideAIAPI';
|
|
2
|
+
export { useGuideAILayout } from './useGuideAILayout';
|
|
3
|
+
export type { GuideAILayout, UseGuideAILayoutParams } from './useGuideAILayout';
|
|
4
|
+
export { useMicPromptHook } from './useMicPromptHook';
|
|
5
|
+
export type { MicPromptHookResult, UseMicPromptHookParams } from './useMicPromptHook';
|
|
2
6
|
export { useTranscriptState } from './useTranscriptState';
|
|
3
7
|
export { useWebRTC } from './useWebRTC';
|
|
8
|
+
export { useDocToFormDropFlow } from './useDocToFormDropFlow';
|
|
9
|
+
export type { DocFormProgress, UseDocToFormDropFlowParams, UseDocToFormDropFlowResult, } from './useDocToFormDropFlow';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
3
|
+
export interface UseAssistantPlaybackMuteParams {
|
|
4
|
+
hooks: ReactHooks;
|
|
5
|
+
audioElementRef: MutableRefObject<HTMLAudioElement | null>;
|
|
6
|
+
isDataChannelOpen: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Mute **assistant** (TTS / remote) playback via the WebRTC `<audio>` element.
|
|
10
|
+
* Separate from mic mute (`guideAI_isMuted`).
|
|
11
|
+
*/
|
|
12
|
+
export declare function useAssistantPlaybackMute({ hooks, audioElementRef, isDataChannelOpen, }: UseAssistantPlaybackMuteParams): {
|
|
13
|
+
isAssistantPlaybackMuted: boolean;
|
|
14
|
+
handleToggleAssistantPlaybackMute: () => void;
|
|
15
|
+
clearAssistantPlaybackMuteOnSessionEnd: () => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DataChannelManager } from '../utils/dataChannel';
|
|
2
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
3
|
+
import type { AudioConfig, StoredAudioConfig } from '../types/audioConfig.types';
|
|
4
|
+
export interface UseAudioConfigSurfaceParams {
|
|
5
|
+
hooks: ReactHooks;
|
|
6
|
+
hasMic: boolean;
|
|
7
|
+
getDataChannel: () => DataChannelManager | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Audio settings dialog: open/close, default mic label for the dialog,
|
|
11
|
+
* and apply → storage + realtime session.update.
|
|
12
|
+
* Entry UI: transcript ⋯ menu → Debug → “Audio settings” (when debug more menu is on).
|
|
13
|
+
*/
|
|
14
|
+
export declare function useAudioConfigSurface({ hooks, hasMic, getDataChannel, }: UseAudioConfigSurfaceParams): {
|
|
15
|
+
showConfigDialog: boolean;
|
|
16
|
+
handleOpenConfigDialog: () => void;
|
|
17
|
+
handleCloseConfigDialog: () => void;
|
|
18
|
+
handleApplyAudioConfig: (config: AudioConfig, stored: StoredAudioConfig) => void;
|
|
19
|
+
defaultMicLabel: string | null;
|
|
20
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
2
|
+
import type { GuideAIProps, RecordingStatus } from '../types/GuideAI.types';
|
|
3
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
4
|
+
import type { ConversationManager } from '../utils/conversationManager';
|
|
5
|
+
import type { DataChannelManager } from '../utils/dataChannel';
|
|
6
|
+
import type { UseVisualContextReturn } from '../visualContext/useVisualContext';
|
|
7
|
+
import type { StoredMessage } from '../utils/messageStorage';
|
|
8
|
+
import type { InitializeWebRTCCallOptions } from './useWebRTC';
|
|
9
|
+
export type UseConversationSessionParams = {
|
|
10
|
+
hooks: ReactHooks;
|
|
11
|
+
conversationKey: string;
|
|
12
|
+
keyTrim: string;
|
|
13
|
+
hasPortalAuth: boolean;
|
|
14
|
+
workspaceDataSource: 'api' | 'stub';
|
|
15
|
+
widgetAuthWorkspace: string | undefined;
|
|
16
|
+
transcriptOptions: GuideAIProps['transcript'];
|
|
17
|
+
inputOptions: GuideAIProps['input'];
|
|
18
|
+
hasInteracted: boolean;
|
|
19
|
+
setHasInteractedState: Dispatch<SetStateAction<boolean>>;
|
|
20
|
+
setShowOnboarding: Dispatch<SetStateAction<boolean>>;
|
|
21
|
+
isConversationActive: boolean;
|
|
22
|
+
setIsConversationActive: Dispatch<SetStateAction<boolean>>;
|
|
23
|
+
setStatus: Dispatch<SetStateAction<RecordingStatus>>;
|
|
24
|
+
setIsResponseActive: Dispatch<SetStateAction<boolean>>;
|
|
25
|
+
setIsConnecting: Dispatch<SetStateAction<boolean>>;
|
|
26
|
+
setShowTranscript: Dispatch<SetStateAction<boolean>>;
|
|
27
|
+
setShowTextInput: Dispatch<SetStateAction<boolean>>;
|
|
28
|
+
setInputMode: Dispatch<SetStateAction<'voice' | 'text'>>;
|
|
29
|
+
setHasMic: Dispatch<SetStateAction<boolean>>;
|
|
30
|
+
setAllMessages: Dispatch<SetStateAction<StoredMessage[]>>;
|
|
31
|
+
/** Close workflow drawer when ending session (`useTranscriptChrome` owns dock/float panel mode). */
|
|
32
|
+
setWorkflowDrawerOpen: Dispatch<SetStateAction<boolean>>;
|
|
33
|
+
hasInitializedRef: MutableRefObject<boolean>;
|
|
34
|
+
isConversationActiveRef: MutableRefObject<boolean>;
|
|
35
|
+
peerConnectionRef: MutableRefObject<RTCPeerConnection | null>;
|
|
36
|
+
dataChannelManagerRef: MutableRefObject<DataChannelManager | null>;
|
|
37
|
+
mediaStreamRef: MutableRefObject<MediaStream | null>;
|
|
38
|
+
conversationManagerRef: MutableRefObject<ConversationManager | null>;
|
|
39
|
+
cleanupWebRTC: () => void;
|
|
40
|
+
initializeWebRTC: (audioStream: MediaStream | null, callOptions?: InitializeWebRTCCallOptions) => Promise<boolean>;
|
|
41
|
+
applyMuteStateToMediaStreamTracks: () => void;
|
|
42
|
+
visualContext: Pick<UseVisualContextReturn, 'cleanupOnConversationEnd'>;
|
|
43
|
+
protectedPlayback: {
|
|
44
|
+
resetProtectedPlayback: () => void;
|
|
45
|
+
};
|
|
46
|
+
errorHandlingTimeoutRefs: MutableRefObject<Set<NodeJS.Timeout>>;
|
|
47
|
+
hasAttemptedAutoStartRef: MutableRefObject<boolean>;
|
|
48
|
+
flushPendingWorkspaceCatalogOnEndSession: () => void;
|
|
49
|
+
clearWorkspaceCatalogCacheForReset: () => void;
|
|
50
|
+
pendingWorkspaceGreetingRef: MutableRefObject<string | null>;
|
|
51
|
+
workspaceGreetingRef: MutableRefObject<string | null>;
|
|
52
|
+
clearPendingWorkflowSteerTitle: () => void;
|
|
53
|
+
reestablishRealtimeSessionRef: MutableRefObject<((callOptions?: InitializeWebRTCCallOptions) => Promise<boolean>) | null>;
|
|
54
|
+
endConversationSessionRef: MutableRefObject<() => void>;
|
|
55
|
+
handleResetChatRef: MutableRefObject<() => Promise<void>>;
|
|
56
|
+
scheduleWorkspaceCatalogFetch: () => Promise<void>;
|
|
57
|
+
resetNoisySuggestForChatReset: () => void;
|
|
58
|
+
/** Runs at the start of `endConversationSession` (toolbar X, errors, reset chat, etc.). */
|
|
59
|
+
onBeforeEndConversationSession?: () => void;
|
|
60
|
+
};
|
|
61
|
+
export declare function useConversationSession(params: UseConversationSessionParams): {
|
|
62
|
+
startConversationSession: () => Promise<boolean>;
|
|
63
|
+
reestablishActiveRealtimeSession: (callOptions?: InitializeWebRTCCallOptions) => Promise<boolean>;
|
|
64
|
+
endConversationSession: () => void;
|
|
65
|
+
toggleConversation: (force?: boolean) => Promise<void>;
|
|
66
|
+
handleToggleConversation: () => Promise<void>;
|
|
67
|
+
handleResetChat: () => Promise<void>;
|
|
68
|
+
handleOnboardingComplete: () => Promise<void>;
|
|
69
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
3
|
+
import type { ConversationManager } from '../utils/conversationManager';
|
|
4
|
+
import type { DataChannelManager } from '../utils/dataChannel';
|
|
5
|
+
export type DocFormProgress = 'off' | 'extracting' | 'filling';
|
|
6
|
+
export interface UseDocToFormDropFlowParams {
|
|
7
|
+
hooks: ReactHooks;
|
|
8
|
+
isConversationActive: boolean;
|
|
9
|
+
isDataChannelOpen: boolean;
|
|
10
|
+
isResponseActive: boolean;
|
|
11
|
+
showTranscript: boolean;
|
|
12
|
+
dataChannelManagerRef: MutableRefObject<DataChannelManager | null>;
|
|
13
|
+
conversationManagerRef: {
|
|
14
|
+
current: ConversationManager | null;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface UseDocToFormDropFlowResult {
|
|
18
|
+
docFormProgress: DocFormProgress;
|
|
19
|
+
fileDragOverDocument: boolean;
|
|
20
|
+
transcriptFileDropAllowed: boolean;
|
|
21
|
+
handleTranscriptFileDrop: (file: File) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Owns the docToForm / fillForm drag-and-drop transcript flow:
|
|
25
|
+
* - tracks extraction/filling progress (`docFormProgress`),
|
|
26
|
+
* - tracks document-wide OS file-drag state (`fileDragOverDocument`),
|
|
27
|
+
* - gates drop acceptance (`transcriptFileDropAllowed`), and
|
|
28
|
+
* - runs Gemini extraction + posts the extracted text to the realtime data channel
|
|
29
|
+
* when a file is dropped on the transcript card.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useDocToFormDropFlow({ hooks, isConversationActive, isDataChannelOpen, isResponseActive, showTranscript, dataChannelManagerRef, conversationManagerRef, }: UseDocToFormDropFlowParams): UseDocToFormDropFlowResult;
|
|
@@ -4,18 +4,15 @@
|
|
|
4
4
|
import type { UseEffectHook } from '../types/GuideAI.types';
|
|
5
5
|
export interface UseGuideAIAPIParams {
|
|
6
6
|
useEffect: UseEffectHook;
|
|
7
|
-
|
|
8
|
-
setShowTranscript: (value: React.SetStateAction<boolean>) => void;
|
|
9
|
-
showTranscript: boolean;
|
|
7
|
+
conversationKey: string;
|
|
10
8
|
setInputMode: (mode: 'voice' | 'text') => void;
|
|
11
|
-
setShowTextInput: (value:
|
|
9
|
+
setShowTextInput: (value: boolean | ((prev: boolean) => boolean)) => void;
|
|
12
10
|
inputMode: 'voice' | 'text';
|
|
13
|
-
setTextInput: (value:
|
|
11
|
+
setTextInput: (value: string) => void;
|
|
14
12
|
inputOptions?: {
|
|
15
13
|
enableTextInput?: boolean;
|
|
16
14
|
};
|
|
17
15
|
isConversationActive: boolean;
|
|
18
|
-
handleToggleInputMode: () => void;
|
|
19
16
|
handleTextSubmit: (text?: string) => Promise<void>;
|
|
20
17
|
visualContextWindowAPI: any;
|
|
21
18
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ZIndexConfig } from '../styles/GuideAI.styles.types';
|
|
3
|
+
import type { GuideAIProps, GuideAIPosition, PopupPosition, TranscriptPanelMode, TranscriptPosition } from '../types/GuideAI.types';
|
|
4
|
+
type LayoutHooks = {
|
|
5
|
+
useState: <T>(initial: T | (() => T)) => [T, (value: T | ((prev: T) => T)) => void];
|
|
6
|
+
useMemo: <T>(factory: () => T, deps: any[]) => T;
|
|
7
|
+
useCallback: <T extends (...args: any[]) => any>(callback: T, deps: any[]) => T;
|
|
8
|
+
useEffect: (effect: () => void | (() => void), deps?: any[]) => void;
|
|
9
|
+
};
|
|
10
|
+
export interface UseGuideAILayoutParams {
|
|
11
|
+
hooks: LayoutHooks;
|
|
12
|
+
position?: GuideAIPosition;
|
|
13
|
+
transcriptOptions?: GuideAIProps['transcript'];
|
|
14
|
+
zIndexConfig: ZIndexConfig;
|
|
15
|
+
/** Key for transcript drawer width pref in localStorage. */
|
|
16
|
+
layoutPrefsKey: string;
|
|
17
|
+
showTranscript: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* `docked` = full-height transcript side panel (toolbar float/dock toggle).
|
|
20
|
+
* Not the workflow checklist drawer (`workflowDrawerOpen` in TranscriptBox).
|
|
21
|
+
*/
|
|
22
|
+
transcriptPanelMode: TranscriptPanelMode;
|
|
23
|
+
}
|
|
24
|
+
export interface GuideAILayout {
|
|
25
|
+
/** Mic / floating UI position (may shift when the transcript docked panel is open). */
|
|
26
|
+
layoutPosition: GuideAIPosition;
|
|
27
|
+
transcriptPosition: TranscriptPosition;
|
|
28
|
+
popupPosition: PopupPosition;
|
|
29
|
+
baseStyles: CSSProperties;
|
|
30
|
+
drawerWidthPx: number;
|
|
31
|
+
onDrawerWidthChange: (nextWidthPx: number) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Transcript docked-panel width persistence, mic position offset when the docked panel is visible,
|
|
35
|
+
* welcome-bubble / onboarding popup placement from mic geometry, fixed mic shell styles, and document `padding-right` while docked.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useGuideAILayout({ hooks, position, transcriptOptions, zIndexConfig, layoutPrefsKey, showTranscript, transcriptPanelMode, }: UseGuideAILayoutParams): GuideAILayout;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
3
|
+
import { getWorkspaceDataSource } from '../utils/localStorageHelper';
|
|
4
|
+
export type GuideAILocalStorageSyncHooks = Pick<ReactHooks, 'useState' | 'useEffect'>;
|
|
5
|
+
export type UseGuideAILocalStorageSyncParams = {
|
|
6
|
+
hooks: GuideAILocalStorageSyncHooks;
|
|
7
|
+
};
|
|
8
|
+
export type GuideAILocalStorageSync = {
|
|
9
|
+
debugMoreMenu: boolean;
|
|
10
|
+
workspaceDataSource: ReturnType<typeof getWorkspaceDataSource>;
|
|
11
|
+
setWorkspaceDataSourceState: Dispatch<SetStateAction<ReturnType<typeof getWorkspaceDataSource>>>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Cross-tab localStorage sync for debug menu visibility and workspace data source (stub vs API).
|
|
15
|
+
* Keeps `GuideAI.tsx` free of raw `window.addEventListener` for these keys.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useGuideAILocalStorageSync({ hooks, }: UseGuideAILocalStorageSyncParams): GuideAILocalStorageSync;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { ConversationManager } from '../utils/conversationManager';
|
|
3
|
+
import type { DataChannelManager } from '../utils/dataChannel';
|
|
4
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
5
|
+
export interface UseHiddenRealtimeSteersParams {
|
|
6
|
+
hooks: ReactHooks;
|
|
7
|
+
isDataChannelOpen: boolean;
|
|
8
|
+
isConversationActive: boolean;
|
|
9
|
+
pendingWorkspaceGreetingRef: MutableRefObject<string | null>;
|
|
10
|
+
pendingWorkflowSteerTitle: string | null;
|
|
11
|
+
clearPendingWorkflowSteerTitle: () => void;
|
|
12
|
+
dataChannelManagerRef: MutableRefObject<DataChannelManager | null>;
|
|
13
|
+
conversationManagerRef: {
|
|
14
|
+
current: ConversationManager | null;
|
|
15
|
+
};
|
|
16
|
+
scheduleInterruptLockThenSend: (dcm: DataChannelManager, send: () => void, reason: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Hidden `conversation.item.create` + `response.create` for workspace greeting and workflow steer,
|
|
20
|
+
* with Noisy-preset interrupt lock sequencing via `scheduleInterruptLockThenSend`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useHiddenRealtimeSteers({ hooks, isDataChannelOpen, isConversationActive, pendingWorkspaceGreetingRef, pendingWorkflowSteerTitle, clearPendingWorkflowSteerTitle, dataChannelManagerRef, conversationManagerRef, scheduleInterruptLockThenSend, }: UseHiddenRealtimeSteersParams): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { ConversationManager } from '../utils/conversationManager';
|
|
3
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
4
|
+
export interface UseMicMuteParams {
|
|
5
|
+
hooks: ReactHooks;
|
|
6
|
+
mediaStreamRef: MutableRefObject<MediaStream | null>;
|
|
7
|
+
conversationManagerRef: {
|
|
8
|
+
current: ConversationManager | null;
|
|
9
|
+
};
|
|
10
|
+
hasMic: boolean;
|
|
11
|
+
isConversationActive: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Mute preference (localStorage), toggle + server log, and `MediaStream` track `enabled` sync.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useMicMute({ hooks, mediaStreamRef, conversationManagerRef, hasMic, isConversationActive, }: UseMicMuteParams): {
|
|
17
|
+
isMuted: boolean;
|
|
18
|
+
handleToggleMute: () => void;
|
|
19
|
+
applyMuteStateToMediaStreamTracks: () => void;
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConversationManager } from '../utils/conversationManager';
|
|
2
|
+
import type { DataChannelManager } from '../utils/dataChannel';
|
|
3
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
4
|
+
import type { MicPresetId } from '../types/audioConfig.types';
|
|
5
|
+
export interface UseMicPresetParams {
|
|
6
|
+
hooks: ReactHooks;
|
|
7
|
+
conversationManagerRef: {
|
|
8
|
+
current: ConversationManager | null;
|
|
9
|
+
};
|
|
10
|
+
getDataChannel: () => DataChannelManager | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Mic preset UI state, localStorage sync, apply + session.update, and debug logging to the server.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useMicPreset({ hooks, conversationManagerRef, getDataChannel, }: UseMicPresetParams): {
|
|
16
|
+
micPreset: MicPresetId;
|
|
17
|
+
handleApplyMicPreset: (preset: MicPresetId) => void;
|
|
18
|
+
logMicPresetToServer: (preset: MicPresetId) => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { MicPromptAnimationId } from '../types/GuideAI.types';
|
|
2
|
+
export interface MicPromptHookResult {
|
|
3
|
+
animation: MicPromptAnimationId | null;
|
|
4
|
+
message: string | null;
|
|
5
|
+
/** Pre-interaction presentation (pill-expand inside the mic shell). */
|
|
6
|
+
isPill: boolean;
|
|
7
|
+
/** Visible in any form (reveal or closing animation). */
|
|
8
|
+
onSurface: boolean;
|
|
9
|
+
/** Reveal-complete; closing has not started yet. */
|
|
10
|
+
revealed: boolean;
|
|
11
|
+
/** Closing animation (pill collapse or simple bubble exit) is running. */
|
|
12
|
+
closing: boolean;
|
|
13
|
+
reduceMotion: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface UseMicPromptHookParams {
|
|
16
|
+
/** All gate conditions pre-combined: idle && !transcript && !onboarding && !connecting. */
|
|
17
|
+
eligible: boolean;
|
|
18
|
+
/** Source of truth for pre (`false`) vs post (`true`) presentation. */
|
|
19
|
+
hasInteracted: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* "The hook" — idle mic call-to-action lifecycle (see `docs/THE_HOOK.md`).
|
|
23
|
+
*
|
|
24
|
+
* State machine: `hidden → waiting → visible → closing → hidden`. One timer at a time.
|
|
25
|
+
* `isPill` is cached at pick time (`!hasInteracted`); if `hasInteracted` flips mid-lifecycle the
|
|
26
|
+
* active pick is discarded and the cycle resets.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useMicPromptHook(React: typeof import('react'), { eligible, hasInteracted }: UseMicPromptHookParams): MicPromptHookResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MicPresetId } from '../types/audioConfig.types';
|
|
2
|
+
export interface UseNoisyPresetSuggestParams {
|
|
3
|
+
micPreset: MicPresetId;
|
|
4
|
+
isDataChannelOpen: boolean;
|
|
5
|
+
onApplyMicPreset?: (preset: MicPresetId) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Precise-only barge-in hint to switch to Noisy preset. Lives in GuideAI; transcript stays presentational via props.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useNoisyPresetSuggest({ micPreset, isDataChannelOpen, onApplyMicPreset, }: UseNoisyPresetSuggestParams): {
|
|
11
|
+
noisyPresetSuggestVisible: boolean;
|
|
12
|
+
onNoisyPresetSuggestYes: () => void;
|
|
13
|
+
onNoisyPresetSuggestNo: () => void;
|
|
14
|
+
onNoisyPresetSuggestAutoDismiss: () => void;
|
|
15
|
+
/** Call from `handlePlaybackInterruptedByUser` (stable ref for current Precise / dismissed state). */
|
|
16
|
+
notifyPlaybackInterrupted: () => void;
|
|
17
|
+
/** Call from chat reset (clears “don’t ask again” for this conversation). */
|
|
18
|
+
resetNoisySuggestForChatReset: () => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
2
|
+
export interface UsePlaybackLockDebugOverlayParams {
|
|
3
|
+
hooks: ReactHooks;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Transcript ⋯ → Debug → playback lock panel: visibility (localStorage + cross-tab sync), close, toggle.
|
|
7
|
+
*/
|
|
8
|
+
export declare function usePlaybackLockDebugOverlay({ hooks }: UsePlaybackLockDebugOverlayParams): {
|
|
9
|
+
visible: boolean;
|
|
10
|
+
close: () => void;
|
|
11
|
+
toggle: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { ConversationManager } from '../utils/conversationManager';
|
|
3
|
+
import type { DataChannelManager } from '../utils/dataChannel';
|
|
4
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
5
|
+
import type { MicPresetId } from '../types/audioConfig.types';
|
|
6
|
+
export interface UseProtectedPlaybackParams {
|
|
7
|
+
hooks: ReactHooks;
|
|
8
|
+
conversationManagerRef: {
|
|
9
|
+
current: ConversationManager | null;
|
|
10
|
+
};
|
|
11
|
+
getDataChannel: () => DataChannelManager | null;
|
|
12
|
+
playbackInterruptNoisyRef: MutableRefObject<() => void>;
|
|
13
|
+
micPreset: MicPresetId;
|
|
14
|
+
isDataChannelOpen: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface InterruptLockOverlayConfig {
|
|
17
|
+
lockMode: 'system_interrupt_lock' | 'none';
|
|
18
|
+
vadType: 'server_vad' | 'off' | 'semantic_vad';
|
|
19
|
+
threshold: number | undefined;
|
|
20
|
+
interruptResponse: boolean | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* System "interrupt lock" for Noisy preset: VAD config during protected assistant playback,
|
|
24
|
+
* restore on output end, barge-in debug + noisy preset nudge wiring.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useProtectedPlayback({ hooks, conversationManagerRef, getDataChannel, playbackInterruptNoisyRef, micPreset, isDataChannelOpen, }: UseProtectedPlaybackParams): {
|
|
27
|
+
protectedPlaybackActiveRef: MutableRefObject<boolean>;
|
|
28
|
+
protectedPlaybackActive: boolean;
|
|
29
|
+
playbackInterruptDebug: boolean;
|
|
30
|
+
handlePlaybackInterruptedByUser: () => void;
|
|
31
|
+
handleAudioOutputStopped: () => void;
|
|
32
|
+
handleAudioOutputStartedClearInterrupt: () => void;
|
|
33
|
+
resetProtectedPlayback: () => void;
|
|
34
|
+
scheduleInterruptLockThenSend: (dcm: DataChannelManager, send: () => void, reason: string) => void;
|
|
35
|
+
overlayConfig: InterruptLockOverlayConfig;
|
|
36
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
2
|
+
import type { TranscriptPanelMode, TranscriptSessionMode } from '../types/GuideAI.types';
|
|
3
|
+
import type { StubWorkflowItem, StubWorkspaceOption } from '../stubs/workspaces';
|
|
4
|
+
import type { ConversationManager } from '../utils/conversationManager';
|
|
5
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
6
|
+
import type { InitializeWebRTCCallOptions } from './useWebRTC';
|
|
7
|
+
export type UseTranscriptChromeHooks = Pick<ReactHooks, 'useState' | 'useEffect' | 'useCallback' | 'useRef'>;
|
|
8
|
+
export type UseTranscriptChromeParams = {
|
|
9
|
+
hooks: UseTranscriptChromeHooks;
|
|
10
|
+
/** Key for transcript panel dock/float prefs in localStorage (per embed / conversation namespace). */
|
|
11
|
+
layoutPrefsKey: string;
|
|
12
|
+
showTranscript: boolean;
|
|
13
|
+
workspaceOptions: StubWorkspaceOption[];
|
|
14
|
+
workspaceDataSource: 'stub' | 'api';
|
|
15
|
+
apiWorkflowsByWorkspaceId: Record<string, StubWorkflowItem[]> | null;
|
|
16
|
+
keyTrim: string;
|
|
17
|
+
hasPortalAuth: boolean;
|
|
18
|
+
reestablishRealtimeSessionRef: MutableRefObject<((callOptions?: InitializeWebRTCCallOptions) => Promise<boolean>) | null>;
|
|
19
|
+
queueWorkflowSteerTitle: (title: string) => void;
|
|
20
|
+
clearPendingWorkflowSteerTitle: () => void;
|
|
21
|
+
conversationManagerRef: MutableRefObject<ConversationManager | null>;
|
|
22
|
+
/** When set (e.g. shared with `useWorkspaceCatalog`), used instead of an internal ref. */
|
|
23
|
+
sessionWorkflowIdForInitRef?: MutableRefObject<string | null>;
|
|
24
|
+
};
|
|
25
|
+
export type TranscriptChrome = {
|
|
26
|
+
sessionWorkflowIdForInitRef: MutableRefObject<string | null>;
|
|
27
|
+
transcriptPanelMode: TranscriptPanelMode;
|
|
28
|
+
workflowDrawerOpen: boolean;
|
|
29
|
+
transcriptSessionMode: TranscriptSessionMode;
|
|
30
|
+
setTranscriptSessionMode: Dispatch<SetStateAction<TranscriptSessionMode>>;
|
|
31
|
+
setWorkflowDrawerOpen: Dispatch<SetStateAction<boolean>>;
|
|
32
|
+
handleToggleTranscriptPanelMode: () => void;
|
|
33
|
+
handleTranscriptSessionModeChange: (mode: TranscriptSessionMode) => void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Transcript dock/float preference, workflow drawer visibility, and workspace session mode
|
|
37
|
+
* (including reconnect + first workflow steer after mode change).
|
|
38
|
+
*/
|
|
39
|
+
export declare function useTranscriptChrome({ hooks, layoutPrefsKey, showTranscript, workspaceOptions, workspaceDataSource, apiWorkflowsByWorkspaceId, keyTrim, hasPortalAuth, reestablishRealtimeSessionRef, queueWorkflowSteerTitle, clearPendingWorkflowSteerTitle, conversationManagerRef, sessionWorkflowIdForInitRef: sessionWorkflowIdForInitRefProp, }: UseTranscriptChromeParams): TranscriptChrome;
|
|
@@ -10,7 +10,7 @@ export interface UseTranscriptStateParams {
|
|
|
10
10
|
};
|
|
11
11
|
useCallback: <T extends (...args: any[]) => any>(callback: T, deps: any[]) => T;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
conversationKey: string;
|
|
14
14
|
setAllMessages: React.Dispatch<React.SetStateAction<StoredMessage[]>>;
|
|
15
15
|
setStatus: (status: RecordingStatus) => void;
|
|
16
16
|
}
|
|
@@ -20,16 +20,22 @@ export interface UseWebRTCParams {
|
|
|
20
20
|
};
|
|
21
21
|
useCallback: <T extends (...args: any[]) => any>(callback: T, deps: any[]) => T;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
/** Namespace for local conversation / transcript storage (`guideAI_conversation`). */
|
|
24
|
+
conversationKey: string;
|
|
25
|
+
/** Sent to /initialize when not using Bearer (access key + workspace only on session exchange otherwise). */
|
|
26
|
+
widgetAuth?: {
|
|
27
|
+
authKey?: string;
|
|
28
|
+
workspace?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Pre-issued widget Bearer JWT (portal / extension); skips ensureWidgetSession. */
|
|
31
|
+
widgetSessionToken?: string;
|
|
32
|
+
/** Sent as `user` on /initialize when using widget Bearer (e.g. portal AuthUser id). */
|
|
33
|
+
initializeUserId?: string;
|
|
24
34
|
environment: GuideAIEnvironment;
|
|
25
35
|
setIsDataChannelOpen: (open: boolean) => void;
|
|
26
36
|
setIsResponseActive: (active: boolean) => void;
|
|
27
37
|
setIsConnecting: (connecting: boolean) => void;
|
|
28
38
|
setStatus: (status: RecordingStatus) => void;
|
|
29
|
-
handleHighlightThenClick: (out: any) => Promise<boolean>;
|
|
30
|
-
handleHoverThenClick: (out: any) => Promise<boolean>;
|
|
31
|
-
handleHover: (out: any) => Promise<boolean>;
|
|
32
|
-
handleGoToAElmLink: (linkText: string, delay?: number) => Promise<boolean>;
|
|
33
39
|
handleResetChatRef: {
|
|
34
40
|
current: () => Promise<void>;
|
|
35
41
|
};
|
|
@@ -46,7 +52,36 @@ export interface UseWebRTCParams {
|
|
|
46
52
|
onMessageLogged: () => void;
|
|
47
53
|
/** Optional tools from component prop: Record<functionName, { description, parameters, execute }> */
|
|
48
54
|
tools?: PropTools;
|
|
55
|
+
onSessionUpdated?: (session: any) => void;
|
|
56
|
+
onAudioOutputStarted?: () => void;
|
|
57
|
+
onAudioOutputStopped?: () => void;
|
|
58
|
+
/** Fired when user speech starts during assistant `output_audio_buffer` playback. */
|
|
59
|
+
onPlaybackInterruptedByUser?: () => void;
|
|
60
|
+
/** Set connection message (e.g. "Retrying...") during init retries */
|
|
61
|
+
setConnectionMessage: (msg: string | null) => void;
|
|
62
|
+
/** Called when initialize fails after all retries */
|
|
63
|
+
onInitializeError?: (error: {
|
|
64
|
+
message: string;
|
|
65
|
+
}) => void;
|
|
66
|
+
/** Latest workspace `greeting` from initialize (access-key); cleared when absent. */
|
|
67
|
+
workspaceGreetingRef?: {
|
|
68
|
+
current: string | null;
|
|
69
|
+
};
|
|
70
|
+
/** Fire-and-forget workspace catalog fetch in parallel with initialize (after access-key session if any). */
|
|
71
|
+
onWorkspaceCatalogPrefetch?: () => void;
|
|
72
|
+
/** Read at connect — published workflow id for /initialize (null = server default). */
|
|
73
|
+
sessionWorkflowIdForInitRef?: {
|
|
74
|
+
current: string | null;
|
|
75
|
+
};
|
|
76
|
+
/** When true, omit sessionWorkflowId so the server uses full rollup instructions. */
|
|
77
|
+
rollupWorkflowsForInitRef?: {
|
|
78
|
+
current: boolean;
|
|
79
|
+
};
|
|
49
80
|
}
|
|
81
|
+
/** One-shot options for a single `initializeWebRTC` call (e.g. reconnect before React commits new workspace). */
|
|
82
|
+
export type InitializeWebRTCCallOptions = {
|
|
83
|
+
workspaceForInit?: string;
|
|
84
|
+
};
|
|
50
85
|
export declare function useWebRTC(params: UseWebRTCParams): {
|
|
51
86
|
peerConnectionRef: {
|
|
52
87
|
current: RTCPeerConnection | null;
|
|
@@ -67,5 +102,5 @@ export declare function useWebRTC(params: UseWebRTCParams): {
|
|
|
67
102
|
current: string | null;
|
|
68
103
|
};
|
|
69
104
|
cleanupWebRTC: () => void;
|
|
70
|
-
initializeWebRTC: (audioStream: MediaStream | null) => Promise<boolean>;
|
|
105
|
+
initializeWebRTC: (audioStream: MediaStream | null, callOptions?: InitializeWebRTCCallOptions) => Promise<boolean>;
|
|
71
106
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { TranscriptSessionMode } from '../types/GuideAI.types';
|
|
3
|
+
import type { StubWorkspaceOption } from '../stubs/workspaces';
|
|
4
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
5
|
+
import type { InitializeWebRTCCallOptions } from './useWebRTC';
|
|
6
|
+
export type UseWidgetWorkflowSessionParams = {
|
|
7
|
+
hooks: ReactHooks;
|
|
8
|
+
workspaceOptions: StubWorkspaceOption[];
|
|
9
|
+
transcriptSessionMode: TranscriptSessionMode;
|
|
10
|
+
/**
|
|
11
|
+
* Optional shared ref (e.g. with `useWorkspaceCatalog` apply) so clearing workflow id stays in
|
|
12
|
+
* sync. If omitted, an internal ref is used unless `sessionWorkflowIdForInitRefOverride` is set.
|
|
13
|
+
*/
|
|
14
|
+
sessionWorkflowIdForInitRef?: MutableRefObject<string | null>;
|
|
15
|
+
/** Filled after `reestablishActiveRealtimeSession` is defined; read at call time. */
|
|
16
|
+
reestablishRef: MutableRefObject<((callOptions?: InitializeWebRTCCallOptions) => Promise<boolean>) | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Optional shared ref (e.g. with `useTranscriptChrome`) so clearing workflow id on session mode
|
|
19
|
+
* change stays in sync. Takes precedence over `sessionWorkflowIdForInitRef` when both are set.
|
|
20
|
+
*/
|
|
21
|
+
sessionWorkflowIdForInitRefOverride?: MutableRefObject<string | null>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Access-key workflow focus for /initialize (sessionWorkflowId vs rollup) and pending hidden
|
|
25
|
+
* workflow steer after reconnect (non-rollup) or immediately (rollup).
|
|
26
|
+
*/
|
|
27
|
+
export declare function useWidgetWorkflowSession(params: UseWidgetWorkflowSessionParams): {
|
|
28
|
+
sessionWorkflowIdForInitRef: MutableRefObject<string | null>;
|
|
29
|
+
rollupWorkflowsForInitRef: MutableRefObject<boolean>;
|
|
30
|
+
pendingWorkflowSteerTitle: string | null;
|
|
31
|
+
clearPendingWorkflowSteerTitle: () => void;
|
|
32
|
+
/** Queue hidden `Start the … Workflow` steer once the data channel is ready. */
|
|
33
|
+
queueWorkflowSteerTitle: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
34
|
+
onSessionWorkflowForRealtimeInit: (workflowId: string | null, workflowLabel?: string) => void;
|
|
35
|
+
};
|