guideai-app 0.5.4-2 → 0.5.4-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 +64 -1
- package/dist/GuideAI.d.ts +2 -5
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.LICENSE.txt +2 -17
- package/dist/components/DeveloperTools.d.ts +5 -3
- package/dist/components/Microphone.d.ts +10 -1
- package/dist/components/PlaybackLockDebugOverlayRoot.d.ts +1 -1
- package/dist/components/SessionRatingPopup.d.ts +16 -0
- package/dist/components/SubtitleInputBar.d.ts +23 -0
- package/dist/components/SubtitleSettingsMenu.d.ts +9 -0
- package/dist/components/TranscriptBox.d.ts +11 -12
- package/dist/components/TranscriptSessionMicLevels.d.ts +8 -0
- package/dist/components/TranscriptStudioChrome.d.ts +8 -7
- package/dist/components/TranscriptTextInput.d.ts +4 -12
- package/dist/components/TranscriptToolbar.d.ts +3 -1
- package/dist/components/TranscriptWorkflowDrawer.d.ts +5 -7
- package/dist/contexts/GuideAIThemeContext.d.ts +13 -0
- package/dist/devtools/DeveloperToolsShell.d.ts +1 -1
- package/dist/devtools/TranscriptDeveloperToolsMenuItems.d.ts +45 -0
- package/dist/devtools/TranscriptUiDevtoolsPanel.d.ts +10 -0
- package/dist/devtools/adminToolDiagnostics/AdminToolDiagnosticsPanel.d.ts +1 -1
- package/dist/devtools/developerToolPanelId.d.ts +1 -1
- package/dist/devtools/devtoolsAdminPortalLinks.d.ts +11 -0
- package/dist/devtools/devtoolsAuth/DevtoolsAuthContext.d.ts +14 -0
- package/dist/devtools/devtoolsAuth/DevtoolsLoginModal.d.ts +13 -0
- package/dist/devtools/devtoolsAuth/devtoolsAccessTrigger.d.ts +9 -0
- package/dist/devtools/devtoolsAuth/devtoolsAdminApi.d.ts +13 -0
- package/dist/devtools/devtoolsAuth/devtoolsLoginModalStyles.d.ts +1 -0
- package/dist/devtools/devtoolsAuth/devtoolsPortalLogin.d.ts +15 -0
- package/dist/devtools/devtoolsAuth/devtoolsSessionStorage.d.ts +4 -0
- package/dist/devtools/devtoolsAuth/index.d.ts +9 -0
- package/dist/devtools/devtoolsAuth/types.d.ts +21 -0
- package/dist/devtools/devtoolsAuth/useDevtoolsAccess.d.ts +33 -0
- package/dist/devtools/devtoolsThemePreference.d.ts +3 -0
- package/dist/devtools/excavator/ExcavatorPanel.d.ts +17 -0
- package/dist/devtools/excavator/excavatorPanelStyles.d.ts +5 -0
- package/dist/devtools/excavator/excavatorSse.d.ts +6 -0
- package/dist/devtools/learn/LearnCaptureChrome.stub.d.ts +3 -0
- package/dist/devtools/learn/LearnModePanel.d.ts +18 -0
- package/dist/devtools/learn/LearnModePanel.stub.d.ts +3 -0
- package/dist/devtools/learn/LearnOrchestrationHost.d.ts +52 -0
- package/dist/devtools/learn/injectLearnModeStyles.d.ts +2 -0
- package/dist/devtools/learn/learnCaptureChrome.d.ts +33 -0
- package/dist/devtools/learn/learnCaptureLayout.d.ts +26 -0
- package/dist/devtools/learn/learnCaptureToolbar.d.ts +27 -0
- package/dist/devtools/learn/learnClarifyKickoff.d.ts +6 -0
- package/dist/devtools/learn/learnLiteTranscript.d.ts +22 -0
- package/dist/devtools/learn/learnModeStyles.d.ts +5 -0
- package/dist/devtools/learn/learnModeTypes.d.ts +5 -0
- package/dist/devtools/learn/learnOrchestrationStub.d.ts +5 -0
- package/dist/devtools/learn/learnPanelSyncFieldsEqual.d.ts +3 -0
- package/dist/devtools/learn/learnRealtimeSession.d.ts +10 -0
- package/dist/devtools/learn/learnRefBag.d.ts +41 -0
- package/dist/devtools/learn/learnSessionStorage.d.ts +23 -0
- package/dist/devtools/learn/learnWorkspaceContext.d.ts +5 -0
- package/dist/devtools/learn/loadLearnOrchestration.d.ts +10 -0
- package/dist/devtools/learn/useLearnCaptureDuration.d.ts +4 -0
- package/dist/devtools/learn/useLearnClickCapture.d.ts +9 -0
- package/dist/devtools/learn/useLearnMode.d.ts +47 -0
- package/dist/devtools/learn/useLearnMode.stub.d.ts +3 -0
- package/dist/devtools/panelLayout.d.ts +6 -0
- package/dist/devtools/transcriptDevtoolsMenuProps.d.ts +28 -0
- package/dist/devtools/transcriptMoreMenu/DeveloperToolsAdminPortalFlyout.d.ts +20 -0
- package/dist/devtools/transcriptMoreMenu/DeveloperToolsLoggerFlyout.d.ts +16 -0
- package/dist/devtools/transcriptMoreMenu/DeveloperToolsMicPresetFlyout.d.ts +22 -0
- package/dist/devtools/transcriptMoreMenu/TranscriptDeveloperToolsMenuItems.d.ts +21 -0
- package/dist/devtools/transcriptMoreMenu/TranscriptDeveloperToolsThemeFlyout.d.ts +13 -0
- package/dist/devtools/transcriptMoreMenu/TranscriptMoreMenuDevtools.d.ts +27 -0
- package/dist/devtools/transcriptMoreMenu/devtoolsFlyoutTypes.d.ts +1 -0
- package/dist/devtools/transcriptMoreMenu/index.d.ts +2 -0
- package/dist/devtools/transcriptMoreMenu/readWindowGuideAILogger.d.ts +12 -0
- package/dist/devtools/transcriptMoreMenu/useTranscriptMoreMenuDebugFlyouts.d.ts +24 -0
- package/dist/devtools/useDraggableDialog.d.ts +8 -1
- package/dist/devtools/useGuideDeveloperTools.d.ts +16 -7
- package/dist/devtools/useGuideDevtoolsIntegration.d.ts +51 -0
- package/dist/devtools/workflowTester/WorkflowTesterPanel.d.ts +4 -28
- package/dist/devtools/workflowTester/WorkflowTesterPanel.stub.d.ts +3 -0
- package/dist/devtools/workflowTester/index.d.ts +1 -2
- package/dist/devtools/workflowTester/useWorkflowSimulationController.d.ts +12 -0
- package/dist/devtools/workflowTester/useWorkflowSimulationRun.d.ts +47 -0
- package/dist/devtools/workflowTester/workflowSimulationController.d.ts +31 -0
- package/dist/devtools/workflowTester/workflowSimulationDevtoolsApi.d.ts +51 -0
- package/dist/devtools/workflowTester/workflowSimulationRunner.d.ts +46 -0
- package/dist/devtools/workflowTester/workflowSimulationRunnerAi.d.ts +20 -0
- package/dist/devtools/workflowTester/workflowSimulationSessionRestore.d.ts +21 -0
- package/dist/devtools/workflowTester/workflowSimulationTurnState.d.ts +20 -0
- package/dist/devtools/workflowTester/workflowSimulationTypes.d.ts +26 -0
- package/dist/devtools/workflowTester/workflowSimulationWaits.d.ts +55 -0
- package/dist/devtools/workflowTester/workflowTesterPanel.types.d.ts +25 -0
- package/dist/devtools/workflowTester/workflowTesterRunSessionStorage.d.ts +43 -0
- package/dist/devtools/workflowTester/workflowTesterWorkspaceBridge.d.ts +4 -2
- package/dist/hooks/useConversationSession.d.ts +14 -2
- package/dist/hooks/useGuideAIMutePipeline.d.ts +1 -0
- package/dist/hooks/useGuideAIThemeState.d.ts +6 -0
- package/dist/hooks/useMicMute.d.ts +1 -0
- package/dist/hooks/useSessionRating.d.ts +25 -0
- package/dist/hooks/useSubtitleAppearancePrefs.d.ts +5 -0
- package/dist/hooks/useThemePortalProps.d.ts +4 -0
- package/dist/hooks/useTranscriptChrome.d.ts +7 -2
- package/dist/hooks/useTranscriptDisplayMode.d.ts +6 -0
- package/dist/hooks/useTranscriptPanelDragResize.d.ts +47 -0
- package/dist/hooks/useWebRTC.d.ts +3 -0
- package/dist/hooks/useWidgetWorkflowSession.d.ts +2 -0
- package/dist/hooks/useWorkflowTesterOverlay.d.ts +7 -0
- package/dist/hooks/useWorkspaceCatalog.d.ts +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/playwrightSimulationHarness.d.ts +16 -0
- package/dist/playwrightSimulationHarness.js +1 -0
- package/dist/playwrightToolHarness.js +1 -1
- package/dist/sessionRating.defaults.d.ts +4 -0
- package/dist/sessionRatingPrompts.d.ts +3 -0
- package/dist/staticContext/useStaticContext.d.ts +0 -1
- package/dist/stubs/workspaces.d.ts +2 -2
- package/dist/styles/guideAIThemeTokens.d.ts +5 -0
- package/dist/styles/guideaiTestsiteWidgetTheme.d.ts +6 -0
- package/dist/themes/buildThemeCss.d.ts +8 -0
- package/dist/themes/guideAIThemeIds.d.ts +5 -0
- package/dist/themes/presetThemes.d.ts +10 -0
- package/dist/themes/syncGuideAITheme.d.ts +2 -0
- package/dist/themes/themeTokens.types.d.ts +37 -0
- package/dist/types/GuideAI.types.d.ts +22 -3
- package/dist/utils/api.d.ts +3 -0
- package/dist/utils/api.learn.d.ts +18 -0
- package/dist/utils/conversationContextSwitch.d.ts +41 -0
- package/dist/utils/conversationManager.d.ts +41 -0
- package/dist/utils/dataChannel.d.ts +8 -0
- package/dist/utils/dataChannelHelpers.d.ts +10 -0
- package/dist/utils/guideaiMirroredStorageKeys.d.ts +33 -0
- package/dist/utils/lastSystemToolCall.d.ts +2 -1
- package/dist/utils/localStorageHelper.d.ts +46 -21
- package/dist/utils/messageStorage.d.ts +0 -7
- package/dist/utils/parseWorkspaceSlugList.d.ts +12 -0
- package/dist/utils/pathIncludesAnyRef.d.ts +12 -0
- package/dist/utils/sessionRatingThrottle.d.ts +3 -0
- package/dist/utils/themeRegistry.d.ts +14 -0
- package/dist/utils/tools/descriptionToHighlightSelector.d.ts +1 -1
- package/dist/utils/tools/docToForm.d.ts +2 -2
- package/dist/utils/tools/elementToBestInteractionSelector.d.ts +10 -0
- package/dist/utils/transcriptDisplayModePref.d.ts +4 -0
- package/dist/utils/transcriptFloatGeometry.d.ts +78 -0
- package/dist/utils/transcriptSubtitleUiPref.d.ts +5 -0
- package/dist/utils/webrtcConnection.d.ts +5 -0
- package/dist/utils/widgetBearerStorage.d.ts +2 -2
- package/dist/utils/workspaceCatalog.d.ts +13 -2
- package/dist/utils/workspaceCatalogFatal.d.ts +4 -0
- package/dist/visualContext/defaultProvider.d.ts +4 -10
- package/dist/visualContext/visualContextCaptureLock.d.ts +17 -0
- package/package.json +2 -2
|
@@ -7,14 +7,21 @@ interface UseDraggableDialogParams {
|
|
|
7
7
|
initialPosition: () => DraggableDialogPosition;
|
|
8
8
|
minVisibleWidth: number;
|
|
9
9
|
minVisibleHeight: number;
|
|
10
|
+
/** When set, used during drag instead of minVisibleWidth/Height (e.g. measured panel size). */
|
|
11
|
+
clampSize?: () => {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
10
15
|
ignoreSelector?: string;
|
|
16
|
+
/** Called when the user finishes a drag (pointer up) with the settled position. */
|
|
17
|
+
onPositionSettled?: (position: DraggableDialogPosition) => void;
|
|
11
18
|
/**
|
|
12
19
|
* Host dialog handles drag/position; keep hook API stable with a fixed `{0,0}` position
|
|
13
20
|
* and inert drag handlers (e.g. panels nested in {@link DeveloperToolsShell}).
|
|
14
21
|
*/
|
|
15
22
|
embedded?: boolean;
|
|
16
23
|
}
|
|
17
|
-
export declare function useDraggableDialog(React: typeof import('react'), { initialPosition, minVisibleWidth, minVisibleHeight, ignoreSelector, embedded, }: UseDraggableDialogParams): {
|
|
24
|
+
export declare function useDraggableDialog(React: typeof import('react'), { initialPosition, minVisibleWidth, minVisibleHeight, clampSize, ignoreSelector, onPositionSettled, embedded, }: UseDraggableDialogParams): {
|
|
18
25
|
position: DraggableDialogPosition;
|
|
19
26
|
setPosition: import("react").Dispatch<import("react").SetStateAction<DraggableDialogPosition>>;
|
|
20
27
|
dialogRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
@@ -13,17 +13,16 @@ import type { AudioConfig, StoredAudioConfig } from '../types/audioConfig.types'
|
|
|
13
13
|
import type { StubWorkflowItem } from '../stubs/workspaces';
|
|
14
14
|
import type { UseVisualContextReturn } from '../visualContext/useVisualContext';
|
|
15
15
|
import type { InterruptLockOverlayConfig } from '../hooks/useProtectedPlayback';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} | null;
|
|
16
|
+
import type { LearnModePanelProps } from './learn/LearnModePanel';
|
|
17
|
+
import { type DeveloperToolPanelId } from './developerToolPanelId';
|
|
18
|
+
import type { DeveloperToolsShellControl } from './transcriptDevtoolsMenuProps';
|
|
20
19
|
export interface UseGuideDeveloperToolsParams {
|
|
21
20
|
hooks: ReactHooks;
|
|
22
21
|
React: typeof import('react');
|
|
23
22
|
ReactDOM?: {
|
|
24
23
|
createPortal: (children: React.ReactNode, container: Element) => React.ReactNode;
|
|
25
24
|
};
|
|
26
|
-
|
|
25
|
+
developerToolsSectionVisible: boolean;
|
|
27
26
|
visualContextEnabled: boolean;
|
|
28
27
|
visualContext: UseVisualContextReturn;
|
|
29
28
|
getDataChannelManager: () => DataChannelManager | null;
|
|
@@ -47,9 +46,19 @@ export interface UseGuideDeveloperToolsParams {
|
|
|
47
46
|
conversationIdRef: MutableRefObject<string | null>;
|
|
48
47
|
getConversationManager: () => ConversationManager | null;
|
|
49
48
|
queueWorkflowSteerTitle?: (title: string) => void;
|
|
49
|
+
isDataChannelReady?: () => boolean;
|
|
50
|
+
ensureRealtimeSession?: () => Promise<boolean>;
|
|
51
|
+
syncTranscriptFromStorage?: () => void;
|
|
52
|
+
learn: LearnModePanelProps;
|
|
53
|
+
/** First time the Learn tab is selected (lazy-load Learn orchestration). */
|
|
54
|
+
onLearnTabActivate?: () => void;
|
|
50
55
|
}
|
|
51
56
|
export interface UseGuideDeveloperToolsResult {
|
|
52
|
-
|
|
57
|
+
developerToolsShellControl: DeveloperToolsShellControl;
|
|
53
58
|
developerToolsPanel: React.ReactNode;
|
|
59
|
+
/** Open the devtools shell and switch to the given tab (e.g. Learn after clarifying). */
|
|
60
|
+
openShellOnTab: (tab: DeveloperToolPanelId) => void;
|
|
61
|
+
/** Close the floating developer-tools shell (e.g. when entering learn focus mode). */
|
|
62
|
+
closeShell: () => void;
|
|
54
63
|
}
|
|
55
|
-
export declare function useGuideDeveloperTools({ hooks, React, ReactDOM,
|
|
64
|
+
export declare function useGuideDeveloperTools({ hooks, React, ReactDOM, developerToolsSectionVisible, visualContextEnabled, visualContext, getDataChannelManager, propToolNames, zIndexDevTools, micPreset, protectedPlaybackActive, overlayConfig, playbackInterruptDebug, hasRespondedWithAudio, defaultMicLabel, handleApplyAudioConfig, logMicPresetToServer, handleTextSubmit, isConversationActive, isDataChannelOpen, isResponseActive, allMessages, workspaceWorkflows, sessionWorkflowIdForInitRef, conversationIdRef, getConversationManager, queueWorkflowSteerTitle, isDataChannelReady, ensureRealtimeSession, syncTranscriptFromStorage, learn, onLearnTabActivate, }: UseGuideDeveloperToolsParams): UseGuideDeveloperToolsResult;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MutableRefObject } from 'react';
|
|
3
|
+
import type { ZIndexConfig } from '../styles/GuideAI.styles.types';
|
|
4
|
+
import type { ReactHooks } from '../utils/reactHooks';
|
|
5
|
+
import type { GuideAIEnvironment } from '../types/GuideAI.types';
|
|
6
|
+
import { type UseGuideDeveloperToolsParams } from './useGuideDeveloperTools';
|
|
7
|
+
import type { ExtensionPortalAuthProp } from './devtoolsAuth/types';
|
|
8
|
+
import type { TranscriptDevtoolsMenuProps } from './transcriptDevtoolsMenuProps';
|
|
9
|
+
import type { RecordingStatus } from '../types/GuideAI.types';
|
|
10
|
+
import type { StubWorkspaceOption } from '../stubs/workspaces';
|
|
11
|
+
export type GuideDevtoolsShellParams = Omit<UseGuideDeveloperToolsParams, 'hooks' | 'React' | 'ReactDOM' | 'developerToolsSectionVisible' | 'zIndexDevTools' | 'learn'> & {
|
|
12
|
+
conversationKey: string;
|
|
13
|
+
/** Same path as transcript ⋯ → Reset chat (no confirm). */
|
|
14
|
+
performResetChat: () => void | Promise<void>;
|
|
15
|
+
transcriptSessionMode: string;
|
|
16
|
+
workspaceOptions: StubWorkspaceOption[];
|
|
17
|
+
widgetAuthWorkspace?: string;
|
|
18
|
+
hasInitializedRef: MutableRefObject<boolean>;
|
|
19
|
+
startConversationSession: () => Promise<boolean>;
|
|
20
|
+
setStatus: (status: RecordingStatus) => void;
|
|
21
|
+
setIsConversationActive: (active: boolean) => void;
|
|
22
|
+
onLearnFocusEnter?: () => void;
|
|
23
|
+
onLearnFocusExit?: () => void;
|
|
24
|
+
};
|
|
25
|
+
export type UseGuideDevtoolsIntegrationParams = {
|
|
26
|
+
hooks: ReactHooks;
|
|
27
|
+
React: typeof import('react');
|
|
28
|
+
ReactDOM?: UseGuideDeveloperToolsParams['ReactDOM'];
|
|
29
|
+
environment?: GuideAIEnvironment;
|
|
30
|
+
extensionPortalAuth?: ExtensionPortalAuthProp;
|
|
31
|
+
zIndexConfig: ZIndexConfig;
|
|
32
|
+
shell: GuideDevtoolsShellParams;
|
|
33
|
+
cleanupWebRTC: () => void;
|
|
34
|
+
handleToggleMute: () => void;
|
|
35
|
+
applyMicMuted: (muted: boolean) => void;
|
|
36
|
+
isMuted: boolean;
|
|
37
|
+
isAssistantPlaybackMuted: boolean;
|
|
38
|
+
handleToggleAssistantPlaybackMute: () => void;
|
|
39
|
+
recordingStatus: RecordingStatus;
|
|
40
|
+
isConnecting: boolean;
|
|
41
|
+
connectionMessage?: string | null;
|
|
42
|
+
hasMic: boolean;
|
|
43
|
+
/** Mic + transcript; hidden during learn focus. Receives transcript ⋯ menu props from integration. */
|
|
44
|
+
renderStandardEmbed: (transcriptDevtools: TranscriptDevtoolsMenuProps) => React.ReactNode;
|
|
45
|
+
};
|
|
46
|
+
export type UseGuideDevtoolsIntegrationResult = {
|
|
47
|
+
transcriptDevtools: TranscriptDevtoolsMenuProps;
|
|
48
|
+
embedChrome: React.ReactNode;
|
|
49
|
+
};
|
|
50
|
+
/** GuideAI entry: auth gate, developer tools shell, login modal, and transcript ⋯ menu wiring. */
|
|
51
|
+
export declare function useGuideDevtoolsIntegration({ hooks, React, ReactDOM, environment, extensionPortalAuth, zIndexConfig, shell, cleanupWebRTC, handleToggleMute, applyMicMuted, isMuted, isAssistantPlaybackMuted, handleToggleAssistantPlaybackMute, recordingStatus, isConnecting, connectionMessage, hasMic, renderStandardEmbed, }: UseGuideDevtoolsIntegrationParams): UseGuideDevtoolsIntegrationResult;
|
|
@@ -5,32 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Visual structure matches {@link AdminToolDiagnosticsPanel} (`guideai-atd-*` classes).
|
|
7
7
|
*/
|
|
8
|
-
import React
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export interface WorkflowTesterPanelProps {
|
|
13
|
-
zIndex: number;
|
|
14
|
-
visible: boolean;
|
|
15
|
-
onClose: () => void;
|
|
16
|
-
/** Same callback the transcript text input uses; gates on `isConversationActive` internally. */
|
|
17
|
-
handleTextSubmit: (text: string) => void | Promise<void>;
|
|
18
|
-
isConversationActive: boolean;
|
|
19
|
-
isDataChannelOpen: boolean;
|
|
20
|
-
isResponseActive: boolean;
|
|
21
|
-
allMessages: StoredMessage[];
|
|
22
|
-
ReactDOM?: {
|
|
23
|
-
createPortal?: (children: React.ReactNode, c: Element) => React.ReactNode;
|
|
24
|
-
};
|
|
25
|
-
/** Workflows for the active transcript workspace (used to pick the steer label for the session workflow id). */
|
|
26
|
-
workspaceWorkflows: StubWorkflowItem[];
|
|
27
|
-
/** Same ref as transcript chrome: focused workflow id for `/initialize`. */
|
|
28
|
-
sessionWorkflowIdForInitRef: MutableRefObject<string | null>;
|
|
29
|
-
getServerConversationId?: () => string | null;
|
|
30
|
-
/** Admin messages API markers (not transcript storage) when a server conversation exists. */
|
|
31
|
-
logWorkflowTesterSessionMarker?: (logdata: WorkflowTesterSessionLogdata) => void | Promise<void>;
|
|
32
|
-
/** Nested in {@link DeveloperToolsShell}: no portal, no floating title bar. */
|
|
33
|
-
embedded?: boolean;
|
|
34
|
-
}
|
|
35
|
-
declare const WorkflowTesterPanel: ({ zIndex, visible, onClose, handleTextSubmit, isConversationActive, isDataChannelOpen, isResponseActive, allMessages, ReactDOM, workspaceWorkflows, sessionWorkflowIdForInitRef, getServerConversationId, logWorkflowTesterSessionMarker, embedded, }: WorkflowTesterPanelProps) => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type { WorkflowTesterPanelProps } from './workflowTesterPanel.types';
|
|
10
|
+
export type { WorkflowTesterPanelProps } from './workflowTesterPanel.types';
|
|
11
|
+
declare const WorkflowTesterPanel: ({ zIndex, visible, onClose, handleTextSubmit, isConversationActive, isDataChannelOpen, isResponseActive, allMessages, ReactDOM, workspaceWorkflows, sessionWorkflowIdForInitRef, getServerConversationId, logWorkflowTesterSessionMarker, isDataChannelReady, ensureRealtimeSession, syncTranscriptFromStorage, embedded, }: WorkflowTesterPanelProps) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
36
12
|
export default WorkflowTesterPanel;
|
|
@@ -3,5 +3,4 @@
|
|
|
3
3
|
* Colocated under `devtools/` so a production-only build can drop this folder,
|
|
4
4
|
* the `WorkflowTesterPanel` import in `DeveloperTools.tsx`, and related props from `GuideAI.tsx`.
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export type { WorkflowTesterPanelProps } from './WorkflowTesterPanel';
|
|
6
|
+
export type { WorkflowTesterPanelProps } from './workflowTesterPanel.types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactHooks } from '../../utils/reactHooks';
|
|
2
|
+
import { type WorkflowSimulationControllerHost } from './workflowSimulationController';
|
|
3
|
+
export type UseWorkflowSimulationControllerParams = WorkflowSimulationControllerHost & {
|
|
4
|
+
hooks: ReactHooks;
|
|
5
|
+
};
|
|
6
|
+
export type UseWorkflowSimulationControllerResult = {
|
|
7
|
+
isDataChannelReady: () => boolean;
|
|
8
|
+
ensureRealtimeSession: () => Promise<boolean>;
|
|
9
|
+
shouldSkipConversationAutoRestore: () => boolean;
|
|
10
|
+
shouldKeepTranscriptOnInitFailure: () => boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function useWorkflowSimulationController({ hooks, ...host }: UseWorkflowSimulationControllerParams): UseWorkflowSimulationControllerResult;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { StoredMessage } from '../../utils/messageStorage';
|
|
3
|
+
import type { WorkflowTesterSessionLogdata } from '../../utils/conversationManager';
|
|
4
|
+
import type { StubWorkflowItem } from '../../stubs/workspaces';
|
|
5
|
+
import { type PendingWorkflowTesterRun } from './workflowTesterRunSessionStorage';
|
|
6
|
+
import { type TesterStatus, type WorkflowSimulationType } from './workflowSimulationTypes';
|
|
7
|
+
export type UseWorkflowSimulationRunParams = {
|
|
8
|
+
visible: boolean;
|
|
9
|
+
portalToken: string | null;
|
|
10
|
+
answersText: string;
|
|
11
|
+
simulationType: WorkflowSimulationType;
|
|
12
|
+
maxRounds: number | null;
|
|
13
|
+
selectedSimulationId: string | null;
|
|
14
|
+
targetWorkflowId: string | null;
|
|
15
|
+
workspaceWorkflows: StubWorkflowItem[];
|
|
16
|
+
sessionWorkflowIdForInitRef: MutableRefObject<string | null>;
|
|
17
|
+
allMessages: StoredMessage[];
|
|
18
|
+
isConversationActive: boolean;
|
|
19
|
+
isDataChannelOpen: boolean;
|
|
20
|
+
isResponseActive: boolean;
|
|
21
|
+
handleTextSubmit: (text: string) => void | Promise<void>;
|
|
22
|
+
isDataChannelReady?: () => boolean;
|
|
23
|
+
ensureRealtimeSession?: () => Promise<boolean>;
|
|
24
|
+
syncTranscriptFromStorage?: () => void;
|
|
25
|
+
getServerConversationId?: () => string | null;
|
|
26
|
+
logWorkflowTesterSessionMarker?: (logdata: WorkflowTesterSessionLogdata) => void | Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
export declare function useWorkflowSimulationRun({ visible, portalToken, answersText, simulationType, maxRounds, selectedSimulationId, targetWorkflowId, workspaceWorkflows, sessionWorkflowIdForInitRef, allMessages, isConversationActive, isDataChannelOpen, isResponseActive, handleTextSubmit, isDataChannelReady, ensureRealtimeSession, syncTranscriptFromStorage, getServerConversationId, logWorkflowTesterSessionMarker, }: UseWorkflowSimulationRunParams): {
|
|
29
|
+
status: TesterStatus;
|
|
30
|
+
statusLabel: Record<TesterStatus, string>;
|
|
31
|
+
errorMessage: string | null;
|
|
32
|
+
setErrorMessage: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
33
|
+
queueIndex: number;
|
|
34
|
+
queueTotal: number;
|
|
35
|
+
lastRunOutcome: string | null;
|
|
36
|
+
isRunning: boolean;
|
|
37
|
+
isAiPaused: boolean;
|
|
38
|
+
onWorkflowTesterStartStop: () => void;
|
|
39
|
+
stopWorkflowTester: () => void;
|
|
40
|
+
endWorkflowTester: () => Promise<void>;
|
|
41
|
+
resetRunFeedback: () => void;
|
|
42
|
+
prepareResumeFromPending: (pending: PendingWorkflowTesterRun) => void;
|
|
43
|
+
runWorkflowTester: (resume?: PendingWorkflowTesterRun) => Promise<void>;
|
|
44
|
+
stopRequestedRef: MutableRefObject<boolean>;
|
|
45
|
+
lastResumedRunIdRef: MutableRefObject<string | null>;
|
|
46
|
+
clearPendingOnPanelClose: () => void;
|
|
47
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { DataChannelManager } from '../../utils/dataChannel';
|
|
3
|
+
export type WorkflowSimulationControllerHost = {
|
|
4
|
+
conversationKey: string;
|
|
5
|
+
hasInitializedRef: MutableRefObject<boolean>;
|
|
6
|
+
isConversationActiveRef: MutableRefObject<boolean>;
|
|
7
|
+
hasAttemptedAutoStartRef: MutableRefObject<boolean>;
|
|
8
|
+
dataChannelManagerRef: MutableRefObject<DataChannelManager | null>;
|
|
9
|
+
toggleConversation: (force?: boolean) => Promise<void>;
|
|
10
|
+
syncMessagesFromStorage: () => void;
|
|
11
|
+
setShowTranscript: (show: boolean) => void;
|
|
12
|
+
setShowTextInput: (show: boolean) => void;
|
|
13
|
+
setIsResponseActive: (active: boolean) => void;
|
|
14
|
+
transcriptUiEnabled: boolean;
|
|
15
|
+
textInputUiEnabled: boolean;
|
|
16
|
+
};
|
|
17
|
+
/** Owns simulation session restore, deduping, and hot-path active checks for GuideAI. */
|
|
18
|
+
export declare class WorkflowSimulationController {
|
|
19
|
+
private getHost;
|
|
20
|
+
private sessionRestoreInFlight;
|
|
21
|
+
private pendingRestoreAttempted;
|
|
22
|
+
constructor(getHost: () => WorkflowSimulationControllerHost);
|
|
23
|
+
private host;
|
|
24
|
+
shouldSkipConversationAutoRestore(): boolean;
|
|
25
|
+
shouldKeepTranscriptOnInitFailure(): boolean;
|
|
26
|
+
isDataChannelReady(): boolean;
|
|
27
|
+
resetPendingRestoreForConversationKey(): void;
|
|
28
|
+
/** Call once after widget init when a pending simulation run exists in sessionStorage. */
|
|
29
|
+
maybeRestoreSessionOnMount(): void;
|
|
30
|
+
ensureRealtimeSession(): Promise<boolean>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { GuideAIEnvironment } from '../../types/GuideAI.types';
|
|
2
|
+
import type { WorkflowSimulationType } from './workflowSimulationTypes';
|
|
3
|
+
export type WorkflowSimulationListItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
simulationType: WorkflowSimulationType;
|
|
7
|
+
body: string;
|
|
8
|
+
passCriteria: string;
|
|
9
|
+
maxRounds: number | null;
|
|
10
|
+
sortOrder: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function fetchWorkflowSimulationsForDevtools(workflowId: string, token: string, environment?: GuideAIEnvironment): Promise<WorkflowSimulationListItem[]>;
|
|
13
|
+
export type GenerateWorkflowSimulationBodyForDevtoolsOptions = {
|
|
14
|
+
/** Optional scenario override (default: customer completes the RAW workflow). */
|
|
15
|
+
instructions?: string;
|
|
16
|
+
simulationType?: WorkflowSimulationType;
|
|
17
|
+
environment?: GuideAIEnvironment;
|
|
18
|
+
};
|
|
19
|
+
/** Generate simulation body for one RAW workflow from its prompt (server / Gemini). */
|
|
20
|
+
export declare function generateWorkflowSimulationBodyForDevtools(workflowId: string, token: string, options?: GenerateWorkflowSimulationBodyForDevtoolsOptions): Promise<string>;
|
|
21
|
+
export declare function generateWorkflowSimulationTurnForDevtools(workflowId: string, token: string, payload: {
|
|
22
|
+
instructions: string;
|
|
23
|
+
messages: Array<{
|
|
24
|
+
role: 'user' | 'assistant';
|
|
25
|
+
content: string;
|
|
26
|
+
}>;
|
|
27
|
+
}, environment?: GuideAIEnvironment): Promise<{
|
|
28
|
+
message: string;
|
|
29
|
+
shouldStop: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function saveWorkflowSimulationForDevtools(workflowId: string, token: string, payload: {
|
|
32
|
+
id?: string;
|
|
33
|
+
title: string;
|
|
34
|
+
simulationType?: WorkflowSimulationType;
|
|
35
|
+
body: string;
|
|
36
|
+
passCriteria: string;
|
|
37
|
+
maxRounds?: number | null;
|
|
38
|
+
}, environment?: GuideAIEnvironment): Promise<WorkflowSimulationListItem>;
|
|
39
|
+
export type FinishSimulationRunResult = {
|
|
40
|
+
workflowId: string;
|
|
41
|
+
assessedOutcome: 'pass' | 'fail';
|
|
42
|
+
judgeSummary: string | null;
|
|
43
|
+
mechanicalStatus: string;
|
|
44
|
+
};
|
|
45
|
+
export declare function finishWorkflowSimulationRunForDevtools(workflowId: string, token: string, payload: {
|
|
46
|
+
simulationId: string;
|
|
47
|
+
conversationId: string;
|
|
48
|
+
runId: string;
|
|
49
|
+
mechanicalStatus: 'finished' | 'stopped' | 'error';
|
|
50
|
+
failureReason?: string | null;
|
|
51
|
+
}, environment?: GuideAIEnvironment): Promise<FinishSimulationRunResult>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { WorkflowTesterSessionLogdata } from '../../utils/conversationManager';
|
|
3
|
+
import type { StubWorkflowItem } from '../../stubs/workspaces';
|
|
4
|
+
import { type PendingWorkflowTesterRun } from './workflowTesterRunSessionStorage';
|
|
5
|
+
import { type TesterStatus, type WorkflowSimulationType } from './workflowSimulationTypes';
|
|
6
|
+
import type { WorkflowSimulationWaits } from './workflowSimulationWaits';
|
|
7
|
+
export type WorkflowSimulationRunnerCallbacks = {
|
|
8
|
+
onStatus: (status: TesterStatus) => void;
|
|
9
|
+
onError: (message: string | null) => void;
|
|
10
|
+
onQueueProgress: (index: number, total: number) => void;
|
|
11
|
+
onLastRunOutcome: (message: string | null) => void;
|
|
12
|
+
};
|
|
13
|
+
export type WorkflowSimulationRunnerParams = {
|
|
14
|
+
resume?: PendingWorkflowTesterRun;
|
|
15
|
+
simulationType?: WorkflowSimulationType;
|
|
16
|
+
answersText: string;
|
|
17
|
+
/** AI simulations: customer actor instructions (body field). */
|
|
18
|
+
instructionsText?: string;
|
|
19
|
+
maxRounds?: number | null;
|
|
20
|
+
selectedSimulationId: string | null;
|
|
21
|
+
targetWorkflowId: string | null;
|
|
22
|
+
workspaceWorkflows: StubWorkflowItem[];
|
|
23
|
+
sessionWorkflowIdForInitRef: MutableRefObject<string | null>;
|
|
24
|
+
portalToken: string | null;
|
|
25
|
+
stopRequested: () => boolean;
|
|
26
|
+
runningRef: {
|
|
27
|
+
current: boolean;
|
|
28
|
+
};
|
|
29
|
+
lastResumedRunIdRef: {
|
|
30
|
+
current: string | null;
|
|
31
|
+
};
|
|
32
|
+
getMessages: () => import('../../utils/messageStorage').StoredMessage[];
|
|
33
|
+
isResponseActive: () => boolean;
|
|
34
|
+
isConversationActive: () => boolean;
|
|
35
|
+
isDataChannelOpen: () => boolean;
|
|
36
|
+
isDataChannelReady?: () => boolean;
|
|
37
|
+
handleTextSubmit: (text: string) => void | Promise<void>;
|
|
38
|
+
ensureRealtimeSession?: () => Promise<boolean>;
|
|
39
|
+
syncTranscriptFromStorage?: () => void;
|
|
40
|
+
getServerConversationId?: () => string | null;
|
|
41
|
+
enqueueWorkflowSteer: (label: string) => void;
|
|
42
|
+
logWorkflowTesterSessionMarker?: (logdata: WorkflowTesterSessionLogdata) => void | Promise<void>;
|
|
43
|
+
callbacks: WorkflowSimulationRunnerCallbacks;
|
|
44
|
+
waits: WorkflowSimulationWaits;
|
|
45
|
+
};
|
|
46
|
+
export declare function runWorkflowSimulation(params: WorkflowSimulationRunnerParams): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WorkflowSimulationRunnerParams } from './workflowSimulationRunner';
|
|
2
|
+
import { type PendingWorkflowTesterRun } from './workflowTesterRunSessionStorage';
|
|
3
|
+
import type { WorkflowSimulationRunnerCallbacks } from './workflowSimulationRunner';
|
|
4
|
+
export type EndAiWorkflowSimulationRunParams = {
|
|
5
|
+
pending: PendingWorkflowTesterRun;
|
|
6
|
+
portalToken: string;
|
|
7
|
+
getServerConversationId?: () => string | null;
|
|
8
|
+
logWorkflowTesterSessionMarker?: WorkflowSimulationRunnerParams['logWorkflowTesterSessionMarker'];
|
|
9
|
+
callbacks: Pick<WorkflowSimulationRunnerCallbacks, 'onStatus' | 'onLastRunOutcome' | 'onError'>;
|
|
10
|
+
lastResumedRunIdRef?: {
|
|
11
|
+
current: string | null;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/** Finalize a paused AI run: audit/judge when possible, then clear resumable pending state. */
|
|
15
|
+
export declare function endAiWorkflowSimulationRun(params: EndAiWorkflowSimulationRunParams): Promise<void>;
|
|
16
|
+
export type AiWorkflowSimulationRunnerParams = WorkflowSimulationRunnerParams & {
|
|
17
|
+
instructionsText: string;
|
|
18
|
+
maxRounds: number | null;
|
|
19
|
+
};
|
|
20
|
+
export declare function runAiWorkflowSimulation(params: AiWorkflowSimulationRunnerParams): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type RestoreWidgetRealtimeSessionParams = {
|
|
2
|
+
conversationKey: string;
|
|
3
|
+
hasInitialized: () => boolean;
|
|
4
|
+
isConversationActive: () => boolean;
|
|
5
|
+
isDataChannelOpen: () => boolean;
|
|
6
|
+
transcriptUiEnabled: boolean;
|
|
7
|
+
textInputUiEnabled: boolean;
|
|
8
|
+
hasAttemptedAutoStart: {
|
|
9
|
+
current: boolean;
|
|
10
|
+
};
|
|
11
|
+
syncMessagesFromStorage: () => void;
|
|
12
|
+
toggleConversation: (force?: boolean) => Promise<void>;
|
|
13
|
+
setShowTranscript: (show: boolean) => void;
|
|
14
|
+
setShowTextInput: (show: boolean) => void;
|
|
15
|
+
setIsResponseActive: (active: boolean) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Reconnect WebRTC after a mid-simulation page refresh (admin workflow tester only).
|
|
19
|
+
* Dedupes concurrent callers via {@link WorkflowSimulationController}.
|
|
20
|
+
*/
|
|
21
|
+
export declare function restoreWidgetRealtimeSession(params: RestoreWidgetRealtimeSessionParams): Promise<boolean>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StoredMessage } from '../../utils/messageStorage';
|
|
2
|
+
import type { StubWorkflowItem } from '../../stubs/workspaces';
|
|
3
|
+
export declare function parseSimulationAnswers(raw: string): string[];
|
|
4
|
+
export declare function newWorkflowSimulationRunId(): string;
|
|
5
|
+
export declare function resolveWorkflowStepLabelForSteer(workflows: StubWorkflowItem[], sessionWorkflowId: string | null): string | null;
|
|
6
|
+
export type AnswerTurnState = {
|
|
7
|
+
status: 'not_started';
|
|
8
|
+
} | {
|
|
9
|
+
status: 'awaiting_assistant';
|
|
10
|
+
humanTimestamp: number;
|
|
11
|
+
} | {
|
|
12
|
+
status: 'complete';
|
|
13
|
+
};
|
|
14
|
+
export declare function getAnswerTurnState(messages: StoredMessage[], answer: string, startedAt: number): AnswerTurnState;
|
|
15
|
+
export declare function findHumanAnswerMessage(messages: StoredMessage[], answer: string, startedAt: number): StoredMessage | null;
|
|
16
|
+
export declare function formatMessagesForAiCustomerTurn(messages: StoredMessage[], startedAt: number): Array<{
|
|
17
|
+
role: 'user' | 'assistant';
|
|
18
|
+
content: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function lastVisibleTranscriptMessage(messages: StoredMessage[] | undefined): StoredMessage | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type WorkflowSimulationType = 'SCRIPTED' | 'AI';
|
|
2
|
+
/** Default pass criteria for new AI simulations (custom tester + save draft). */
|
|
3
|
+
export declare const DEFAULT_WORKFLOW_SIMULATION_PASS_CRITERIA = "Evaluate the outcome of the interaction to determine whether the simulation succeeded or failed.";
|
|
4
|
+
/** Default scripted body: one cooperative customer line per assistant turn. */
|
|
5
|
+
export declare const DEFAULT_SCRIPTED_SIMULATION_BODY: string;
|
|
6
|
+
/** Default AI customer-actor instructions for custom/new simulations. */
|
|
7
|
+
export declare const DEFAULT_AI_SIMULATION_INSTRUCTIONS: string;
|
|
8
|
+
/** Placeholder hint for scripted body fields (not pre-filled). */
|
|
9
|
+
export declare const SCRIPTED_SIMULATION_BODY_PLACEHOLDER = "Hi \u2014 I'd like help with this.\nYes, please walk me through the steps.\nHere is the info you asked for.";
|
|
10
|
+
/** Placeholder hint for AI instruction fields (not pre-filled). */
|
|
11
|
+
export declare const AI_SIMULATION_INSTRUCTIONS_PLACEHOLDER = "Cooperative customer who completes the workflow. Use a frustrated tone on step 2 but still finish.";
|
|
12
|
+
export declare function defaultSimulationBodyForType(simulationType: WorkflowSimulationType): string;
|
|
13
|
+
/** Short label for the workflow tester Type column. */
|
|
14
|
+
export declare function workflowSimulationTypeDisplayLabel(simulationType: WorkflowSimulationType): string;
|
|
15
|
+
/** Short labels for the custom-mode Type dropdown. */
|
|
16
|
+
export declare function workflowSimulationTypePickerLabel(simulationType: WorkflowSimulationType): string;
|
|
17
|
+
/** Saved simulation option label in the picker (`(ai)` suffix for AI sims). */
|
|
18
|
+
export declare function workflowSimulationPickerOptionLabel(title: string, simulationType: WorkflowSimulationType): string;
|
|
19
|
+
export type TesterStatus = 'idle' | 'starting-workflow' | 'waiting-for-conversation' | 'sending' | 'awaiting-response' | 'generating-customer' | 'finished' | 'error' | 'stopped';
|
|
20
|
+
export declare const TESTER_STATUS_LABEL: Record<TesterStatus, string>;
|
|
21
|
+
export declare const ASSISTANT_RESPONSE_TIMEOUT_MS = 60000;
|
|
22
|
+
export declare const POST_RESPONSE_PAUSE_MS = 400;
|
|
23
|
+
export declare const STEER_QUEUE_YIELD_MS = 50;
|
|
24
|
+
export declare const DATA_CHANNEL_POLL_MS = 100;
|
|
25
|
+
export declare const CONDITION_POLL_MS = 200;
|
|
26
|
+
export declare const TESTER_WAIT_FAILSAFE_MS = 120000;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { StoredMessage } from '../../utils/messageStorage';
|
|
2
|
+
import { type TesterStatus } from './workflowSimulationTypes';
|
|
3
|
+
export type WorkflowSimulationWaitsDeps = {
|
|
4
|
+
stopRequested: () => boolean;
|
|
5
|
+
getMessages: () => StoredMessage[];
|
|
6
|
+
isResponseActive: () => boolean;
|
|
7
|
+
isDataChannelOpen: () => boolean;
|
|
8
|
+
isDataChannelReady?: () => boolean;
|
|
9
|
+
syncTranscriptFromStorage?: () => void;
|
|
10
|
+
onStatus: (status: TesterStatus) => void;
|
|
11
|
+
};
|
|
12
|
+
export type WorkflowSimulationWaits = ReturnType<typeof createWorkflowSimulationWaits>;
|
|
13
|
+
export declare function createWorkflowSimulationWaits(deps: WorkflowSimulationWaitsDeps): {
|
|
14
|
+
waitForCondition: (predicate: () => boolean, timeoutMs: number, pollMs?: number) => Promise<boolean>;
|
|
15
|
+
channelIsReady: () => boolean;
|
|
16
|
+
waitForSteerResponseCycle: () => Promise<{
|
|
17
|
+
ok: true;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
message: string;
|
|
21
|
+
}>;
|
|
22
|
+
waitForTranscriptRestored: () => Promise<{
|
|
23
|
+
ok: true;
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
message: string;
|
|
27
|
+
}>;
|
|
28
|
+
waitForTesterChannelReady: (options?: {
|
|
29
|
+
skipResponseIdle?: boolean;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
ok: true;
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
message: string;
|
|
35
|
+
}>;
|
|
36
|
+
waitForAssistantAfterHuman: (humanTimestamp: number) => Promise<{
|
|
37
|
+
ok: true;
|
|
38
|
+
} | {
|
|
39
|
+
ok: false;
|
|
40
|
+
message: string;
|
|
41
|
+
}>;
|
|
42
|
+
waitForAssistantSettled: (humanTimestamp: number) => Promise<{
|
|
43
|
+
ok: true;
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
message: string;
|
|
47
|
+
}>;
|
|
48
|
+
waitForUserAnswerInTranscript: (answer: string, startedAt: number) => Promise<{
|
|
49
|
+
ok: true;
|
|
50
|
+
human: StoredMessage;
|
|
51
|
+
} | {
|
|
52
|
+
ok: false;
|
|
53
|
+
message: string;
|
|
54
|
+
}>;
|
|
55
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { StoredMessage } from '../../utils/messageStorage';
|
|
3
|
+
import type { WorkflowTesterSessionLogdata } from '../../utils/conversationManager';
|
|
4
|
+
import type { StubWorkflowItem } from '../../stubs/workspaces';
|
|
5
|
+
export interface WorkflowTesterPanelProps {
|
|
6
|
+
zIndex: number;
|
|
7
|
+
visible: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
handleTextSubmit: (text: string) => void | Promise<void>;
|
|
10
|
+
isConversationActive: boolean;
|
|
11
|
+
isDataChannelOpen: boolean;
|
|
12
|
+
isResponseActive: boolean;
|
|
13
|
+
allMessages: StoredMessage[];
|
|
14
|
+
ReactDOM?: {
|
|
15
|
+
createPortal?: (children: React.ReactNode, c: Element) => React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
workspaceWorkflows: StubWorkflowItem[];
|
|
18
|
+
sessionWorkflowIdForInitRef: MutableRefObject<string | null>;
|
|
19
|
+
getServerConversationId?: () => string | null;
|
|
20
|
+
logWorkflowTesterSessionMarker?: (logdata: WorkflowTesterSessionLogdata) => void | Promise<void>;
|
|
21
|
+
isDataChannelReady?: () => boolean;
|
|
22
|
+
ensureRealtimeSession?: () => Promise<boolean>;
|
|
23
|
+
syncTranscriptFromStorage?: () => void;
|
|
24
|
+
embedded?: boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { DeveloperToolPanelId } from '../developerToolPanelId';
|
|
2
|
+
import type { WorkflowSimulationType } from './workflowSimulationTypes';
|
|
3
|
+
export type PendingWorkflowTesterRun = {
|
|
4
|
+
runId: string;
|
|
5
|
+
workflowId: string;
|
|
6
|
+
simulationId: string | null;
|
|
7
|
+
simulationType?: WorkflowSimulationType;
|
|
8
|
+
/** SCRIPTED: full answer queue (parsed lines). */
|
|
9
|
+
answersQueue?: string[];
|
|
10
|
+
/** SCRIPTED: index of the next line to send (0-based). */
|
|
11
|
+
queueIndex?: number;
|
|
12
|
+
/** AI: customer actor instructions. */
|
|
13
|
+
instructions?: string;
|
|
14
|
+
/** AI: completed user+assistant rounds. */
|
|
15
|
+
roundIndex?: number;
|
|
16
|
+
/** AI: optional cap (null/undefined = indefinite). */
|
|
17
|
+
maxRounds?: number | null;
|
|
18
|
+
/** Initial hidden workflow steer completed. */
|
|
19
|
+
steerDone: boolean;
|
|
20
|
+
/** Server conversation id when known (for audit finish-run). */
|
|
21
|
+
conversationId: string | null;
|
|
22
|
+
/** Ms since epoch — used to detect duplicate sends after reload. */
|
|
23
|
+
startedAt: number;
|
|
24
|
+
/** In-memory only: same-tab resume after Stop (not persisted to sessionStorage). */
|
|
25
|
+
resumeMode?: 'page' | 'pause';
|
|
26
|
+
};
|
|
27
|
+
export type DevtoolsShellSession = {
|
|
28
|
+
open: boolean;
|
|
29
|
+
activeTab: DeveloperToolPanelId;
|
|
30
|
+
};
|
|
31
|
+
export declare function getPendingWorkflowTesterRun(): PendingWorkflowTesterRun | null;
|
|
32
|
+
export declare function refreshSimulationActiveFlag(): void;
|
|
33
|
+
export declare function setSimulationActiveFlag(active: boolean): void;
|
|
34
|
+
export declare function isSimulationActive(): boolean;
|
|
35
|
+
/** True when sessionStorage has a resumable pending run (no side effects). */
|
|
36
|
+
export declare function hasPendingWorkflowTesterRun(): boolean;
|
|
37
|
+
export declare function setPendingWorkflowTesterRun(run: PendingWorkflowTesterRun): void;
|
|
38
|
+
export declare function clearPendingWorkflowTesterRun(): void;
|
|
39
|
+
export declare function getDevtoolsShellSession(): DevtoolsShellSession | null;
|
|
40
|
+
export declare function setDevtoolsShellSession(session: DevtoolsShellSession): void;
|
|
41
|
+
export declare function clearDevtoolsShellSession(): void;
|
|
42
|
+
/** User dismissed the workflow tester — do not auto-open or resume on the next page load. */
|
|
43
|
+
export declare function dismissWorkflowTesterAutoResume(): void;
|
|
@@ -2,11 +2,13 @@ import type { StubWorkspaceOption } from '../../stubs/workspaces';
|
|
|
2
2
|
export type WorkflowTesterWorkspaceBridgeSnapshot = {
|
|
3
3
|
transcriptSessionMode: string;
|
|
4
4
|
workspaceOptions: StubWorkspaceOption[];
|
|
5
|
+
/** Workflow row the user activated in the transcript drawer (null = none selected yet). */
|
|
6
|
+
focusedWorkflowId: string | null;
|
|
5
7
|
};
|
|
6
8
|
type Listener = () => void;
|
|
7
9
|
/**
|
|
8
|
-
* Transcript chrome keeps this in sync so {@link WorkflowTesterPanel} can read workspace slug
|
|
9
|
-
* catalog rows without extra props from `GuideAI`.
|
|
10
|
+
* Transcript chrome keeps this in sync so {@link WorkflowTesterPanel} can read workspace slug,
|
|
11
|
+
* drawer-focused workflow id, and catalog rows without extra props from `GuideAI`.
|
|
10
12
|
*/
|
|
11
13
|
export declare function setWorkflowTesterWorkspaceBridge(next: WorkflowTesterWorkspaceBridgeSnapshot | null): void;
|
|
12
14
|
export declare function getWorkflowTesterWorkspaceBridge(): WorkflowTesterWorkspaceBridgeSnapshot | null;
|
|
@@ -6,12 +6,22 @@ import type { DataChannelManager } from '../utils/dataChannel';
|
|
|
6
6
|
import type { UseVisualContextReturn } from '../visualContext/useVisualContext';
|
|
7
7
|
import type { StoredMessage } from '../utils/messageStorage';
|
|
8
8
|
import type { InitializeWebRTCCallOptions } from './useWebRTC';
|
|
9
|
+
export type EndConversationSessionOptions = {
|
|
10
|
+
/** When false, skip the post-session rating prompt (e.g. chat reset). Default true. */
|
|
11
|
+
promptRating?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type ConversationSessionEndedPayload = {
|
|
14
|
+
conversationId: string | null;
|
|
15
|
+
promptRating: boolean;
|
|
16
|
+
/** Wall-clock ms the mic session was active (mic on → mic off). */
|
|
17
|
+
sessionDurationMs: number;
|
|
18
|
+
};
|
|
9
19
|
export type UseConversationSessionParams = {
|
|
10
20
|
hooks: ReactHooks;
|
|
11
21
|
conversationKey: string;
|
|
12
22
|
keyTrim: string;
|
|
13
23
|
hasPortalAuth: boolean;
|
|
14
|
-
|
|
24
|
+
catalogFromApi: boolean;
|
|
15
25
|
widgetAuthWorkspace: string | undefined;
|
|
16
26
|
transcriptOptions: GuideAIProps['transcript'];
|
|
17
27
|
inputOptions: GuideAIProps['input'];
|
|
@@ -57,11 +67,13 @@ export type UseConversationSessionParams = {
|
|
|
57
67
|
resetNoisySuggestForChatReset: () => void;
|
|
58
68
|
/** Runs at the start of `endConversationSession` (toolbar X, errors, reset chat, etc.). */
|
|
59
69
|
onBeforeEndConversationSession?: () => void;
|
|
70
|
+
conversationIdRef: MutableRefObject<string | null>;
|
|
71
|
+
onConversationSessionEnded?: (payload: ConversationSessionEndedPayload) => void;
|
|
60
72
|
};
|
|
61
73
|
export declare function useConversationSession(params: UseConversationSessionParams): {
|
|
62
74
|
startConversationSession: () => Promise<boolean>;
|
|
63
75
|
reestablishActiveRealtimeSession: (callOptions?: InitializeWebRTCCallOptions) => Promise<boolean>;
|
|
64
|
-
endConversationSession: () => void;
|
|
76
|
+
endConversationSession: (options?: EndConversationSessionOptions) => void;
|
|
65
77
|
toggleConversation: (force?: boolean) => Promise<void>;
|
|
66
78
|
handleToggleConversation: () => Promise<void>;
|
|
67
79
|
handleResetChat: () => Promise<void>;
|