@marktrue/dsh-mobile-remote 3.2.4-alpha.3 → 3.2.4-alpha.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.2.4-alpha.4(build 36,issue #45)— 会话文件浏览显示隐藏条目
4
+
5
+ > 插件 `3.2.4-alpha.4` / App `3.2.4+36` / 载体 `3.2.4-alpha.4-app`。
6
+
7
+ ### 宿主:目录列表按需返回隐藏条目
8
+
9
+ - `GET /api/directories` 新增可选 `includeHidden=1`:返回点开头的文件和目录(含 `fileEntries` 元数据);默认行为不变。
10
+ - 名称恰为 `.git` 的条目(文件或目录)始终排除;显式路径读取沿用既有只读信任模型。
11
+ - 旧 App 不传参数、旧 Host 忽略参数时均保持原行为,无 capability 位。
12
+
13
+ ### App:文件浏览显示隐藏文件开关
14
+
15
+ - 新增 App 全局「设置 → 文件浏览 → 显示隐藏文件」,默认开启并持久化;只作用于会话文件浏览,目录选择器保持隐藏。
16
+ - 会话文件浏览在开启时请求 `includeHidden=1`,点开头文件/目录按普通条目展示和预览;客户端防御性过滤 `.git`。
17
+ - 关闭开关后回到旧行为(全部隐藏);设置在下一次目录加载/刷新生效;旧 Host 静默降级。
18
+
19
+ ### 记录
20
+
21
+ - ADR 0026「会话文件浏览按需显示隐藏条目」与 `CONTEXT.md`「隐藏条目」术语(develop 决策记录,不进入上游 PR diff)。
22
+
23
+
3
24
  ## v3.2.4-alpha.3(build 35,issue #42)— 文件历史导航修复
4
25
 
5
26
  > 插件 `3.2.4-alpha.3` / App `3.2.4+35` / 载体 `3.2.4-alpha.3-app`。
package/docs/03-api.md CHANGED
@@ -348,7 +348,7 @@
348
348
  | POST | `/m/api/actions/:id/invoke` | 执行插件动作 |
349
349
  | GET | `/m/api/usage` | 会话 token 用量统计(v2.1) |
350
350
  | GET | `/m/api/workspaces` | 已注册工作区(新建会话默认目录,v2.1) |
351
- | GET | `/m/api/directories` | 目录浏览(盘符/子目录,v2.1;v3.1.1 根视图响应新增 `sep` 字段) |
351
+ | GET | `/m/api/directories` | 目录浏览(盘符/子目录,v2.1;v3.1.1 根视图响应新增 `sep` 字段;issue #45 可选 `includeHidden=1` 显示点开头条目,`.git` 永不返回) |
352
352
  | POST | `/m/api/directories` | 新建文件夹(v2.1) |
353
353
  | GET | `/m/api/diagnostics` | 环境诊断(服务端端点实测,v2.1) |
354
354
  | GET | `/m/api/balance` | DeepSeek 官方余额(服务端代查,v2.1) |
@@ -363,6 +363,16 @@
363
363
  > 根视图响应(`path` 为空)携带 `sep`(服务端真实分隔符),新版 App 据此拼接子目录,不再按 Windows 习惯硬编码 `\`;
364
364
  > 该字段为纯增量,旧版 App 忽略即可。
365
365
 
366
+ > **隐藏条目(issue #45,纯增量)**:`GET /m/api/directories?path=<非空>&includeHidden=1` 时,
367
+ > 点开头的目录与文件会同时出现在 `dirs` / `files` / `fileEntries` 三条列表里(排序规则不变);
368
+ > 缺省或 `includeHidden` 不是 `1` 时保持旧行为,全部隐藏点开头条目。无论是否 `includeHidden`,
369
+ > 名称恰为 `.git` 的条目(**文件或目录**)永远不返回——避免暴露对象库与可能含凭据的 `.git/config`,
370
+ > 列表也不提供进入其内部的入口。根视图(`path` 为空)与 `POST /m/api/directories` 不受该参数影响;
371
+ > `/m/api/files` 下载/预览通道对隐藏文件与普通文件一视同仁(可按普通文件路径读取隐藏文件)。
372
+ > 隐藏判定只看**名字是否以 `.` 开头**(Windows 隐藏属性不在本次范围);显式按路径发起的列表/读取
373
+ > 仍沿用既有只读信任模型,本参数只影响目录列表的可见性。旧客户端不传该参数即可,契约纯增量,
374
+ > 不新增 capability 位。
375
+
366
376
  ### 6.2 GET /m/api/catalog
367
377
 
368
378
  返回 PC 端真实枚举(单一事实源,客户端不硬编码):
package/lib/index.js CHANGED
@@ -1166,6 +1166,16 @@ const FILE_MIME = {
1166
1166
  };
1167
1167
  const fileMimeOf = (name) => FILE_MIME[extname(name).toLowerCase()] ?? "application/octet-stream";
1168
1168
 
1169
+ /**
1170
+ * `GET /m/api/directories` 条目可见性(issue #45)。
1171
+ *
1172
+ * 默认隐藏所有点开头条目;`includeHidden=1` 时保留点开头文件/目录。
1173
+ * 名称恰为 `.git` 的条目(文件或目录)**永远排除**:既避免把对象库/可能含
1174
+ * 凭据的 `.git/config` 暴露给文件浏览,也不提供进入其内部的入口。
1175
+ * dirs / files / fileEntries 三条列表共用这一条规则,避免实现分叉。
1176
+ */
1177
+ const directoryEntryVisible = (name, includeHidden) => name !== ".git" && (includeHidden || !String(name).startsWith("."));
1178
+
1169
1179
  /** 旧宿主逐个标题兜底的读取宽度:与宿主 `persistedReadConcurrency` 默认值一致(≤4)。 */
1170
1180
  const TITLE_FALLBACK_READ_WIDTH = DEFAULT_TITLE_REFRESH_CONCURRENCY;
1171
1181
  /**
@@ -7868,20 +7878,23 @@ export function apply(ctx, config, runtime = {}) {
7868
7878
  }
7869
7879
  // v3.1.1(issue #5):兜底兼容旧版 App 的 `\` 拼接(WSL 上 `/\home` 归一为 `/home`)
7870
7880
  const base = normalizeServerPath(path);
7881
+ // issue #45:`includeHidden=1` 时显示点开头条目;默认(含旧客户端不传参)
7882
+ // 保持旧行为,全部隐藏。无论开关如何,名称恰为 `.git` 的条目永不出现。
7883
+ const includeHidden = url.searchParams.get("includeHidden") === "1";
7871
7884
  try {
7872
7885
  const entries = await readdir(base, { withFileTypes: true });
7873
7886
  const dirs = entries
7874
- .filter((entry) => entry.isDirectory() && !entry.name.startsWith("."))
7887
+ .filter((entry) => entry.isDirectory() && directoryEntryVisible(entry.name, includeHidden))
7875
7888
  .map((entry) => entry.name)
7876
7889
  .sort((a, b) => a.localeCompare(b, "zh-CN"));
7877
7890
  // v3.1.2:文件列表(文件选择器用;纯增量字段,旧版 App 忽略)
7878
7891
  const files = entries
7879
- .filter((entry) => entry.isFile() && !entry.name.startsWith("."))
7892
+ .filter((entry) => entry.isFile() && directoryEntryVisible(entry.name, includeHidden))
7880
7893
  .map((entry) => entry.name)
7881
7894
  .sort((a, b) => a.localeCompare(b, "zh-CN"));
7882
7895
  // v3.2.3:文件元数据(大小/修改时间/MIME);files 保持纯字符串以兼容旧 App。
7883
7896
  const fileEntries = entries
7884
- .filter((entry) => entry.isFile() && !entry.name.startsWith("."))
7897
+ .filter((entry) => entry.isFile() && directoryEntryVisible(entry.name, includeHidden))
7885
7898
  .map((entry) => {
7886
7899
  let size = null;
7887
7900
  let mtimeMs = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marktrue/dsh-mobile-remote",
3
- "version": "3.2.4-alpha.3",
3
+ "version": "3.2.4-alpha.4",
4
4
  "description": "DSH Mobile:把 DeepSeek Harness 变成随身控制台——手机远程发消息派活、看进度、收通知、审批决策、管理会话;配套 Flutter App(当前 Android 端,iOS 未开发)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -52,7 +52,7 @@
52
52
  "qrcode"
53
53
  ],
54
54
  "optionalDependencies": {
55
- "@marktrue/dsh-mobile-remote-app": "npm:@marktrue/dsh-mobile-remote@3.2.4-alpha.3-app"
55
+ "@marktrue/dsh-mobile-remote-app": "npm:@marktrue/dsh-mobile-remote@3.2.4-alpha.4-app"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@deepseek-ai/dsh-credentials": ">=0.1.0-rc.6 <0.3.0",