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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
update pipe store ui
Louis Beaumont7f2c32dac694
diff --git a/examples/typescript/pipe-phi3.5-engineering-team-logs/README.md b/examples/typescript/pipe-phi3.5-engineering-team-logs/README.mdindex 11872eb6c..325aa45b3 100644--- a/examples/typescript/pipe-phi3.5-engineering-team-logs/README.md+++ b/examples/typescript/pipe-phi3.5-engineering-team-logs/README.md@@ -1,40 +1,30 @@### phi3.5 engineering team logs-this pipe automates logging of engineering work to notion using screenpipe and phi3.5 ai.+automates logging of engineering work to notion using screenpipe and phi3.5 ai.-#### setup+#### quick setup-1. install screenpipe and git clone this repo- ```- git clone https://github.com/mediar-ai/screenpipe.git- cd screenpipe- ```--2. install and run ollama:- - follow instructions at https://github.com/jmorganca/ollama- - run `ollama run phi3.5`--3. set up notion:- - create a notion integration: https://www.notion.so/my-integrations- - create a database with properties: Title, Description (rich text), Tags (multi-select), Date- - share database with your integration--4. set environment variables:+1. install stuff:```- export SCREENPIPE_NOTION_API_KEY=your_notion_api_key- export SCREENPIPE_NOTION_DATABASE_ID=your_notion_database_id+ npm install -g screenpipe+ git clone https://github.com/jmorganca/ollama+ cd ollama && ./scripts/install.sh```-5. run the pipe:+2. run ollama:```- screenpipe pipe download ./examples/typescript/pipe-phi3.5-engineering-team-logs- screenpipe pipe enable phi3.5-engineering-team-logs- screenpipe+ ollama run phi3.5:3.8b-mini-instruct-q4_K_M```-the pipe will run continuously, logging engineering work to your notion database every hour.+3. set up notion:+ - create integration: https://www.notion.so/my-integrations (copy api key)+ - make database with: Title, Description (rich text), Tags (multi-select), Date+ - share database with your integration (click three dots, connections, your integration), open database in full screen mode, copy the database id e.g. https://www.notion.so/some-database-id?v=some-database-version-id++4. put the fields in the app ui, save, enable, restart screenpipe recording++boom! it'll log your work to notion every minute.++wanna tweak it? check `pipe.ts` to change frequency or adjust the ai prompt.-#### customization-- adjust `INTERVAL` in pipe.ts to change logging frequency-- modify the prompt to refine ai outputdiff --git a/examples/typescript/pipe-phi3.5-engineering-team-logs/pipe.json b/examples/typescript/pipe-phi3.5-engineering-team-logs/pipe.jsonnew file mode 100644index 000000000..4fc31a3fc--- /dev/null+++ b/examples/typescript/pipe-phi3.5-engineering-team-logs/pipe.json@@ -0,0 +1,40 @@+{+ "fields": [+ {+ "name": "interval",+ "type": "number",+ "default": 60,+ "description": "Interval in seconds to stream data"+ },+ {+ "name": "notionDatabaseId",+ "type": "string",+ "default": "<fill your notion database id here>",+ "description": "Notion Database ID"+ },+ {+ "name": "notionApiKey",+ "type": "string",+ "default": "<fill your notion api key here>",+ "description": "Notion API Key"+ },+ {+ "name": "ollamaApiUrl",+ "type": "string",+ "default": "http://localhost:11434/api",+ "description": "Ollama API URL"+ },+ {+ "name": "ollamaModel",+ "type": "string",+ "default": "phi3.5:3.8b-mini-instruct-q4_K_M",+ "description": "Ollama Model"+ },+ {+ "name": "pageSize",+ "type": "number",+ "default": 100,+ "description": "Number of records to retrieve from Screenpipe per page"+ }+ ]+}\ No newline at end of filediff --git a/examples/typescript/pipe-phi3.5-engineering-team-logs/pipe.ts b/examples/typescript/pipe-phi3.5-engineering-team-logs/pipe.tsindex 7d05a0299..807af5b3e 100644--- a/examples/typescript/pipe-phi3.5-engineering-team-logs/pipe.ts+++ b/examples/typescript/pipe-phi3.5-engineering-team-logs/pipe.ts@@ -1,7 +1,9 @@-const INTERVAL = 60 * 6 * 1; // 1 hour in milliseconds+const DEFAULT_INTERVAL = 60 * 60 * 1000; // 1 hour in milliseconds+const DEFAULT_OLLAMA_API_URL = "http://localhost:11434/api/chat";+const DEFAULT_OLLAMA_MODEL = "phi3.5:3.8b-mini-instruct-q4_K_M";const NOTION_API_URL = "https://api.notion.com/v1/pages";-const NOTION_DATABASE_ID = process.env.SCREENPIPE_NOTION_DATABASE_ID;-const NOTION_API_KEY = process.env.SCREENPIPE_NOTION_API_KEY;+const DEFAULT_NOTION_DATABASE_ID = process.env.NOTION_DATABASE_ID;+const DEFAULT_NOTION_API_KEY = process.env.NOTION_API_KEY;interface ScreenData {data: {@@ -66,18 +68,22 @@ async function generateEngineeringLog(return JSON.parse(content);}-async function syncLogToNotion(logEntry: EngineeringLog): Promise<void> {+async function syncLogToNotion(+ logEntry: EngineeringLog,+ apiKey: string,+ databaseId: string+): Promise<void> {try {console.log("syncLogToNotion", logEntry);const response = await fetch(NOTION_API_URL, {method: "POST",headers: {- Authorization: `Bearer ${NOTION_API_KEY}`,+ Authorization: `Bearer ${apiKey}`,"Notion-Version": "2022-06-28","Content-Type": "application/json",},body: JSON.stringify({- parent: { database_id: NOTION_DATABASE_ID },+ parent: { database_id: databaseId },properties: {Title: { title: [{ text: { content: logEntry.title } }] },Description: {@@ -105,10 +111,19 @@ async function syncLogToNotion(logEntry: EngineeringLog): Promise<void> {async function streamEngineeringLogsToNotion(): Promise<void> {console.log("Starting Engineering Logs Stream to Notion");+ const config = await pipe.loadConfig();+ console.log("loaded config:", JSON.stringify(config, null, 2));++ const interval = config.interval || DEFAULT_INTERVAL;+ const databaseId = config.notionDatabaseId || DEFAULT_NOTION_DATABASE_ID;+ const apiKey = config.notionApiKey || DEFAULT_NOTION_API_KEY;+ const ollamaApiUrl = config.ollamaApiUrl || DEFAULT_OLLAMA_API_URL;+ const ollamaModel = config.ollamaModel || DEFAULT_OLLAMA_MODEL;+while (true) {try {const now = new Date();- const oneHourAgo = new Date(now.getTime() - INTERVAL);+ const oneHourAgo = new Date(now.getTime() - interval);const screenData = await queryScreenpipe(oneHourAgo.toISOString(),@@ -117,41 +132,49 @@ async function streamEngineeringLogsToNotion(): Promise<void> {if (screenData.data && screenData.data.length > 0) {const logEntry = await generateEngineeringLog(screenData);- await syncLogToNotion(logEntry);+ await syncLogToNotion(logEntry, apiKey, databaseId);} else {console.log("No relevant engineering work detected in the last hour");}} catch (error) {console.error("Error in engineering log pipeline:", error);}- await new Promise((resolve) => setTimeout(resolve, INTERVAL));+ await new Promise((resolve) => setTimeout(resolve, interval));}}streamEngineeringLogsToNotion();/*-Instructions to run this pipe:-1. Make sure you have Ollama installed and running:- https://github.com/jmorganca/ollama+Instructions to run this pipe:-2. Run the phi3.5 model:- ollama run phi3.5+1. install screenpipe and git clone this repo+ ```+ git clone https://github.com/mediar-ai/screenpipe.git+ cd screenpipe+ ```-3. Set up your Notion integration and get your API key:- https://www.notion.so/my-integrations+2. install and run ollama:+ - follow instructions at https://github.com/jmorganca/ollama+ - run `ollama run phi3.5:3.8b-mini-instruct-q4_K_M`-4. Create a Notion database with the following properties:- - Title (title)- - Tags (multi-select)- - Date (date)- - share this page with your integration (click three dots, connections, your integration)+3. set up notion:+ - create a notion integration: https://www.notion.so/my-integrations - copy the API key+ - create a database with properties: Title (text), Description (text), Tags (multi-select), Date (date)+ - share database with your integration - copy the database ID eg https://www.notion.so/<THIS>?<NOTTHIS>-5. Set the following environment variables:+4. set environment variables:+ ```export SCREENPIPE_NOTION_API_KEY=your_notion_api_key- export SCREENPIPE_NOTION_DATABASE_ID=your_notion_database_id # e.g. https://www.notion.so/83c75a51b3bd4a?something+ export SCREENPIPE_NOTION_DATABASE_ID=your_notion_database_id+ ```++5. run the pipe:+ ```+ screenpipe pipe download ./examples/typescript/pipe-screen-to-crm+ screenpipe pipe enable screen-to-crm+ screenpipe+ ```-The pipe will run continuously, checking for engineering work every hour-and logging it to your Notion database.*/diff --git a/examples/typescript/pipe-phi3.5-engineering-team-logs/screenpipe.d.ts b/examples/typescript/pipe-phi3.5-engineering-team-logs/screenpipe.d.tsnew file mode 100644index 000000000..ed848b812--- /dev/null+++ b/examples/typescript/pipe-phi3.5-engineering-team-logs/screenpipe.d.ts@@ -0,0 +1,44 @@+declare global {+ const pipe: {+ readFile: (path: string) => Promise<string>;+ writeFile: (path: string, contents: string) => Promise<void>;+ removeFile: (path: string) => Promise<void>;+ get: (url: string) => Promise<any>;+ post: (url: string, body: string) => Promise<any>;+ fetch: (url: string, options?: RequestInit) => Promise<Response>;+ sendNotification: (options: {+ title: string;+ body: string;+ }) => Promise<any>;+ loadConfig: () => Promise<Record<string, any>>;+ config: Record<string, any>;+ metadata: {+ id: string;+ };+ };++ const fs: {+ readFileSync: (path: string) => string;+ writeFileSync: (path: string, contents: string) => void;+ };++ const path: {+ join: (...paths: string[]) => string;+ };++ namespace NodeJS {+ interface ProcessEnv {+ SCREENPIPE_DIR: string;+ SCREENPIPE_LOG_API_URL?: string;+ SCREENPIPE_SERVER_URL?: string;+ PIPE_DIR: string;+ NOTION_DATABASE_ID: string;+ NOTION_API_KEY: string;+ }+ }+ const process: {+ env: NodeJS.ProcessEnv;+ };+}++export {};diff --git a/examples/typescript/pipe-phi3.5-engineering-team-logs/tsconfig.json b/examples/typescript/pipe-phi3.5-engineering-team-logs/tsconfig.jsonnew file mode 100644index 000000000..c4e6dfdd7--- /dev/null+++ b/examples/typescript/pipe-phi3.5-engineering-team-logs/tsconfig.json@@ -0,0 +1,17 @@+{+ "compilerOptions": {+ "target": "es2018",+ "module": "esnext",+ "moduleResolution": "node",+ "outDir": "./",+ "rootDir": "./",+ "strict": true,+ "esModuleInterop": true+ },+ "include": [+ "./**/*.ts"+ ],+ "exclude": [+ "node_modules"+ ]+}\ No newline at end of filediff --git a/examples/typescript/pipe-screen-to-crm/pipe.js b/examples/typescript/pipe-screen-to-crm/pipe.jsdeleted file mode 100644index 109cd348e..000000000--- a/examples/typescript/pipe-screen-to-crm/pipe.js+++ /dev/null@@ -1,64 +0,0 @@-"use strict";-let INTERVAL = 10 * 1000; // 10 seconds in milliseconds-async function queryScreenpipe() {- try {- const now = new Date();- const oneMinuteAgo = new Date(now.getTime() - INTERVAL);- const queryParams = `start_time=${oneMinuteAgo.toISOString()}&end_time=${now.toISOString()}&limit=50&content_type=ocr`;- const result = await fetch(`http://localhost:3030/search?${queryParams}`).then((r) => r.json());- console.log("Retrieved", result.data.length, "items from screenpipe");- return result.data;- }- catch (error) {- console.error("Error querying screenpipe:", error);- return [];- }-}-async function writeToMarkdown(data) {- console.log("Writing to markdown", JSON.stringify(data));- const fileName = `screen-ocr-${new Date()- .toISOString()- .replace(/[:.]/g, "-")}.md`;- const content = data- .map((item) => `## ${item.content.timestamp}\n\n${item.content.text}\n\n---\n`)- .join("\n");- const dir = path.join(process.env.PIPE_DIR, fileName);- console.log("Writing to", dir);- fs.writeFileSync(dir, content);- console.log(`Written OCR data to ${fileName}`);-}-async function runOCRTracker() {- console.log("Starting OCR Tracker");- // wait 2 seocnds- await new Promise((resolve) => setTimeout(resolve, 1000));- console.log(pipe);- await pipe.loadConfig();- INTERVAL = pipe.config.interval * 1000;- console.log("INTERVAL", INTERVAL);- while (true) {- try {- const screenData = await queryScreenpipe();- await writeToMarkdown(screenData);- }- catch (error) {- console.error("Error in OCR tracking:", error);- }- finally {- await new Promise((resolve) => setTimeout(resolve, INTERVAL));- }- // const isEnabled = await pipe.isEnabled();- // if (!isEnabled) {- // console.log("pipe is disabled");- // break;- // }- }-}-// Self-invoking async function to run the OCR tracker-(async () => {- try {- await runOCRTracker();- }- catch (error) {- console.error("Fatal error in OCR Tracker:", error);- }-})();diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsxindex b238da801..26a70c1a2 100644--- a/screenpipe-app-tauri/components/pipe-store.tsx+++ b/screenpipe-app-tauri/components/pipe-store.tsx@@ -19,7 +19,7 @@ import { useSettings } from "@/lib/hooks/use-settings";import { invoke } from "@tauri-apps/api/core";import { toast } from "./ui/use-toast";import { Input } from "./ui/input";-import { Download, Plus, Trash2 } from "lucide-react";+import { Download, Plus, Trash2, ExternalLink } from "lucide-react";import { PipeConfigForm } from "./pipe-config-form";import { useHealthCheck } from "@/lib/hooks/use-health-check";import posthog from "posthog-js";@@ -50,6 +50,25 @@ export interface Pipe {config?: Record<string, any>;}+interface CorePipe {+ id: string;+ description: string;+ url: string;+}++const corePipes: CorePipe[] = [+ {+ id: "pipe-phi3.5-engineering-team-logs",+ description: "continuously write logs of your days in a notion table using ollama+phi3.5",+ url: "https://github.com/mediar-ai/screenpipe/tree/main/examples/typescript/pipe-phi3.5-engineering-team-logs",+ },+ // {+ // id: "transcriber",+ // description: "generate accurate transcriptions",+ // url: "https://github.com/screenpipe/transcriber-pipe",+ // },+];+const PipeDialog: React.FC = () => {const [newRepoUrl, setNewRepoUrl] = useState("");const [selectedPipe, setSelectedPipe] = useState<Pipe | null>(null);@@ -421,6 +440,28 @@ const PipeDialog: React.FC = () => {);};+ const renderCorePipes = () => (+ <div className="mb-3">+ <h3 className="text-lg font-semibold mb-2">try these pipes</h3>+ <div className="flex flex-col overflow-hidden">+ {corePipes.map((pipe) => (+ <Card key={pipe.id} className="p-4">+ <h4 className="font-medium text-lg mb-2">{pipe.id}</h4>+ <p className="text-sm text-gray-500 mb-4">{pipe.description}</p>+ <Button+ size="sm"+ className="w-full"+ onClick={() => handleDownloadPipe(pipe.url)}+ >+ <Download className="mr-2 h-4 w-4" />+ add pipe+ </Button>+ </Card>+ ))}+ </div>+ </div>+ );+const renderContent = () => {if (!health || health?.status === "error") {return (@@ -436,46 +477,43 @@ const PipeDialog: React.FC = () => {);}return (- <div className="flex h-[500px]">- <div className="w-1/3 pr-4 overflow-y-auto">- {/* {pipes.length === 0 &&- Array(5)- .fill(0)- .map((_, index) => (- <div key={index} className="mb-2">- <Skeleton className="h-24 w-full" />- </div>- ))} */}- {pipes.map((pipe: Pipe) => (- <Card- key={pipe.id}- className="cursor-pointer hover:bg-gray-100 mb-2 p-2"- onClick={() => setSelectedPipe(pipe)}- >- <div className="flex justify-between items-start">- <h3>{pipe.id}</h3>- </div>+ <div className="flex flex-col h-[550px]">+ <div className="flex flex-1 overflow-hidden">+ <div className="w-3/5 pr-4 overflow-y-auto">+ {renderCorePipes()}+ <Separator className="my-4" />+ <h3 className="text-lg font-semibold mb-2">your pipes</h3>+ {pipes.map((pipe: Pipe) => (+ <Card+ key={pipe.id}+ className="cursor-pointer hover:bg-gray-100 mb-2 p-2"+ onClick={() => setSelectedPipe(pipe)}+ >+ <div className="flex justify-between items-start">+ <h3>{pipe.id}</h3>+ </div>+ </Card>+ ))}+ <Card className="mb-2 p-2">+ <Input+ type="url"+ placeholder="enter repo url"+ value={newRepoUrl}+ onChange={(e) => setNewRepoUrl(e.target.value)}+ />+ <Button+ className="mt-2 w-full"+ onClick={handleAddOwnPipe}+ disabled={!newRepoUrl}+ >+ <Plus className="mr-2" size={16} />+ add your own pipe+ </Button></Card>- ))}- <Card className="mb-2 p-2">- <Input- type="url"- placeholder="Enter repo URL"- value={newRepoUrl}- onChange={(e) => setNewRepoUrl(e.target.value)}- />- <Button- className="mt-2 w-full"- onClick={handleAddOwnPipe}- disabled={!newRepoUrl}- >- <Plus className="mr-2" size={16} />- Add Your Own Pipe- </Button>- </Card>- </div>- <div className="w-full pl-4 border-l overflow-y-auto">- {renderPipeContent()}+ </div>+ <div className="w-full pl-4 border-l overflow-y-auto">+ {renderPipeContent()}+ </div></div></div>);@@ -486,7 +524,7 @@ const PipeDialog: React.FC = () => {<DialogTrigger asChild><Button variant="ghost">pipe store</Button></DialogTrigger>- <DialogContent className="max-w-[90vw] w-full max-h-[90vh] h-full">+ <DialogContent className="max-w-[90vw] w-full max-h-[90vh] h-full "><DialogHeader><DialogTitle>pipe store@@ -494,7 +532,7 @@ const PipeDialog: React.FC = () => {experimental</Badge></DialogTitle>- <div className="flex justify-end mr-10">+ <div className="absolute top-4 right-20"><TooltipProvider><Tooltip><TooltipTrigger asChild>@@ -530,7 +568,8 @@ const PipeDialog: React.FC = () => {target="_blank"rel="noopener noreferrer">- {" "}read the docs+ {" "}+ read the docs</a></DialogDescription>diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 40c904c43..dc21ee85a 100644--- a/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "screenpipe-app"-version = "0.2.64"+version = "0.2.65"description = ""authors = ["you"]license = ""