a4phone 1.5.0 → 1.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/setup.mjs +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "a4phone",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Claude Code / Codex / DSH 远程手机交互:任务完成通知(含 AI 最后输出)、提问/权限请求手机点选或文字作答、远程续聊(ntfy.sh,含 DSH 会话续聊)",
5
5
  "type": "module",
6
6
  "bin": {
package/src/setup.mjs CHANGED
@@ -348,7 +348,12 @@ function mountDshHook({ profileDir, pluginEntry }) {
348
348
  const block = dshHookBlock(rel);
349
349
  if (content.includes(DSH_MARKER_START) && content.includes(block)) return false;
350
350
 
351
- const base = stripDshHookBlocks(content).trimEnd().replace(/\n{3,}/g, '\n\n');
351
+ // 默认模板占位符 `[]` 本身就是一个完整的 YAML 文档;若原样保留再往后追加
352
+ // 条目,文件会变成两个没有 `---` 分隔的文档,DSH 启动解析时报
353
+ // "end of the stream or a document separator is expected",故追加前移除。
354
+ const base = stripDshHookBlocks(content)
355
+ .replace(/^[ \t]*\[\][ \t]*\r?$/m, '')
356
+ .trimEnd().replace(/\n{3,}/g, '\n\n');
352
357
  const out = (base ? base + '\n\n' : '') + block + '\n';
353
358
  fs.mkdirSync(profileDir, { recursive: true });
354
359
  fs.writeFileSync(patchPath, out);