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
fix: cli was failing on windows bcs of scarf, fix cli browser login, fix sentry cloudflare
Louis Beaumont4634027726e8
diff --git a/pipes/rewind/package.json b/pipes/rewind/package.jsonindex 4a5bcfe86..80ce6c3fc 100644--- a/pipes/rewind/package.json+++ b/pipes/rewind/package.json@@ -1,6 +1,6 @@{"name": "rewind",- "version": "0.1.12",+ "version": "0.1.13","private": true,"scripts": {"dev": "next dev --turbopack",diff --git a/screenpipe-js/ai-proxy/src/index.ts b/screenpipe-js/ai-proxy/src/index.tsindex eaaec8626..42f2b3c35 100644--- a/screenpipe-js/ai-proxy/src/index.ts+++ b/screenpipe-js/ai-proxy/src/index.ts@@ -278,6 +278,7 @@ export default Sentry.withSentry((env) => ({dsn: 'https://60750a679399e9d0b8631c059fb7578d@o4507617161314304.ingest.us.sentry.io/4508689350983680',tracesSampleRate: 0.1,+ sampleRate: 0.1,environment: env.NODE_ENV || 'development',enabled: (env.NODE_ENV || 'development') === 'production',}),@@ -290,6 +291,7 @@ export default Sentry.withSentry(* @param ctx - The execution context of the Worker* @returns The response to be sent back to the client*/+ // @ts-ignoreasync fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {const langfuse = new Langfuse({publicKey: env.LANGFUSE_PUBLIC_KEY,diff --git a/screenpipe-js/browser-sdk/package.json b/screenpipe-js/browser-sdk/package.jsonindex d7501d2cf..1f61b0d5b 100644--- a/screenpipe-js/browser-sdk/package.json+++ b/screenpipe-js/browser-sdk/package.json@@ -1,6 +1,6 @@{"name": "@screenpipe/browser",- "version": "0.1.35",+ "version": "0.1.36","type": "module","main": "./dist/index.cjs","module": "./dist/index.js",@@ -20,7 +20,6 @@"tsup": "^8.0.0"},"dependencies": {- "@scarf/scarf": "^1.4.0","@types/express": "^5.0.0","@types/node-cron": "^3.0.11","@types/uuid": "^10.0.0",diff --git a/screenpipe-js/cli/bun.lockb b/screenpipe-js/cli/bun.lockbindex b2b59662d..e179ead08 100755Binary files a/screenpipe-js/cli/bun.lockb and b/screenpipe-js/cli/bun.lockb differdiff --git a/screenpipe-js/cli/dist/index.js b/screenpipe-js/cli/dist/index.jsindex 0653e47ca..51d8e3b0a 100755--- a/screenpipe-js/cli/dist/index.js+++ b/screenpipe-js/cli/dist/index.js@@ -57804,6 +57804,41 @@ var ERRORS = {BUILD_MISSING_REGISTRY_FILE: "3"};+// src/utils/credentials.ts+import os2 from "os";+import fs from "fs";+import path from "path";++class Credentials {+ static configDir = path.join(os2.homedir(), ".screenpipe");+ static configFile = path.join(this.configDir, "config-developer.json");+ static getApiKey() {+ try {+ if (!fs.existsSync(this.configFile)) {+ return null;+ }+ const config = JSON.parse(fs.readFileSync(this.configFile, "utf-8"));+ return config.apiKey || null;+ } catch (error) {+ return null;+ }+ }+ static setApiKey(apiKey, developerId) {+ if (!fs.existsSync(this.configDir)) {+ fs.mkdirSync(this.configDir);+ }+ fs.writeFileSync(this.configFile, JSON.stringify({+ apiKey,+ developerId+ }, null, 2));+ }+ static clearCredentials() {+ if (fs.existsSync(this.configFile)) {+ fs.unlinkSync(this.configFile);+ }+ }+}+// src/commands/login/utils/cli-login.tsclass UserCancellationError extends Error {constructor(message) {@@ -57814,21 +57849,30 @@ class UserCancellationError extends Error {var authPayload = z.object({token: z.string(),email: z.string(),- user_id: z.string()+ user_id: z.string(),+ developer_id: z.string(),+ api_key: z.string()});async function sendAuthData(authPayload2) {- const response = await fetch(`http://localhost:11435/auth`, {- method: "POST",- headers: {- "Content-Type": "application/json"- },- body: JSON.stringify(authPayload2)- });- if (!response.ok) {- throw new Error("failed to send auth data");+ try {+ const response = await fetch(`http://localhost:11435/auth`, {+ method: "POST",+ headers: {+ "Content-Type": "application/json"+ },+ body: JSON.stringify(authPayload2)+ });+ if (!response.ok) {+ throw new Error("failed to send auth data");+ }+ const data = await response.json();+ return data;+ } catch (error) {+ if (error instanceof TypeError && error.message.includes("fetch")) {+ throw new Error("Make sure to run the app before attempting to login");+ }+ throw error;}- const data = await response.json();- return data;}var nanoid = customAlphabet("123456789qazwsxedcrfvtgbyhnujmikolp", 8);async function cliLogin() {@@ -57874,12 +57918,25 @@ async function cliLogin() {`);logger.log(`if something goes wrong, copy and paste this url into your browser: ${colors8.bold(confirmationUrl.toString())}`);- spawn("open", [confirmationUrl.toString()]);+ const openBrowser = (url2) => {+ const platform = process.platform;+ switch (platform) {+ case "win32":+ const escapedUrl = url2.replace(/&/g, "^&");+ return spawn("cmd", ["/c", "start", "", escapedUrl]);+ case "darwin":+ return spawn("open", [url2]);+ default:+ return spawn("xdg-open", [url2]);+ }+ };+ openBrowser(confirmationUrl.toString());const loadingSpinner = spinner("waiting for authentication...");try {loadingSpinner.start();const authData = await authPromise;await sendAuthData(authData);+ Credentials.setApiKey(authData.api_key, authData.developer_id);loadingSpinner.succeed("authentication successful");server.close();} catch (error) {@@ -57903,41 +57960,6 @@ async function cliLogin() {// src/constants.tsvar API_BASE_URL = process.env.SC_API_BASE_URL || "https://screenpi.pe";-// src/utils/credentials.ts-import os2 from "os";-import fs from "fs";-import path from "path";--class Credentials {- static configDir = path.join(os2.homedir(), ".screenpipe");- static configFile = path.join(this.configDir, "config-developer.json");- static getApiKey() {- try {- if (!fs.existsSync(this.configFile)) {- return null;- }- const config = JSON.parse(fs.readFileSync(this.configFile, "utf-8"));- return config.apiKey || null;- } catch (error) {- return null;- }- }- static setApiKey(apiKey, developerId) {- if (!fs.existsSync(this.configDir)) {- fs.mkdirSync(this.configDir);- }- fs.writeFileSync(this.configFile, JSON.stringify({- apiKey,- developerId- }, null, 2));- }- static clearCredentials() {- if (fs.existsSync(this.configFile)) {- fs.unlinkSync(this.configFile);- }- }-}-// src/commands/login/utils/api-key-login.tsasync function apiKeyLogin(apiKey) {try {@@ -58316,6 +58338,7 @@ ${symbols.info} publishing ${colors8.highlight(packageJson.name)} v${packageJsonlogger.log(colors8.dim(`${symbols.arrow} uploading to storage...`));const uploadResponse = await retryFetch(uploadUrl, {method: "PUT",+ verbose: true,headers: {"Content-Type": "application/zip"},diff --git a/screenpipe-js/cli/package.json b/screenpipe-js/cli/package.jsonindex 332666766..87dd38bcd 100644--- a/screenpipe-js/cli/package.json+++ b/screenpipe-js/cli/package.json@@ -1,6 +1,6 @@{"name": "@screenpipe/dev",- "version": "1.1.15",+ "version": "1.1.20","description": "screenpipe development CLI","type": "module","main": "dist/index.js",@@ -13,8 +13,8 @@"dev": "bun run src/index.ts"},"dependencies": {- "@screenpipe/browser": "^0.1.26",- "@screenpipe/js": "^1.0.7",+ "@screenpipe/browser": "^0.1.36",+ "@screenpipe/js": "^1.0.17","@topcli/spinner": "^2.1.2","archiver": "^7.0.1","async-listen": "^3.0.1",diff --git a/screenpipe-js/cli/src/commands/login/utils/cli-login.ts b/screenpipe-js/cli/src/commands/login/utils/cli-login.tsindex 3f3cc80ee..f0a035b84 100644--- a/screenpipe-js/cli/src/commands/login/utils/cli-login.ts+++ b/screenpipe-js/cli/src/commands/login/utils/cli-login.ts@@ -1,6 +1,5 @@import http from "http";import { spawn } from "child_process";-import { ParsedUrlQuery } from "node:querystring";import url from "url";import { listen } from "async-listen";import { customAlphabet } from "nanoid";@@ -8,6 +7,7 @@ import { logger, spinner } from "../../components/commands/add/utils/logger";import { colors } from "../../../utils/colors";import { handleError } from "../../components/commands/add/utils/handle-error";import { z } from "zod";+import { Credentials } from "../../../utils/credentials";class UserCancellationError extends Error {constructor(message: string) {@@ -22,23 +22,32 @@ const authPayload = z.object({token: z.string(),email: z.string(),user_id: z.string(),+ developer_id: z.string(),+ api_key: z.string(),});async function sendAuthData(authPayload: AuthPayload) {- const response = await fetch(`http://localhost:11435/auth`, {- method: "POST",- headers: {- "Content-Type": "application/json",- },- body: JSON.stringify(authPayload),- });+ try {+ const response = await fetch(`http://localhost:11435/auth`, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify(authPayload),+ });- if (!response.ok) {- throw new Error("failed to send auth data");- }+ if (!response.ok) {+ throw new Error("failed to send auth data");+ }- const data = await response.json();- return data;+ const data = await response.json();+ return data;+ } catch (error) {+ if (error instanceof TypeError && error.message.includes("fetch")) {+ throw new Error("Make sure to run the app before attempting to login");+ }+ throw error;+ }}const nanoid = customAlphabet("123456789qazwsxedcrfvtgbyhnujmikolp", 8);@@ -110,7 +119,23 @@ export async function cliLogin() {)}\n`);- spawn("open", [confirmationUrl.toString()]);+ // Use the appropriate command based on the operating system+ const openBrowser = (url: string) => {+ const platform = process.platform;+ switch (platform) {+ case "win32":+ // Escape & characters for Windows command prompt+ const escapedUrl = url.replace(/&/g, "^&");+ return spawn("cmd", ["/c", "start", "", escapedUrl]);+ case "darwin":+ return spawn("open", [url]);+ default:+ // For Linux and other systems+ return spawn("xdg-open", [url]);+ }+ };++ openBrowser(confirmationUrl.toString());const loadingSpinner = spinner("waiting for authentication...");@@ -118,6 +143,7 @@ export async function cliLogin() {loadingSpinner.start();const authData = await authPromise;await sendAuthData(authData);+ Credentials.setApiKey(authData.api_key, authData.developer_id);loadingSpinner.succeed("authentication successful");server.close();diff --git a/screenpipe-js/node-sdk/package.json b/screenpipe-js/node-sdk/package.jsonindex dec3b2f0c..e639afacd 100644--- a/screenpipe-js/node-sdk/package.json+++ b/screenpipe-js/node-sdk/package.json@@ -1,6 +1,6 @@{"name": "@screenpipe/js",- "version": "1.0.16",+ "version": "1.0.17","type": "module","main": "./dist/index.cjs","module": "./dist/index.js",@@ -20,7 +20,6 @@"tsup": "^8.0.0"},"dependencies": {- "@scarf/scarf": "^1.4.0","@types/express": "^5.0.0","@types/node-cron": "^3.0.11","@types/uuid": "^10.0.0",