@koalaauto/agentchannel 3.98.3 → 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();
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "3.98.3";
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.3';
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.3",
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",