@koalaauto/agentchannel 3.98.2 → 3.99.0

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/mcp.d.ts CHANGED
@@ -95,6 +95,8 @@ export declare function buildMcpServer(client: Client, o?: {
95
95
  };
96
96
  /** how often tool-call counts are reported (default: once a minute) */
97
97
  useEveryMs?: number;
98
+ /** connected as a person who gets no notifications on any device: where they turn them on (the hub's /me `notify`) */
99
+ notifyOff?: string;
98
100
  }): McpServer;
99
101
  /**
100
102
  * Where the one-line reminder goes in the session that runs this server.
package/dist/src/mcp.js CHANGED
@@ -543,7 +543,9 @@ export function buildMcpServer(client, o = {}) {
543
543
  // a session that is the person: each waiting item says which tool settles it, and the cards waiting for their word come along
544
544
  const items = Array.isArray(inbox.items) ? inbox.items.map((i) => { const h = i.pending ? inboxHandle(i) : ''; return h ? { ...i, handle: h } : i; }) : inbox.items;
545
545
  const cards = await client.yoda().then((y) => y.pending.filter((i) => i.kind === 'confirm' && i.act_id).map((i) => ({ act: i.act_id, what: i.body, handle: 'confirm_card {act}: asks your user here' })), () => []);
546
- return wrapUntrusted({ ...inbox, items, ...(cards.length ? { cards } : {}) });
546
+ // nothing reaches them outside a session: said with what waits, since that is when it matters
547
+ const notice = o.notifyOff ? { notice: `No browser of ${o.person}'s takes notifications: when no session is open, nothing tells them something waits. They turn them on once at ${o.notifyOff}` } : {};
548
+ return wrapUntrusted({ ...notice, ...inbox, items, ...(cards.length ? { cards } : {}) });
547
549
  }));
548
550
  server.registerTool('ask', {
549
551
  description: 'Ask a factual question on a task. It goes to the other party\'s agent by default (`to` takes an agent name, not a person); to reach a person, @ them by name in a post or reply. For money, product direction or irreversible actions use request_decision instead.',
@@ -924,7 +926,10 @@ export async function startMcp(client, where = { cwd: process.cwd() }) {
924
926
  client.yodaFrom = hand.name;
925
927
  if (viaKey && !hand)
926
928
  client.yodaOutside = true;
927
- const server = buildMcpServer(client, { brief, identity, memory, me: (hand ? handMe : me) ?? undefined, person, hand });
929
+ // (asked of the hub once, when the session starts: a person who turns notifications on mid-session hears it once more)
930
+ const notify = person ? me?.notify : undefined;
931
+ const notifyOff = notify && notify.devices === 0 && notify.url ? notify.url : undefined;
932
+ const server = buildMcpServer(client, { brief, identity, memory, me: (hand ? handMe : me) ?? undefined, person, hand, notifyOff });
928
933
  // reminders start once the session said hello (its name decides Claude channel vs codex queue)
929
934
  let notices = null;
930
935
  server.server.oninitialized = () => {
@@ -934,12 +939,21 @@ export async function startMcp(client, where = { cwd: process.cwd() }) {
934
939
  // this machine's runner, when it stopped and should not have (watchdog.ts): started again from here
935
940
  // (a session connected as a person has no runner to look after)
936
941
  const watchdog = linked && !hand ? { stop() { } } : startRunnerWatchdog({ me: () => (hand ? hand.client : client).me(), log: (s) => process.stderr.write(`[ach mcp] ${s}\n`) });
937
- // the client ends a session by closing the pipe and then killing the process: what was counted since the last report is
938
- // told first (a session shorter than a minute would otherwise leave no trace), within a second and a half
942
+ // A session ends when its client closes the pipe (and usually kills the process after). What was counted since the last
943
+ // report is told first, within a second and a half, and then the process goes: a server whose client is gone has nobody to
944
+ // answer, and until 3.98.2 it stayed, still following the hub's events (a client that was killed left one behind each time).
939
945
  const lastWord = () => Promise.race([server.toolUse?.flush(), new Promise((r) => setTimeout(r, 1500))]).catch(() => { });
940
- process.stdin.once('end', () => void lastWord());
946
+ let leaving = false;
947
+ const leave = () => {
948
+ if (leaving)
949
+ return;
950
+ leaving = true;
951
+ void lastWord().finally(() => process.exit(0));
952
+ };
953
+ process.stdin.once('end', leave);
954
+ process.stdin.once('close', leave);
941
955
  for (const sig of ['SIGTERM', 'SIGINT', 'SIGHUP'])
942
- process.once(sig, () => void lastWord().finally(() => process.exit(0)));
956
+ process.once(sig, leave);
943
957
  server.server.onclose = () => {
944
958
  void server.toolUse?.flush();
945
959
  notices?.stop();
@@ -143,7 +143,8 @@ export declare class SelfUpdater {
143
143
  /**
144
144
  * The hub names a release on every answer (`x-ach-latest-client`): when it is newer than this one, check now instead of at the
145
145
  * next 6-hourly tick. Once per release, again after five minutes when the release could not be installed yet (npm does not
146
- * serve it the moment the hub names it), and after an hour if this one is still behind for another reason.
146
+ * serve it the moment the hub names it) or the hub's versions did not name it yet (a deploy still rolling out), and after an
147
+ * hour if this one is still behind for another reason.
147
148
  * What a check can never fix by itself (a manual verdict, ACH_AUTO_UPDATE=0) is not asked again for that release.
148
149
  */
149
150
  heardLatest(latest: string): Promise<CheckResult> | undefined;
@@ -222,7 +222,8 @@ export class SelfUpdater {
222
222
  /**
223
223
  * The hub names a release on every answer (`x-ach-latest-client`): when it is newer than this one, check now instead of at the
224
224
  * next 6-hourly tick. Once per release, again after five minutes when the release could not be installed yet (npm does not
225
- * serve it the moment the hub names it), and after an hour if this one is still behind for another reason.
225
+ * serve it the moment the hub names it) or the hub's versions did not name it yet (a deploy still rolling out), and after an
226
+ * hour if this one is still behind for another reason.
226
227
  * What a check can never fix by itself (a manual verdict, ACH_AUTO_UPDATE=0) is not asked again for that release.
227
228
  */
228
229
  heardLatest(latest) {
@@ -240,8 +241,11 @@ export class SelfUpdater {
240
241
  // paused, and waiting the hour for it kept every runner an hour behind each release. A hub that names the release on an
241
242
  // error and then fails the versions read is the same: 2026-11-25 three of twelve pool runners heard 3.95.1 while the hub
242
243
  // was failing, waited the hour, and held their pool (which restarts once every runner has moved) half an hour. Both are
243
- // asked again in five minutes.
244
- this.heardWait.set(latest, r === 'failed' || r === 'unreachable' ? 5 * 60_000 : 3600_000);
244
+ // asked again in five minutes. So is a check that found nothing to do though the hub had just named a newer release: while
245
+ // a deploy rolls out, the answer naming it can come from the new Worker and the versions read from the old one. 2026-11-26
246
+ // one of eleven pool runners heard 3.98.2 that way, judged "none", waited the hour, and held the other ten offline for
247
+ // the pool's half hour.
248
+ this.heardWait.set(latest, r === 'failed' || r === 'unreachable' || r === 'none' ? 5 * 60_000 : 3600_000);
245
249
  return r;
246
250
  });
247
251
  }
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "3.98.2";
1
+ export declare const VERSION = "3.99.0";
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
  /**
@@ -1,4 +1,4 @@
1
- export const VERSION = '3.98.2';
1
+ export const VERSION = '3.99.0';
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
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalaauto/agentchannel",
3
- "version": "3.98.2",
3
+ "version": "3.99.0",
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",