peaks-loop-internal-runtime 0.0.32 → 0.0.33

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const RUNTIME_VERSION = "4.0.47";
1
+ export declare const RUNTIME_VERSION = "4.0.48";
2
2
  export declare const RUNTIME_NPM_VERSION = "0.0.21";
3
3
  export { ClaudeAdapter } from './vendor/claude-adapter.js';
4
4
  export { CodexAdapter } from './vendor/codex-adapter.js';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // API contract: RUNTIME_VERSION tracks peaks-loop root version (4.0.x).
2
2
  // This is what consumers (sub-agents dispatched by peaks-code) check at
3
3
  // runtime to verify protocol compatibility.
4
- export const RUNTIME_VERSION = '4.0.47';
4
+ export const RUNTIME_VERSION = '4.0.48';
5
5
  // npm version: independent 0.0.x SemVer. Runtime is its own package
6
6
  // (peaks-loop-internal-runtime@NPM_VERSION) on the registry; bumps
7
7
  // per peaks release notes when its public surface actually changes
@@ -1 +1 @@
1
- {"version":3,"file":"process-supervisor.d.ts","sourceRoot":"","sources":["../src/process-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AAIzF,MAAM,WAAW,SAAS;IACxB;;;;;;;;OAQG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC3B;AACD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACpC;;;;;;;OAOG;IACH,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAChD;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;CAmDnF"}
1
+ {"version":3,"file":"process-supervisor.d.ts","sourceRoot":"","sources":["../src/process-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AAIzF,MAAM,WAAW,SAAS;IACxB;;;;;;;;OAQG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC3B;AACD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACpC;;;;;;;OAOG;IACH,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAChD;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;CAiEnF"}
@@ -45,7 +45,21 @@ export class ProcessSupervisor {
45
45
  });
46
46
  const dir = join(this.cfg.runtimeDir, opts.rid);
47
47
  mkdirSync(dir, { recursive: true });
48
- writeFileSync(join(dir, 'pid'), String(child.pid ?? ''));
48
+ // `<rid>/pid` exists IFF a real OS process was launched. `child.pid` is
49
+ // `undefined` until the OS confirms the spawn, so a failed launch used to
50
+ // write `String(undefined ?? '')` — an EMPTY pid file. That is not a
51
+ // cosmetic wart: `Number('')` is `0`, so a cleanup path doing
52
+ // `kill(Number(readFileSync(pid)))` would send its signal to pid 0 (the
53
+ // whole process group), and an existence check for "is something running
54
+ // here" reads `true` for a launch that never happened.
55
+ //
56
+ // Nothing is lost by omitting it: the launch failure is recorded as a
57
+ // VALUE on the dispatch record (`status: 'failed'` + `spawnError`), which
58
+ // is the surface a reader should consult. Absence in the pid file is the
59
+ // one encoding that cannot be misread as a pid.
60
+ if (child.pid !== undefined) {
61
+ writeFileSync(join(dir, 'pid'), String(child.pid));
62
+ }
49
63
  return {
50
64
  pid: child.pid ?? -1,
51
65
  child,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peaks-loop-internal-runtime",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "Detached sub-agent runtime: ProcessSupervisor + LifecycleOwner + VendorAdapter (claude/codex/copilot) + G8 infinite-context auto-compact. Slice 2026-08-10.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "peerDependencies": {
19
- "peaks-loop-shared": "0.0.81"
19
+ "peaks-loop-shared": "0.0.82"
20
20
  },
21
21
  "devDependencies": {
22
22
  "typescript": "^5.4.0",
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // API contract: RUNTIME_VERSION tracks peaks-loop root version (4.0.x).
2
2
  // This is what consumers (sub-agents dispatched by peaks-code) check at
3
3
  // runtime to verify protocol compatibility.
4
- export const RUNTIME_VERSION = '4.0.47';
4
+ export const RUNTIME_VERSION = '4.0.48';
5
5
 
6
6
  // npm version: independent 0.0.x SemVer. Runtime is its own package
7
7
  // (peaks-loop-internal-runtime@NPM_VERSION) on the registry; bumps
@@ -76,7 +76,21 @@ export class ProcessSupervisor {
76
76
 
77
77
  const dir = join(this.cfg.runtimeDir, opts.rid);
78
78
  mkdirSync(dir, { recursive: true });
79
- writeFileSync(join(dir, 'pid'), String(child.pid ?? ''));
79
+ // `<rid>/pid` exists IFF a real OS process was launched. `child.pid` is
80
+ // `undefined` until the OS confirms the spawn, so a failed launch used to
81
+ // write `String(undefined ?? '')` — an EMPTY pid file. That is not a
82
+ // cosmetic wart: `Number('')` is `0`, so a cleanup path doing
83
+ // `kill(Number(readFileSync(pid)))` would send its signal to pid 0 (the
84
+ // whole process group), and an existence check for "is something running
85
+ // here" reads `true` for a launch that never happened.
86
+ //
87
+ // Nothing is lost by omitting it: the launch failure is recorded as a
88
+ // VALUE on the dispatch record (`status: 'failed'` + `spawnError`), which
89
+ // is the surface a reader should consult. Absence in the pid file is the
90
+ // one encoding that cannot be misread as a pid.
91
+ if (child.pid !== undefined) {
92
+ writeFileSync(join(dir, 'pid'), String(child.pid));
93
+ }
80
94
 
81
95
  return {
82
96
  pid: child.pid ?? -1,