(tabId)
| 19 | * This ensures the generated code can reproduce the same starting conditions |
| 20 | */ |
| 21 | export async function captureInitialState(tabId) { |
| 22 | try { |
| 23 | console.log('📸 Capturing initial webpage state...'); |
| 24 | |
| 25 | // Request initial state from content script |
| 26 | const response = await chrome.tabs.sendMessage(tabId, { |
| 27 | type: 'GET_INITIAL_STATE' |
| 28 | }); |
| 29 | |
| 30 | if (response && response.success) { |
| 31 | console.log('✅ Initial state captured:', response.state); |
| 32 | return response.state; |
| 33 | } else { |
| 34 | console.warn('⚠️ Failed to capture initial state from content script'); |
| 35 | return null; |
| 36 | } |
| 37 | } catch (error) { |
| 38 | console.error('❌ Error capturing initial state:', error); |
| 39 | return null; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Create initial actions based on captured webpage state |
no outgoing calls
no test coverage detected