@deepseek-ai/dsh-native-command 0.1.6-alpha.2 → 0.1.7-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/util/native-command/README.md
5
- README.md: 10b60266403f6a479a286cccd369ee2e52dd3aa6
6
- README.zh.md: e8f2adda57ee257983a06bb2798c852cab20bf6a
5
+ README.md: 23df6d784aae1a5a911b556a3d70bae7971bd566
6
+ README.zh.md: e8548777191d1433188712c42797d4a902314f64
package/README.md CHANGED
@@ -45,10 +45,12 @@ The `NativeCommandRunner` type is the injectable command boundary for host integ
45
45
 
46
46
  ### Opening a Host path
47
47
 
48
- `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.
48
+ `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. `openNativeAssociatedPath(path, signal)` always uses the file-type association, without a browser override. `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.
49
49
 
50
50
  `revealNativePath(path, signal)` selects the file in Finder or Explorer, including WSL path translation, and opens its parent directory through `xdg-open` on desktop Linux. `nativeFileManager()` identifies that action for Host-derived UI labels; desktop availability remains a separate `canOpenNativePath()` check. Callers must authorize the absolute file path before invoking either operation. Platform dispatch is covered by injected-runner tests; native desktop verification belongs to the corresponding platform. Explorer receives an encoded file URI as a separate argument. Its exit code 1 is accepted as a delegated handoff; cancellation, missing executables, and other exit codes still reject. This acknowledgement does not prove that a desktop window selected the file.
51
51
 
52
+ `nativeFileApplications(path, signal)` returns registered applications, localized names, icons, and the current default. macOS 12 and later use LaunchServices; Windows uses Shell association handlers; Linux uses GIO with shared XDG desktop-entry and icon lookup. On macOS, copies sharing a bundle identifier and display name (staged self-updates, per-version installs) collapse to the system default, else the highest version; deliberate side-by-side installs keep distinct display names and both entries. `openNativeFileApplication(path, application, signal)` revalidates the handler against the complete registered list, so copies collapsed out of the display list stay openable, and never changes the system default. Windows delegates invocation to the Shell, and Linux delegates argument expansion to `gio launch`. WSL translates the path and uses the Windows adapter. Callers authorize the local file path. Native integration tests use private Windows file associations and Linux XDG roots on their respective platforms.
53
+
52
54
  -----
53
55
 
54
56
  <a id="understand-the-implementation"></a>
@@ -83,7 +85,7 @@ Read these pages when you need the consumers or the general subprocess capabilit
83
85
 
84
86
  - [Native directory picker](../../host/directory-picker-native/README.md) — the OS chooser commands this runner executes.
85
87
  - [Session Controller](../../api/session-controller/README.md) — resolves Session-relative workspace paths before opening them.
86
- - [Settings Controller](../../api/settings-controller/README.md) — selects settings documents and agent-preset directories.
88
+ - [Settings Controller](../../api/settings-controller/README.md) — selects settings documents.
87
89
  - [Subprocess capability](../../subprocess/subprocess/README.md) — the general subprocess seam, of which this package is not a part.
88
90
 
89
91
  -----
@@ -101,10 +103,12 @@ Nothing here enters a request prefix; this package neither assembles nor sends a
101
103
 
102
104
  <a id="known-limitations-and-deferred-work"></a>
103
105
 
106
+ Linux association discovery and explicit launching require GIO. Missing native commands reject the query, and missing artwork returns null; callers can retain file-manager reveal as their fallback.
107
+
104
108
 
105
109
  These limits define when this runner is not the right tool. They are current package constraints, not a task backlog.
106
110
 
107
- - **No output bounding** — both streams buffer unbounded in memory; every current caller invokes small native tools whose output is a path or an error line. Adopt `dsh-output-retention` bounding before pointing this at commands with meaningful output volume.
111
+ - Command output uses Node’s `execFile` buffer limit; oversized replies reject. Use the subprocess capability for streaming output.
108
112
 
109
113
  <a id="dev-note"></a>
110
114
  ### Dev Note
package/README.zh.md CHANGED
@@ -45,10 +45,12 @@ const { stdout, stderr } = await runNativeCommand('osascript', ['-e', script], s
45
45
 
46
46
  ### 打开 Host 路径
47
47
 
48
- `openNativePath(path, signal)` 将路径交给默认应用;平台能够确定默认浏览器时,HTML 与 SVG 会优先交给该浏览器。`openNativeTextFile(path, signal)` 选择文本编辑器意图;macOS 使用 `open -t`。WSL 路径先通过 `wslpath -w` 转换,再交给 Windows 桌面。`canOpenNativePath()` 报告当前 Host 是否可能具备桌面目标。
48
+ `openNativePath(path, signal)` 将路径交给默认应用;平台能够确定默认浏览器时,HTML 与 SVG 会优先交给该浏览器。`openNativeAssociatedPath(path, signal)` 始终使用文件类型关联,不覆盖为浏览器。`openNativeTextFile(path, signal)` 选择文本编辑器意图;macOS 使用 `open -t`。WSL 路径先通过 `wslpath -w` 转换,再交给 Windows 桌面。`canOpenNativePath()` 报告当前 Host 是否可能具备桌面目标。
49
49
 
50
50
  `revealNativePath(path, signal)` 在 Finder 或文件资源管理器中选中文件,包含 WSL 路径转换;在桌面 Linux 上通过 `xdg-open` 打开上层目录。`nativeFileManager()` 标识该操作,供 UI 根据 Host 选择文案;桌面是否可用仍由独立的 `canOpenNativePath()` 检查决定。调用方必须先授权绝对文件路径,再执行操作。平台分派由注入运行器的测试覆盖;原生桌面验证由对应平台负责。 Explorer 接收独立参数中的编码文件 URI。退出码 1 按已转交请求处理;取消、找不到可执行文件和其他退出码仍然报错。该确认不能证明桌面窗口已选中文件。
51
51
 
52
+ `nativeFileApplications(path, signal)` 返回关联应用、本地化名称、图标和当前默认项。macOS 12 及以上版本使用 LaunchServices,Windows 使用 Shell 关联处理器,Linux 使用 GIO,并共用 XDG 桌面文件和图标读取逻辑。macOS 上 bundle 标识符与显示名都相同的多份拷贝(自更新暂存副本、按版本安装的拷贝)合并为系统默认项,否则保留最高版本;显示名不同的并存安装两项都保留。`openNativeFileApplication(path, application, signal)` 按完整的当前注册列表重新验证关联应用,展示列表中被合并掉的拷贝仍可打开,且不修改系统默认值。Windows 交给 Shell 启动应用,Linux 交给 `gio launch` 展开参数。WSL 转换路径后使用 Windows 适配器。调用方负责验证本地文件路径。原生集成测试分别在相应平台使用独立的 Windows 文件关联和 Linux XDG 目录。
53
+
52
54
  -----
53
55
 
54
56
  <a id="understand-the-implementation"></a>
@@ -83,7 +85,7 @@ const { stdout, stderr } = await runNativeCommand('osascript', ['-e', script], s
83
85
 
84
86
  - [原生目录选择器](../../host/directory-picker-native/README.zh.md)——本运行器执行的 OS 选择器命令。
85
87
  - [Session Controller](../../api/session-controller/README.zh.md)——打开前解析 Session 相对 workspace 路径。
86
- - [Settings Controller](../../api/settings-controller/README.zh.md)——选择 settings 文档与 agent-preset 目录。
88
+ - [Settings Controller](../../api/settings-controller/README.zh.md)——选择 settings 文档。
87
89
  - [子进程能力](../../subprocess/subprocess/README.zh.md)——通用子进程 seam,本包并非其组成部分。
88
90
 
89
91
  -----
@@ -101,10 +103,12 @@ const { stdout, stderr } = await runNativeCommand('osascript', ['-e', script], s
101
103
 
102
104
  <a id="known-limitations-and-deferred-work"></a>
103
105
 
106
+ Linux 的关联查询和指定应用启动需要 GIO。缺少原生命令时查询失败,缺失的图标返回 null;调用方可以保留文件定位作为备用动作。
107
+
104
108
 
105
109
  这些限制说明本运行器何时不是合适的工具。它们是当前包约束,不是任务积压。
106
110
 
107
- - **不做输出限量**——两路流在内存中无界缓冲;当前每个调用方只运行输出为一个路径或一行错误的小型原生工具。把它指向输出量可观的命令之前,先接入 `dsh-output-retention` 限量。
111
+ - 命令输出受 Node 的 `execFile` 缓冲上限约束,超过上限时拒绝结果。流式输出由 subprocess 能力处理。
108
112
 
109
113
  <a id="dev-note"></a>
110
114
  ### 开发备注