markupr 2.1.8 → 2.5.0
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 +292 -15
- package/dist/cli/index.mjs +3593 -0
- package/dist/main/index.mjs +743 -220
- package/dist/mcp/index.mjs +4053 -0
- package/package.json +32 -7
- package/.claude/commands/review-feedback.md +0 -47
- package/.eslintrc.json +0 -35
- package/.github/CODEOWNERS +0 -16
- package/.github/FUNDING.yml +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -56
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -54
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -89
- package/.github/dependabot.yml +0 -70
- package/.github/workflows/ci.yml +0 -184
- package/.github/workflows/deploy-landing.yml +0 -134
- package/.github/workflows/nightly.yml +0 -288
- package/.github/workflows/release.yml +0 -318
- package/CHANGELOG.md +0 -127
- package/CLAUDE.md +0 -137
- package/CODE_OF_CONDUCT.md +0 -9
- package/CONTRIBUTING.md +0 -390
- package/PRODUCT_VISION.md +0 -277
- package/SECURITY.md +0 -51
- package/SIGNING_INSTRUCTIONS.md +0 -284
- package/assets/DMG_BACKGROUND_INSTRUCTIONS.md +0 -130
- package/assets/svg-source/dmg-background.svg +0 -70
- package/assets/svg-source/icon.svg +0 -20
- package/assets/svg-source/tray-icon-processing.svg +0 -7
- package/assets/svg-source/tray-icon-recording.svg +0 -7
- package/assets/svg-source/tray-icon.svg +0 -6
- package/assets/tray-complete.png +0 -0
- package/assets/tray-complete@2x.png +0 -0
- package/assets/tray-completeTemplate.png +0 -0
- package/assets/tray-completeTemplate@2x.png +0 -0
- package/assets/tray-error.png +0 -0
- package/assets/tray-error@2x.png +0 -0
- package/assets/tray-errorTemplate.png +0 -0
- package/assets/tray-errorTemplate@2x.png +0 -0
- package/assets/tray-icon-processing.png +0 -0
- package/assets/tray-icon-processing@2x.png +0 -0
- package/assets/tray-icon-processingTemplate.png +0 -0
- package/assets/tray-icon-processingTemplate@2x.png +0 -0
- package/assets/tray-icon-recording.png +0 -0
- package/assets/tray-icon-recording@2x.png +0 -0
- package/assets/tray-icon-recordingTemplate.png +0 -0
- package/assets/tray-icon-recordingTemplate@2x.png +0 -0
- package/assets/tray-icon.png +0 -0
- package/assets/tray-icon@2x.png +0 -0
- package/assets/tray-iconTemplate.png +0 -0
- package/assets/tray-iconTemplate@2x.png +0 -0
- package/assets/tray-idle.png +0 -0
- package/assets/tray-idle@2x.png +0 -0
- package/assets/tray-idleTemplate.png +0 -0
- package/assets/tray-idleTemplate@2x.png +0 -0
- package/assets/tray-processing-0.png +0 -0
- package/assets/tray-processing-0@2x.png +0 -0
- package/assets/tray-processing-0Template.png +0 -0
- package/assets/tray-processing-0Template@2x.png +0 -0
- package/assets/tray-processing-1.png +0 -0
- package/assets/tray-processing-1@2x.png +0 -0
- package/assets/tray-processing-1Template.png +0 -0
- package/assets/tray-processing-1Template@2x.png +0 -0
- package/assets/tray-processing-2.png +0 -0
- package/assets/tray-processing-2@2x.png +0 -0
- package/assets/tray-processing-2Template.png +0 -0
- package/assets/tray-processing-2Template@2x.png +0 -0
- package/assets/tray-processing-3.png +0 -0
- package/assets/tray-processing-3@2x.png +0 -0
- package/assets/tray-processing-3Template.png +0 -0
- package/assets/tray-processing-3Template@2x.png +0 -0
- package/assets/tray-processing.png +0 -0
- package/assets/tray-processing@2x.png +0 -0
- package/assets/tray-processingTemplate.png +0 -0
- package/assets/tray-processingTemplate@2x.png +0 -0
- package/assets/tray-recording.png +0 -0
- package/assets/tray-recording@2x.png +0 -0
- package/assets/tray-recordingTemplate.png +0 -0
- package/assets/tray-recordingTemplate@2x.png +0 -0
- package/build/DMG_BACKGROUND_SPEC.md +0 -50
- package/build/dmg-background.png +0 -0
- package/build/dmg-background@2x.png +0 -0
- package/build/entitlements.mac.inherit.plist +0 -27
- package/build/entitlements.mac.plist +0 -41
- package/build/favicon-16.png +0 -0
- package/build/favicon-180.png +0 -0
- package/build/favicon-192.png +0 -0
- package/build/favicon-32.png +0 -0
- package/build/favicon-48.png +0 -0
- package/build/favicon-512.png +0 -0
- package/build/favicon-64.png +0 -0
- package/build/icon-128.png +0 -0
- package/build/icon-16.png +0 -0
- package/build/icon-24.png +0 -0
- package/build/icon-256.png +0 -0
- package/build/icon-32.png +0 -0
- package/build/icon-48.png +0 -0
- package/build/icon-64.png +0 -0
- package/build/icon.icns +0 -0
- package/build/icon.ico +0 -0
- package/build/icon.iconset/icon_128x128.png +0 -0
- package/build/icon.iconset/icon_128x128@2x.png +0 -0
- package/build/icon.iconset/icon_16x16.png +0 -0
- package/build/icon.iconset/icon_16x16@2x.png +0 -0
- package/build/icon.iconset/icon_256x256.png +0 -0
- package/build/icon.iconset/icon_256x256@2x.png +0 -0
- package/build/icon.iconset/icon_32x32.png +0 -0
- package/build/icon.iconset/icon_32x32@2x.png +0 -0
- package/build/icon.iconset/icon_512x512.png +0 -0
- package/build/icon.iconset/icon_512x512@2x.png +0 -0
- package/build/icon.png +0 -0
- package/build/installer-header.bmp +0 -0
- package/build/installer-header.png +0 -0
- package/build/installer-sidebar.bmp +0 -0
- package/build/installer-sidebar.png +0 -0
- package/build/installer.nsh +0 -45
- package/build/overlay-processing.png +0 -0
- package/build/overlay-recording.png +0 -0
- package/build/toolbar-record.png +0 -0
- package/build/toolbar-screenshot.png +0 -0
- package/build/toolbar-settings.png +0 -0
- package/build/toolbar-stop.png +0 -0
- package/dist/preload/index.mjs +0 -907
- package/dist/renderer/assets/index-CCmUjl9K.js +0 -19495
- package/dist/renderer/assets/index-CUqz_Gs6.css +0 -2270
- package/dist/renderer/index.html +0 -27
- package/docs/AI_AGENT_QUICKSTART.md +0 -42
- package/docs/AI_PIPELINE_DESIGN.md +0 -595
- package/docs/API.md +0 -514
- package/docs/ARCHITECTURE.md +0 -460
- package/docs/CONFIGURATION.md +0 -336
- package/docs/DEVELOPMENT.md +0 -508
- package/docs/EXPORT_FORMATS.md +0 -451
- package/docs/GETTING_STARTED.md +0 -236
- package/docs/KEYBOARD_SHORTCUTS.md +0 -334
- package/docs/TROUBLESHOOTING.md +0 -418
- package/docs/landing/index.html +0 -672
- package/docs/landing/script.js +0 -342
- package/docs/landing/styles.css +0 -1543
- package/electron-builder.yml +0 -140
- package/electron.vite.config.ts +0 -63
- package/railway.json +0 -12
- package/scripts/build.mjs +0 -51
- package/scripts/generate-icons.mjs +0 -314
- package/scripts/generate-installer-images.cjs +0 -253
- package/scripts/generate-tray-icons.mjs +0 -258
- package/scripts/notarize.cjs +0 -180
- package/scripts/one-click-clean-test.sh +0 -147
- package/scripts/postinstall.mjs +0 -36
- package/scripts/setup-markupr.sh +0 -55
- package/setup +0 -17
- package/site/index.html +0 -1835
- package/site/package.json +0 -11
- package/site/railway.json +0 -12
- package/site/server.js +0 -31
- package/src/main/AutoUpdater.ts +0 -392
- package/src/main/CrashRecovery.ts +0 -655
- package/src/main/ErrorHandler.ts +0 -703
- package/src/main/HotkeyManager.ts +0 -399
- package/src/main/MenuManager.ts +0 -529
- package/src/main/PermissionManager.ts +0 -420
- package/src/main/SessionController.ts +0 -1465
- package/src/main/TrayManager.ts +0 -540
- package/src/main/ai/AIPipelineManager.ts +0 -199
- package/src/main/ai/ClaudeAnalyzer.ts +0 -339
- package/src/main/ai/ImageOptimizer.ts +0 -176
- package/src/main/ai/StructuredMarkdownBuilder.ts +0 -379
- package/src/main/ai/index.ts +0 -16
- package/src/main/ai/types.ts +0 -258
- package/src/main/analysis/ClarificationGenerator.ts +0 -385
- package/src/main/analysis/FeedbackAnalyzer.ts +0 -531
- package/src/main/analysis/index.ts +0 -19
- package/src/main/audio/AudioCapture.ts +0 -978
- package/src/main/audio/audioUtils.ts +0 -100
- package/src/main/audio/index.ts +0 -20
- package/src/main/capture/index.ts +0 -1
- package/src/main/index.ts +0 -1693
- package/src/main/ipc/captureHandlers.ts +0 -272
- package/src/main/ipc/index.ts +0 -45
- package/src/main/ipc/outputHandlers.ts +0 -302
- package/src/main/ipc/sessionHandlers.ts +0 -56
- package/src/main/ipc/settingsHandlers.ts +0 -471
- package/src/main/ipc/types.ts +0 -56
- package/src/main/ipc/windowHandlers.ts +0 -277
- package/src/main/output/ClipboardService.ts +0 -369
- package/src/main/output/ExportService.ts +0 -539
- package/src/main/output/FileManager.ts +0 -416
- package/src/main/output/MarkdownGenerator.ts +0 -791
- package/src/main/output/MarkdownPatcher.ts +0 -299
- package/src/main/output/index.ts +0 -186
- package/src/main/output/sessionAdapter.ts +0 -207
- package/src/main/output/templates/html-template.ts +0 -553
- package/src/main/pipeline/FrameExtractor.ts +0 -330
- package/src/main/pipeline/PostProcessor.ts +0 -399
- package/src/main/pipeline/TranscriptAnalyzer.ts +0 -226
- package/src/main/pipeline/index.ts +0 -36
- package/src/main/platform/WindowsTaskbar.ts +0 -600
- package/src/main/platform/index.ts +0 -16
- package/src/main/settings/SettingsManager.ts +0 -730
- package/src/main/settings/index.ts +0 -19
- package/src/main/transcription/ModelDownloadManager.ts +0 -494
- package/src/main/transcription/TierManager.ts +0 -219
- package/src/main/transcription/TranscriptionRecoveryService.ts +0 -340
- package/src/main/transcription/WhisperService.ts +0 -748
- package/src/main/transcription/index.ts +0 -56
- package/src/main/transcription/types.ts +0 -135
- package/src/main/windows/PopoverManager.ts +0 -284
- package/src/main/windows/TaskbarIntegration.ts +0 -452
- package/src/main/windows/index.ts +0 -23
- package/src/preload/index.ts +0 -1047
- package/src/renderer/App.tsx +0 -515
- package/src/renderer/AppWrapper.tsx +0 -28
- package/src/renderer/assets/logo-dark.svg +0 -7
- package/src/renderer/assets/logo.svg +0 -7
- package/src/renderer/audio/AudioCaptureRenderer.ts +0 -454
- package/src/renderer/capture/ScreenRecordingRenderer.ts +0 -492
- package/src/renderer/components/AnnotationOverlay.tsx +0 -836
- package/src/renderer/components/AudioWaveform.tsx +0 -811
- package/src/renderer/components/ClarificationQuestions.tsx +0 -656
- package/src/renderer/components/CountdownTimer.tsx +0 -495
- package/src/renderer/components/CrashRecoveryDialog.tsx +0 -632
- package/src/renderer/components/DonateButton.tsx +0 -127
- package/src/renderer/components/ErrorBoundary.tsx +0 -308
- package/src/renderer/components/ExportDialog.tsx +0 -872
- package/src/renderer/components/HotkeyHint.tsx +0 -261
- package/src/renderer/components/KeyboardShortcuts.tsx +0 -787
- package/src/renderer/components/ModelDownloadDialog.tsx +0 -844
- package/src/renderer/components/Onboarding.tsx +0 -1830
- package/src/renderer/components/ProcessingOverlay.tsx +0 -157
- package/src/renderer/components/RecordingOverlay.tsx +0 -423
- package/src/renderer/components/SessionHistory.tsx +0 -1746
- package/src/renderer/components/SessionReview.tsx +0 -1321
- package/src/renderer/components/SettingsPanel.tsx +0 -217
- package/src/renderer/components/Skeleton.tsx +0 -347
- package/src/renderer/components/StatusIndicator.tsx +0 -86
- package/src/renderer/components/ThemeProvider.tsx +0 -429
- package/src/renderer/components/Tooltip.tsx +0 -370
- package/src/renderer/components/TranscriptionPreview.tsx +0 -183
- package/src/renderer/components/TranscriptionTierSelector.tsx +0 -640
- package/src/renderer/components/UpdateNotification.tsx +0 -377
- package/src/renderer/components/WindowSelector.tsx +0 -947
- package/src/renderer/components/index.ts +0 -99
- package/src/renderer/components/primitives/ApiKeyInput.tsx +0 -98
- package/src/renderer/components/primitives/ColorPicker.tsx +0 -65
- package/src/renderer/components/primitives/DangerButton.tsx +0 -45
- package/src/renderer/components/primitives/DirectoryPicker.tsx +0 -41
- package/src/renderer/components/primitives/Dropdown.tsx +0 -34
- package/src/renderer/components/primitives/KeyRecorder.tsx +0 -117
- package/src/renderer/components/primitives/SettingsSection.tsx +0 -32
- package/src/renderer/components/primitives/Slider.tsx +0 -43
- package/src/renderer/components/primitives/Toggle.tsx +0 -36
- package/src/renderer/components/primitives/index.ts +0 -10
- package/src/renderer/components/settings/AdvancedTab.tsx +0 -174
- package/src/renderer/components/settings/AppearanceTab.tsx +0 -77
- package/src/renderer/components/settings/GeneralTab.tsx +0 -40
- package/src/renderer/components/settings/HotkeysTab.tsx +0 -79
- package/src/renderer/components/settings/RecordingTab.tsx +0 -84
- package/src/renderer/components/settings/index.ts +0 -9
- package/src/renderer/components/settings/settingsStyles.ts +0 -673
- package/src/renderer/components/settings/tabConfig.tsx +0 -85
- package/src/renderer/components/settings/useSettingsPanel.ts +0 -447
- package/src/renderer/contexts/ProcessingContext.tsx +0 -227
- package/src/renderer/contexts/RecordingContext.tsx +0 -683
- package/src/renderer/contexts/UIContext.tsx +0 -326
- package/src/renderer/contexts/index.ts +0 -24
- package/src/renderer/donateMessages.ts +0 -69
- package/src/renderer/hooks/index.ts +0 -75
- package/src/renderer/hooks/useAnimation.tsx +0 -544
- package/src/renderer/hooks/useTheme.ts +0 -313
- package/src/renderer/index.html +0 -26
- package/src/renderer/main.tsx +0 -52
- package/src/renderer/styles/animations.css +0 -1093
- package/src/renderer/styles/app-shell.css +0 -662
- package/src/renderer/styles/globals.css +0 -515
- package/src/renderer/styles/theme.ts +0 -578
- package/src/renderer/types/electron.d.ts +0 -385
- package/src/shared/hotkeys.ts +0 -283
- package/src/shared/types.ts +0 -809
- package/tests/clipboard.test.ts +0 -228
- package/tests/e2e/criticalPaths.test.ts +0 -594
- package/tests/feedbackAnalyzer.test.ts +0 -303
- package/tests/integration/sessionFlow.test.ts +0 -583
- package/tests/markdownGenerator.test.ts +0 -418
- package/tests/output.test.ts +0 -96
- package/tests/setup.ts +0 -486
- package/tests/unit/appIntegration.test.ts +0 -676
- package/tests/unit/appViewState.test.ts +0 -281
- package/tests/unit/audioIpcChannels.test.ts +0 -17
- package/tests/unit/exportService.test.ts +0 -492
- package/tests/unit/hotkeys.test.ts +0 -92
- package/tests/unit/navigationPreload.test.ts +0 -94
- package/tests/unit/onboardingFlow.test.ts +0 -345
- package/tests/unit/permissionManager.test.ts +0 -175
- package/tests/unit/permissionManagerExpanded.test.ts +0 -296
- package/tests/unit/screenRecordingRenderer.test.ts +0 -368
- package/tests/unit/sessionController.test.ts +0 -515
- package/tests/unit/tierManager.test.ts +0 -61
- package/tests/unit/tierManagerExpanded.test.ts +0 -142
- package/tests/unit/transcriptAnalyzer.test.ts +0 -64
- package/tsconfig.json +0 -25
- package/vitest.config.ts +0 -46
|
@@ -1,683 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RecordingContext
|
|
3
|
-
*
|
|
4
|
-
* Manages the core recording session lifecycle: state machine, IPC listeners,
|
|
5
|
-
* screen recording sync, audio levels, output paths, and session actions.
|
|
6
|
-
* This is the foundational context that other contexts depend on.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
10
|
-
import type { SessionPayload, SessionState, ReviewSession } from '../../shared/types';
|
|
11
|
-
import { getScreenRecordingRenderer } from '../capture/ScreenRecordingRenderer';
|
|
12
|
-
import { useCrashRecovery } from '../components';
|
|
13
|
-
|
|
14
|
-
// ============================================================================
|
|
15
|
-
// Types
|
|
16
|
-
// ============================================================================
|
|
17
|
-
|
|
18
|
-
export interface ProcessingProgress {
|
|
19
|
-
percent: number;
|
|
20
|
-
step: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface RecentSession {
|
|
24
|
-
id: string;
|
|
25
|
-
startTime: number;
|
|
26
|
-
endTime: number;
|
|
27
|
-
itemCount: number;
|
|
28
|
-
screenshotCount: number;
|
|
29
|
-
sourceName: string;
|
|
30
|
-
firstThumbnail?: string;
|
|
31
|
-
folder: string;
|
|
32
|
-
transcriptionPreview?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface LastCapture {
|
|
36
|
-
trigger?: 'pause' | 'manual' | 'voice-command';
|
|
37
|
-
timestamp: number;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface RecordingContextValue {
|
|
41
|
-
// Session state
|
|
42
|
-
state: SessionState;
|
|
43
|
-
duration: number;
|
|
44
|
-
screenshotCount: number;
|
|
45
|
-
isPaused: boolean;
|
|
46
|
-
isMutating: boolean;
|
|
47
|
-
|
|
48
|
-
// Audio
|
|
49
|
-
audioLevel: number;
|
|
50
|
-
isVoiceActive: boolean;
|
|
51
|
-
lastCapture: LastCapture | null;
|
|
52
|
-
|
|
53
|
-
// Output
|
|
54
|
-
reportPath: string | null;
|
|
55
|
-
recordingPath: string | null;
|
|
56
|
-
audioPath: string | null;
|
|
57
|
-
sessionDir: string | null;
|
|
58
|
-
reviewSession: ReviewSession | null;
|
|
59
|
-
errorMessage: string | null;
|
|
60
|
-
|
|
61
|
-
// Capability
|
|
62
|
-
hasTranscriptionCapability: boolean | null;
|
|
63
|
-
|
|
64
|
-
// Recent sessions
|
|
65
|
-
recentSessions: RecentSession[];
|
|
66
|
-
loadRecentSessions: () => Promise<void>;
|
|
67
|
-
|
|
68
|
-
// Processing raw state (consumed by ProcessingContext)
|
|
69
|
-
rawProcessingProgress: ProcessingProgress | null;
|
|
70
|
-
processingStartedAt: number | null;
|
|
71
|
-
|
|
72
|
-
// Review editor
|
|
73
|
-
showReviewEditor: boolean;
|
|
74
|
-
setShowReviewEditor: (show: boolean) => void;
|
|
75
|
-
|
|
76
|
-
// Crash recovery
|
|
77
|
-
incompleteSession: ReturnType<typeof useCrashRecovery>['incompleteSession'];
|
|
78
|
-
isCheckingRecovery: boolean;
|
|
79
|
-
|
|
80
|
-
// Actions
|
|
81
|
-
startSession: () => Promise<void>;
|
|
82
|
-
stopSession: () => Promise<void>;
|
|
83
|
-
togglePause: () => Promise<void>;
|
|
84
|
-
manualCapture: () => Promise<void>;
|
|
85
|
-
copyReportPath: () => Promise<void>;
|
|
86
|
-
openReportFolder: () => Promise<void>;
|
|
87
|
-
copyRecordingPath: () => Promise<void>;
|
|
88
|
-
copyAudioPath: () => Promise<void>;
|
|
89
|
-
openRecent: (session: { folder: string }) => Promise<void>;
|
|
90
|
-
copyRecentPath: (session: { folder: string }) => Promise<void>;
|
|
91
|
-
recoverSession: () => void;
|
|
92
|
-
discardSession: () => void;
|
|
93
|
-
reviewSave: (session: ReviewSession) => Promise<void>;
|
|
94
|
-
reviewClose: () => void;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const RecordingContext = createContext<RecordingContextValue | null>(null);
|
|
98
|
-
|
|
99
|
-
export function useRecording(): RecordingContextValue {
|
|
100
|
-
const context = useContext(RecordingContext);
|
|
101
|
-
if (!context) {
|
|
102
|
-
throw new Error('useRecording must be used within RecordingProvider');
|
|
103
|
-
}
|
|
104
|
-
return context;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// ============================================================================
|
|
108
|
-
// Provider
|
|
109
|
-
// ============================================================================
|
|
110
|
-
|
|
111
|
-
export const RecordingProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
|
112
|
-
// ---------------------------------------------------------------------------
|
|
113
|
-
// Session state
|
|
114
|
-
// ---------------------------------------------------------------------------
|
|
115
|
-
const [state, setState] = useState<SessionState>('idle');
|
|
116
|
-
const [duration, setDuration] = useState(0);
|
|
117
|
-
const [screenshotCount, setScreenshotCount] = useState(0);
|
|
118
|
-
const [isPaused, setIsPaused] = useState(false);
|
|
119
|
-
const [isMutating, setIsMutating] = useState(false);
|
|
120
|
-
const [audioLevel, setAudioLevel] = useState(0);
|
|
121
|
-
const [isVoiceActive, setIsVoiceActive] = useState(false);
|
|
122
|
-
const [lastCapture, setLastCapture] = useState<LastCapture | null>(null);
|
|
123
|
-
const [reportPath, setReportPath] = useState<string | null>(null);
|
|
124
|
-
const [recordingPath, setRecordingPath] = useState<string | null>(null);
|
|
125
|
-
const [audioPath, setAudioPath] = useState<string | null>(null);
|
|
126
|
-
const [sessionDir, setSessionDir] = useState<string | null>(null);
|
|
127
|
-
const [reviewSession, setReviewSession] = useState<ReviewSession | null>(null);
|
|
128
|
-
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
|
129
|
-
const [hasTranscriptionCapability, setHasTranscriptionCapability] = useState<boolean | null>(null);
|
|
130
|
-
const [recentSessions, setRecentSessions] = useState<RecentSession[]>([]);
|
|
131
|
-
const [rawProcessingProgress, setRawProcessingProgress] = useState<ProcessingProgress | null>(null);
|
|
132
|
-
const [showReviewEditor, setShowReviewEditor] = useState(false);
|
|
133
|
-
|
|
134
|
-
// Refs
|
|
135
|
-
const outputReadyRef = useRef(false);
|
|
136
|
-
const processingStartedAtRef = useRef<number | null>(null);
|
|
137
|
-
const stopRequestedRef = useRef(false);
|
|
138
|
-
const screenRecorderRef = useRef(getScreenRecordingRenderer());
|
|
139
|
-
const screenSyncQueueRef = useRef<Promise<void>>(Promise.resolve());
|
|
140
|
-
|
|
141
|
-
// ---------------------------------------------------------------------------
|
|
142
|
-
// Crash recovery
|
|
143
|
-
// ---------------------------------------------------------------------------
|
|
144
|
-
const {
|
|
145
|
-
incompleteSession,
|
|
146
|
-
isCheckingRecovery,
|
|
147
|
-
recoverSession: rawRecoverSession,
|
|
148
|
-
discardSession: rawDiscardSession,
|
|
149
|
-
} = useCrashRecovery();
|
|
150
|
-
|
|
151
|
-
// ---------------------------------------------------------------------------
|
|
152
|
-
// Recent sessions
|
|
153
|
-
// ---------------------------------------------------------------------------
|
|
154
|
-
const loadRecentSessions = useCallback(async () => {
|
|
155
|
-
try {
|
|
156
|
-
if (!window.markupr?.output?.listSessions) {
|
|
157
|
-
setRecentSessions([]);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const sessions = await window.markupr.output.listSessions();
|
|
161
|
-
setRecentSessions(sessions.slice(0, 5));
|
|
162
|
-
} catch (error) {
|
|
163
|
-
console.error('[RecordingContext] Failed to load recent sessions:', error);
|
|
164
|
-
setRecentSessions([]);
|
|
165
|
-
}
|
|
166
|
-
}, []);
|
|
167
|
-
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
loadRecentSessions();
|
|
170
|
-
}, [loadRecentSessions]);
|
|
171
|
-
|
|
172
|
-
// ---------------------------------------------------------------------------
|
|
173
|
-
// Transcription capability check
|
|
174
|
-
// ---------------------------------------------------------------------------
|
|
175
|
-
useEffect(() => {
|
|
176
|
-
window.markupr.whisper
|
|
177
|
-
.hasTranscriptionCapability()
|
|
178
|
-
.then((ready) => setHasTranscriptionCapability(ready))
|
|
179
|
-
.catch(() => setHasTranscriptionCapability(false));
|
|
180
|
-
}, []);
|
|
181
|
-
|
|
182
|
-
// ---------------------------------------------------------------------------
|
|
183
|
-
// Screen recording sync
|
|
184
|
-
// ---------------------------------------------------------------------------
|
|
185
|
-
const syncScreenRecording = useCallback(
|
|
186
|
-
async (nextState: SessionState, session: SessionPayload | null, paused: boolean) => {
|
|
187
|
-
const recorder = screenRecorderRef.current;
|
|
188
|
-
|
|
189
|
-
if (nextState === 'recording') {
|
|
190
|
-
if (stopRequestedRef.current) {
|
|
191
|
-
recorder.releaseCaptureTracks();
|
|
192
|
-
if (recorder.isRecording() || recorder.getSessionId()) {
|
|
193
|
-
await recorder.stop().catch((error) => {
|
|
194
|
-
console.warn('[RecordingContext] Forced recorder stop during stop-request guard failed:', error);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const latestStatus = await window.markupr.session.getStatus().catch(() => null);
|
|
201
|
-
if (latestStatus && latestStatus.state !== 'recording') {
|
|
202
|
-
if (recorder.isRecording() || recorder.getSessionId()) {
|
|
203
|
-
await recorder.stop().catch((error) => {
|
|
204
|
-
console.warn('[RecordingContext] Forced recorder stop during stale recording status guard failed:', error);
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (!recorder.isRecording()) {
|
|
211
|
-
let activeSession = session;
|
|
212
|
-
if (!activeSession) {
|
|
213
|
-
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
214
|
-
activeSession = await window.markupr.session.getCurrent();
|
|
215
|
-
if (activeSession) break;
|
|
216
|
-
if (attempt < 3) {
|
|
217
|
-
await new Promise((resolve) => setTimeout(resolve, 180));
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (!activeSession) {
|
|
223
|
-
setErrorMessage((prev) => prev || 'Session started, but screen recorder could not find an active capture target.');
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
try {
|
|
228
|
-
await recorder.start({
|
|
229
|
-
sessionId: activeSession.id,
|
|
230
|
-
sourceId: activeSession.sourceId,
|
|
231
|
-
});
|
|
232
|
-
} catch (error) {
|
|
233
|
-
console.warn('[RecordingContext] Continuous screen recording failed to start with primary source:', error);
|
|
234
|
-
|
|
235
|
-
try {
|
|
236
|
-
const sources = await window.markupr.capture.getSources();
|
|
237
|
-
const fallbackSource = sources.find((source) => source.type === 'screen');
|
|
238
|
-
|
|
239
|
-
if (!fallbackSource || fallbackSource.id === activeSession.sourceId) {
|
|
240
|
-
throw error;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
await recorder.start({
|
|
244
|
-
sessionId: activeSession.id,
|
|
245
|
-
sourceId: fallbackSource.id,
|
|
246
|
-
});
|
|
247
|
-
} catch (fallbackError) {
|
|
248
|
-
const message =
|
|
249
|
-
fallbackError instanceof Error
|
|
250
|
-
? fallbackError.message
|
|
251
|
-
: 'Unknown screen recording error.';
|
|
252
|
-
console.warn('[RecordingContext] Continuous screen recording fallback also failed:', message);
|
|
253
|
-
setErrorMessage((prev) => prev || `Screen recording unavailable: ${message}`);
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (paused) {
|
|
260
|
-
await recorder.pause();
|
|
261
|
-
} else {
|
|
262
|
-
await recorder.resume();
|
|
263
|
-
}
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
recorder.releaseCaptureTracks();
|
|
268
|
-
if (recorder.isRecording() || recorder.getSessionId()) {
|
|
269
|
-
await recorder.stop().catch((error) => {
|
|
270
|
-
console.warn('[RecordingContext] Failed to stop continuous screen recording:', error);
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
recorder.forceReleaseOrphanedCapture();
|
|
274
|
-
},
|
|
275
|
-
[]
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
const queueScreenRecordingSync = useCallback(
|
|
279
|
-
(nextState: SessionState, session: SessionPayload | null, paused: boolean) => {
|
|
280
|
-
screenSyncQueueRef.current = screenSyncQueueRef.current
|
|
281
|
-
.catch(() => {})
|
|
282
|
-
.then(() => syncScreenRecording(nextState, session, paused));
|
|
283
|
-
return screenSyncQueueRef.current;
|
|
284
|
-
},
|
|
285
|
-
[syncScreenRecording]
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
// ---------------------------------------------------------------------------
|
|
289
|
-
// Session IPC listeners
|
|
290
|
-
// ---------------------------------------------------------------------------
|
|
291
|
-
useEffect(() => {
|
|
292
|
-
let mounted = true;
|
|
293
|
-
const recorder = screenRecorderRef.current;
|
|
294
|
-
|
|
295
|
-
window.markupr.session
|
|
296
|
-
.getStatus()
|
|
297
|
-
.then((status) => {
|
|
298
|
-
if (!mounted) return;
|
|
299
|
-
setState(status.state);
|
|
300
|
-
setDuration(status.duration);
|
|
301
|
-
setScreenshotCount(status.screenshotCount);
|
|
302
|
-
setIsPaused(status.isPaused);
|
|
303
|
-
void queueScreenRecordingSync(status.state, null, status.isPaused);
|
|
304
|
-
})
|
|
305
|
-
.catch((error) => {
|
|
306
|
-
console.error('[RecordingContext] Failed to load initial status:', error);
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
const toUiState = (nextState: SessionState): SessionState =>
|
|
310
|
-
nextState === 'complete' && !outputReadyRef.current ? 'processing' : nextState;
|
|
311
|
-
|
|
312
|
-
const unsubState = window.markupr.session.onStateChange(({ state: nextState, session }) => {
|
|
313
|
-
const effectiveState =
|
|
314
|
-
stopRequestedRef.current && nextState === 'recording' ? 'stopping' : nextState;
|
|
315
|
-
setState(toUiState(effectiveState));
|
|
316
|
-
void queueScreenRecordingSync(effectiveState, session, false);
|
|
317
|
-
if (nextState === 'recording') {
|
|
318
|
-
stopRequestedRef.current = false;
|
|
319
|
-
outputReadyRef.current = false;
|
|
320
|
-
setErrorMessage(null);
|
|
321
|
-
setReportPath(null);
|
|
322
|
-
setRecordingPath(null);
|
|
323
|
-
setAudioPath(null);
|
|
324
|
-
setSessionDir(null);
|
|
325
|
-
setReviewSession(null);
|
|
326
|
-
setShowReviewEditor(false);
|
|
327
|
-
setRawProcessingProgress(null);
|
|
328
|
-
processingStartedAtRef.current = null;
|
|
329
|
-
setIsPaused(false);
|
|
330
|
-
}
|
|
331
|
-
if (nextState === 'stopping' || nextState === 'processing') {
|
|
332
|
-
stopRequestedRef.current = true;
|
|
333
|
-
if (!processingStartedAtRef.current) {
|
|
334
|
-
processingStartedAtRef.current = Date.now();
|
|
335
|
-
}
|
|
336
|
-
setRawProcessingProgress((previous) => previous ?? { percent: 0, step: 'preparing' });
|
|
337
|
-
}
|
|
338
|
-
if (nextState === 'idle') {
|
|
339
|
-
stopRequestedRef.current = false;
|
|
340
|
-
outputReadyRef.current = false;
|
|
341
|
-
setDuration(0);
|
|
342
|
-
setRawProcessingProgress(null);
|
|
343
|
-
processingStartedAtRef.current = null;
|
|
344
|
-
setIsPaused(false);
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
const unsubStatus = window.markupr.session.onStatusUpdate((status) => {
|
|
349
|
-
if (status.state === 'stopping' || status.state === 'processing') {
|
|
350
|
-
stopRequestedRef.current = true;
|
|
351
|
-
}
|
|
352
|
-
const effectiveState =
|
|
353
|
-
stopRequestedRef.current && status.state === 'recording' ? 'stopping' : status.state;
|
|
354
|
-
setDuration(status.duration);
|
|
355
|
-
setScreenshotCount(status.screenshotCount);
|
|
356
|
-
setState(toUiState(effectiveState));
|
|
357
|
-
setIsPaused(status.isPaused);
|
|
358
|
-
void queueScreenRecordingSync(effectiveState, null, status.isPaused);
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
const unsubScreenshot = window.markupr.capture.onScreenshot((payload) => {
|
|
362
|
-
setScreenshotCount(payload.count);
|
|
363
|
-
setLastCapture({
|
|
364
|
-
trigger: payload.trigger,
|
|
365
|
-
timestamp: payload.timestamp,
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
const unsubReady = window.markupr.output.onReady((payload) => {
|
|
370
|
-
recorder.releaseCaptureTracks();
|
|
371
|
-
recorder.forceReleaseOrphanedCapture();
|
|
372
|
-
void queueScreenRecordingSync('idle', null, false).catch((error) => {
|
|
373
|
-
console.warn('[RecordingContext] Failed to force-release screen recorder on output ready:', error);
|
|
374
|
-
});
|
|
375
|
-
window.setTimeout(() => {
|
|
376
|
-
recorder.forceReleaseOrphanedCapture();
|
|
377
|
-
void queueScreenRecordingSync('idle', null, false).catch(() => {});
|
|
378
|
-
}, 450);
|
|
379
|
-
stopRequestedRef.current = false;
|
|
380
|
-
outputReadyRef.current = true;
|
|
381
|
-
setRawProcessingProgress({ percent: 100, step: 'complete' });
|
|
382
|
-
setState('complete');
|
|
383
|
-
setErrorMessage(null);
|
|
384
|
-
setReportPath(payload.path || payload.reportPath || null);
|
|
385
|
-
setRecordingPath(payload.recordingPath || null);
|
|
386
|
-
setAudioPath(payload.audioPath || null);
|
|
387
|
-
setSessionDir(payload.sessionDir || null);
|
|
388
|
-
setReviewSession(payload.reviewSession || null);
|
|
389
|
-
setShowReviewEditor(false);
|
|
390
|
-
setDuration(0);
|
|
391
|
-
loadRecentSessions();
|
|
392
|
-
processingStartedAtRef.current = null;
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
const unsubSessionError = window.markupr.session.onError((payload) => {
|
|
396
|
-
stopRequestedRef.current = false;
|
|
397
|
-
outputReadyRef.current = false;
|
|
398
|
-
setState('error');
|
|
399
|
-
setErrorMessage(payload.message);
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
const unsubOutputError = window.markupr.output.onError((payload) => {
|
|
403
|
-
stopRequestedRef.current = false;
|
|
404
|
-
outputReadyRef.current = false;
|
|
405
|
-
setState('error');
|
|
406
|
-
setErrorMessage(payload.message);
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
return () => {
|
|
410
|
-
mounted = false;
|
|
411
|
-
unsubState();
|
|
412
|
-
unsubStatus();
|
|
413
|
-
unsubScreenshot();
|
|
414
|
-
unsubReady();
|
|
415
|
-
unsubSessionError();
|
|
416
|
-
unsubOutputError();
|
|
417
|
-
|
|
418
|
-
if (recorder.isRecording()) {
|
|
419
|
-
void recorder.stop();
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
|
-
}, [loadRecentSessions, queueScreenRecordingSync]);
|
|
423
|
-
|
|
424
|
-
// ---------------------------------------------------------------------------
|
|
425
|
-
// Audio level + voice activity listeners
|
|
426
|
-
// ---------------------------------------------------------------------------
|
|
427
|
-
useEffect(() => {
|
|
428
|
-
const unsubLevel = window.markupr.audio.onLevel((level) => {
|
|
429
|
-
setAudioLevel(level);
|
|
430
|
-
});
|
|
431
|
-
const unsubVoice = window.markupr.audio.onVoiceActivity((active) => {
|
|
432
|
-
setIsVoiceActive(active);
|
|
433
|
-
});
|
|
434
|
-
const unsubSessionVoice = window.markupr.session.onVoiceActivity(({ active }) => {
|
|
435
|
-
setIsVoiceActive(active);
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
return () => {
|
|
439
|
-
unsubLevel();
|
|
440
|
-
unsubVoice();
|
|
441
|
-
unsubSessionVoice();
|
|
442
|
-
};
|
|
443
|
-
}, []);
|
|
444
|
-
|
|
445
|
-
// ---------------------------------------------------------------------------
|
|
446
|
-
// Post-processing progress listeners
|
|
447
|
-
// ---------------------------------------------------------------------------
|
|
448
|
-
useEffect(() => {
|
|
449
|
-
const markuprApi = window.markupr as Record<string, unknown>;
|
|
450
|
-
let unsubProgress: (() => void) | null = null;
|
|
451
|
-
let unsubComplete: (() => void) | null = null;
|
|
452
|
-
|
|
453
|
-
if (markuprApi.processing && typeof (markuprApi.processing as Record<string, unknown>).onProgress === 'function') {
|
|
454
|
-
const processingApi = markuprApi.processing as {
|
|
455
|
-
onProgress: (cb: (data: ProcessingProgress) => void) => () => void;
|
|
456
|
-
onComplete: (cb: (data: unknown) => void) => () => void;
|
|
457
|
-
};
|
|
458
|
-
unsubProgress = processingApi.onProgress((data) => {
|
|
459
|
-
setRawProcessingProgress({
|
|
460
|
-
percent: Math.max(0, Math.min(100, Math.round(data.percent))),
|
|
461
|
-
step: data.step,
|
|
462
|
-
});
|
|
463
|
-
});
|
|
464
|
-
unsubComplete = processingApi.onComplete(() => {
|
|
465
|
-
setRawProcessingProgress({ percent: 100, step: 'complete' });
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
return () => {
|
|
470
|
-
unsubProgress?.();
|
|
471
|
-
unsubComplete?.();
|
|
472
|
-
};
|
|
473
|
-
}, []);
|
|
474
|
-
|
|
475
|
-
// ---------------------------------------------------------------------------
|
|
476
|
-
// Actions
|
|
477
|
-
// ---------------------------------------------------------------------------
|
|
478
|
-
const startSession = useCallback(async () => {
|
|
479
|
-
setIsMutating(true);
|
|
480
|
-
try {
|
|
481
|
-
setScreenshotCount(0);
|
|
482
|
-
setLastCapture(null);
|
|
483
|
-
setRecordingPath(null);
|
|
484
|
-
setAudioPath(null);
|
|
485
|
-
setErrorMessage(null);
|
|
486
|
-
stopRequestedRef.current = false;
|
|
487
|
-
outputReadyRef.current = false;
|
|
488
|
-
|
|
489
|
-
const result = await window.markupr.session.start();
|
|
490
|
-
if (!result.success) {
|
|
491
|
-
setState('error');
|
|
492
|
-
setErrorMessage(result.error || 'Unable to start session.');
|
|
493
|
-
window.markupr.whisper
|
|
494
|
-
.hasTranscriptionCapability()
|
|
495
|
-
.then((ready) => setHasTranscriptionCapability(ready))
|
|
496
|
-
.catch(() => {});
|
|
497
|
-
} else {
|
|
498
|
-
const activeSession = await window.markupr.session.getCurrent();
|
|
499
|
-
if (activeSession) {
|
|
500
|
-
await queueScreenRecordingSync('recording', activeSession, false);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
} catch (error) {
|
|
504
|
-
setState('error');
|
|
505
|
-
setErrorMessage(error instanceof Error ? error.message : 'Unknown session error.');
|
|
506
|
-
} finally {
|
|
507
|
-
setIsMutating(false);
|
|
508
|
-
}
|
|
509
|
-
}, [queueScreenRecordingSync]);
|
|
510
|
-
|
|
511
|
-
const stopSession = useCallback(async () => {
|
|
512
|
-
setIsMutating(true);
|
|
513
|
-
try {
|
|
514
|
-
stopRequestedRef.current = true;
|
|
515
|
-
|
|
516
|
-
const recorder = screenRecorderRef.current;
|
|
517
|
-
recorder.releaseCaptureTracks();
|
|
518
|
-
|
|
519
|
-
try {
|
|
520
|
-
await queueScreenRecordingSync('idle', null, false);
|
|
521
|
-
} catch (error) {
|
|
522
|
-
console.warn('[RecordingContext] Failed to flush screen recording before stop:', error);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
const result = await window.markupr.session.stop();
|
|
526
|
-
if (!result.success) {
|
|
527
|
-
setState('error');
|
|
528
|
-
setErrorMessage(result.error || 'Unable to stop session.');
|
|
529
|
-
}
|
|
530
|
-
} catch (error) {
|
|
531
|
-
setState('error');
|
|
532
|
-
setErrorMessage(error instanceof Error ? error.message : 'Unknown session error.');
|
|
533
|
-
} finally {
|
|
534
|
-
setIsMutating(false);
|
|
535
|
-
}
|
|
536
|
-
}, [queueScreenRecordingSync]);
|
|
537
|
-
|
|
538
|
-
const togglePause = useCallback(async () => {
|
|
539
|
-
if (state !== 'recording') return;
|
|
540
|
-
|
|
541
|
-
setIsMutating(true);
|
|
542
|
-
try {
|
|
543
|
-
if (isPaused) {
|
|
544
|
-
const result = await window.markupr.session.resume();
|
|
545
|
-
if (!result.success) {
|
|
546
|
-
setErrorMessage(result.error || 'Unable to resume session.');
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
setIsPaused(false);
|
|
550
|
-
await queueScreenRecordingSync('recording', null, false);
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
const result = await window.markupr.session.pause();
|
|
555
|
-
if (!result.success) {
|
|
556
|
-
setErrorMessage(result.error || 'Unable to pause session.');
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
setIsPaused(true);
|
|
560
|
-
setIsVoiceActive(false);
|
|
561
|
-
await queueScreenRecordingSync('recording', null, true);
|
|
562
|
-
} catch (error) {
|
|
563
|
-
setErrorMessage(error instanceof Error ? error.message : 'Pause/resume failed.');
|
|
564
|
-
} finally {
|
|
565
|
-
setIsMutating(false);
|
|
566
|
-
}
|
|
567
|
-
}, [isPaused, state, queueScreenRecordingSync]);
|
|
568
|
-
|
|
569
|
-
const manualCapture = useCallback(async () => {
|
|
570
|
-
if (state !== 'recording' || isPaused || isMutating) return;
|
|
571
|
-
const result = await window.markupr.capture.manualScreenshot();
|
|
572
|
-
if (!result.success) {
|
|
573
|
-
setErrorMessage(result.error || 'Manual capture failed.');
|
|
574
|
-
}
|
|
575
|
-
}, [state, isPaused, isMutating]);
|
|
576
|
-
|
|
577
|
-
const copyReportPath = useCallback(async () => {
|
|
578
|
-
if (!reportPath) return;
|
|
579
|
-
await window.markupr.copyToClipboard(reportPath);
|
|
580
|
-
}, [reportPath]);
|
|
581
|
-
|
|
582
|
-
const openReportFolder = useCallback(async () => {
|
|
583
|
-
if (sessionDir) {
|
|
584
|
-
await window.markupr.output.openFolder(sessionDir);
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
if (reportPath) {
|
|
588
|
-
await window.markupr.output.openFolder(reportPath);
|
|
589
|
-
}
|
|
590
|
-
}, [sessionDir, reportPath]);
|
|
591
|
-
|
|
592
|
-
const copyRecordingPath = useCallback(async () => {
|
|
593
|
-
if (!recordingPath) return;
|
|
594
|
-
await window.markupr.copyToClipboard(recordingPath);
|
|
595
|
-
}, [recordingPath]);
|
|
596
|
-
|
|
597
|
-
const copyAudioPath = useCallback(async () => {
|
|
598
|
-
if (!audioPath) return;
|
|
599
|
-
await window.markupr.copyToClipboard(audioPath);
|
|
600
|
-
}, [audioPath]);
|
|
601
|
-
|
|
602
|
-
const openRecent = useCallback(async (session: { folder: string }) => {
|
|
603
|
-
await window.markupr.output.openFolder(session.folder);
|
|
604
|
-
}, []);
|
|
605
|
-
|
|
606
|
-
const copyRecentPath = useCallback(async (session: { folder: string }) => {
|
|
607
|
-
await window.markupr.copyToClipboard(`${session.folder}/feedback-report.md`);
|
|
608
|
-
}, []);
|
|
609
|
-
|
|
610
|
-
const recoverSession = useCallback(() => {
|
|
611
|
-
rawRecoverSession();
|
|
612
|
-
outputReadyRef.current = true;
|
|
613
|
-
setState('complete');
|
|
614
|
-
loadRecentSessions();
|
|
615
|
-
}, [rawRecoverSession, loadRecentSessions]);
|
|
616
|
-
|
|
617
|
-
const discardSession = useCallback(() => {
|
|
618
|
-
rawDiscardSession();
|
|
619
|
-
}, [rawDiscardSession]);
|
|
620
|
-
|
|
621
|
-
const reviewSave = useCallback(async (_session: ReviewSession) => {
|
|
622
|
-
try {
|
|
623
|
-
await window.markupr.output.save();
|
|
624
|
-
} catch {
|
|
625
|
-
// Save failure is non-fatal in review mode
|
|
626
|
-
}
|
|
627
|
-
}, []);
|
|
628
|
-
|
|
629
|
-
const reviewClose = useCallback(() => {
|
|
630
|
-
setShowReviewEditor(false);
|
|
631
|
-
}, []);
|
|
632
|
-
|
|
633
|
-
// ---------------------------------------------------------------------------
|
|
634
|
-
// Context value
|
|
635
|
-
// ---------------------------------------------------------------------------
|
|
636
|
-
const value: RecordingContextValue = {
|
|
637
|
-
state,
|
|
638
|
-
duration,
|
|
639
|
-
screenshotCount,
|
|
640
|
-
isPaused,
|
|
641
|
-
isMutating,
|
|
642
|
-
audioLevel,
|
|
643
|
-
isVoiceActive,
|
|
644
|
-
lastCapture,
|
|
645
|
-
reportPath,
|
|
646
|
-
recordingPath,
|
|
647
|
-
audioPath,
|
|
648
|
-
sessionDir,
|
|
649
|
-
reviewSession,
|
|
650
|
-
errorMessage,
|
|
651
|
-
hasTranscriptionCapability,
|
|
652
|
-
recentSessions,
|
|
653
|
-
loadRecentSessions,
|
|
654
|
-
rawProcessingProgress,
|
|
655
|
-
processingStartedAt: processingStartedAtRef.current,
|
|
656
|
-
showReviewEditor,
|
|
657
|
-
setShowReviewEditor,
|
|
658
|
-
incompleteSession,
|
|
659
|
-
isCheckingRecovery,
|
|
660
|
-
startSession,
|
|
661
|
-
stopSession,
|
|
662
|
-
togglePause,
|
|
663
|
-
manualCapture,
|
|
664
|
-
copyReportPath,
|
|
665
|
-
openReportFolder,
|
|
666
|
-
copyRecordingPath,
|
|
667
|
-
copyAudioPath,
|
|
668
|
-
openRecent,
|
|
669
|
-
copyRecentPath,
|
|
670
|
-
recoverSession,
|
|
671
|
-
discardSession,
|
|
672
|
-
reviewSave,
|
|
673
|
-
reviewClose,
|
|
674
|
-
};
|
|
675
|
-
|
|
676
|
-
return (
|
|
677
|
-
<RecordingContext.Provider value={value}>
|
|
678
|
-
{children}
|
|
679
|
-
</RecordingContext.Provider>
|
|
680
|
-
);
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
export default RecordingContext;
|