@aglit-ai/cli 1.0.17159 → 1.0.17176
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/package.json +1 -1
- package/src/installation.cjs +14 -1
- package/src/updates.cjs +1 -1
package/package.json
CHANGED
package/src/installation.cjs
CHANGED
|
@@ -218,7 +218,20 @@ function start() {
|
|
|
218
218
|
...(env.PATH ? ['--env', 'PATH=' + env.PATH] : []),
|
|
219
219
|
'--stdout', path.join(root, 'runtime.log'), '--stderr', path.join(root, 'runtime.log'),
|
|
220
220
|
'--args', '--computer-use'], { env });
|
|
221
|
-
|
|
221
|
+
// Launch Services owns TCC attribution, but open's PID is not the app PID.
|
|
222
|
+
// Bind the result to the exact installed executable and current OS user.
|
|
223
|
+
const deadline = Date.now() + 10000;
|
|
224
|
+
do {
|
|
225
|
+
const rows = execFileSync('/bin/ps', ['-axo', 'pid=,uid=,comm='], {encoding: 'utf8', timeout: 15000, maxBuffer: 8 * 1024 ** 2});
|
|
226
|
+
const matches = rows.split('\n').flatMap(line => {
|
|
227
|
+
const row = /^\s*(\d+)\s+(\d+)\s+(.+)$/.exec(line);
|
|
228
|
+
return row && Number(row[2]) === process.getuid() && row[3].trim() === installed.executable ? [Number(row[1])] : [];
|
|
229
|
+
});
|
|
230
|
+
if (matches.length > 1) throw Error('Multiple installed Desktop processes; activation remains pending');
|
|
231
|
+
if (matches.length === 1) return { pid: matches[0] };
|
|
232
|
+
execFileSync('/bin/sleep', ['0.1'], {timeout: 1000});
|
|
233
|
+
} while (Date.now() < deadline);
|
|
234
|
+
throw Error('Launch Services did not expose the installed Desktop process; activation remains pending');
|
|
222
235
|
}
|
|
223
236
|
const child = spawn(installed.executable, ['--computer-use'], { detached: true, windowsHide: true, stdio: ['ignore', log, log], env });
|
|
224
237
|
child.on('error', error => { process.stderr.write(`Computer Use failed to start: ${error.message}\n`); });
|
package/src/updates.cjs
CHANGED
|
@@ -497,7 +497,7 @@ async function update({check = false, channel} = {}) {
|
|
|
497
497
|
if (accepted) return {updated: true, version: cli.version, runtimeUpdated: true, runtimeVersion: runtime.version, runtimePid: launched.pid, recoveryMetadataPending: true};
|
|
498
498
|
// A candidate can be retired only through its own authenticated idle
|
|
499
499
|
// handoff. Never kill an unproven process or start two profile owners.
|
|
500
|
-
let candidateStopped =
|
|
500
|
+
let candidateStopped = runtimeStopped(runtime);
|
|
501
501
|
if (launched && !candidateStopped) {
|
|
502
502
|
try { const closing = await control(config, 'update-prepare'); if (closing.quitting && closing.pid === launched.pid) {
|
|
503
503
|
const deadline = Date.now() + 30000; while (live(launched.pid) && Date.now() < deadline) await delay(250); candidateStopped = !live(launched.pid);
|