peaks-loop-internal-runtime 0.0.4 → 0.0.7
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/dispatch.d.ts.map +1 -1
- package/dist/dispatch.js +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/process-supervisor.d.ts +9 -0
- package/dist/process-supervisor.d.ts.map +1 -1
- package/dist/process-supervisor.js +11 -3
- package/package.json +2 -2
- package/src/dispatch.ts +5 -1
- package/src/index.ts +1 -1
- package/src/process-supervisor.ts +22 -5
package/dist/dispatch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAYvD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,KAAK,GAAC,iBAAiB,CAAC;IACvE,MAAM,EAAE,QAAQ,GAAC,OAAO,GAAC,SAAS,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IACzC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AACD,MAAM,WAAW,cAAc;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAC;CAAE;AAElG,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAYvD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,GAAC,IAAI,GAAC,IAAI,GAAC,KAAK,GAAC,iBAAiB,CAAC;IACvE,MAAM,EAAE,QAAQ,GAAC,OAAO,GAAC,SAAS,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IACzC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AACD,MAAM,WAAW,cAAc;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAC;CAAE;AAElG,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAsChF"}
|
package/dist/dispatch.js
CHANGED
|
@@ -27,7 +27,11 @@ export async function dispatchDetached(i) {
|
|
|
27
27
|
writeFileSync(join(dir, 'owner-session'), i.sid);
|
|
28
28
|
const sup = new ProcessSupervisor({ runtimeDir: i.runtimeDir });
|
|
29
29
|
const lo = new LifecycleOwner(i.runtimeDir);
|
|
30
|
-
|
|
30
|
+
// F2: in-shell background subprocess. The `detach` field is retained
|
|
31
|
+
// for backward compat with the public SpawnOpts surface but is now a
|
|
32
|
+
// no-op (ProcessSupervisor forces detached:false). Pass `false` to
|
|
33
|
+
// reflect the post-F2 contract explicitly.
|
|
34
|
+
const handle = await sup.spawn(adapter.binary, args, { detach: false, rid: i.rid });
|
|
31
35
|
lo.register(handle.pid, i.rid, i.sid);
|
|
32
36
|
// Write dispatch record (placeholder — final shape per Task 8 schema)
|
|
33
37
|
const recPath = join(i.subAgentsDir, `dispatch-${i.rid}-${Date.now()}.json`);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const RUNTIME_VERSION = "4.0.22";
|
|
2
|
-
export declare const RUNTIME_NPM_VERSION = "0.0.
|
|
2
|
+
export declare const RUNTIME_NPM_VERSION = "0.0.7";
|
|
3
3
|
export { ClaudeAdapter } from './vendor/claude-adapter.js';
|
|
4
4
|
export { CodexAdapter } from './vendor/codex-adapter.js';
|
|
5
5
|
export { CopilotAdapter } from './vendor/copilot-adapter.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export const RUNTIME_VERSION = '4.0.22';
|
|
|
6
6
|
// (peaks-loop-internal-runtime@NPM_VERSION) on the registry; bumps
|
|
7
7
|
// per peaks release notes when its public surface actually changes
|
|
8
8
|
// (not per root version bump).
|
|
9
|
-
export const RUNTIME_NPM_VERSION = '0.0.
|
|
9
|
+
export const RUNTIME_NPM_VERSION = '0.0.7';
|
|
10
10
|
export { ClaudeAdapter } from './vendor/claude-adapter.js';
|
|
11
11
|
export { CodexAdapter } from './vendor/codex-adapter.js';
|
|
12
12
|
export { CopilotAdapter } from './vendor/copilot-adapter.js';
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { ChildProcess } from 'node:child_process';
|
|
2
2
|
export interface SpawnOpts {
|
|
3
|
+
/**
|
|
4
|
+
* F2 in-shell background subprocess contract: this flag is a no-op
|
|
5
|
+
* retained for backward compat with the pre-F2 public surface.
|
|
6
|
+
* The supervisor always forces `detached: false` so the child runs
|
|
7
|
+
* in the parent's process group (visible to the user's shell) and
|
|
8
|
+
* the parent retains pipe ownership for SIGTERM/SIGKILL control.
|
|
9
|
+
* Pre-F2 callers passing `detach: true` see identical runtime
|
|
10
|
+
* behavior (F2 makes OS-detached detach a no-op, not an error).
|
|
11
|
+
*/
|
|
3
12
|
detach: boolean;
|
|
4
13
|
rid: string;
|
|
5
14
|
stdio?: 'pipe' | 'ignore';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-supervisor.d.ts","sourceRoot":"","sources":["../src/process-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,
|
|
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;CACrC;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;CA+BnF"}
|
|
@@ -8,14 +8,22 @@ export class ProcessSupervisor {
|
|
|
8
8
|
}
|
|
9
9
|
async spawn(binary, args, opts) {
|
|
10
10
|
const isWin = process.platform === 'win32';
|
|
11
|
+
// F2: in-shell background subprocess. The pre-F2 OS-detached path
|
|
12
|
+
// used the Windows process-group + detached-process flags (and the
|
|
13
|
+
// POSIX session-detach helpers), which spawned a popup PowerShell
|
|
14
|
+
// window detached from the user's shell. The new contract keeps
|
|
15
|
+
// the child in the parent's process group so the user can see
|
|
16
|
+
// what the sub-agent is doing, and the parent owns the stdio
|
|
17
|
+
// pipes for capture + lifecycle control.
|
|
11
18
|
const spawnOpts = {
|
|
12
|
-
detached:
|
|
19
|
+
detached: false,
|
|
13
20
|
stdio: opts.stdio ?? 'pipe',
|
|
14
21
|
};
|
|
15
22
|
if (isWin) {
|
|
23
|
+
// Suppress the popup console window on Windows without changing
|
|
24
|
+
// process group membership. The child is still part of the
|
|
25
|
+
// parent's process group (no Windows process-group detach flag).
|
|
16
26
|
spawnOpts.windowsHide = true;
|
|
17
|
-
// CREATE_NEW_PROCESS_GROUP = 0x00000200, DETACHED_PROCESS = 0x00000008
|
|
18
|
-
spawnOpts.detached = true;
|
|
19
27
|
}
|
|
20
28
|
const child = nodeSpawn(binary, args, spawnOpts);
|
|
21
29
|
const dir = join(this.cfg.runtimeDir, opts.rid);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peaks-loop-internal-runtime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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.
|
|
19
|
+
"peaks-loop-shared": "0.0.56"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"typescript": "^5.4.0",
|
package/src/dispatch.ts
CHANGED
|
@@ -43,7 +43,11 @@ export async function dispatchDetached(i: DispatchInput): Promise<DispatchResult
|
|
|
43
43
|
|
|
44
44
|
const sup = new ProcessSupervisor({ runtimeDir: i.runtimeDir });
|
|
45
45
|
const lo = new LifecycleOwner(i.runtimeDir);
|
|
46
|
-
|
|
46
|
+
// F2: in-shell background subprocess. The `detach` field is retained
|
|
47
|
+
// for backward compat with the public SpawnOpts surface but is now a
|
|
48
|
+
// no-op (ProcessSupervisor forces detached:false). Pass `false` to
|
|
49
|
+
// reflect the post-F2 contract explicitly.
|
|
50
|
+
const handle = await sup.spawn(adapter.binary, args, { detach: false, rid: i.rid });
|
|
47
51
|
lo.register(handle.pid, i.rid, i.sid);
|
|
48
52
|
|
|
49
53
|
// Write dispatch record (placeholder — final shape per Task 8 schema)
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export const RUNTIME_VERSION = '4.0.22';
|
|
|
7
7
|
// (peaks-loop-internal-runtime@NPM_VERSION) on the registry; bumps
|
|
8
8
|
// per peaks release notes when its public surface actually changes
|
|
9
9
|
// (not per root version bump).
|
|
10
|
-
export const RUNTIME_NPM_VERSION = '0.0.
|
|
10
|
+
export const RUNTIME_NPM_VERSION = '0.0.7';
|
|
11
11
|
export { ClaudeAdapter } from './vendor/claude-adapter.js';
|
|
12
12
|
export { CodexAdapter } from './vendor/codex-adapter.js';
|
|
13
13
|
export { CopilotAdapter } from './vendor/copilot-adapter.js';
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import { spawn as nodeSpawn, ChildProcess } from 'node:child_process';
|
|
1
|
+
import { spawn as nodeSpawn, ChildProcess, type SpawnOptions } from 'node:child_process';
|
|
2
2
|
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
|
|
5
5
|
export interface SpawnOpts {
|
|
6
|
+
/**
|
|
7
|
+
* F2 in-shell background subprocess contract: this flag is a no-op
|
|
8
|
+
* retained for backward compat with the pre-F2 public surface.
|
|
9
|
+
* The supervisor always forces `detached: false` so the child runs
|
|
10
|
+
* in the parent's process group (visible to the user's shell) and
|
|
11
|
+
* the parent retains pipe ownership for SIGTERM/SIGKILL control.
|
|
12
|
+
* Pre-F2 callers passing `detach: true` see identical runtime
|
|
13
|
+
* behavior (F2 makes OS-detached detach a no-op, not an error).
|
|
14
|
+
*/
|
|
6
15
|
detach: boolean;
|
|
7
16
|
rid: string;
|
|
8
17
|
stdio?: 'pipe' | 'ignore';
|
|
@@ -18,14 +27,22 @@ export class ProcessSupervisor {
|
|
|
18
27
|
|
|
19
28
|
async spawn(binary: string, args: string[], opts: SpawnOpts): Promise<SpawnHandle> {
|
|
20
29
|
const isWin = process.platform === 'win32';
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
// F2: in-shell background subprocess. The pre-F2 OS-detached path
|
|
31
|
+
// used the Windows process-group + detached-process flags (and the
|
|
32
|
+
// POSIX session-detach helpers), which spawned a popup PowerShell
|
|
33
|
+
// window detached from the user's shell. The new contract keeps
|
|
34
|
+
// the child in the parent's process group so the user can see
|
|
35
|
+
// what the sub-agent is doing, and the parent owns the stdio
|
|
36
|
+
// pipes for capture + lifecycle control.
|
|
37
|
+
const spawnOpts: SpawnOptions = {
|
|
38
|
+
detached: false,
|
|
23
39
|
stdio: opts.stdio ?? 'pipe',
|
|
24
40
|
};
|
|
25
41
|
if (isWin) {
|
|
42
|
+
// Suppress the popup console window on Windows without changing
|
|
43
|
+
// process group membership. The child is still part of the
|
|
44
|
+
// parent's process group (no Windows process-group detach flag).
|
|
26
45
|
spawnOpts.windowsHide = true;
|
|
27
|
-
// CREATE_NEW_PROCESS_GROUP = 0x00000200, DETACHED_PROCESS = 0x00000008
|
|
28
|
-
spawnOpts.detached = true;
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
const child = nodeSpawn(binary, args, spawnOpts);
|