@slack/radar-mcp 1.14.0 → 1.17.1

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.
Files changed (49) hide show
  1. package/README.md +15 -3
  2. package/dist/mcp/db-tools.js +23 -0
  3. package/dist/mcp/dispatch.d.ts +4 -0
  4. package/dist/mcp/dispatch.js +26 -0
  5. package/dist/mcp/index.js +105 -37
  6. package/dist/mcp/platform-detect.d.ts +110 -0
  7. package/dist/mcp/platform-detect.js +246 -0
  8. package/dist/mcp/prefs-tools.d.ts +4 -3
  9. package/dist/mcp/prefs-tools.js +26 -3
  10. package/dist/mcp/session-enable.js +19 -1
  11. package/dist/mcp/snapshot.js +4 -1
  12. package/dist/mcp/sources-gate.js +6 -3
  13. package/dist/mcp/tools.d.ts +11 -0
  14. package/dist/mcp/tools.js +38 -0
  15. package/dist/mcp/web-child-env.d.ts +1 -0
  16. package/dist/mcp/web-child-env.js +32 -0
  17. package/dist/shared/android.d.ts +89 -1
  18. package/dist/shared/android.js +352 -78
  19. package/dist/shared/constants.d.ts +25 -1
  20. package/dist/shared/constants.js +27 -1
  21. package/dist/shared/db.js +11 -2
  22. package/dist/shared/debug-log.js +6 -1
  23. package/dist/shared/enable-diagnosis.d.ts +28 -0
  24. package/dist/shared/enable-diagnosis.js +41 -0
  25. package/dist/shared/prefs.d.ts +0 -5
  26. package/dist/shared/prefs.js +6 -2
  27. package/dist/shared/screen.d.ts +46 -9
  28. package/dist/shared/screen.js +74 -11
  29. package/dist/shared/transport.d.ts +62 -5
  30. package/dist/shared/webapp.d.ts +50 -0
  31. package/dist/shared/webapp.js +65 -0
  32. package/dist/web/bin.js +5 -1
  33. package/dist/web/install-app.d.ts +87 -0
  34. package/dist/web/install-app.js +703 -0
  35. package/dist/web/macapp/RadarApp.swift +466 -0
  36. package/dist/web/public/icons/radar-1024.png +0 -0
  37. package/dist/web/public/icons/radar.svg +40 -0
  38. package/dist/web/public/index.html +41 -1
  39. package/dist/web/public/next/app.js +19 -4
  40. package/dist/web/public/next/db.js +145 -5
  41. package/dist/web/public/next/feed.js +18 -0
  42. package/dist/web/public/next/hooks.js +10 -1
  43. package/dist/web/public/next/registry.js +18 -10
  44. package/dist/web/public/next/screen.js +147 -43
  45. package/dist/web/public/next/store.js +393 -51
  46. package/dist/web/public/next/toast.js +134 -0
  47. package/dist/web/server.d.ts +26 -1
  48. package/dist/web/server.js +341 -113
  49. package/package.json +2 -2
package/dist/web/bin.js CHANGED
@@ -3,7 +3,7 @@ import { execSync } from "child_process";
3
3
  import { realpathSync } from "fs";
4
4
  import http from "http";
5
5
  import { fileURLToPath } from "url";
6
- import { cleanupOnBind, createServer, seedInitialSpec, shutdownDashboard, startAutoCloseSweep, WEB_PORT, } from "./server.js";
6
+ import { armOnBoot, cleanupOnBind, createServer, seedInitialSpec, shutdownDashboard, startAutoCloseSweep, WEB_PORT, } from "./server.js";
7
7
  import { RADAR_VERSION } from "../shared/constants.js";
8
8
  /**
9
9
  * One loopback GET against the dashboard's own port, used by the adopt path. Resolves with the
@@ -148,6 +148,10 @@ export function startWebServer() {
148
148
  // in createServer) keeps importing the module — or a second launcher that loses the bind —
149
149
  // from arming a timer that could process.exit. The interval is unref'd inside.
150
150
  startAutoCloseSweep(server);
151
+ // Arm the device now, for the same post-bind reason: only the process that won the port may
152
+ // touch it. A fresh app process starts with Radar off, so without this every launch against
153
+ // one shows "waiting for device" until the human finds the Reconnect button.
154
+ armOnBoot();
151
155
  const url = `http://localhost:${WEB_PORT}`;
152
156
  console.log(`Slack Radar Web running at ${url}`);
153
157
  // Auto-open the browser for the HUMAN launcher (`slack-radar web` / `slack-radar-web`),
@@ -0,0 +1,87 @@
1
+ import { spawn } from "child_process";
2
+ /**
3
+ * Resolve npx's absolute path, same reasoning as the baked-in node path: a Finder-launched dock
4
+ * app gets a minimal PATH with no shell config, so a bare `npx` would not resolve. npm ships npx
5
+ * alongside node in most installs, so check there first; `which` covers the rest. Returns null
6
+ * (never throws) so a machine with no npx just does not get the self-heal capability.
7
+ */
8
+ export declare function resolveNpxPath(): string | null;
9
+ /**
10
+ * The launcher script that becomes the .app's executable. Written as text (not compiled) so it
11
+ * stays readable and auditable in place -- a binary blob dropped in ~/Applications by an npm
12
+ * package deserves more suspicion than a shell script anyone can cat.
13
+ *
14
+ * `nodeBin` and `webBin` are baked in as ABSOLUTE paths, resolved at install time. A dock app
15
+ * launches from Finder with a minimal PATH that usually lacks node entirely (nvm/homebrew node
16
+ * live in a shell-configured PATH), so `node` or `npx` by bare name would fail with a dialog-less
17
+ * silent exit. Baking the paths also pins the launcher to the exact install that generated it
18
+ * rather than whatever npx would resolve today.
19
+ *
20
+ * Exported for testing: a test can assert on the generated script without writing a bundle into
21
+ * the developer's ~/Applications.
22
+ */
23
+ export declare function launcherScript(nodeBin: string, webBin: string, port: number): string;
24
+ /**
25
+ * The `--- BEGIN/END INSTALL CONFIG ---` block buildSwiftApp() substitutes into RadarApp.swift.
26
+ * Exported like launcherScript, for the same reason: a test can assert on the generated text
27
+ * without touching ~/Applications.
28
+ */
29
+ export declare function swiftInstallConfig(radarUrl: string, node: string, webBin: string, npx: string, mcpBin: string): string;
30
+ /**
31
+ * Create (or replace) the launcher app. Returns its path.
32
+ *
33
+ * Builds the new bundle at a `.new` staging path and swaps it in only once fully written, so a
34
+ * failure partway through a rebuild leaves the previous, working bundle in place instead of
35
+ * deleted with nothing to replace it. An exclusive lock file guards the whole build+swap against
36
+ * a second concurrent install (a dock self-heal and a manual install-app overlapping, say) racing
37
+ * the same staging path.
38
+ */
39
+ export declare function installMacApp(): {
40
+ app: string;
41
+ native: boolean;
42
+ };
43
+ /** Entry point for the `install-app` subcommand. Prints what to do next, then reveals the app. */
44
+ export declare function runInstallApp(): void;
45
+ /**
46
+ * Entry point for `install-app --self-heal-check`, spawned in the background by RadarApp.swift
47
+ * on every dock launch. install-app bakes the .app's paths and version in ONCE, so a Radar
48
+ * upgrade via `npx @slack/radar-mcp@latest` (the documented setup) can leave the installed app
49
+ * pointed at a stale, orphaned npx cache path with no signal to the user. This rebuilds it in
50
+ * place when this process's own version (itself just resolved via the same `@latest` npx call)
51
+ * differs from what is installed, so the fix lands invisibly and takes effect on the NEXT
52
+ * launch. Never throws out of this function: a launcher-triggered background process failing
53
+ * loudly would look like a crash, which is exactly what staying invisible rules out.
54
+ */
55
+ export declare function runSelfHealCheck(): void;
56
+ /** Test seam: override the registry URL checkLatestPublishedVersion() reads from. */
57
+ export declare function _setRegistryUrlForTest(url: string): void;
58
+ /**
59
+ * Reads the latest published version from the npm registry, or null on ANY failure (non-200,
60
+ * timeout, malformed JSON, network down) -- never throws. This is a pure metadata read: it never
61
+ * executes any resolved package's code, so unlike `npx @latest install-app --self-heal-check` it
62
+ * carries none of the old-dispatch risk (an already-published old build that does not understand
63
+ * `--self-heal-check` would just run its full interactive install unconditionally).
64
+ */
65
+ export declare function checkLatestPublishedVersion(): Promise<string | null>;
66
+ /** Test seam: override the spawn implementation runSelfHealPrecheckAsync() uses to trigger the
67
+ * conditional npx rebuild. */
68
+ export declare function _setSelfHealSpawnForTest(fn: typeof spawn): void;
69
+ /**
70
+ * Entry point for `install-app --self-heal-precheck`. RadarApp.swift now spawns THIS (the
71
+ * already-installed, guaranteed self-heal-aware mcp/index.js) instead of going straight to `npx
72
+ * -y @slack/radar-mcp@latest install-app --self-heal-check`. The direct-to-npx version had a real
73
+ * bug: nothing guaranteed `@latest` resolved to code that understood `--self-heal-check`, and the
74
+ * already-published old dispatch ignores unknown flags and runs the full INTERACTIVE install
75
+ * unconditionally (opens a Finder window) on every dock click until npm catches up -- which is
76
+ * the normal state, not an edge case, for a locally-built dock app ahead of what is published.
77
+ *
78
+ * This checks the registry's plain version metadata first (no package code ever executes) and
79
+ * only spawns the npx follow-up once that confirms a real, strictly-newer version exists. At that
80
+ * point whatever `npx @latest` resolves to is guaranteed to postdate this build and understand
81
+ * `--self-heal-check`, because versions only move forward under this project's manual, sequential
82
+ * publish model -- so the old-dispatch bug cannot trigger here.
83
+ */
84
+ export declare function runSelfHealPrecheck(): void;
85
+ /** The awaitable core of runSelfHealPrecheck(), exported so a test can await its outcome
86
+ * directly instead of polling for the fire-and-forget wrapper to finish. */
87
+ export declare function runSelfHealPrecheckAsync(): Promise<void>;