description: "Host-native command and path-opening utilities with shell-free execution, cancellation, desktop detection, and WSL path handoff."
English | 中文
dsh-native-command runs host executables without a shell and opens Host filesystem paths through the desktop. The command runner captures utf8 output, propagates cancellation, and hides transient Windows consoles. The path opener supports default-application and text-editor intents, browser-renderable documents, WSL translation, and desktop availability checks. It is a library, not a plugin: no ctx, no state, no events.
Use this runner when a host-side integration must execute one native command and needs its output, its failure, or both — and must never involve a shell.
import { runNativeCommand } from '@deepseek-ai/dsh-native-command'
declare const script: string
declare const signal: AbortSignal
const { stdout, stderr } = await runNativeCommand('osascript', ['-e', script], signal)
On exit 0 the call resolves with captured stdout and stderr. On any failure it rejects with the exit code and both captured streams attached, so a caller can tell a missing tool (ENOENT), a cancellation (ABORT_ERR), and a real command failure apart without re-running the command.
The NativeCommandRunner type is the injectable command boundary for host integrations: pass the function (or a wrapper) where the integration needs a testable seam, so tests can substitute a fake runner.
openNativePath(path, signal) hands a path to the default application and prefers the named default browser for HTML and SVG where the platform can identify one. openNativeTextFile(path, signal) selects text-editor intent; on macOS it uses open -t. WSL paths are translated with wslpath -w before the Windows desktop receives them. canOpenNativePath() reports whether the current Host plausibly has a desktop target.
Read these pages when you need the consumers or the general subprocess capability this utility deliberately is not.
None, as the host-side utilities register nothing model-facing.
Nothing here enters a request prefix; this package neither assembles nor sends a provider request.
These limits define when this runner is not the right tool. They are current package constraints, not a task backlog.
dsh-output-retention bounding before pointing this at commands with meaningful output volume.