Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I built an app launcher for my desktop AI companion: an index, not a shell command

说明与用途

为桌面 AI 助手构建了安全的应用程序启动器,使用应用程序索引而非 shell 命令,避免了语音队列阻塞和安全风险。

问题

A shell command to launch apps can leave a child process that holds the voice queue open, causing the assistant to freeze, and can be unsafe if the model injects malicious code.

结果

The launcher safely opens applications without freezing the assistant, using an index to prevent shell injection and detaching processes to avoid voice queue blockage.

工作流

  • 1. Scan installed apps and cache results in apps-index.json (max 600 entries, 7‑day age).
  • 2. Build a strict matching ladder: exact name → unique prefix → substring → multi‑token matching.
  • 3. If multiple matches, return ambiguous with up to 5 candidates and ask user to choose.
  • 4. For Windows AppIDs, launch via cmd /c start after shape validation; for file paths, spawn directly with shell:false after absolute path and existence checks.
  • 5. Detach child process, ignore stdio, call unref() and do not register in job state.
  • 6. Log app name and source, not absolute path.
  • 7. Prompt user only for unknown apps not in index.

证据

"Open Notepad" sounds like the simplest request a desktop companion can get. It nearly became the most dangerous one.

来源

The obvious implementation is a shell command: take the app name, run it, done. But a shell command has a child process, and a child that outlives its turn can hold the voice queue open — the exact bug that used to freeze voice entirely.

来源

So I built open_app around one decision: the model picks a name from an index, never a path.

来源

Ankita scans the machine's installed apps and caches them in apps-index.json (mode 0o600, capped at 600 entries).

来源

The launch itself is detached, with stdio ignored and unref() called — and deliberately not registered in the assistant's job state.

来源

  • 记录日期: 2026-11-01T19:59:06.879Z