botmux 2.97.0 → 2.98.0-canary.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.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Builds the public URL for the web dashboard, given a token.
3
+ *
4
+ * When 远程访问 is enabled AND this machine is bound to the central platform, the
5
+ * URL routes through the machine subdomain
6
+ * (`https://m-<machineId>.<platformHost>/?t=<token>`): the platform
7
+ * reverse-proxies that subdomain to this host's local dashboard, which still
8
+ * enforces the `?t=` token itself, so the link is reachable centrally with no
9
+ * `:port`. When 远程访问 is off (or the machine isn't bound) the platform base is
10
+ * null and we fall back to the local `http://<externalHost>:<port>/` form.
11
+ *
12
+ * Mirrors buildTerminalUrl (terminal-url.ts) and publicWebhookUrl
13
+ * (dashboard/connector-api.ts) so dashboard, terminal, and webhook links all
14
+ * flip to the platform together under the single 远程访问 switch — instead of the
15
+ * dashboard link being the one place that always stays local.
16
+ */
17
+ export declare function buildDashboardUrl(opts: {
18
+ host: string;
19
+ port: number | string;
20
+ token?: string;
21
+ }): string;
22
+ //# sourceMappingURL=dashboard-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-url.d.ts","sourceRoot":"","sources":["../../src/core/dashboard-url.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAIvG"}
@@ -0,0 +1,24 @@
1
+ import { platformMachineBaseUrl } from '../platform/binding.js';
2
+ import { isRemoteAccessEnabled } from '../global-config.js';
3
+ /**
4
+ * Builds the public URL for the web dashboard, given a token.
5
+ *
6
+ * When 远程访问 is enabled AND this machine is bound to the central platform, the
7
+ * URL routes through the machine subdomain
8
+ * (`https://m-<machineId>.<platformHost>/?t=<token>`): the platform
9
+ * reverse-proxies that subdomain to this host's local dashboard, which still
10
+ * enforces the `?t=` token itself, so the link is reachable centrally with no
11
+ * `:port`. When 远程访问 is off (or the machine isn't bound) the platform base is
12
+ * null and we fall back to the local `http://<externalHost>:<port>/` form.
13
+ *
14
+ * Mirrors buildTerminalUrl (terminal-url.ts) and publicWebhookUrl
15
+ * (dashboard/connector-api.ts) so dashboard, terminal, and webhook links all
16
+ * flip to the platform together under the single 远程访问 switch — instead of the
17
+ * dashboard link being the one place that always stays local.
18
+ */
19
+ export function buildDashboardUrl(opts) {
20
+ const platformBase = isRemoteAccessEnabled() ? platformMachineBaseUrl() : null;
21
+ const origin = platformBase ?? `http://${opts.host}:${opts.port}`;
22
+ return opts.token ? `${origin}/?t=${opts.token}` : `${origin}/`;
23
+ }
24
+ //# sourceMappingURL=dashboard-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-url.js","sourceRoot":"","sources":["../../src/core/dashboard-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA6D;IAC7F,MAAM,YAAY,GAAG,qBAAqB,EAAE,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/E,MAAM,MAAM,GAAG,YAAY,IAAI,UAAU,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAClE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC;AAClE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../src/daemon.ts"],"names":[],"m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,GAAG,OAAO,CAAC,IAAI,CAAC,CAidlE"}
package/dist/daemon.js CHANGED
@@ -8,6 +8,7 @@ const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = dirname(__filename);
9
9
  import { config, getDashboardExternalHost } from './config.js';
10
10
  import { repoPickerScanOptions } from './global-config.js';
11
+ import { buildDashboardUrl } from './core/dashboard-url.js';
11
12
  import { writeHeartbeat } from './core/daemon-heartbeat.js';
12
13
  import { botmuxWrapperFiles } from './core/botmux-wrapper.js';
13
14
  import { startMaintenance, stopMaintenance } from './core/maintenance.js';
@@ -3361,13 +3362,11 @@ function dashboardUrlForReport() {
3361
3362
  const portFile = join(dir, '.dashboard-port');
3362
3363
  const tokenFile = join(dir, '.dashboard-token');
3363
3364
  const port = existsSync(portFile) ? readFileSync(portFile, 'utf8').trim() : String(config.dashboard.port);
3364
- const base = `http://${getDashboardExternalHost()}:${port}/`;
3365
- if (existsSync(tokenFile)) {
3366
- const tok = readFileSync(tokenFile, 'utf8').trim();
3367
- if (tok)
3368
- return `${base}?t=${tok}`;
3369
- }
3370
- return base;
3365
+ const tok = existsSync(tokenFile) ? readFileSync(tokenFile, 'utf8').trim() : '';
3366
+ // buildDashboardUrl swaps in the central-platform machine subdomain when
3367
+ // 远程访问 is on and this host is bound, so the restart-report DM links to the
3368
+ // platform dashboard instead of an unreachable local host:port.
3369
+ return buildDashboardUrl({ host: getDashboardExternalHost(), port, token: tok || undefined });
3371
3370
  }
3372
3371
  catch {
3373
3372
  return undefined;