@koalaauto/agentchannel 3.7.1 → 3.7.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.
@@ -67,7 +67,7 @@ export interface ChangeFeedOptions {
67
67
  log?: (s: string) => void;
68
68
  }
69
69
  /**
70
- * Follows the hub's changes, like the panel (hub/pb_public/realtime.js):
70
+ * Follows the hub's changes, like the panel (web/realtime.js):
71
71
  * 1. the WebSocket GET /api/ach/events: "something changed", ids only; a socket that worked and then closed (a deploy,
72
72
  * a network change) is opened again;
73
73
  * 2. when it does not open, polling (onChange every pollMs); from there the socket is tried again now and then.
@@ -170,7 +170,7 @@ export class AttentionNotifier {
170
170
  }
171
171
  const realSleep = (ms) => new Promise((r) => setTimeout(r, ms).unref?.());
172
172
  /**
173
- * Follows the hub's changes, like the panel (hub/pb_public/realtime.js):
173
+ * Follows the hub's changes, like the panel (web/realtime.js):
174
174
  * 1. the WebSocket GET /api/ach/events: "something changed", ids only; a socket that worked and then closed (a deploy,
175
175
  * a network change) is opened again;
176
176
  * 2. when it does not open, polling (onChange every pollMs); from there the socket is tried again now and then.
package/dist/src/cli.js CHANGED
@@ -98,19 +98,22 @@ export async function runOpener(cmd, args, spawn) {
98
98
  async function exchangeLink(link, hubOpt, io, cmd) {
99
99
  const tok = loginTokenOf(link);
100
100
  const fromUrl = /^(https?:\/\/[^/#?\s]+)/.exec(link.trim())?.[1];
101
- let saved;
101
+ let cfg;
102
102
  try {
103
- saved = loadConfig(io.env).hub;
103
+ cfg = loadConfig(io.env);
104
104
  }
105
105
  catch {
106
- saved = undefined;
106
+ cfg = undefined;
107
107
  }
108
+ const saved = cfg?.hub;
108
109
  const hub = (hubOpt ?? fromUrl ?? saved ?? '').replace(/\/+$/, '');
109
110
  if (!hub)
110
111
  throw new UsageError(`${cmd}: --hub <url> is required when --link is a bare token`);
111
112
  if (!hubTransportOk(hub))
112
113
  throw new UsageError(`${cmd}: ${hub} is plain http:// to a host that is not this machine; use the https:// link`);
113
- const c = new Client({ hub, cfId: io.env.ACH_CF_ID, cfSecret: io.env.ACH_CF_SECRET, fetch: io.fetch });
114
+ // the front-door pass this machine keeps for that hub (a hub behind Cloudflare Access refuses the exchange without it)
115
+ const samehub = !!saved && saved.replace(/\/+$/, '') === hub;
116
+ const c = new Client({ hub, cfId: io.env.ACH_CF_ID || (samehub ? cfg?.cfId : undefined), cfSecret: io.env.ACH_CF_SECRET || (samehub ? cfg?.cfSecret : undefined), fetch: io.fetch });
114
117
  const r = await c.exchangeLoginLink(tok);
115
118
  if (!r?.token)
116
119
  throw new Error('login failed: no token returned');
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "3.7.1";
1
+ export declare const VERSION = "3.7.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
  /**
@@ -1,4 +1,4 @@
1
- export const VERSION = '3.7.1';
1
+ export const VERSION = '3.7.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
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalaauto/agentchannel",
3
- "version": "3.7.1",
3
+ "version": "3.7.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",