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

feat: more logs commands

Louis Beaumont61a076be3239
diff --git a/examples/apps/screenpipe-app-tauri/components/screenpipe-status.tsx b/examples/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
index f93436a3b..58f6c414f 100644
--- a/examples/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
@@ -30,19 +30,26 @@ const HealthStatus = ({ className }: { className?: string }) => {
const [health, setHealth] = useState<HealthCheckResponse | null>(null);
const [isBlinking, setIsBlinking] = useState(false);
const [isDialogOpen, setIsDialogOpen] = useState(false);
+ const [error, setError] = useState<string | null>(null);
useEffect(() => {
const fetchHealth = async () => {
try {
const response = await fetch("http://localhost:3030/health");
+ if (!response.ok) {
+ throw new Error(`HTTP error! status: ${response.status}`);
+ }
const data: HealthCheckResponse = await response.json();
if (health && data.status !== health.status) {
setIsBlinking(true);
setTimeout(() => setIsBlinking(false), 5000); // Blink for 5 seconds on status change
}
setHealth(data);
+ setError(null);
} catch (error) {
console.error("Failed to fetch health status:", error);
+ setError("Failed to fetch health status. Server might be down.");
+ setHealth(null);
}
};
@@ -50,7 +57,93 @@ const HealthStatus = ({ className }: { className?: string }) => {
const interval = setInterval(fetchHealth, 1000); // Poll every 1 seconds
return () => clearInterval(interval);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
+ const logCommands = `# Stream the log:
+tail -f $HOME/.screenpipe/screenpipe.log
+
+# Scroll the logs:
+less $HOME/.screenpipe/screenpipe.log
+
+# View last 10 frames:
+sqlite3 $HOME/.screenpipe/db.sqlite \\
+"SELECT * FROM frames ORDER BY timestamp DESC LIMIT 10;"
+
+# View last 10 audio transcriptions:
+sqlite3 $HOME/.screenpipe/db.sqlite \\
+"SELECT * FROM audio_transcriptions ORDER BY timestamp DESC LIMIT 10;"`;
+ if (error) {
+ return (
+ <>
+ <style jsx>{`
+ @keyframes pulse-custom {
+ 0%,
+ 100% {
+ opacity: 1;
+ }
+ 50% {
+ opacity: 0.5;
+ }
+ }
+ .animate-pulse-custom {
+ animation: pulse-custom 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
+ }
+ `}</style>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div
+ className={`w-4 h-4 rounded-full bg-red-500 animate-pulse-custom shadow-lg flex items-center justify-center text-white font-bold ${className}`}
+ />
+ </TooltipTrigger>
+ <TooltipContent className="w-64 p-2">
+ <h3 className="font-bold mb-2">Error</h3>
+ <p className="text-sm">{error}</p>
+ <Button
+ variant="outline"
+ size="sm"
+ className="mt-2 w-full"
+ onClick={() => setIsDialogOpen(true)}
+ >
+ View Log Commands
+ </Button>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
+ <DialogContent className="max-w-3xl max-h-[80vh] flex flex-col">
+ <DialogHeader>
+ <DialogTitle>Log Commands</DialogTitle>
+ </DialogHeader>
+ <div className="flex-grow overflow-auto">
+ <CodeBlock language="bash" value={logCommands} />
+ </div>
+ <div className="mt-2 text-sm text-gray-500">
+ <p>Or, for more advanced queries:</p>
+ <ol className="list-decimal list-inside mt-2">
+ <li>
+ <a
+ href="https://github.com/louis030195/screen-pipe/blob/main/screenpipe-server/src/db.rs"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-blue-500 hover:underline"
+ >
+ Go to the database schema
+ </a>
+ </li>
+ <li>Copy the entire page (Cmd+A, Cmd+C)</li>
+ <li>Paste into ChatGPT (Cmd+V)</li>
+ <li>
+ Ask: &quot;give me 10 sqlite query CLI to look up my
+ data&quot;
+ </li>
+ </ol>
+ </div>
+ </DialogContent>
+ </Dialog>
+ </>
+ );
+ }
if (!health) return null;
@@ -74,12 +167,6 @@ const HealthStatus = ({ className }: { className?: string }) => {
const blinkingClass =
isBlinking || health.status === "Unhealthy" ? "animate-pulse" : "";
- const logCommands = `# Stream the log:
-tail -f $HOME/.screenpipe/screenpipe.log
-
-# Scroll the logs:
-less $HOME/.screenpipe/screenpipe.log`;
-
return (
<>
<style jsx>{`
@@ -133,11 +220,33 @@ less $HOME/.screenpipe/screenpipe.log`;
</Tooltip>
</TooltipProvider>
<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
- <DialogContent>
+ <DialogContent className="max-w-3xl max-h-[80vh] flex flex-col">
<DialogHeader>
<DialogTitle>Log Commands</DialogTitle>
</DialogHeader>
- <CodeBlock language="bash" value={logCommands} />
+ <div className="flex-grow overflow-auto">
+ <CodeBlock language="bash" value={logCommands} />
+ </div>
+ <div className="mt-4 text-sm text-gray-500">
+ <p>Or, for more advanced queries:</p>
+ <ol className="list-decimal list-inside mt-2">
+ <li>
+ <a
+ href="https://github.com/louis030195/screen-pipe/blob/main/screenpipe-server/src/db.rs"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-blue-500 hover:underline"
+ >
+ Go to the database schema
+ </a>
+ </li>
+ <li>Copy the entire page (Cmd+A, Cmd+C)</li>
+ <li>Paste into ChatGPT (Cmd+V)</li>
+ <li>
+ Ask: &quot;give me 10 sqlite query CLI to look up my data&quot;
+ </li>
+ </ol>
+ </div>
</DialogContent>
</Dialog>
</>
diff --git a/examples/apps/screenpipe-app-tauri/scripts/pre_build.js b/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
index d156e918f..0584b96f6 100644
--- a/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
+++ b/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
@@ -119,6 +119,43 @@ if (platform == 'windows') {
/* ########## macOS ########## */
if (platform == 'macos') {
+ const nativeArch = os.arch();
+ const architectures = ['arm64', 'x86_64'];
+ // Additional steps for x86_64 build on ARM Mac
+ if (nativeArch === 'arm64') {
+ console.log('\nTo build for x86_64 on your ARM Mac:');
+ console.log('1. Install Rosetta 2 if not already installed:');
+ console.log(' softwareupdate --install-rosetta');
+ console.log('2. Set up an x86_64 Homebrew environment:');
+ console.log(' arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"');
+ // console.log('3. When building, use this command:');
+ // console.log(' arch -x86_64 bunx tauri build -- --target x86_64-apple-darwin');
+ }
+ for (const arch of architectures) {
+ const tesseractBinary = `./tesseract-${arch}-apple-darwin`;
+ if (!(await fs.exists(tesseractBinary))) {
+ console.log(`Setting up Tesseract for ${arch}...`);
+
+ if (arch === 'arm64' || (arch === 'x86_64' && nativeArch === 'x64')) {
+ // Native architecture or x86_64 on Intel Mac
+ await $`brew install tesseract`;
+ await $`cp $(brew --prefix)/bin/tesseract ${tesseractBinary}`;
+ await $`cp /usr/local/bin/tesseract ${tesseractBinary}`;
+ } else if (arch === 'x86_64' && nativeArch === 'arm64') {
+ // x86_64 on ARM Mac
+ console.log('Installing x86_64 version using Rosetta 2...');
+ await $`arch -x86_64 /usr/local/bin/brew install tesseract`;
+ await $`cp /usr/local/bin/tesseract /tmp/tesseract`
+ await $`cp /tmp/tesseract ${tesseractBinary}`;
+ }
+
+ console.log(`Tesseract for ${arch} set up successfully.`);
+ } else {
+ console.log(`Tesseract for ${arch} already exists.`);
+ }
+ }
+
+
// Setup FFMPEG
if (!(await fs.exists(config.ffmpegRealname))) {
await $`wget -nc ${config.macos.ffmpegUrl} -O ${config.macos.ffmpegName}.tar.xz`
@@ -149,12 +186,17 @@ if (platform == 'macos') {
}
if (!found) {
console.error("Failed to find screenpipe");
+ console.error("Here's how you can build screenpipe's CLI for Intel or Silicon:");
+ console.error("place yourself in the root directory of screenpipe");
+ console.error("export PKG_CONFIG_PATH=\"/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH\"");
+ console.error("export PKG_CONFIG_ALLOW_CROSS=1");
+ console.error("cargo build --release --metal --target aarch64-apple-darwin");
+ console.error("or for x86_64:");
+ console.error("cargo build --release --metal --target x86_64-apple-darwin");
process.exit(1);
}
- // await $`sudo cp /opt/homebrew/bin/tesseract ./`
- // await $`sudo chown ${process.env.USER} ./tesseract`
- await $`cp /opt/homebrew/bin/tesseract /tmp/tesseract`
- await $`mv /tmp/tesseract ./tesseract-aarch64-apple-darwin` // TODO intel
+ // await $`cp /opt/homebrew/bin/tesseract /tmp/tesseract`
+ // await $`mv /tmp/tesseract ./tesseract-aarch64-apple-darwin` // TODO intel
}
// Nvidia
@@ -266,9 +308,6 @@ if (!process.env.GITHUB_ENV) {
console.log(`$env:ROCM_PATH = "${rocmPath}"`)
}
}
- if (platform == 'macos') {
- console.log(`export FFMPEG_DIR="${exports.ffmpeg}"`)
- }
if (!process.env.GITHUB_ENV) {
console.log('bunx tauri build'
+ (platform === 'macos' ? ' -- --features metal' : ''))