Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

docs

Louis Beaumont1b5b7b42a6b4
diff --git a/content/docs/pages/docs/getting-started.mdx b/content/docs/pages/docs/getting-started.mdx
index 5d89af030..7316b0bde 100644
--- a/content/docs/pages/docs/getting-started.mdx
+++ b/content/docs/pages/docs/getting-started.mdx
@@ -18,7 +18,7 @@ screenpipe
then
```bash copy
-open screenpipe-server/examples/timeline_ui/index.html # or open manually in your browser
+open screenpipe-server/examples/timeline_ui_simple/index.html # or open manually in your browser
```
this will open a rewind.ai alike timeline powered by a single html file :) that you can tweak around!
diff --git a/screenpipe-server/examples/timeline_ui/index.html b/screenpipe-server/examples/timeline_ui/index.html
deleted file mode 100644
index ba0eb01a7..000000000
--- a/screenpipe-server/examples/timeline_ui/index.html
+++ /dev/null
@@ -1,773 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>screenpipe frame stream</title>
- <style>
- body {
- background: #000;
- color: #fff;
- font-family: 'Press Start 2P', monospace;
- margin: 0;
- padding: 20px;
- image-rendering: pixelated;
- max-width: 100vw;
- overflow-x: hidden;
- box-sizing: border-box;
- }
- #timeline {
- position: fixed;
- left: 50%;
- transform: translateX(-50%);
- bottom: 20px;
- width: 80%;
- height: 60px;
- background: #111;
- border: 4px solid #444;
- image-rendering: pixelated;
- box-shadow: 0 0 16px rgba(0,0,0,0.8), inset 0 0 8px rgba(255,255,255,0.1);
- max-width: calc(80vw - 48px);
- box-sizing: border-box;
- z-index: 1000;
- }
- #cursor {
- position: absolute;
- width: 4px;
- height: 100%;
- background: #0f0;
- box-shadow: 0 0 12px #0f0;
- top: 0;
- opacity: 0.8;
- left: 50%;
- transform: translateX(-50%);
- }
- #frame {
- display: none;
- margin: 32px auto;
- max-width: min(80%, calc(80vw - 48px));
- border: 4px solid #333;
- min-height: 200px;
- image-rendering: pixelated;
- box-shadow: 0 0 16px rgba(255,255,255,0.1);
- height: auto;
- }
- #info {
- margin-top: 10px;
- font-size: 8px;
- color: #888;
- letter-spacing: 1px;
- }
- #error {
- color: #ff4444;
- margin-top: 10px;
- white-space: pre-wrap;
- font-family: monospace;
- }
- .loading {
- position: fixed;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- background: rgba(0,0,0,0.9);
- padding: 20px;
- border-radius: 4px;
- border: 4px solid #333;
- box-shadow: 0 0 32px rgba(0,0,0,0.8);
- image-rendering: pixelated;
- display: none;
- text-align: center;
- }
- .loading.active {
- display: block;
- }
- .progress-bar {
- width: 200px;
- height: 4px;
- background: #111;
- border: 2px solid #333;
- margin: 10px auto;
- position: relative;
- }
- .progress-bar-fill {
- position: absolute;
- left: 0;
- top: 0;
- height: 100%;
- background: #fff;
- transition: width 0.2s ease;
- box-shadow: 0 0 8px #fff;
- }
- .progress-text {
- font-size: 12px;
- color: #666;
- margin-top: 5px;
- }
- /* retro cursor animation */
- .loading::after {
- content: '';
- display: inline-block;
- width: 8px;
- height: 8px;
- background: #fff;
- margin-left: 5px;
- animation: blink 1s infinite;
- }
- @keyframes blink {
- 0% { opacity: 0; }
- 50% { opacity: 1; }
- 100% { opacity: 0; }
- }
- /* New retro scanline effect */
- body::after {
- content: '';
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: repeating-linear-gradient(
- 0deg,
- rgba(0,0,0,0.1) 0px,
- rgba(0,0,0,0.1) 1px,
- transparent 1px,
- transparent 2px
- );
- pointer-events: none;
- z-index: 999;
- }
- .timeline-timestamps {
- width: 80%;
- margin: 4px auto 0 auto;
- position: relative;
- font-size: 8px;
- color: #666;
- max-width: calc(80vw - 48px);
- box-sizing: border-box;
- padding: 0 8px;
- transition: transform 0.3s ease;
- }
- .timestamp {
- position: absolute;
- transform: translateX(-50%);
- white-space: nowrap;
- left: 0;
- color: #0f0;
- text-shadow: 0 0 8px #0f0;
- font-size: 10px;
- bottom: -20px;
- }
- /* Add spacing between elements */
- #timeline {
- margin: 0 auto 32px auto; /* Increased bottom margin */
- }
-
- #frame {
- margin: 32px auto; /* Added vertical margin */
- }
-
- /* Center info and error text */
- #info, #error {
- text-align: center;
- margin: 20px auto;
- max-width: 80%;
- }
-
- /* Add colored background for current position */
- .timeline-highlight {
- position: absolute;
- height: 100%;
- width: 4px; /* Match cursor width instead of 20% */
- background: rgba(255, 255, 255, 0.1);
- top: 0;
- transform: translateX(-50%);
- pointer-events: none;
- transition: left 0.3s ease;
- box-shadow: 0 0 8px rgba(255, 255, 255, 0.1); /* Added subtle glow */
- }
-
- /* Add grid lines */
- #timeline::before {
- content: '';
- position: absolute;
- width: 100%;
- height: 100%;
- background:
- linear-gradient(90deg,
- rgba(0,255,0,0.1) 1px,
- transparent 1px
- );
- background-size: 10% 100%;
- transition: transform 0.3s ease;
- }
-
- /* Add new styles for app and window info */
- .metadata {
- font-family: 'Press Start 2P', monospace;
- font-size: 8px;
- color: #0f0;
- text-shadow: 0 0 8px rgba(0,255,0,0.3);
- margin: 16px 0;
- text-align: center;
- position: fixed;
- top: 20px;
- left: 50%;
- transform: translateX(-50%);
- width: 100%;
- z-index: 1001;
- background: rgba(0, 0, 0, 0.8);
- padding: 10px;
- border-bottom: 2px solid #0f0;
- }
- .metadata span {
- margin: 0 8px;
- display: inline-block;
- }
-
- #timeline::after {
- content: '← scroll to navigate →';
- position: absolute;
- bottom: -24px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 8px;
- color: #666;
- white-space: nowrap;
- }
-
- /* Add hover effect to indicate scrollable */
- #timeline:hover {
- border-color: #0f0;
- box-shadow: 0 0 16px rgba(0,255,0,0.2), inset 0 0 8px rgba(0,255,0,0.1);
- }
-
- /* Add these styles */
- html, body {
- overscroll-behavior: none; /* Disable the bounce/rubber-band effect */
- height: 100%;
- overflow: hidden; /* Prevent default scrolling */
- }
-
- /* Add these styles */
- .timeline-top-bar {
- position: absolute;
- bottom: -24px;
- left: 0;
- width: 100%;
- height: 20px;
- display: flex;
- align-items: center;
- font-size: 10px;
- color: #0f0;
- overflow: hidden;
- }
-
- .timeline-numbers {
- position: absolute;
- display: flex;
- transition: transform 0.3s ease;
- white-space: nowrap;
- }
-
- .time-mark {
- padding: 0 10px;
- opacity: 0.8;
- }
-
- .now-indicator {
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- background: #0f0;
- color: #000;
- padding: 2px 6px;
- font-size: 8px;
- border-radius: 2px;
- z-index: 1;
- box-shadow: 0 0 8px rgba(0,255,0,0.4);
- }
-
- /* Add styles for app indicators */
- .app-indicators {
- position: absolute;
- bottom: -48px; /* Below the timeline numbers */
- left: 0;
- width: 100%;
- height: 20px;
- display: flex;
- align-items: center;
- overflow: hidden;
- }
-
- .app-marker {
- position: absolute;
- transform: translateX(-50%);
- font-size: 8px;
- color: #0f0;
- opacity: 0.8;
- white-space: nowrap;
- text-shadow: 0 0 8px rgba(0,255,0,0.4);
- }
-
- /* Update timeline container to account for bottom elements */
- #timeline {
- margin-bottom: 64px; /* Increased to make room for bottom elements */
- }
-
- /* Rename and update the bar styles */
- .timeline-bottom-bar {
- position: absolute;
- bottom: -24px;
- left: 0;
- width: 100%;
- height: 20px;
- display: flex;
- align-items: center;
- font-size: 10px;
- color: #0f0;
- overflow: visible;
- }
-
- .timeline-numbers {
- position: absolute;
- display: flex;
- transition: transform 0.3s ease;
- white-space: nowrap;
- width: 100%;
- }
-
- .time-mark {
- position: absolute;
- padding: 0 10px;
- opacity: 0.8;
- transform: translateX(-50%);
- text-shadow: 0 0 8px rgba(0,255,0,0.4);
- }
-
- .app-indicators {
- position: absolute;
- bottom: -48px;
- left: 0;
- width: 100%;
- height: 20px;
- display: flex;
- align-items: center;
- overflow: visible;
- }
-
- /* Make sure the timeline container has enough margin */
- #timeline {
- margin-bottom: 84px !important; /* Increased to make room for both bars */
- }
-
- /* Add these new styles for the time travel indicator */
- .time-travel-indicator {
- position: fixed;
- bottom: 40px;
- left: 50%;
- transform: translateX(-50%);
- font-size: 12px;
- color: #0f0;
- text-shadow: 0 0 8px #0f0;
- opacity: 0;
- transition: opacity 0.2s ease;
- pointer-events: none;
- z-index: 1002;
- }
-
- .time-travel-indicator.active {
- opacity: 1;
- animation: pulse 0.5s infinite alternate;
- }
-
- @keyframes pulse {
- from { transform: translateX(-50%) scale(1); }
- to { transform: translateX(-50%) scale(1.1); }
- }
-
- .loading-indicator {
- position: fixed;
- bottom: 10px;
- left: 50%;
- transform: translateX(-50%);
- background: rgba(0, 255, 0, 0.1);
- border: 2px solid #0f0;
- padding: 8px 16px;
- font-family: 'Press Start 2P', monospace;
- font-size: 10px;
- color: #0f0;
- text-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
- display: none;
- z-index: 1000;
- box-shadow: 0 0 16px rgba(0, 255, 0, 0.2);
- }
-
- .loading-indicator.active {
- display: block;
- animation: pulse 1s infinite;
- }
-
- @keyframes pulse {
- 0% { opacity: 0.5; }
- 50% { opacity: 1; }
- 100% { opacity: 0.5; }
- }
-
- </style>
- <link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
-</head>
-<body>
- <div id="timeline">
- <div class="timeline-highlight"></div>
- <div id="cursor"></div>
- <div class="app-indicators"></div>
- </div>
- <div class="timeline-bottom-bar">
- <div class="timeline-numbers"></div>
- <div class="now-indicator">now</div>
- </div>
- <div class="timeline-timestamps" id="timestamps"></div>
- <img id="frame" />
- <div class="metadata">
- <span id="timestamp-display"></span>
- <span id="app-name-display"></span>
- <span id="window-name-display"></span>
- </div>
- <div id="info"></div>
- <div id="error"></div>
-
- <div class="loading-indicator">loading frames...</div>
-
- <script>
- let currentTime = new Date();
- let endTime = new Date();
- let startTime = new Date(endTime - 1000 * 60 * 15); // last 15 minutes
- let frames = []; // Store all frames
- const timelineWidth = document.getElementById('timeline').offsetWidth;
-
- // Add debounce utility
- let scrollTimeout = null;
-
- // Add these new variables
- const PREFETCH_THRESHOLD = 0.8; // When to fetch more frames (80% of visible range)
- const FETCH_OVERLAP = 1000 * 60 * 2; // 2 minutes overlap when fetching new frames
-
- // Add debounce utility at the top
- let prefetchTimeout = null;
- let lastPrefetchDirection = null;
- let isPrefetching = false;
-
- function debugFrames() {
- console.log('Current frames:', {
- count: frames.length,
- timeRange: `${new Date(frames[0]?.timestamp)} to ${new Date(frames[frames.length-1]?.timestamp)}`,
- currentTime: currentTime
- });
- }
-
- function updateTimelinePosition() {
- const timeRange = endTime - startTime;
- const position = (currentTime - startTime) / timeRange;
-
- // Calculate the translation percentage
- const translateX = (0.5 - position) * 100;
-
- // Update all timeline-related elements
- const elements = [
- '.timeline-timestamps',
- '.timeline-numbers',
- '.app-indicators',
- '#timeline::before' // Grid lines
- ];
-
- elements.forEach(selector => {
- const el = document.querySelector(selector);
- if (el) {
- el.style.transform = `translateX(${translateX}%)`;
- }
- });
-
- // Update grid position
- const timeline = document.getElementById('timeline');
- if (timeline) {
- timeline.style.setProperty('--grid-translate', `${translateX}%`);
- }
- }
-
- // Update prefetchFrames to prevent duplicate requests
- async function prefetchFrames(direction) {
- if (isPrefetching || direction === lastPrefetchDirection) {
- return;
- }
-
- if (prefetchTimeout) {
- clearTimeout(prefetchTimeout);
- }
-
- prefetchTimeout = setTimeout(async () => {
- isPrefetching = true;
- lastPrefetchDirection = direction;
-
- // Show loading indicator
- const loadingIndicator = document.querySelector('.loading-indicator');
- loadingIndicator.classList.add('active');
-
- try {
- const timeWindow = endTime - startTime;
- let newStartTime, newEndTime;
-
- if (direction === 'future') {
- newStartTime = new Date(endTime - FETCH_OVERLAP);
- newEndTime = new Date(endTime.getTime() + timeWindow);
- } else {
- newEndTime = new Date(startTime + FETCH_OVERLAP);
- newStartTime = new Date(startTime.getTime() - timeWindow);
- }
-
- console.log(`Prefetching ${direction} frames:`, {
- newStartTime,
- newEndTime,
- currentFrames: frames.length
- });
-
- // Use /frames endpoint instead of /stream/frames for batch fetch
- const url = new URL('http://localhost:3030/stream/frames');
- url.searchParams.append('start_time', newStartTime.toISOString());
- url.searchParams.append('end_time', newEndTime.toISOString());
-
- const response = await fetch(url.toString());
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
- }
- const newFrames = await response.json();
-
- if (!Array.isArray(newFrames)) {
- throw new Error('Expected array of frames');
- }
-
- const existingTimestamps = new Set(frames.map(f => f.timestamp));
- const uniqueNewFrames = newFrames.filter(f => !existingTimestamps.has(f.timestamp));
-
- if (direction === 'future') {
- frames.push(...uniqueNewFrames);
- endTime = newEndTime;
- } else {
- frames.unshift(...uniqueNewFrames);
- startTime = newStartTime;
- }
-
- frames.sort((a, b) => new Date(a.timestamp) - new Date(b.timestamp));
- updateTimelineMarkers();
-
- console.log('Prefetch complete:', {
- direction,
- newFramesAdded: uniqueNewFrames.length,
- totalFrames: frames.length
- });
- } catch (e) {
- console.error('Failed to prefetch frames:', e);
- } finally {
- // Hide loading indicator
- loadingIndicator.classList.remove('active');
-
- setTimeout(() => {
- isPrefetching = false;
- lastPrefetchDirection = null;
- }, 1000);
- }
- }, 500);
- }
-
- function displayFrameAtTime(timestamp) {
- if (!frames.length) {
- console.log('No frames available');
- return;
- }
-
- const targetTime = new Date(timestamp).getTime();
-
- // Find closest frame using binary search for better performance
- let closest = frames[0];
- let closestDiff = Math.abs(new Date(closest.timestamp).getTime() - targetTime);
-
- for (const frame of frames) {
- const diff = Math.abs(new Date(frame.timestamp).getTime() - targetTime);
- if (diff < closestDiff) {
- closest = frame;
- closestDiff = diff;
- }
- }
-
- console.log('Frame selection:', {
- targetTime: new Date(targetTime).toISOString(),
- selectedTime: closest.timestamp,
- timeDiff: closestDiff,
- framesAvailable: frames.length
- });
-
- // Update display
- const frameElement = document.getElementById('frame');
- frameElement.style.display = 'block';
- frameElement.src = `data:image/jpeg;base64,${closest.frame}`;
-
- // Restore app and window name display
- document.getElementById('timestamp-display').textContent =
- `time: ${new Date(closest.timestamp).toLocaleTimeString()}`;
- document.getElementById('app-name-display').textContent =
- `app: ${closest.app_name || 'unknown'}`;
- document.getElementById('window-name-display').textContent =
- `window: ${closest.window_name || 'unknown'}`;
- }
-
- function connectToStream(startTime, endTime) {
- if (window.eventSource) {
- window.eventSource.close();
- }
-
- const url = new URL('http://localhost:3030/stream/frames');
- url.searchParams.append('start_time', `${startTime.toISOString().slice(0, -1)}Z`);
- url.searchParams.append('end_time', `${endTime.toISOString().slice(0, -1)}Z`);
-
- window.eventSource = new EventSource(url.toString());
-
- window.eventSource.onopen = () => {
- console.log('SSE connection opened');
- document.getElementById('error').textContent = '';
- };
-
- window.eventSource.onmessage = (event) => {
- try {
- const data = JSON.parse(event.data);
-
- // Skip keep-alive messages
- if (data === 'keep-alive-text') return;
-
- // Ensure timestamp is properly formatted
- data.timestamp = new Date(data.timestamp).toISOString();
-
- // Add frame to array and sort by timestamp
- frames.push(data);
- frames.sort((a, b) => new Date(a.timestamp) - new Date(b.timestamp));
-
- console.log('Frame received:', {
- timestamp: data.timestamp,
- framesCount: frames.length
- });
-
- // Update display if needed
- if (frames.length === 1 || Math.abs(new Date(data.timestamp) - currentTime) < 1000) {
- displayFrameAtTime(currentTime);
- }
- } catch (e) {
- console.error('Failed to parse frame data:', e);
- }
- };
-
- window.eventSource.onerror = (error) => {
- console.log('stream ended or errored (expected behavior)');
- window.eventSource.close();
- };
- }
-
- function updateTimelineMarkers() {
- const timestampsContainer = document.querySelector('.timeline-numbers');
- const appIndicators = document.querySelector('.app-indicators');
-
- // Clear existing markers
- timestampsContainer.innerHTML = '';
- appIndicators.innerHTML = '';
-
- // Create evenly spaced timestamps
- const timeRange = endTime - startTime;
- const numMarkers = 10;
-
- for (let i = 0; i < numMarkers; i++) {
- const percent = (i / (numMarkers - 1)) * 100;
- const time = new Date(startTime.getTime() + (timeRange * (i / (numMarkers - 1))));
-
- const marker = document.createElement('div');
- marker.className = 'time-mark';
- marker.style.left = `${percent}%`;
- marker.textContent = time.toLocaleTimeString();
- timestampsContainer.appendChild(marker);
-
- console.log(`Added time marker at ${percent}%: ${time.toLocaleTimeString()}`); // Debug log
- }
-
- // Add app/window markers
- frames.forEach(frame => {
- const timestamp = new Date(frame.timestamp);
- const percent = ((timestamp - startTime) / timeRange) * 100;
-
- if (percent >= 0 && percent <= 100) {
- const marker = document.createElement('div');
- marker.className = 'app-marker';
- marker.style.left = `${percent}%`;
- marker.textContent = `${frame.app_name || 'unknown'} - ${frame.window_name || 'unknown'}`;
- appIndicators.appendChild(marker);
-
- console.log(`Added app marker at ${percent}%: ${frame.app_name}`); // Debug log
- }
- });
- }
-
- function navigateTimeRange(direction) {
- const timeWindow = endTime - startTime;
-
- if (direction === 'past') {
- endTime = new Date(startTime);
- startTime = new Date(startTime - timeWindow);
- } else if (direction === 'future') {
- startTime = new Date(endTime);
- endTime = new Date(endTime + timeWindow);
- }
-
- frames = []; // Clear existing frames
- connectToStream(startTime, endTime);
- updateTimelineMarkers();
- }
-
- // Update the wheel event listener
- document.addEventListener('wheel', (e) => {
- e.preventDefault();
-
- const timeRange = endTime - startTime;
- const scrollSensitivity = timeRange / 200;
-
- const timeDelta = e.deltaY > 0 ? scrollSensitivity : -scrollSensitivity;
- const newTime = new Date(currentTime.getTime() + timeDelta);
-
- if (newTime >= startTime && newTime <= endTime) {
- currentTime = newTime;
-
- // Check if we're near boundaries and need to prefetch
- const position = (currentTime - startTime) / (endTime - startTime);
-
- if (position > PREFETCH_THRESHOLD) {
- prefetchFrames('future');
- } else if (position < (1 - PREFETCH_THRESHOLD)) {
- prefetchFrames('past');
- }
-
- displayFrameAtTime(currentTime);
- updateTimelinePosition();
- }
- }, { passive: false });
-
- // Optional: Add touch support for mobile
- document.addEventListener('touchmove', (e) => {
- e.preventDefault();
-
- const touch = e.touches[0];
- if (touch.clientY > e.target.clientY) {
- navigateTimeRange('future');
- } else {
- navigateTimeRange('past');
- }
- }, { passive: false });
-
- // Initial connection
- connectToStream(startTime, endTime);
- updateTimelineMarkers();
- </script>
- <div class="time-travel-indicator">▼ traveling through time ▼</div>
-</body>
-</html>
\ No newline at end of file