@koalaauto/agentchannel 3.82.1 → 3.82.2

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.js CHANGED
@@ -1032,7 +1032,10 @@ async function dispatch(p, io) {
1032
1032
  const cwd = io.cwd ?? process.cwd();
1033
1033
  const sess = sessionHome(cwd, env);
1034
1034
  const menv = sess.how === 'dir' ? { ...env, AGENTCHANNEL_HOME: sess.home } : env;
1035
- await startMcp(clientFromConfig(loadConfig(menv), { fetch: io.fetch }), { cwd, dir: sess.dir });
1035
+ // every answer names the newest release: this machine's install moves on to it even with no runner here (mcpupdate.ts)
1036
+ const { mcpUpdater } = await import('./mcpupdate.js');
1037
+ const upd = mcpUpdater({ env: menv, log: (s) => process.stderr.write(`[ach mcp] ${s}\n`) });
1038
+ await startMcp(clientFromConfig(loadConfig(menv), { fetch: io.fetch, onLatestClient: (latest) => void upd.heard(latest)?.catch(() => { }) }), { cwd, dir: sess.dir });
1036
1039
  return await new Promise(() => { }); // stdio server runs until killed
1037
1040
  }
1038
1041
  case 'caps': {
@@ -0,0 +1,12 @@
1
+ import { type InstallExec } from './appinstall.js';
2
+ export interface McpUpdater {
3
+ heard(latest: string): Promise<string> | undefined;
4
+ }
5
+ export declare function mcpUpdater(o?: {
6
+ env?: NodeJS.ProcessEnv;
7
+ self?: string;
8
+ version?: string;
9
+ exec?: InstallExec;
10
+ now?: () => number;
11
+ log?: (s: string) => void;
12
+ }): McpUpdater;
@@ -0,0 +1,43 @@
1
+ // The MCP server keeps this machine's install current by itself (docs/decisions.md §47).
2
+ //
3
+ // The install in the AgentChannel home (appinstall.ts: app/current names the release every `ach` here starts) was only ever moved on
4
+ // by a runner's updater. A machine whose runner had stopped kept starting the old release in every Claude Code or Codex session, so
5
+ // nothing new (the runner watchdog, a fix) ever reached it. Every hub answer names the newest release (x-ach-latest-client): when it
6
+ // is newer and this MCP runs from that install, it installs it there and points `current` at it. This session goes on with the
7
+ // files it has; the next one starts the new release.
8
+ import { appDir, appWritable, inApp, installIntoApp } from './appinstall.js';
9
+ import { thisCliPath } from './invite.js';
10
+ import { defaultInstallExec } from './selfupdate.js';
11
+ import { newerVersion, VERSION } from './version.js';
12
+ const isVersion = (v) => /^\d+\.\d+\.\d+$/.test(v);
13
+ export function mcpUpdater(o = {}) {
14
+ const env = o.env ?? process.env;
15
+ const now = o.now ?? Date.now;
16
+ const tried = new Map();
17
+ let working = false;
18
+ return {
19
+ heard(latest) {
20
+ if (env.ACH_AUTO_UPDATE === '0' || working || !isVersion(latest) || !newerVersion(latest, o.version ?? VERSION))
21
+ return undefined;
22
+ const app = appDir(env);
23
+ if (!inApp(o.self ?? thisCliPath(), app))
24
+ return undefined; // npx re-resolves by itself, a global install is its runner's or its person's
25
+ const at = tried.get(latest);
26
+ if (at !== undefined && now() - at < 10 * 60_000)
27
+ return undefined; // npm serves a release a minute or two after the hub names it
28
+ tried.set(latest, now());
29
+ if (!appWritable(app))
30
+ return Promise.resolve('not writable');
31
+ working = true;
32
+ return installIntoApp(app, latest, o.exec ?? defaultInstallExec)
33
+ .then((r) => {
34
+ o.log?.(r.ok ? `${r.detail}: the next session starts it` : r.detail);
35
+ return r.ok ? `installed ${latest}` : 'failed';
36
+ })
37
+ .catch((e) => `failed: ${e?.message ?? e}`)
38
+ .finally(() => {
39
+ working = false;
40
+ });
41
+ },
42
+ };
43
+ }
@@ -1,11 +1,13 @@
1
- export declare const VERSION = "3.82.1";
1
+ export declare const VERSION = "3.82.2";
2
2
  /** The npm package (scripts/release.mjs keeps it and VERSION in step with package.json). */
3
3
  export declare const PKG_NAME = "@koalaauto/agentchannel";
4
4
  /**
5
5
  * What this CLI says about itself on every request (x-ach-proto). The hub's ACH_MIN_CLIENT_PROTO refuses a CLI below its
6
6
  * floor. Raise this only when the CLI starts to need something an older hub does not have, and a hub only when it can no
7
- * longer serve the older CLIs: docs/api/README.md, "Client compatibility". 1 = the CLI announces itself (3.5). 2 = ids carry a kind letter and the hub may be read-only (3.75, 2026-11-24).
7
+ * longer serve the older CLIs: docs/api/README.md, "Client compatibility". 1 = the CLI announces itself (3.5). 2 = ids carry a kind letter and the hub may be read-only (3.77, 2026-11-24).
8
8
  */
9
9
  export declare const CLIENT_PROTO = 2;
10
+ /** The first release of each protocol: scripts/deploy.mjs refuses a floor raise while runners in use are older (decisions §47). */
11
+ export declare const PROTO_SINCE: Record<number, string>;
10
12
  /** True when version a is newer than b (x.y.z, a release beats its own prereleases; prerelease parts compared by number when numeric). */
11
13
  export declare function newerVersion(a: string, b: string): boolean;
@@ -1,12 +1,14 @@
1
- export const VERSION = '3.82.1';
1
+ export const VERSION = '3.82.2';
2
2
  /** The npm package (scripts/release.mjs keeps it and VERSION in step with package.json). */
3
3
  export const PKG_NAME = '@koalaauto/agentchannel';
4
4
  /**
5
5
  * What this CLI says about itself on every request (x-ach-proto). The hub's ACH_MIN_CLIENT_PROTO refuses a CLI below its
6
6
  * floor. Raise this only when the CLI starts to need something an older hub does not have, and a hub only when it can no
7
- * longer serve the older CLIs: docs/api/README.md, "Client compatibility". 1 = the CLI announces itself (3.5). 2 = ids carry a kind letter and the hub may be read-only (3.75, 2026-11-24).
7
+ * longer serve the older CLIs: docs/api/README.md, "Client compatibility". 1 = the CLI announces itself (3.5). 2 = ids carry a kind letter and the hub may be read-only (3.77, 2026-11-24).
8
8
  */
9
9
  export const CLIENT_PROTO = 2;
10
+ /** The first release of each protocol: scripts/deploy.mjs refuses a floor raise while runners in use are older (decisions §47). */
11
+ export const PROTO_SINCE = { 1: '3.5.0', 2: '3.77.0' };
10
12
  /** True when version a is newer than b (x.y.z, a release beats its own prereleases; prerelease parts compared by number when numeric). */
11
13
  export function newerVersion(a, b) {
12
14
  const parse = (v) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalaauto/agentchannel",
3
- "version": "3.82.1",
3
+ "version": "3.82.2",
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",