r4k5O

Entwickle eine Chrome-Extension, die im 'Agent'-Modus von ChatGPT alle Interaktionen, einschließlich Bilder und Aktionen, in Echtzeit aufzeichnet. Die Extension sollte eine Benutzeroberfläche bieten, um die Aufnahme zu starten und zu stoppen, und das aufgenommene Material in einem gängigen Videoformat (z.B. MP4) speichern, mit der Möglichkeit, die Videoqualität (720p, 1080p) auszuwählen. Zusätzlich soll die Erweiterung sicherstellen, dass alle aufgezeichneten Daten lokal auf dem Benutzergerät gespeichert werden, um Datenschutz und Sicherheit zu gewährleisten.

Kodari AI
KodariMay 1 at 8:21 am 400 (v2)
ChatGPTAgentRecorder
A Chrome extension that records all interactions in ChatGPT's Agent mode, including images and actions, in real-time. It provides a user interface to start and stop recording, saves captured content as MP4 video with selectable quality (720p or 1080p), and ensures all data is stored locally on the user's device for privacy and security. The extension detects Agent mode on chat.openai.com and uses tab capture for seamless video recording.
r4k5O

But ChatGPT is also available under chatgpt.com

Kodari AI
KodariMay 1 at 8:22 am 308 (v2)

Updated manifest.json to include support for both chat.openai.com and chatgpt.com domains.

r4k5O

Can you add now actual record logic?

Kodari AI
KodariMay 1 at 8:28 am 1,018 (v2)

The extension now includes full recording logic: it detects Agent mode on both ChatGPT domains, captures tab video/audio in real-time using chrome.tabCapture, supports 720p/1080p quality selection, saves recordings locally as MP4 (with WebM fallback), and monitors for Agent mode changes via DOM observation. All data remains local for privacy.

r4k5O

Beispielbild-URL: https://chatgpt.com/backend-api/estuary/content?id=file_00000000cdd471f4a3e27339ae3d9c0e&ts=493784&p=fs&cid=1&sig=a051b075ed90b097f6b47b0a343fcd95cce7e1d67b46f888acccff478d60055f&v=0

Kodari AI
KodariMay 1 at 8:34 am 697 (v2)
  • The extension already records all visible interactions on the ChatGPT tab, including images, using chrome.tabCapture for real-time video capture.

  • The provided example image URL indicates images are served from ChatGPT’s backend, but since tabCapture captures the rendered page content, images are automatically included in the video recording.

  • No additional code changes are needed to handle images, as the current implementation covers the requirement to record interactions including images.

Kodari can make mistakes. Review important code before using.
Files
background.js
content.js
manifest.json
popup.css
popup.html
popup.js
Code
6 219
background.js
let recorder;
let recordedChunks = [];
let agentModeActive = false;

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  if (message.action === 'startRecording') {
    if (agentModeActive) {
      startRecording(message.quality);
    } else {
      console.error('Not in Agent mode');
      // Optionally notify user
    }
  } else if (message.action === 'stopRecording') {
    stopRecording();
  } else if (message.action === 'agentModeDetected') {
    agentModeActive = true;
  } else if (message.action === 'agentModeLeft') {
    agentModeActive = false;
  }
});

async function startRecording(quality) {
  const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
  if (!tab.url.includes('chat.openai.com') && !tab.url.includes('chatgpt.com')) {
    console.error('Not on ChatGPT page');
    return;
  }

  const constraints = quality === '720p' ? { video: { width: 1280, height: 720 }, audio: true } : { video: { width: 1920, height: 1080 }, audio: true };

  try {
    const stream = await chrome.tabCapture.capture(constraints);
    recorder = new MediaRecorder(stream, { mimeType: 'video/mp4;codecs=avc1.42E01E,mp4a.40.2' });
    recordedChunks = [];

    recorder.ondataavailable = (event) => {
      if (event.data.size > 0) {
        recordedChunks.push(event.data);
      }
    };

    recorder.onstop = () => {
      const blob = new Blob(recordedChunks, { type: 'video/mp4' });
      const url = URL.createObjectURL(blob);
      chrome.downloads.download({
        url: url,
        filename: `chatgpt_agent_recording_${Date.now()}.mp4`
      });
      stream.getTracks().forEach(track => track.stop());
      chrome.storage.local.set({ isRecording: false });
      agentModeActive = false; // Reset after recording
    };

    recorder.start();
    chrome.storage.local.set({ isRecording: true });
  } catch (error) {
    console.error('Failed to start recording:', error);
    // Fallback to webm if mp4 not supported
    try {
      const stream = await chrome.tabCapture.capture(constraints);
      recorder = new MediaRecorder(stream, { mimeType: 'video/webm' });
      recordedChunks = [];

      recorder.ondataavailable = (event) => {
        if (event.data.size > 0) {
          recordedChunks.push(event.data);
        }
      };

      recorder.onstop = () => {
        const blob = new Blob(recordedChunks, { type: 'video/webm' });
        const url = URL.createObjectURL(blob);
        chrome.downloads.download({
          url: url,
          filename: `chatgpt_agent_recording_${Date.now()}.webm`
        });
        stream.getTracks().forEach(track => track.stop());
        chrome.storage.local.set({ isRecording: false });
        agentModeActive = false;
      };

      recorder.start();
      chrome.storage.local.set({ isRecording: true });
    } catch (fallbackError) {
      console.error('Fallback recording also failed:', fallbackError);
    }
  }
}

function stopRecording() {
  if (recorder && recorder.state === 'recording') {
    recorder.stop();
  }
}