@tbox.cn/dsh-acp-full-app 0.1.0-rc.4 → 0.1.0-rc.5

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/lib/index.d.ts CHANGED
@@ -7,7 +7,25 @@ declare const name = "acp-app-startup";
7
7
  declare const inject: string[];
8
8
  /** acp 行等待的就绪服务名。 */
9
9
  declare const ACP_APP_STARTUP_SERVICE = "acpAppStartup";
10
- /** 接受调用 → 发布就绪 + 绑定 EOF 关停;解析失败不发布(传输不装载)。 */
10
+ /** 看门狗注入面(单测驱动探测/心跳/回调——无 cordis 依赖)。 */
11
+ interface ParentLivenessWatchOptions {
12
+ parentPid: number;
13
+ intervalMs?: number;
14
+ /** 探测父进程存活;缺省 `kill(pid, 0)`(ESRCH=死 / EPERM=活)。 */
15
+ probe?: (pid: number) => boolean;
16
+ /** 父死回调(至多触发一次)。 */
17
+ onLost: () => void;
18
+ }
19
+ /**
20
+ * 父进程存活性看门狗:cli 被外层 SIGKILL 时 stdio 管道写端可能仍被上游持有
21
+ * (EOF 永不触发),dsh 孙进程将无限期持有会话写租约。探测 `kill(ppid, 0)`:
22
+ * ESRCH = 父死 → onLost(接 appExit 有界关停);EPERM = 父存活(他用户)。
23
+ * pid 复用误判接受(最坏少杀一次,无过杀风险)。ppid <= 1(启动即孤儿)不武装。
24
+ * 仅 acp-app bundle 挂载——server 的 ready 后孤儿语义(server-envelope 契约)不受影响。
25
+ * @returns 停止函数(idempotent)。
26
+ */
27
+ declare function startParentLivenessWatch(options: ParentLivenessWatchOptions): () => void;
28
+ /** 接受调用 → 发布就绪 + 绑定 EOF 关停与父存活看门狗;解析失败不发布(传输不装载)。 */
11
29
  declare function apply(ctx: Context): void;
12
30
  //#endregion
13
- export { ACP_APP_STARTUP_SERVICE, apply, inject, name };
31
+ export { ACP_APP_STARTUP_SERVICE, ParentLivenessWatchOptions, apply, inject, name, startParentLivenessWatch };
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import{Command as e}from"commander";import{exitOnStdinEnd as t,parseCmdline as n}from"@deepseek-ai/dsh-cmdline";const r=`acp-app-startup`,i=[`cmdlineArgs`],a=`acpAppStartup`;function o(){return new e().name(`dsh --profile tboxcode-acp`).description(`Serve automation clients over Agent Client Protocol stdio.`).helpOption(`-h, --help`,`show this help`).addHelpText(`after`,`
2
2
  Example:
3
3
  dsh --profile tboxcode-acp serve ACP until the client disconnects
4
- `)}function s(e){let r=o();r.action(()=>{t(e,`acp-app.stdin`),e.provide(a,{accepted:!0})}),n(e,r)}export{a as ACP_APP_STARTUP_SERVICE,s as apply,i as inject,r as name};
4
+ `)}function s(e){let t=e.intervalMs??2e3,n=e.probe??c;if(e.parentPid<=1)return()=>{};let r=!1,i=setInterval(()=>{if(r)return;let t=!0;try{t=n(e.parentPid)}catch{t=!0}t||(r=!0,clearInterval(i),e.onLost())},t);return i.unref?.(),()=>clearInterval(i)}function c(e){try{return process.kill(e,0),!0}catch(e){return e.code!==`ESRCH`}}function l(e){let t=e.get(`appExit`),n=e.get(`appReady`);if(t===void 0||n===void 0)return;let r=s({parentPid:process.ppid,onLost:()=>{n.onReady(()=>t(0))}});e.effect(()=>r,`acp-app.parent-watch`)}function u(e){let r=o();r.action(()=>{t(e,`acp-app.stdin`),l(e),e.provide(a,{accepted:!0})}),n(e,r)}export{a as ACP_APP_STARTUP_SERVICE,u as apply,i as inject,r as name,s as startParentLivenessWatch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/dsh-acp-full-app",
3
- "version": "0.1.0-rc.4",
3
+ "version": "0.1.0-rc.5",
4
4
  "type": "module",
5
5
  "description": "profile bundle:dsh-base 组合 + 启动闩 / 有界关停(对位官方 dsh-acp-app 的 automation 导向精简面)+ tool-ask-user 挂载行(elicitation 能力前提)",
6
6
  "main": "lib/index.js",