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

fix(skill-install): grant $DOWNLOAD fs scope + show loading/saved/error UX

Louis Beaumont29ca22a81e24
diff --git a/apps/screenpipe-app-tauri/components/settings/agent-card.tsx b/apps/screenpipe-app-tauri/components/settings/agent-card.tsx
index dc12d5a78..07ce4eb8c 100644
--- a/apps/screenpipe-app-tauri/components/settings/agent-card.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/agent-card.tsx
@@ -23,8 +23,10 @@ import {
} from "lucide-react";
import { invoke } from "@tauri-apps/api/core";
import { openUrl } from "@tauri-apps/plugin-opener";
-import { writeFile } from "@tauri-apps/plugin-fs";
+import { writeTextFile, BaseDirectory } from "@tauri-apps/plugin-fs";
import { downloadDir, join } from "@tauri-apps/api/path";
+import { revealItemInDir } from "@tauri-apps/plugin-opener";
+import { toast } from "@/components/ui/use-toast";
import posthog from "posthog-js";
import { useSettings } from "@/lib/hooks/use-settings";
@@ -142,6 +144,7 @@ function SkillSection({ name, skill }: { name: string; skill: AgentCardProps["sk
const [copied, setCopied] = useState(false);
const [savedPath, setSavedPath] = useState<string | null>(null);
const [saveError, setSaveError] = useState<string | null>(null);
+ const [isSaving, setIsSaving] = useState(false);
const [cmdCopied, setCmdCopied] = useState(false);
const copyMd = useCallback(async () => {
@@ -149,7 +152,10 @@ function SkillSection({ name, skill }: { name: string; skill: AgentCardProps["sk
await navigator.clipboard.writeText(SCREENPIPE_SKILL_MD);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
- } catch {}
+ toast({ title: "copied SKILL.md to clipboard" });
+ } catch (e) {
+ toast({ title: "copy failed", description: String(e), variant: "destructive" });
+ }
}, []);
const copyCmd = useCallback(async () => {
@@ -158,22 +164,43 @@ function SkillSection({ name, skill }: { name: string; skill: AgentCardProps["sk
await navigator.clipboard.writeText(skill.cliInstall);
setCmdCopied(true);
setTimeout(() => setCmdCopied(false), 2000);
- } catch {}
+ toast({ title: "copied install command" });
+ } catch (e) {
+ toast({ title: "copy failed", description: String(e), variant: "destructive" });
+ }
}, [skill.cliInstall]);
const saveToDownloads = useCallback(async () => {
setSaveError(null);
setSavedPath(null);
+ setIsSaving(true);
try {
+ await writeTextFile("screenpipe-SKILL.md", SCREENPIPE_SKILL_MD, {
+ baseDir: BaseDirectory.Download,
+ });
const dir = await downloadDir();
const filePath = await join(dir, "screenpipe-SKILL.md");
- await writeFile(filePath, new TextEncoder().encode(SCREENPIPE_SKILL_MD));
setSavedPath(filePath);
+ toast({ title: "saved to Downloads", description: filePath });
} catch (e) {
- setSaveError(e instanceof Error ? e.message : String(e));
+ const msg = e instanceof Error ? e.message : String(e);
+ console.error("[skill] save failed", e);
+ setSaveError(msg);
+ toast({ title: "save failed", description: msg, variant: "destructive" });
+ } finally {
+ setIsSaving(false);
}
}, []);
+ const revealSaved = useCallback(async () => {
+ if (!savedPath) return;
+ try {
+ await revealItemInDir(savedPath);
+ } catch (e) {
+ toast({ title: "could not open Finder", description: String(e), variant: "destructive" });
+ }
+ }, [savedPath]);
+
return (
<div className="space-y-3">
<p className="text-xs text-muted-foreground leading-relaxed">
@@ -209,11 +236,29 @@ function SkillSection({ name, skill }: { name: string; skill: AgentCardProps["sk
</div>
)}
- <div className="flex items-start gap-2">
- <Button variant="outline" size="sm" onClick={saveToDownloads} className="text-xs h-7">
- <Download className="h-3 w-3 mr-1.5" />
- Save SKILL.md to Downloads
+ <div className="flex items-start gap-2 flex-wrap">
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={saveToDownloads}
+ disabled={isSaving}
+ className="text-xs h-7"
+ >
+ {isSaving ? (
+ <Loader2 className="h-3 w-3 mr-1.5 animate-spin" />
+ ) : savedPath ? (
+ <Check className="h-3 w-3 mr-1.5" />
+ ) : (
+ <Download className="h-3 w-3 mr-1.5" />
+ )}
+ {isSaving ? "saving…" : savedPath ? "saved" : "Save SKILL.md to Downloads"}
</Button>
+ {savedPath && (
+ <Button variant="ghost" size="sm" onClick={revealSaved} className="text-xs h-7">
+ <ExternalLink className="h-3 w-3 mr-1.5" />
+ show in Finder
+ </Button>
+ )}
<Button variant="ghost" size="sm" onClick={copyMd} className="text-xs h-7">
{copied ? <Check className="h-3 w-3 mr-1.5" /> : <Copy className="h-3 w-3 mr-1.5" />}
Copy file contents
diff --git a/apps/screenpipe-app-tauri/src-tauri/capabilities/main.json b/apps/screenpipe-app-tauri/src-tauri/capabilities/main.json
index 7e660f4b1..88e862ba8 100644
--- a/apps/screenpipe-app-tauri/src-tauri/capabilities/main.json
+++ b/apps/screenpipe-app-tauri/src-tauri/capabilities/main.json
@@ -123,6 +123,14 @@
"path": "$HOME/*",
"requireLiteralLeadingDot": false
},
+ {
+ "path": "$DOWNLOAD",
+ "requireLiteralLeadingDot": false
+ },
+ {
+ "path": "$DOWNLOAD/*",
+ "requireLiteralLeadingDot": false
+ },
{
"path": "$HOME/.screenpipe/*",
"requireLiteralLeadingDot": false
diff --git a/apps/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json b/apps/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
index 171bbca74..817931bad 100644
--- a/apps/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
+++ b/apps/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
@@ -1 +1 @@
-{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","remote":{"urls":["http://localhost:*","https://api.openai.com/*","https://*.openai.com/*","https://api.screenpi.pe/*","https://*.anthropic.com/*","https://*.ollama.ai/*","https://*"]},"local":true,"windows":["*"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default",{"identifier":"shell:allow-open","allow":[{"url":"^https?://.*"},{"url":"^mailto:.*"},{"url":"^tel:.*"},{"url":"^x-apple-reminderkit://.*"}]},"store:default","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default","sentry:default",{"identifier":"opener:allow-open-url","allow":[{"url":"^https?://.*"},{"url":"^mailto:.*"},{"url":"^tel:.*"},{"url":"^x-apple-reminderkit://.*"},{"url":"^obsidian://.*"}]},"core:window:default","core:window:allow-get-all-windows","core:window:allow-close","core:window:allow-destroy","core:window:allow-start-dragging",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/**","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/**","requireLiteralLeadingDot":false},{"path":"$HOME/.cursor","requireLiteralLeadingDot":false},{"path":"$HOME/.cursor/**","requireLiteralLeadingDot":false},{"path":"$HOME/Library/Application Support/Claude","requireLiteralLeadingDot":false},{"path":"$HOME/Library/Application Support/Claude/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/Claude","requireLiteralLeadingDot":false},{"path":"$APPDATA/Claude/**","requireLiteralLeadingDot":false},{"path":"$HOME/AppData/Roaming/Claude","requireLiteralLeadingDot":false},{"path":"$HOME/AppData/Roaming/Claude/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},"cli:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","core:webview:allow-internal-toggle-devtools","core:webview:allow-create-webview-window",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]},{"identifier":"http:default","allow":[{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"http://**/*"},{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"https://**/*"}]},"deep-link:default","fs:allow-write-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPLOCALDATA"},{"path":"$APPLOCALDATA/**"},{"path":"$TEMP"},{"path":"$TEMP/*"},{"path":"$TEMP/**"}]},"opener:default",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"open","name":"open","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"cmd","name":"cmd","sidecar":false}]}]}}
\ No newline at end of file
+{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","remote":{"urls":["http://localhost:*","https://api.openai.com/*","https://*.openai.com/*","https://api.screenpi.pe/*","https://*.anthropic.com/*","https://*.ollama.ai/*","https://*"]},"local":true,"windows":["*"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default",{"identifier":"shell:allow-open","allow":[{"url":"^https?://.*"},{"url":"^mailto:.*"},{"url":"^tel:.*"},{"url":"^x-apple-reminderkit://.*"}]},"store:default","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default","sentry:default",{"identifier":"opener:allow-open-url","allow":[{"url":"^https?://.*"},{"url":"^mailto:.*"},{"url":"^tel:.*"},{"url":"^x-apple-reminderkit://.*"},{"url":"^obsidian://.*"}]},"core:window:default","core:window:allow-get-all-windows","core:window:allow-close","core:window:allow-destroy","core:window:allow-start-dragging",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$DOWNLOAD","requireLiteralLeadingDot":false},{"path":"$DOWNLOAD/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/**","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/**","requireLiteralLeadingDot":false},{"path":"$HOME/.cursor","requireLiteralLeadingDot":false},{"path":"$HOME/.cursor/**","requireLiteralLeadingDot":false},{"path":"$HOME/Library/Application Support/Claude","requireLiteralLeadingDot":false},{"path":"$HOME/Library/Application Support/Claude/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/Claude","requireLiteralLeadingDot":false},{"path":"$APPDATA/Claude/**","requireLiteralLeadingDot":false},{"path":"$HOME/AppData/Roaming/Claude","requireLiteralLeadingDot":false},{"path":"$HOME/AppData/Roaming/Claude/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},"cli:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","core:webview:allow-internal-toggle-devtools","core:webview:allow-create-webview-window",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]},{"identifier":"http:default","allow":[{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"http://**/*"},{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"https://**/*"}]},"deep-link:default","fs:allow-write-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPLOCALDATA"},{"path":"$APPLOCALDATA/**"},{"path":"$TEMP"},{"path":"$TEMP/*"},{"path":"$TEMP/**"}]},"opener:default",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"open","name":"open","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"cmd","name":"cmd","sidecar":false}]}]}}
\ No newline at end of file