@mycompbox/compbox-cli 1.21.2 → 1.21.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/.tsbuildinfo +1 -1
- package/commands/run.d.ts +2 -0
- package/commands/run.d.ts.map +1 -1
- package/commands/run.js +41 -2
- package/commands/run.js.map +1 -1
- package/commands/workspace.d.ts +2 -1
- package/commands/workspace.d.ts.map +1 -1
- package/commands/workspace.js +15 -1
- package/commands/workspace.js.map +1 -1
- package/index.js +358 -21
- package/package.json +1 -1
- package/utils/agent-invoker.d.ts +61 -0
- package/utils/agent-invoker.d.ts.map +1 -1
- package/utils/agent-invoker.js +313 -10
- package/utils/agent-invoker.js.map +1 -1
- package/utils/config-store.d.ts +6 -0
- package/utils/config-store.d.ts.map +1 -1
- package/utils/config-store.js.map +1 -1
- package/utils/keep-awake.d.ts +23 -0
- package/utils/keep-awake.d.ts.map +1 -0
- package/utils/keep-awake.js +35 -0
- package/utils/keep-awake.js.map +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ChildProcess, type SpawnOptions } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps a Mac from idle-sleeping while the agent runner is up, so the machine
|
|
4
|
+
* stays available on the website. A sleeping Mac freezes the runner, its
|
|
5
|
+
* heartbeats stop, and the web shows the machine as unavailable — locking the
|
|
6
|
+
* screen alone does not do this, sleep does.
|
|
7
|
+
*
|
|
8
|
+
* Uses macOS's own `caffeinate`: `-i` blocks idle sleep (the display can still
|
|
9
|
+
* sleep and the screen still locks), `-s` blocks system sleep while on AC
|
|
10
|
+
* power, and `-w <pid>` ties it to this process so it ends when the runner
|
|
11
|
+
* does. Nothing can keep a Mac awake with the lid closed and no external
|
|
12
|
+
* display, and `-s` does nothing on battery.
|
|
13
|
+
*
|
|
14
|
+
* On by default; `"keepAwake": false` in ~/.compbox/config.json turns it off.
|
|
15
|
+
* Other platforms are left alone.
|
|
16
|
+
*/
|
|
17
|
+
export declare function startKeepAwake(opts: {
|
|
18
|
+
enabled: boolean | undefined;
|
|
19
|
+
platform?: NodeJS.Platform;
|
|
20
|
+
pid?: number;
|
|
21
|
+
spawnFn?: (cmd: string, args: string[], options: SpawnOptions) => ChildProcess;
|
|
22
|
+
}): ChildProcess | null;
|
|
23
|
+
//# sourceMappingURL=keep-awake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keep-awake.d.ts","sourceRoot":"","sources":["../../src/utils/keep-awake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,KAAK,YAAY,CAAC;CAChF,GAAG,YAAY,GAAG,IAAI,CAetB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps a Mac from idle-sleeping while the agent runner is up, so the machine
|
|
4
|
+
* stays available on the website. A sleeping Mac freezes the runner, its
|
|
5
|
+
* heartbeats stop, and the web shows the machine as unavailable — locking the
|
|
6
|
+
* screen alone does not do this, sleep does.
|
|
7
|
+
*
|
|
8
|
+
* Uses macOS's own `caffeinate`: `-i` blocks idle sleep (the display can still
|
|
9
|
+
* sleep and the screen still locks), `-s` blocks system sleep while on AC
|
|
10
|
+
* power, and `-w <pid>` ties it to this process so it ends when the runner
|
|
11
|
+
* does. Nothing can keep a Mac awake with the lid closed and no external
|
|
12
|
+
* display, and `-s` does nothing on battery.
|
|
13
|
+
*
|
|
14
|
+
* On by default; `"keepAwake": false` in ~/.compbox/config.json turns it off.
|
|
15
|
+
* Other platforms are left alone.
|
|
16
|
+
*/
|
|
17
|
+
export function startKeepAwake(opts) {
|
|
18
|
+
const platform = opts.platform ?? process.platform;
|
|
19
|
+
if (opts.enabled === false || platform !== 'darwin')
|
|
20
|
+
return null;
|
|
21
|
+
const spawnFn = opts.spawnFn ?? spawn;
|
|
22
|
+
try {
|
|
23
|
+
const child = spawnFn('/usr/bin/caffeinate', ['-i', '-s', '-w', String(opts.pid ?? process.pid)], {
|
|
24
|
+
stdio: 'ignore',
|
|
25
|
+
});
|
|
26
|
+
// A missing or failing caffeinate must never take the runner down.
|
|
27
|
+
child.on('error', () => undefined);
|
|
28
|
+
child.unref();
|
|
29
|
+
return child;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=keep-awake.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keep-awake.js","sourceRoot":"","sources":["../../src/utils/keep-awake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAwC,MAAM,oBAAoB,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,IAK9B;IACC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACnD,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACjE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE;YAChG,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;QACH,mEAAmE;QACnE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACnC,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|