@koalaauto/agentchannel 3.87.0 → 3.87.1
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/src/cli-run.js +10 -2
- package/dist/src/selfupdate.d.ts +18 -0
- package/dist/src/selfupdate.js +19 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/dist/src/cli-run.js
CHANGED
|
@@ -11,7 +11,7 @@ import { Client, clientFromConfig, HubError, isZh } from './client.js';
|
|
|
11
11
|
import { achHome, defaultHome, loadConfig, readFileConfig, resolveClaimDelay, writeFileConfig } from './config.js';
|
|
12
12
|
import { isPerm } from './perm.js';
|
|
13
13
|
import { isRuntime, runtimePerm } from './adapters/spec.js';
|
|
14
|
-
import { bootGuard, markHealthy, SelfUpdater, superviseSelf, UPDATE_EXIT_CODE, UPDATE_HANDOFF_EXIT_CODE, waitForWindowsUpdate } from './selfupdate.js';
|
|
14
|
+
import { bootGuard, loadUpdateState, markHealthy, restartFromNpx, SelfUpdater, superviseSelf, UPDATE_EXIT_CODE, UPDATE_HANDOFF_EXIT_CODE, waitForWindowsUpdate } from './selfupdate.js';
|
|
15
15
|
import { inheritedEnv } from './env.js';
|
|
16
16
|
import { clearStopped, markStopped } from './watchdog.js';
|
|
17
17
|
import { parseNum, splitList, str } from './cli-shared.js';
|
|
@@ -355,8 +355,16 @@ async function runOnce(p, io) {
|
|
|
355
355
|
return UPDATE_HANDOFF_EXIT_CODE;
|
|
356
356
|
}
|
|
357
357
|
if (updater.restarting) {
|
|
358
|
+
const byHand = process.env.ACH_SUPERVISED !== '1' && !(await import('./servicefix.js')).startedByService(me.name, process.platform, process.env);
|
|
359
|
+
// started by hand through npx: npx would start the old release again, so the new one goes into the home install and runs from there
|
|
360
|
+
if (byHand && updater.installed === 'npx') {
|
|
361
|
+
const { appDir } = await import('./appinstall.js');
|
|
362
|
+
const code = await restartFromNpx({ target: loadUpdateState(home)?.target, app: appDir(env), argv: process.argv, log: io.err });
|
|
363
|
+
if (code !== undefined)
|
|
364
|
+
return code;
|
|
365
|
+
}
|
|
358
366
|
// started by hand (no systemd / launchd behind it) from a global or home install: nothing would start it again, so it does that itself
|
|
359
|
-
if ((updater.installed === 'global' || updater.installed === 'app') &&
|
|
367
|
+
if ((updater.installed === 'global' || updater.installed === 'app') && byHand) {
|
|
360
368
|
io.err('ach run: updated; starting the new release here');
|
|
361
369
|
// the install in the AgentChannel home: through its launcher (this process's argv names the old release's own file)
|
|
362
370
|
const { appDir, launcherPath } = await import('./appinstall.js');
|
package/dist/src/selfupdate.d.ts
CHANGED
|
@@ -204,6 +204,24 @@ export type SpawnSelf = (file: string, args: string[], env: NodeJS.ProcessEnv) =
|
|
|
204
204
|
exit: Promise<number>;
|
|
205
205
|
kill: (sig: NodeJS.Signals) => void;
|
|
206
206
|
};
|
|
207
|
+
/**
|
|
208
|
+
* A runner started by hand through npx, after an update: npx would start the old release again from its cache, and nothing else
|
|
209
|
+
* starts it at all (2026-11-24: hand-started npx runners on Windows stayed on 3.68 or stopped). The release goes into the install
|
|
210
|
+
* in the AgentChannel home, and this process starts it from there through the launcher and stays as its parent (superviseSelf);
|
|
211
|
+
* from then on the runner runs from that install and updates it in place. Undefined when it could not be installed: the caller
|
|
212
|
+
* exits as before.
|
|
213
|
+
*/
|
|
214
|
+
export declare function restartFromNpx(o: {
|
|
215
|
+
target: string | undefined;
|
|
216
|
+
app: string;
|
|
217
|
+
argv: string[];
|
|
218
|
+
install?: (app: string, version: string) => Promise<{
|
|
219
|
+
ok: boolean;
|
|
220
|
+
detail: string;
|
|
221
|
+
}>;
|
|
222
|
+
supervise?: (argv: string[]) => Promise<number>;
|
|
223
|
+
log: (s: string) => void;
|
|
224
|
+
}): Promise<number | undefined>;
|
|
207
225
|
/**
|
|
208
226
|
* After a global install replaced this CLI's files, run the same command line again (the new release) and stay as its parent: the
|
|
209
227
|
* terminal, the Startup script or whatever started the runner still sees one process. The child knows it is watched
|
package/dist/src/selfupdate.js
CHANGED
|
@@ -464,6 +464,25 @@ const defaultSpawnSelf = (file, args, env) => {
|
|
|
464
464
|
kill: (sig) => void child.kill(sig),
|
|
465
465
|
};
|
|
466
466
|
};
|
|
467
|
+
/**
|
|
468
|
+
* A runner started by hand through npx, after an update: npx would start the old release again from its cache, and nothing else
|
|
469
|
+
* starts it at all (2026-11-24: hand-started npx runners on Windows stayed on 3.68 or stopped). The release goes into the install
|
|
470
|
+
* in the AgentChannel home, and this process starts it from there through the launcher and stays as its parent (superviseSelf);
|
|
471
|
+
* from then on the runner runs from that install and updates it in place. Undefined when it could not be installed: the caller
|
|
472
|
+
* exits as before.
|
|
473
|
+
*/
|
|
474
|
+
export async function restartFromNpx(o) {
|
|
475
|
+
if (!o.target)
|
|
476
|
+
return undefined;
|
|
477
|
+
const r = await (o.install ?? ((app, v) => installIntoApp(app, v, defaultInstallExec)))(o.app, o.target);
|
|
478
|
+
if (!r.ok) {
|
|
479
|
+
o.log(`ach run: could not put ${o.target} into ${o.app} (${r.detail}); exiting: run it again to start the new release`);
|
|
480
|
+
return undefined;
|
|
481
|
+
}
|
|
482
|
+
o.log(`ach run: updated; ${o.target} is in ${o.app}, starting it here`);
|
|
483
|
+
const argv = [o.argv[0], join(o.app, 'ach.mjs'), ...o.argv.slice(2)];
|
|
484
|
+
return (o.supervise ?? ((a) => superviseSelf({ log: o.log, argv: a })))(argv);
|
|
485
|
+
}
|
|
467
486
|
/**
|
|
468
487
|
* After a global install replaced this CLI's files, run the same command line again (the new release) and stay as its parent: the
|
|
469
488
|
* terminal, the Startup script or whatever started the runner still sees one process. The child knows it is watched
|
package/dist/src/version.d.ts
CHANGED
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalaauto/agentchannel",
|
|
3
|
-
"version": "3.87.
|
|
3
|
+
"version": "3.87.1",
|
|
4
4
|
"description": "Hand work between your team's agents (Claude Code, Codex) and follow it in one panel: the ach CLI, MCP server and runner for AgentChannel v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentchannel",
|