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.
Files changed (146) hide show
  1. package/README.md +179 -80
  2. package/dist/GuideAI.d.ts +1 -1
  3. package/dist/GuideAI.js +1 -1
  4. package/dist/GuideAI.js.LICENSE.txt +7 -0
  5. package/dist/GuideAI.js.map +1 -1
  6. package/dist/__mocks__/fileMock.d.ts +2 -0
  7. package/dist/components/AudioConfigDialog.d.ts +22 -0
  8. package/dist/components/DeveloperTools.d.ts +36 -0
  9. package/dist/components/MicGlyphs.d.ts +9 -0
  10. package/dist/components/Microphone.d.ts +4 -2
  11. package/dist/components/NoisyPresetSuggestBanner.d.ts +12 -0
  12. package/dist/components/PlaybackInterruptLockDebugOverlay.d.ts +19 -0
  13. package/dist/components/PlaybackLockDebugOverlayRoot.d.ts +14 -0
  14. package/dist/components/ResetGlyph.d.ts +5 -0
  15. package/dist/components/SpeakerGlyphs.d.ts +9 -0
  16. package/dist/components/TranscriptBox.d.ts +65 -8
  17. package/dist/components/TranscriptMessages.d.ts +8 -1
  18. package/dist/components/TranscriptTextInput.d.ts +41 -2
  19. package/dist/components/TranscriptToolbar.d.ts +23 -0
  20. package/dist/components/TranscriptWorkflowDrawer.d.ts +39 -0
  21. package/dist/components/WelcomeBubble.d.ts +6 -1
  22. package/dist/components/WorkspaceStubIcon.d.ts +6 -0
  23. package/dist/contexts/AdminToolDiagnosticsContext.d.ts +6 -0
  24. package/dist/devtools/adminToolDiagnostics/AdminToolDiagnosticsPanel.d.ts +16 -0
  25. package/dist/devtools/adminToolDiagnostics/adminToolDiagnosticsPanelUtils.d.ts +8 -0
  26. package/dist/devtools/adminToolDiagnostics/adminToolDiagnosticsStyles.d.ts +5 -0
  27. package/dist/devtools/adminToolDiagnostics/buildDiagnosticsToolNameList.d.ts +6 -0
  28. package/dist/devtools/adminToolDiagnostics/getIdOrFallbackSelectorForDiagnostics.d.ts +5 -0
  29. package/dist/devtools/adminToolDiagnostics/index.d.ts +2 -0
  30. package/dist/devtools/useDraggableDialog.d.ts +23 -0
  31. package/dist/devtools/visualContextInspector/BufferIndicator.d.ts +15 -0
  32. package/dist/devtools/visualContextInspector/ConfigSection.d.ts +18 -0
  33. package/dist/devtools/visualContextInspector/ScreenshotList.d.ts +13 -0
  34. package/dist/devtools/visualContextInspector/VisualContextInspector.d.ts +36 -0
  35. package/dist/devtools/visualContextInspector/fieldInfo.d.ts +7 -0
  36. package/dist/devtools/visualContextInspector/index.d.ts +13 -0
  37. package/dist/devtools/visualContextInspector/inspectorStore.d.ts +35 -0
  38. package/dist/devtools/visualContextInspector/inspectorStyles.d.ts +13 -0
  39. package/dist/devtools/visualContextInspector/types.d.ts +27 -0
  40. package/dist/hooks/index.d.ts +6 -0
  41. package/dist/hooks/useAssistantPlaybackMute.d.ts +16 -0
  42. package/dist/hooks/useAudioConfigSurface.d.ts +20 -0
  43. package/dist/hooks/useConversationSession.d.ts +69 -0
  44. package/dist/hooks/useDocToFormDropFlow.d.ts +31 -0
  45. package/dist/hooks/useGuideAIAPI.d.ts +3 -6
  46. package/dist/hooks/useGuideAILayout.d.ts +38 -0
  47. package/dist/hooks/useGuideAILocalStorageSync.d.ts +17 -0
  48. package/dist/hooks/useHiddenRealtimeSteers.d.ts +22 -0
  49. package/dist/hooks/useMicMute.d.ts +20 -0
  50. package/dist/hooks/useMicPreset.d.ts +19 -0
  51. package/dist/hooks/useMicPromptHook.d.ts +28 -0
  52. package/dist/hooks/useNoisyPresetSuggest.d.ts +19 -0
  53. package/dist/hooks/usePlaybackLockDebugOverlay.d.ts +12 -0
  54. package/dist/hooks/useProtectedPlayback.d.ts +36 -0
  55. package/dist/hooks/useTranscriptChrome.d.ts +39 -0
  56. package/dist/hooks/useTranscriptState.d.ts +1 -1
  57. package/dist/hooks/useWebRTC.d.ts +41 -6
  58. package/dist/hooks/useWidgetWorkflowSession.d.ts +35 -0
  59. package/dist/hooks/useWorkspaceCatalog.d.ts +32 -0
  60. package/dist/index.d.ts +6 -1
  61. package/dist/lib/workspaceEmbedIcons.d.ts +57 -0
  62. package/dist/micPrompt.defaults.d.ts +25 -0
  63. package/dist/playwrightToolHarness.d.ts +8 -0
  64. package/dist/playwrightToolHarness.js +3 -0
  65. package/dist/playwrightToolHarness.js.LICENSE.txt +16 -0
  66. package/dist/playwrightToolHarness.js.map +1 -0
  67. package/dist/staticContext/collectContext.d.ts +28 -0
  68. package/dist/staticContext/index.d.ts +8 -0
  69. package/dist/staticContext/types.d.ts +176 -0
  70. package/dist/staticContext/useStaticContext.d.ts +32 -0
  71. package/dist/stubs/workspaces.d.ts +36 -0
  72. package/dist/styles/GuideAI.styles.d.ts +2 -6
  73. package/dist/styles/GuideAI.styles.types.d.ts +6 -0
  74. package/dist/styles/guideAIStylesCore.d.ts +2 -0
  75. package/dist/styles/guideAIStylesDialogs.d.ts +2 -0
  76. package/dist/styles/guideAIStylesMicPrompt.d.ts +2 -0
  77. package/dist/styles/guideAIStylesTranscript.d.ts +2 -0
  78. package/dist/types/GuideAI.types.d.ts +63 -2
  79. package/dist/types/audioConfig.types.d.ts +78 -0
  80. package/dist/utils/api.d.ts +61 -15
  81. package/dist/utils/confettiBurst.d.ts +6 -0
  82. package/dist/utils/constants.d.ts +7 -1
  83. package/dist/utils/conversationManager.d.ts +20 -2
  84. package/dist/utils/dataChannel.d.ts +56 -6
  85. package/dist/utils/dataChannelHelpers.d.ts +28 -0
  86. package/dist/utils/dataTransferHasFiles.d.ts +2 -0
  87. package/dist/utils/date.d.ts +11 -0
  88. package/dist/utils/embedConversationNamespace.d.ts +10 -0
  89. package/dist/utils/isMobileBrowser.d.ts +5 -0
  90. package/dist/utils/lastSystemToolCall.d.ts +6 -0
  91. package/dist/utils/localStorageHelper.d.ts +84 -0
  92. package/dist/utils/logger.d.ts +17 -20
  93. package/dist/utils/messageStorage.d.ts +16 -11
  94. package/dist/utils/micPromptThrottle.d.ts +13 -0
  95. package/dist/utils/positionUtils.d.ts +8 -7
  96. package/dist/utils/reactHooks.d.ts +14 -0
  97. package/dist/utils/reducedMotion.d.ts +17 -0
  98. package/dist/utils/tools/back.d.ts +19 -0
  99. package/dist/utils/tools/clickElement.d.ts +32 -0
  100. package/dist/utils/tools/cssPathForElement.d.ts +2 -0
  101. package/dist/utils/tools/descriptionToHighlightSelector.d.ts +2 -0
  102. package/dist/utils/tools/docToForm.d.ts +54 -0
  103. package/dist/utils/tools/docUploadPrompt.d.ts +11 -0
  104. package/dist/utils/tools/elementInteractions.d.ts +40 -0
  105. package/dist/utils/tools/fillField.d.ts +41 -0
  106. package/dist/utils/tools/fillForm.d.ts +49 -0
  107. package/dist/utils/tools/goToAElmLink.d.ts +27 -0
  108. package/dist/utils/tools/highlight.d.ts +23 -0
  109. package/dist/utils/tools/highlightThenClick.d.ts +31 -0
  110. package/dist/utils/tools/hover.d.ts +23 -0
  111. package/dist/utils/tools/hoverThenClick.d.ts +37 -0
  112. package/dist/utils/tools/markWorkflowComplete.d.ts +18 -0
  113. package/dist/utils/tools/navigateTo.d.ts +23 -0
  114. package/dist/utils/tools/refresh.d.ts +19 -0
  115. package/dist/utils/tools/sampleToolArgsJson.d.ts +1 -0
  116. package/dist/utils/tools/scroll.d.ts +32 -0
  117. package/dist/utils/tools/toolRegistry.d.ts +55 -0
  118. package/dist/utils/tools/workflowToolBridge.d.ts +15 -0
  119. package/dist/utils/webrtcConnection.d.ts +9 -2
  120. package/dist/utils/widgetAuthStore.d.ts +9 -0
  121. package/dist/utils/widgetBearerStorage.d.ts +26 -0
  122. package/dist/utils/widgetSession.d.ts +20 -0
  123. package/dist/utils/widgetWorkspaces.d.ts +10 -0
  124. package/dist/utils/workflowSteer.d.ts +6 -0
  125. package/dist/utils/workspaceCatalog.d.ts +24 -0
  126. package/dist/visualContext/VisualContextScheduler.d.ts +48 -2
  127. package/dist/visualContext/domChangeTracker.d.ts +29 -0
  128. package/dist/visualContext/imageHash.d.ts +19 -0
  129. package/dist/visualContext/index.d.ts +3 -3
  130. package/dist/visualContext/types.d.ts +48 -2
  131. package/dist/visualContext/useVisualContext.d.ts +23 -8
  132. package/package.json +3 -1
  133. package/dist/components/AnimatedSettingsItem.d.ts +0 -9
  134. package/dist/components/MuteButton.d.ts +0 -11
  135. package/dist/components/ResetButton.d.ts +0 -9
  136. package/dist/components/SettingsMenu.d.ts +0 -16
  137. package/dist/components/SettingsToggle.d.ts +0 -7
  138. package/dist/components/TranscriptToggle.d.ts +0 -7
  139. package/dist/utils/elementInteractions.d.ts +0 -127
  140. package/dist/utils/goToAElmLink.d.ts +0 -1
  141. package/dist/utils/highlightThenClick.d.ts +0 -2
  142. package/dist/utils/hover.d.ts +0 -2
  143. package/dist/utils/hoverThenClick.d.ts +0 -2
  144. package/dist/utils/toolRegistry.d.ts +0 -33
  145. package/dist/utils/workflow.d.ts +0 -62
  146. package/dist/visualContext/debug-overlay.d.ts +0 -10
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Pure DOM collectors for the Static Context blob. No DOM mutation, no
3
+ * network, no React. Exists in its own module so the hook can dedup against
4
+ * a stable hash of the result.
5
+ */
6
+ import { SpaRouteSnapshot, StaticContextIncludeFlags, StaticContextPayload, StaticContextTrigger } from './types';
7
+ export interface CollectStaticContextOptions {
8
+ trigger: StaticContextTrigger;
9
+ rebuild: boolean;
10
+ include?: StaticContextIncludeFlags;
11
+ scrollBucketPx?: number;
12
+ spaRoute?: SpaRouteSnapshot;
13
+ includeRouterState?: boolean;
14
+ }
15
+ /**
16
+ * Collect a fresh static-context payload from the live DOM. Cheap enough to
17
+ * call on every heartbeat / activity tick — the dedup hash is computed by
18
+ * the caller after this returns.
19
+ */
20
+ export declare function collectStaticPageContext(opts: CollectStaticContextOptions): StaticContextPayload;
21
+ /**
22
+ * Stable hash of the fields whose change should trigger a fresh send.
23
+ * Operational metadata (`trigger`, `rebuild`, `capturedAt`) is excluded so the
24
+ * heartbeat cannot send the same blob over and over.
25
+ */
26
+ export declare function hashStaticContextPayload(payload: StaticContextPayload): string;
27
+ /** Format a payload for the realtime model — short tag + JSON body. */
28
+ export declare function formatStaticContextForModel(payload: StaticContextPayload): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Static Context module — pushes a structured page-metadata blob to the
3
+ * realtime model alongside Visual Context's screenshot pipeline.
4
+ */
5
+ export { useStaticContext } from './useStaticContext';
6
+ export { collectStaticPageContext, formatStaticContextForModel, hashStaticContextPayload, } from './collectContext';
7
+ export type { StaticContextConfig, StaticContextPayload, StaticContextTrigger, StaticContextLocation, StaticContextIncludeFlags, StaticDialogContext, StaticFocusedControl, SpaRouteSnapshot, PageActivityDetail, PageActivityKind, } from './types';
8
+ export { PAGE_ACTIVITY_EVENT, STATIC_CONTEXT_SCHEMA_VERSION } from './types';
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Type definitions for the Static Context module.
3
+ *
4
+ * Static Context sends a structured page-metadata blob to the realtime model
5
+ * alongside the Visual Context screenshot pipeline. See `docs/STATIC_CONTEXT.md`
6
+ * (or the inline header in `useStaticContext.ts`) for the full design.
7
+ */
8
+ export declare const STATIC_CONTEXT_SCHEMA_VERSION = 1;
9
+ /** Why a static-context send was triggered. Aligned with the VC trigger taxonomy. */
10
+ export type StaticContextTrigger = 'initial' | 'heartbeat' | 'navigation' | 'dom_update' | 'tool_batch' | 'pointer';
11
+ /**
12
+ * Optional declarative SPA route snapshot the embedder fills from React Router
13
+ * (or any other router) — the package does **not** depend on `react-router`.
14
+ *
15
+ * Keep all values plain JSON-serializable; the package merges this object into
16
+ * the static-context blob under the fixed key `spaRoute`.
17
+ */
18
+ export interface SpaRouteSnapshot {
19
+ pathname?: string;
20
+ search?: string;
21
+ hash?: string;
22
+ key?: string;
23
+ params?: Record<string, string>;
24
+ /** Matched pattern string when the host wants to pass it (e.g. `/users/:id`). */
25
+ pathnamePattern?: string;
26
+ /**
27
+ * `location.state` from React Router. Surfaced in the blob only when
28
+ * `staticContext.includeRouterState === true` and only if shallow + JSON-safe
29
+ * within the size cap (see `useStaticContext`).
30
+ */
31
+ state?: unknown;
32
+ }
33
+ /**
34
+ * Bucketed opt-ins for fields the host can include in the blob. v1 ships
35
+ * conservative defaults; richer presets can be layered in later.
36
+ */
37
+ export interface StaticContextIncludeFlags {
38
+ /** First 1–3 visible headings (h1–h3) inside main content. Default `true`. */
39
+ headings?: boolean;
40
+ /** Landmark roles in document order (`main`, `nav`, etc.). Default `false`. */
41
+ landmarks?: boolean;
42
+ /** Viewport size + document scroll height. Default `false`. */
43
+ viewport?: boolean;
44
+ /** Scroll band (bucketed per `scrollBucketPx`). Default `false`. */
45
+ scrollPosition?: boolean;
46
+ /** Currently-focused form control metadata (no values). Default `true`. */
47
+ focusedControl?: boolean;
48
+ /** Open dialog / `aria-modal` snippet. Default `true`. */
49
+ dialog?: boolean;
50
+ /** `og:title` / `og:type` / `twitter:title`. Default `false`. */
51
+ media?: boolean;
52
+ /** `lang`, `timezone`, `colorScheme`. Default `false`. */
53
+ tech?: boolean;
54
+ /** `utm_*` keys parsed from `location.search`. Default `false`. */
55
+ utm?: boolean;
56
+ }
57
+ export interface StaticContextConfig {
58
+ /** Master switch. Default `true` — runs whenever a conversation is active. */
59
+ enabled?: boolean;
60
+ /**
61
+ * Heartbeat send interval. Static text is small but still costs tokens, so the
62
+ * default heartbeat is meaningfully longer than VC's screenshot heartbeat.
63
+ * Default 12 000 ms (per plan's 8–15s range).
64
+ */
65
+ heartbeatMs?: number;
66
+ /**
67
+ * Minimum elapsed time between non-urgent sends (ms). Default 8000 — keeps
68
+ * static off the same tick as VC heartbeats so we do not double up.
69
+ */
70
+ minIntervalMs?: number;
71
+ /**
72
+ * Minimum elapsed time between urgent sends (ms). Aligns with VC's default
73
+ * (1200) so navigation / pointer / tool_batch share the same floor.
74
+ */
75
+ urgentMinIntervalMs?: number;
76
+ /** Send a `static_context` immediately on conversation start. Default `true`. */
77
+ captureOnLoad?: boolean;
78
+ /** Send a `static_context` after each assistant tool batch completes. Default `true`. */
79
+ captureAfterTools?: boolean;
80
+ /** Listen for debounced pointer/click and treat as urgent. Default `true`. */
81
+ pointerTriggersStaticContext?: boolean;
82
+ /** Pointer debounce window (ms). Default 300. */
83
+ pointerDebounceMs?: number;
84
+ /** Per-bucket toggles for richer DOM fields. */
85
+ include?: StaticContextIncludeFlags;
86
+ /** Width of scroll-position buckets in pixels (only used when `include.scrollPosition === true`). Default 200. */
87
+ scrollBucketPx?: number;
88
+ /**
89
+ * Optional declarative SPA route snapshot. The package never imports
90
+ * `react-router`; the host passes this in from `useLocation()` etc.
91
+ */
92
+ spaRoute?: SpaRouteSnapshot;
93
+ /**
94
+ * Surface `spaRoute.state` on the blob when present. Default `false` —
95
+ * router state can carry app-level data we have not vetted; keep it opt-in.
96
+ */
97
+ includeRouterState?: boolean;
98
+ }
99
+ /**
100
+ * Lightweight focused-control snapshot — no values, only structural identifiers.
101
+ * Excludes `<input value>`, selected option text, contenteditable text, password
102
+ * inputs, and inputs whose `autocomplete` looks like a card / sensitive field.
103
+ */
104
+ export interface StaticFocusedControl {
105
+ tag: string;
106
+ type?: string;
107
+ id?: string;
108
+ name?: string;
109
+ role?: string;
110
+ ariaLabel?: string;
111
+ placeholder?: string;
112
+ autocomplete?: string;
113
+ }
114
+ export interface StaticDialogContext {
115
+ role: string;
116
+ heading?: string;
117
+ ariaLabel?: string;
118
+ }
119
+ export interface StaticContextLocation {
120
+ href: string;
121
+ pathname?: string;
122
+ search?: string;
123
+ hash?: string;
124
+ host?: string;
125
+ origin?: string;
126
+ }
127
+ export interface StaticContextPayload {
128
+ schemaVersion: number;
129
+ trigger: StaticContextTrigger;
130
+ rebuild: boolean;
131
+ capturedAt: string;
132
+ location: StaticContextLocation;
133
+ title?: string;
134
+ description?: string;
135
+ lang?: string;
136
+ canonical?: string;
137
+ headings?: string[];
138
+ landmarks?: string[];
139
+ viewport?: {
140
+ w: number;
141
+ h: number;
142
+ scrollHeight?: number;
143
+ };
144
+ scroll?: {
145
+ yBucket: number;
146
+ bucketSize: number;
147
+ };
148
+ focusedControl?: StaticFocusedControl;
149
+ dialog?: StaticDialogContext;
150
+ media?: {
151
+ ogTitle?: string;
152
+ ogType?: string;
153
+ twitterTitle?: string;
154
+ };
155
+ tech?: {
156
+ lang?: string;
157
+ timezone?: string;
158
+ locale?: string;
159
+ colorScheme?: string;
160
+ };
161
+ utm?: Record<string, string>;
162
+ spaRoute?: SpaRouteSnapshot;
163
+ }
164
+ /**
165
+ * Window-level CustomEvent dispatched by Visual Context's `domChangeTracker`
166
+ * (or by `useStaticContext`'s fallback tracker when VC is disabled). Listeners
167
+ * inside the package consume it to drive non-VC pipelines (currently just
168
+ * static context). Keeps us at one MutationObserver / scroll / nav listener
169
+ * stack across both subsystems.
170
+ */
171
+ export type PageActivityKind = 'navigation' | 'scroll' | 'dom_burst';
172
+ export interface PageActivityDetail {
173
+ kind: PageActivityKind;
174
+ timestamp: number;
175
+ }
176
+ export declare const PAGE_ACTIVITY_EVENT = "guideai:page-activity";
@@ -0,0 +1,32 @@
1
+ /**
2
+ * useStaticContext — companion to `useVisualContext` that pushes a structured
3
+ * page-metadata blob (URL / title / description / DOM signals) to the realtime
4
+ * model and logs each send through the conversation messages API.
5
+ *
6
+ * Design highlights:
7
+ * - **No `response.create`**: items are sent as `conversation.item.create`
8
+ * only, identical to how VC delivers screenshots. The model uses them as
9
+ * background context on the next natural turn — no surprise TTS reply,
10
+ * no separate transcript line.
11
+ * - **Single observer**: when Visual Context is enabled it owns the only
12
+ * `domChangeTracker`; this hook just listens for the
13
+ * `guideai:page-activity` events VC re-broadcasts. When VC is disabled
14
+ * this hook spins up its own minimal tracker so we never run two.
15
+ * - **Looser send gate than VC**: any active conversation may send static
16
+ * context, including `idle` / `playing` statuses. VC rules are unchanged.
17
+ */
18
+ import { StaticContextConfig, StaticContextPayload } from './types';
19
+ export type StaticContextRecordingStatus = 'idle' | 'recording' | 'active' | 'processing' | 'playing';
20
+ export interface UseStaticContextParams {
21
+ options?: StaticContextConfig;
22
+ /** Whether Visual Context is also enabled. When `true`, VC owns the
23
+ * `domChangeTracker`; this hook listens to its `guideai:page-activity`
24
+ * events instead of starting its own. */
25
+ visualContextEnabled: boolean;
26
+ sendMessage: (msg: any) => void;
27
+ isDataChannelOpen: () => boolean;
28
+ isConversationActive: boolean;
29
+ getContainer: () => HTMLElement | null;
30
+ onLogStaticContext: (content: string, payload: StaticContextPayload) => void;
31
+ }
32
+ export declare function useStaticContext(React: typeof import('react'), params: UseStaticContextParams): void;
@@ -0,0 +1,36 @@
1
+ /** Icon id: same set as admin embed config (`lib/workspaceEmbedIcons`). */
2
+ export type WorkspaceIconId = string;
3
+ export interface StubWorkspaceOption {
4
+ /** Workspace slug (stub modes use onboarding | training | doIt). */
5
+ id: string;
6
+ label: string;
7
+ icon: WorkspaceIconId;
8
+ /** Shown under the selector pill and in the workflow drawer header (stub until server-driven). */
9
+ description: string;
10
+ /**
11
+ * When true, the workflow drawer shows per-step checkboxes and the transcript toolbar shows
12
+ * completion progress (e.g. 4/16). Other workspaces list steps as links only.
13
+ * Future: drive from API / workspace config.
14
+ */
15
+ workflowChecklistEnabled?: boolean;
16
+ /**
17
+ * When false, checklist completion does not trigger confetti. Omitted defaults to true (stub only).
18
+ * Future: API workspace config.
19
+ */
20
+ workflowConfettiEnabled?: boolean;
21
+ /** API: when true, initialize always sends full rollup instructions (ignore per-workflow session selection). */
22
+ rollupWorkflows?: boolean;
23
+ }
24
+ /**
25
+ * Sentinel until `/widget/workspaces` returns. Must not match a real workspace slug or stub ids
26
+ * (`onboarding`, `training`, `doIt`).
27
+ */
28
+ export declare const API_WORKSPACE_LOADING_ID = "__guideai_workspace_loading__";
29
+ /** Placeholder row while the workspace catalog request is in flight (API data source). */
30
+ export declare function getApiPlaceholderWorkspaceOptions(): StubWorkspaceOption[];
31
+ export interface StubWorkflowItem {
32
+ id: string;
33
+ label: string;
34
+ }
35
+ export declare function getStubWorkspaceOptions(): StubWorkspaceOption[];
36
+ export declare function getStubWorkflowsForWorkspace(workspaceId: string): StubWorkflowItem[];
@@ -1,7 +1,3 @@
1
- export interface ZIndexConfig {
2
- main: number;
3
- transcript: number;
4
- microphone: number;
5
- onboarding: number;
6
- }
1
+ export type { ZIndexConfig } from './GuideAI.styles.types';
2
+ import type { ZIndexConfig } from './GuideAI.styles.types';
7
3
  export declare const guideAIStyles: (zIndexConfig: ZIndexConfig) => string;
@@ -0,0 +1,6 @@
1
+ export interface ZIndexConfig {
2
+ main: number;
3
+ transcript: number;
4
+ microphone: number;
5
+ onboarding: number;
6
+ }
@@ -0,0 +1,2 @@
1
+ import type { ZIndexConfig } from './GuideAI.styles.types';
2
+ export declare const guideAIStylesCore: (zIndexConfig: ZIndexConfig) => string;
@@ -0,0 +1,2 @@
1
+ import type { ZIndexConfig } from './GuideAI.styles.types';
2
+ export declare const guideAIStylesDialogs: (zIndexConfig: ZIndexConfig) => string;
@@ -0,0 +1,2 @@
1
+ /** Mic prompt idle CTA: tooltip enter/exit, elongate pill, bubble + icon attention variants, reduced-motion overrides. */
2
+ export declare const guideAIStylesMicPrompt: () => string;
@@ -0,0 +1,2 @@
1
+ import type { ZIndexConfig } from './GuideAI.styles.types';
2
+ export declare const guideAIStylesTranscript: (zIndexConfig: ZIndexConfig) => string;
@@ -1,4 +1,5 @@
1
1
  import { VisualContextConfig } from '../visualContext/types';
2
+ import { StaticContextConfig } from '../staticContext/types';
2
3
  export type RecordingStatus = 'idle' | 'recording' | 'active' | 'processing' | 'playing';
3
4
  export type UseStateHook = <T>(initialState: T | (() => T)) => [T, (value: T | ((prev: T) => T)) => void];
4
5
  export type UseEffectHook = (effect: () => void | (() => void), deps?: any[]) => void;
@@ -7,6 +8,19 @@ export type UseRefHook = <T>(initialValue: T) => {
7
8
  };
8
9
  export type UseCallbackHook = <T extends (...args: any[]) => any>(callback: T, deps: any[]) => T;
9
10
  export type GuideAIEnvironment = 'development' | 'production' | 'local';
11
+ /** CSS-driven mic CTA animation ids. Keyframes live in `styles/guideAIStylesMicPrompt.ts`. */
12
+ export declare const MIC_PROMPT_ANIMATION_IDS: readonly ["pulseRing", "bounceNudge", "shimmerGlow", "ribbonPeel", "softWobble", "glowHalo", "stampDrop", "orbitDot", "slideStack", "driftLift", "rippleEcho", "twinklePulse", "sidestepNudge", "magnetPulse", "cornerGlow", "flutterTilt", "depthTap", "auroraSheen", "tickRock", "elongateExpand", "elongateBurst", "elongateSlideReveal", "elongateShadowStack"];
13
+ export type MicPromptAnimationId = (typeof MIC_PROMPT_ANIMATION_IDS)[number];
14
+ /** Pill-style prompts: message inside expanding mic shell (see elongate CSS variants). */
15
+ export declare const MIC_PROMPT_PILL_EXPAND_IDS: readonly ["elongateExpand", "elongateBurst", "elongateSlideReveal", "elongateShadowStack"];
16
+ export type MicPromptPillExpandId = (typeof MIC_PROMPT_PILL_EXPAND_IDS)[number];
17
+ export declare function isMicPromptPillExpand(id: MicPromptAnimationId): id is MicPromptPillExpandId;
18
+ /**
19
+ * CSS modifier class applied alongside `guideai-mic-elongate` for each pill-expand variant.
20
+ * Empty string = base elongate class only. Declaring every variant here keeps new pill ids from
21
+ * silently falling back to the base look.
22
+ */
23
+ export declare const MIC_PROMPT_PILL_EXPAND_MODIFIERS: Record<MicPromptPillExpandId, string>;
10
24
  export type GuideAIPosition = {
11
25
  top?: string;
12
26
  right?: string;
@@ -21,8 +35,32 @@ export type GuideAIPosition = {
21
35
  };
22
36
  export type MicButtonPosition = GuideAIPosition;
23
37
  export interface GuideAIProps {
24
- organizationKey: string;
25
- workflowKey?: string;
38
+ /**
39
+ * Access key for widget auth (memory only; sent only on `POST /widget/session`). Use with optional `workspace`.
40
+ * Requires `authKey`, or `widgetSessionToken` with `adminConversationPersistenceKey`.
41
+ */
42
+ authKey?: string;
43
+ /** Workspace slug when using `authKey` (access-key) auth. */
44
+ workspace?: string;
45
+ /**
46
+ * Pre-issued widget Bearer JWT (internal admin / portal tooling). Requires `adminConversationPersistenceKey`.
47
+ * Written to `guideai_widget_bearer_token` in localStorage; not used for the normal embed flow.
48
+ */
49
+ widgetSessionToken?: string;
50
+ /**
51
+ * Stable namespace for `guideAI_conversation` in localStorage. Required with `widgetSessionToken`.
52
+ * Must never be the raw access key. Optional on embeds: when omitted, a non-secret key is derived from
53
+ * `location.origin` only (so SPA navigations keep the same transcript partition). Pass an explicit value
54
+ * when multiple widget instances on one page need isolated transcripts.
55
+ */
56
+ adminConversationPersistenceKey?: string;
57
+ /** Value sent as `user` on `/initialize` when using portal/widget Bearer (e.g. portal AuthUser id). */
58
+ initializeUserId?: string;
59
+ /**
60
+ * Optional allowlist of workspace slugs for the catalog request; omit to load all workspaces
61
+ * for the authenticated customer.
62
+ */
63
+ workspaces?: string | string[];
26
64
  environment?: GuideAIEnvironment;
27
65
  React: typeof import('react');
28
66
  ReactDOM: any;
@@ -38,12 +76,35 @@ export interface GuideAIProps {
38
76
  placeholder?: string;
39
77
  };
40
78
  visualContext?: VisualContextConfig;
79
+ /**
80
+ * Static context configuration — periodic structured page-metadata blob
81
+ * (URL, title, description, DOM signals) sent alongside Visual Context.
82
+ * On by default whenever a conversation is active; pass
83
+ * `staticContext: { enabled: false }` to disable.
84
+ */
85
+ staticContext?: StaticContextConfig;
41
86
  /** Custom tools: Record<functionName, { description, parameters, execute }> - always custom handler */
42
87
  tools?: Record<string, {
43
88
  description: string;
44
89
  parameters: object;
45
90
  execute: (args: Record<string, unknown>) => Promise<unknown>;
46
91
  }>;
92
+ /** Called when initialize fails after all retries. Host can show toast. */
93
+ onInitializeError?: (error: {
94
+ message: string;
95
+ }) => void;
96
+ /**
97
+ * When false (default), the widget does not render on mobile/tablet browsers.
98
+ * Set to true to allow the widget on those devices.
99
+ */
100
+ mobileEnabled?: boolean;
47
101
  }
48
102
  export type TranscriptPosition = 'right' | 'left';
103
+ /**
104
+ * Transcript chrome: **FloatPanel** (`float`) = card near the mic; **DockedPanel** (`docked`) = full-height
105
+ * side panel. Distinct from the workflow checklist drawer.
106
+ */
107
+ export type TranscriptPanelMode = 'float' | 'docked';
108
+ /** Session focus: stub slugs `onboarding` | `training` | `doIt`, or a server workspace slug. */
109
+ export type TranscriptSessionMode = string;
49
110
  export type PopupPosition = 'above' | 'below' | 'above-left' | 'above-right' | 'above-center' | 'below-left' | 'below-right' | 'below-center';
@@ -0,0 +1,78 @@
1
+ export interface ServerVadConfig {
2
+ type: 'server_vad';
3
+ create_response?: boolean;
4
+ interrupt_response?: boolean;
5
+ threshold?: number;
6
+ silence_duration_ms?: number | undefined;
7
+ prefix_padding_ms?: number | undefined;
8
+ idle_timeout_ms?: number | null;
9
+ }
10
+ export interface SemanticVadConfig {
11
+ type: 'semantic_vad';
12
+ create_response?: boolean;
13
+ interrupt_response?: boolean;
14
+ eagerness?: 'low' | 'medium' | 'high' | 'auto';
15
+ }
16
+ export type TurnDetectionConfig = ServerVadConfig | SemanticVadConfig;
17
+ export type NoiseReductionType = 'near_field' | 'far_field';
18
+ export interface NoiseReductionConfig {
19
+ type: NoiseReductionType;
20
+ }
21
+ export interface AudioConfigInput {
22
+ noise_reduction?: NoiseReductionConfig | null;
23
+ turn_detection?: TurnDetectionConfig | null;
24
+ }
25
+ export interface AudioConfigOutput {
26
+ speed?: number;
27
+ voice?: string;
28
+ }
29
+ export interface AudioConfig {
30
+ input?: AudioConfigInput;
31
+ output?: AudioConfigOutput;
32
+ }
33
+ /**
34
+ * Tracks which fields the user has customized (unchecked "Default").
35
+ * If a key is absent or true, that field uses the hardcoded default.
36
+ */
37
+ export interface AudioConfigDefaults {
38
+ noise_reduction?: boolean;
39
+ vad_type?: boolean;
40
+ create_response?: boolean;
41
+ interrupt_response?: boolean;
42
+ threshold?: boolean;
43
+ silence_duration_ms?: boolean;
44
+ prefix_padding_ms?: boolean;
45
+ idle_timeout_ms?: boolean;
46
+ eagerness?: boolean;
47
+ speed?: boolean;
48
+ voice?: boolean;
49
+ }
50
+ export interface StoredAudioConfig {
51
+ config: AudioConfig;
52
+ useDefaults: AudioConfigDefaults;
53
+ }
54
+ export type MicPresetId = 'precise' | 'noisy';
55
+ export declare const MIC_PRESETS: readonly MicPresetId[];
56
+ export declare const VOICES: readonly ["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"];
57
+ export type VoiceName = (typeof VOICES)[number];
58
+ export declare const DEFAULT_AUDIO_CONFIG: AudioConfig;
59
+ export declare const DEFAULT_SERVER_VAD: ServerVadConfig;
60
+ /** User preset: Noisy environment defaults (server VAD, lower threshold). */
61
+ export declare const PRESET_NOISY_SERVER_VAD: ServerVadConfig;
62
+ /** System-only preset: used during protected playback when Noisy preset is active. */
63
+ export declare const SYSTEM_INTERRUPT_LOCK_VAD: ServerVadConfig;
64
+ export declare function getPresetBaseAudioConfig(preset: MicPresetId): AudioConfig;
65
+ export declare const DEFAULT_SEMANTIC_VAD: SemanticVadConfig;
66
+ export declare const ALL_DEFAULTS_TRUE: AudioConfigDefaults;
67
+ export declare const FIELD_INFO: Record<string, string>;
68
+ export declare function mergeWithDefaults(stored: StoredAudioConfig | null, preset?: MicPresetId): AudioConfig;
69
+ /**
70
+ * Builds the audio payload for session.update from an AudioConfig.
71
+ * All types match the API shape directly -- no conversion needed.
72
+ */
73
+ export declare function buildAudioSessionPayload(config: AudioConfig): Record<string, any>;
74
+ export interface ValidationError {
75
+ field: string;
76
+ message: string;
77
+ }
78
+ export declare function validateAudioConfig(config: AudioConfig): ValidationError[];
@@ -1,16 +1,17 @@
1
1
  import { GuideAIEnvironment } from '../types/GuideAI.types';
2
+ import type { StubWorkflowItem } from '../stubs/workspaces';
2
3
  import { MessageData } from './conversationManager';
3
- export declare function getApiHeaders(): Record<string, string>;
4
- export interface Workflow {
5
- id: string;
6
- name: string;
7
- triggers: string[];
8
- organizationKey: string;
9
- prompt: string;
10
- archived?: boolean;
11
- createdAt?: string;
12
- updatedAt?: string;
4
+ /** Thrown when `POST /initialize` rejects the widget Bearer JWT (typically HTTP 401). */
5
+ export declare class InitializeUnauthorizedError extends Error {
6
+ readonly status: number;
7
+ constructor(status: number, message: string);
13
8
  }
9
+ export interface ApiHeadersOptions {
10
+ authorizationBearer?: string;
11
+ /** Server treats request as Chrome extension (domain allowlist bypass for session). */
12
+ extensionContext?: boolean;
13
+ }
14
+ export declare function getApiHeaders(options?: ApiHeadersOptions): Record<string, string>;
14
15
  export interface PropToolDefinition {
15
16
  name: string;
16
17
  description: string;
@@ -18,11 +19,12 @@ export interface PropToolDefinition {
18
19
  }
19
20
  export interface InitializeWebRTCPayload {
20
21
  sdp: string;
21
- organizationKey: string;
22
+ /** Workspace slug: forwarded on the body so the server can pick a non-default workspace per request. */
23
+ workspace?: string;
22
24
  user?: string;
23
25
  conversationId?: string;
24
- /** Prop tools to sync to library (server creates if not exist, unpublished) */
25
- propTools?: PropToolDefinition[];
26
+ /** Access-key: linked published workflow id for session instructions (omit = first linked). */
27
+ sessionWorkflowId?: string;
26
28
  }
27
29
  export interface ToolFromServer {
28
30
  toolConfig: object;
@@ -32,6 +34,50 @@ export interface InitializeWebRTCResponse {
32
34
  answerSdp: string;
33
35
  id: string;
34
36
  tools?: ToolFromServer[];
37
+ contextKey?: string;
38
+ transcriptionModel?: string;
39
+ greeting?: string | null;
40
+ }
41
+ export interface InitializeWebRTCOptions {
42
+ /** Required widget Bearer JWT; the server is JWT-only on `/initialize`. */
43
+ authorizationBearer?: string;
44
+ extensionContext?: boolean;
45
+ }
46
+ export declare const initializeWebRTC: (endpoint: string, payload: InitializeWebRTCPayload, options?: InitializeWebRTCOptions) => Promise<InitializeWebRTCResponse>;
47
+ /** Fire-and-forget: register missing prop tools (customer-scoped). Does not await. */
48
+ export declare const registerTools: (endpoint: string, payload: {
49
+ propTools?: PropToolDefinition[];
50
+ }, options?: InitializeWebRTCOptions) => void;
51
+ /** Built-in tool definition for server registration */
52
+ export interface BuiltInToolDefinition {
53
+ toolConfig: object;
54
+ functionConfig: object;
55
+ }
56
+ export declare const logMessage: (messageData: MessageData, conversationId: string | null, _conversationKey: string, user?: string, environment?: GuideAIEnvironment) => Promise<void>;
57
+ /** One workspace row from `POST /widget/workspaces` (normalized). */
58
+ export interface WidgetWorkspaceRow {
59
+ id: string;
60
+ label: string;
61
+ description: string;
62
+ icon: string;
63
+ /** When true, realtime session uses full workspace prompt + rolled-up linked workflow prompts (not a single workflow). */
64
+ rollupWorkflows: boolean;
65
+ workflowChecklistEnabled: boolean;
66
+ workflowConfettiEnabled: boolean;
67
+ workflows: StubWorkflowItem[];
68
+ }
69
+ export interface WidgetWorkspacesResponse {
70
+ workspaces: WidgetWorkspaceRow[];
71
+ }
72
+ export interface FetchWidgetWorkspacesParams {
73
+ apiBase: string;
74
+ /** Omit to request all workspaces for the customer; empty array requests none. */
75
+ workspacesFilter?: string[];
76
+ authorizationBearer?: string;
77
+ extensionContext?: boolean;
35
78
  }
36
- export declare const initializeWebRTC: (endpoint: string, payload: InitializeWebRTCPayload) => Promise<InitializeWebRTCResponse>;
37
- export declare const logMessage: (messageData: MessageData, conversationId: string | null, organizationKey: string, user?: string, environment?: GuideAIEnvironment) => Promise<void>;
79
+ /**
80
+ * POST `/widget/workspaces` widget workspace list + embedded workflow steps.
81
+ * Keep HTTP here; map to transcript types in `widgetWorkspaces.ts` / `workspaceCatalog.ts`.
82
+ */
83
+ export declare function fetchWidgetWorkspaces(params: FetchWidgetWorkspacesParams): Promise<WidgetWorkspacesResponse | null>;
@@ -0,0 +1,6 @@
1
+ /** One-shot confetti burst; DOM-only, no extra deps. Safe to call from event handlers. */
2
+ /**
3
+ * @param clientX - burst origin X (defaults to viewport center)
4
+ * @param clientY - burst origin Y (defaults to upper third)
5
+ */
6
+ export declare function burstConfetti(clientX?: number, clientY?: number, particleCount?: number): void;
@@ -5,7 +5,8 @@ export declare const GUIDE_AI_API_BASE_LOCAL = "http://localhost:3000/api";
5
5
  export declare const getApiBaseUrl: (environment?: "development" | "production" | "local") => string;
6
6
  export declare const GUIDE_AI_API_BASE = "https://app.getguide.ai/api";
7
7
  export declare const OPENAI_REALTIME_BASE = "https://api.openai.com/v1/realtime/calls";
8
- export type ElementInteractionType = 'HIGHLIGHT' | 'HOVERANDCLICK';
8
+ /** Must match guideaisite `WIDGET_EXTENSION_HEADER` server bypasses session hostname allowlist for extension builds. */
9
+ export declare const WIDGET_EXTENSION_HEADER = "x-guideai-extension";
9
10
  export declare const UI_LAYOUT: {
10
11
  /** Mic/icon wrapper size - matches .guideai-icon-wrapper */
11
12
  readonly micButtonSize: 50;
@@ -19,4 +20,9 @@ export declare const UI_LAYOUT: {
19
20
  readonly defaultBottom: 20;
20
21
  /** Default horizontal offset when position is not provided */
21
22
  readonly defaultHorizontalOffset: 40;
23
+ /**
24
+ * Floating transcript card (`guideai-transcript-box`) inset from the viewport right and bottom.
25
+ * Kept separate from mic `position` so the card can sit closer to the corner (e.g. 20px vs 40px).
26
+ */
27
+ readonly transcriptFloatEdgeInset: 20;
22
28
  };