@slack/radar-mcp 1.18.1 → 1.19.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/README.md +2 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/web-child-env.js +10 -7
- package/dist/shared/android.d.ts +10 -21
- package/dist/shared/android.js +30 -9
- package/dist/shared/ios.d.ts +5 -10
- package/dist/shared/ios.js +23 -5
- package/dist/shared/transport.d.ts +31 -19
- package/dist/shared/wire.d.ts +24 -0
- package/dist/shared/wire.js +6 -0
- package/dist/web/macapp/RadarApp.swift +24 -4
- package/dist/web/public/index.html +27 -3
- package/dist/web/public/next/app.js +163 -18
- package/dist/web/public/next/feed.js +60 -11
- package/dist/web/public/next/filter.js +24 -11
- package/dist/web/public/next/store.js +577 -28
- package/dist/web/server.d.ts +12 -2
- package/dist/web/server.js +459 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Opens `http://localhost:8100` automatically. Set `SLACK_RADAR_WEB_PORT` to use a
|
|
|
54
54
|
* **Preferences** — read-only browser for the on-device SharedPreferences files (pick a file, browse its keys, or search across every file at once).
|
|
55
55
|
* **Custom** — a tab Claude builds on request. Ask a Claude Code session in your terminal for a view the pre-built tabs do not cover (e.g. "graph calls per second and flag the slow ones"); it authors the view via the `open_radar_dashboard` tool and it appears here. Persists until you refresh the page.
|
|
56
56
|
|
|
57
|
-
Each tab has a rate, sparkline, graph, a filter / sort / pause / clear feed, and a payload inspector. **Clear** empties the dashboard's own view only, so the device keeps its buffers and a reconnect or a source switch backfills recent records again (ask a Claude Code session for `clear_buffers` to wipe the device too). The filter box takes space-separated terms that must all match, `-term` to exclude, `/pattern/` for regex, and `"quoted phrases"` for spaces or a literal `-` or
|
|
57
|
+
Each tab has a rate, sparkline, graph, a filter / sort / pause / clear feed, and a payload inspector. **Clear** empties the dashboard's own view only, so the device keeps its buffers and a reconnect or a source switch backfills recent records again (ask a Claude Code session for `clear_buffers` to wipe the device too). The filter box takes space-separated terms that must all match, `-term` to exclude, `/pattern/` for regex, and `"quoted phrases"` for spaces or a literal `-` or `/` (curly quotes count too, and pasting text with spaces quotes it for you, unless you are mid-word or the text starts in filter syntax). A phrase that itself contains a quote character goes in `/regex/` form instead, where quotes are plain text. Committed terms turn into removable pills; a leading `-` is now the exclude operator (the old box matched it as plain text), and quoting restores the literal. Regex flags are optional and short (i/m/s/g, 1-2 letters only, so an ambiguous tail like `/api/im` reads as flags, noted in the tooltip); typos like `/error/x` become part of the pattern and match literally, and quoting any `/…/` term matches it literally. Invalid regexes and incomplete typing (e.g. `/foo(`) are ignored (the term turns amber) instead of blanking the feed. On the Live tab a kind name (`log`, `clog`, `trace`, `rtm`, `network`) also matches rows of that type, and its `-kind` form excludes by row type only, so `-log` hides logcat lines without touching a `logout` clog (quote it, `-"log"`, to exclude by text instead). Switching tabs replays what you have already seen this session (the browser caches it, bounded by count and age) so the view does not reset to empty. ADB forwarding and device activation are handled for you; a reconnect control re-arms after a device sleep. The device-side session shuts down after its idle timeout, and an open dashboard tab now recovers that on its own: the header says there is no radar session on the device and re-enables it, once right away (or on the minute, if the session just came back and died again) and then at most once a minute, giving up after three failed attempts (a session that dies again within a minute of coming back counts as a failed attempt), or at once if the attached device changed, so the next press is yours. Only a tab you are looking at does this (a background tab never arms a device you let idle out), never a dashboard an agent opened, and **✋ stop auto re-enable** in the header turns it off for dashboards at this address if you would rather do it by hand (`SLACK_RADAR_NO_ARM=1` on the process turns it off for that process, along with the arm at launch). The dashboard follows your system light/dark setting by default; the theme toggle in the header overrides it and is remembered.
|
|
58
58
|
|
|
59
59
|
### Install it to your dock (macOS)
|
|
60
60
|
|
|
@@ -92,6 +92,7 @@ All optional. Set them on the process that runs the MCP server or the dashboard.
|
|
|
92
92
|
| `SLACK_RADAR_DEVICE_PORT` | Host port forwarded to the device-side server. Default `8099`. |
|
|
93
93
|
| `SLACK_RADAR_NO_AUTO_CLOSE=1` | Keep the dashboard running forever instead of closing it once every tab is gone. |
|
|
94
94
|
| `SLACK_RADAR_ALLOWED_HOSTS` | Extra `Host` values the dashboard will answer, comma-separated (`radar.local,myhost:8100`). Only needed when you reach it by a name other than localhost. See Security. |
|
|
95
|
+
| `SLACK_RADAR_NO_ARM=1` | Never arm the device without a press: skips the arm at launch and turns off a tab's automatic re-enable. A Reconnect press still arms. |
|
|
95
96
|
| `SLACK_RADAR_NO_OPEN=1` | Do not open a browser window on launch. Set automatically when an MCP tool spawns the dashboard. |
|
|
96
97
|
| `SLACK_RADAR_NO_FFMPEG=1` | Pretend ffmpeg is absent, so screen recording degrades to screenshots. |
|
|
97
98
|
| `SLACK_RADAR_PLATFORM` | Transport to use: `android` (the default) or `ios`. Radar does not probe or infer a different platform. |
|
package/dist/mcp/index.js
CHANGED
|
@@ -810,7 +810,7 @@ async function runMcpServer() {
|
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
812
|
// --- MCP Server ---
|
|
813
|
-
const server = new Server({ name: "slack-radar", version: "1.
|
|
813
|
+
const server = new Server({ name: "slack-radar", version: "1.19.0" }, { capabilities: { tools: {} }, instructions: serverInstructions(device.platform) });
|
|
814
814
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
815
815
|
tools: TOOL_DEFINITIONS,
|
|
816
816
|
}));
|
|
@@ -12,13 +12,16 @@ export function webChildEnv(initialSpec) {
|
|
|
12
12
|
// A bridge-spawned dashboard must not pop a window unbidden: the Claude Code session returns the
|
|
13
13
|
// URL instead, which is what the /radar-ui server instructions promise.
|
|
14
14
|
SLACK_RADAR_NO_OPEN: "1",
|
|
15
|
-
// Suppress
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
15
|
+
// Suppress every path by which this dashboard could arm the device on its own: the boot-arm
|
|
16
|
+
// (armOnBoot returns on this flag) AND the automatic re-enable of a diagnosed-dead session
|
|
17
|
+
// (the dashboard reads the flag back off /health's self_arm_blocked and refuses, and the
|
|
18
|
+
// server refuses an unattended /enable?auto=1 itself).
|
|
19
|
+
// open_radar_dashboard is deliberately EXEMPT from the MCP session gate, and the stated reason
|
|
20
|
+
// for that exemption is that opening the dashboard cannot by itself reach the device. Either
|
|
21
|
+
// path would silently invalidate that reasoning: an agent call would arm a real device and start
|
|
22
|
+
// logcat capture to disk with no human in the loop and, since this child is detached with stdio
|
|
23
|
+
// ignored, no visible output either. A HUMAN launch, a terminal `slack-radar web` or the dock
|
|
24
|
+
// app, does not set this: it arms at boot and may recover a dead session unattended.
|
|
22
25
|
SLACK_RADAR_AGENT_LAUNCH: "1",
|
|
23
26
|
// Passed explicitly rather than inherited. RADAR_PORT is a mutable binding, so a setRadarPort()
|
|
24
27
|
// call in this process is invisible to a child that re-evaluates the same expression from env: it
|
package/dist/shared/android.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeviceInfo, DeviceTransport, LogResult, ProcessState } from "./transport.js";
|
|
1
|
+
import type { DeviceInfo, DeviceTransport, LogResult, ProcessState, DevicePick } from "./transport.js";
|
|
2
2
|
/**
|
|
3
3
|
* Resolve the adb binary. MCP servers spawned from GUI launchers (Spotlight,
|
|
4
4
|
* Raycast, Dock) do not inherit the user's shell PATH, so a bare `adb` call
|
|
@@ -103,31 +103,20 @@ export declare class AndroidTransport implements DeviceTransport {
|
|
|
103
103
|
listDevices(): DeviceInfo[] | null;
|
|
104
104
|
listDevicesAsync(): Promise<DeviceInfo[] | null>;
|
|
105
105
|
private reconcileSelectedDevice;
|
|
106
|
-
selectDevice(serial: string | null):
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
devices: DeviceInfo[];
|
|
115
|
-
};
|
|
106
|
+
selectDevice(serial: string | null): DevicePick;
|
|
107
|
+
/**
|
|
108
|
+
* The pick selectDevice WOULD make, with nothing recorded: the listing still runs (and still
|
|
109
|
+
* reconciles a pinned device that vanished, as every listing does), but no pin is set, no
|
|
110
|
+
* stale env pin is dropped, and no selection is cleared. Same code as the real pick, so the
|
|
111
|
+
* two cannot disagree about which device wins.
|
|
112
|
+
*/
|
|
113
|
+
resolveDevice(serial: string | null): DevicePick;
|
|
116
114
|
/**
|
|
117
115
|
* selectDevice, off the event loop. The listing runs through execFileAsync; the pick
|
|
118
116
|
* itself is the exact code the sync twin runs (pickFromListing), so the two cannot
|
|
119
117
|
* disagree about which device wins.
|
|
120
118
|
*/
|
|
121
|
-
selectDeviceAsync(serial: string | null): Promise<
|
|
122
|
-
ok: true;
|
|
123
|
-
serial: string | null;
|
|
124
|
-
switched?: boolean;
|
|
125
|
-
devices: DeviceInfo[];
|
|
126
|
-
} | {
|
|
127
|
-
ok: false;
|
|
128
|
-
error: string;
|
|
129
|
-
devices: DeviceInfo[];
|
|
130
|
-
}>;
|
|
119
|
+
selectDeviceAsync(serial: string | null): Promise<DevicePick>;
|
|
131
120
|
private pickFromListing;
|
|
132
121
|
getSelectedDevice(): {
|
|
133
122
|
serial: string;
|
package/dist/shared/android.js
CHANGED
|
@@ -631,7 +631,16 @@ export class AndroidTransport {
|
|
|
631
631
|
this.selectedDevice = null;
|
|
632
632
|
}
|
|
633
633
|
selectDevice(serial) {
|
|
634
|
-
return this.pickFromListing(this.listDevices(), serial);
|
|
634
|
+
return this.pickFromListing(this.listDevices(), serial, true);
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* The pick selectDevice WOULD make, with nothing recorded: the listing still runs (and still
|
|
638
|
+
* reconciles a pinned device that vanished, as every listing does), but no pin is set, no
|
|
639
|
+
* stale env pin is dropped, and no selection is cleared. Same code as the real pick, so the
|
|
640
|
+
* two cannot disagree about which device wins.
|
|
641
|
+
*/
|
|
642
|
+
resolveDevice(serial) {
|
|
643
|
+
return this.pickFromListing(this.listDevices(), serial, false);
|
|
635
644
|
}
|
|
636
645
|
/**
|
|
637
646
|
* selectDevice, off the event loop. The listing runs through execFileAsync; the pick
|
|
@@ -639,14 +648,18 @@ export class AndroidTransport {
|
|
|
639
648
|
* disagree about which device wins.
|
|
640
649
|
*/
|
|
641
650
|
async selectDeviceAsync(serial) {
|
|
642
|
-
return this.pickFromListing(await this.listDevicesAsync(), serial);
|
|
651
|
+
return this.pickFromListing(await this.listDevicesAsync(), serial, true);
|
|
643
652
|
}
|
|
644
653
|
// Everything selectDevice decides once a listing (or its failure, null) is in hand.
|
|
645
|
-
pickFromListing(devices, serial
|
|
654
|
+
pickFromListing(devices, serial,
|
|
655
|
+
// false = report the pick without making it (resolveDevice): every `this.pin` and every
|
|
656
|
+
// clearing of a stale selection or env pin below is skipped.
|
|
657
|
+
commit) {
|
|
646
658
|
if (devices === null) {
|
|
647
659
|
return {
|
|
648
660
|
ok: false,
|
|
649
661
|
error: "Could not list devices (adb devices failed). Check adb and retry.",
|
|
662
|
+
instructs: true,
|
|
650
663
|
devices: [],
|
|
651
664
|
};
|
|
652
665
|
}
|
|
@@ -664,13 +677,15 @@ export class AndroidTransport {
|
|
|
664
677
|
if (serial) {
|
|
665
678
|
const match = attached.find((d) => d.serial === serial);
|
|
666
679
|
if (match) {
|
|
667
|
-
|
|
680
|
+
if (commit)
|
|
681
|
+
this.pin(match.serial, match.label);
|
|
668
682
|
return { ok: true, serial: match.serial, switched: switchedTo(match.serial), devices };
|
|
669
683
|
}
|
|
670
684
|
const list = attached.length > 0 ? listAttached() : "none";
|
|
671
685
|
return {
|
|
672
686
|
ok: false,
|
|
673
687
|
error: `Device ${serial} is not attached (or not authorized). Attached: ${list}`,
|
|
688
|
+
instructs: false,
|
|
674
689
|
devices,
|
|
675
690
|
};
|
|
676
691
|
}
|
|
@@ -680,17 +695,21 @@ export class AndroidTransport {
|
|
|
680
695
|
if (pinned) {
|
|
681
696
|
const stillAttached = attached.find((d) => d.serial === pinned);
|
|
682
697
|
if (stillAttached) {
|
|
683
|
-
|
|
698
|
+
if (commit)
|
|
699
|
+
this.pin(stillAttached.serial, stillAttached.label);
|
|
684
700
|
return { ok: true, serial: stillAttached.serial, switched: switchedTo(stillAttached.serial), devices };
|
|
685
701
|
}
|
|
686
702
|
// The pinned device detached. Drop the stale env pin AND the recorded selection so
|
|
687
703
|
// /health does not keep claiming a device that is gone.
|
|
688
|
-
|
|
689
|
-
|
|
704
|
+
if (commit) {
|
|
705
|
+
delete process.env.ANDROID_SERIAL;
|
|
706
|
+
this.selectedDevice = null;
|
|
707
|
+
}
|
|
690
708
|
}
|
|
691
709
|
// (c) Exactly one attached device: auto-pin it.
|
|
692
710
|
if (attached.length === 1) {
|
|
693
|
-
|
|
711
|
+
if (commit)
|
|
712
|
+
this.pin(attached[0].serial, attached[0].label);
|
|
694
713
|
return { ok: true, serial: attached[0].serial, switched: switchedTo(attached[0].serial), devices };
|
|
695
714
|
}
|
|
696
715
|
// (d) Zero devices (or a fake adb that does not answer `devices -l`): no-op. The
|
|
@@ -698,7 +717,8 @@ export class AndroidTransport {
|
|
|
698
717
|
// ok/null keeps every flow that fakes adb without a listing green.
|
|
699
718
|
if (attached.length === 0) {
|
|
700
719
|
// Nothing attached: clear any recorded selection so /health reports no device.
|
|
701
|
-
|
|
720
|
+
if (commit)
|
|
721
|
+
this.selectedDevice = null;
|
|
702
722
|
return { ok: true, serial: null, devices };
|
|
703
723
|
}
|
|
704
724
|
// (e) 2+ attached devices with no explicit choice: ambiguous. The transport error stays a
|
|
@@ -706,6 +726,7 @@ export class AndroidTransport {
|
|
|
706
726
|
return {
|
|
707
727
|
ok: false,
|
|
708
728
|
error: `Multiple devices attached; specify which one. Attached: ${listAttached()}.`,
|
|
729
|
+
instructs: true,
|
|
709
730
|
devices,
|
|
710
731
|
};
|
|
711
732
|
}
|
package/dist/shared/ios.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeviceInfo, DeviceTransport } from "./transport.js";
|
|
1
|
+
import type { DeviceInfo, DevicePick, DeviceTransport } from "./transport.js";
|
|
2
2
|
export type IosScreenshotCapturer = (simulatorUdid: string, outputPath: string) => void;
|
|
3
3
|
export type IosScreenRecorder = (simulatorUdid: string, outputPath: string, durationSeconds: number) => void;
|
|
4
4
|
export interface IosSimulatorTransportDependencies {
|
|
@@ -41,15 +41,10 @@ export declare class IosSimulatorTransport implements DeviceTransport {
|
|
|
41
41
|
private readonly recordSimulatorScreen;
|
|
42
42
|
constructor(dependencies?: IosSimulatorTransportDependencies);
|
|
43
43
|
listDevices(): DeviceInfo[] | null;
|
|
44
|
-
selectDevice(serial: string | null):
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} | {
|
|
49
|
-
ok: false;
|
|
50
|
-
error: string;
|
|
51
|
-
devices: DeviceInfo[];
|
|
52
|
-
};
|
|
44
|
+
selectDevice(serial: string | null): DevicePick;
|
|
45
|
+
/** selectDevice's answer without the pin (see DeviceTransport.resolveDevice). */
|
|
46
|
+
resolveDevice(serial: string | null): DevicePick;
|
|
47
|
+
private pick;
|
|
53
48
|
getSelectedDevice(): {
|
|
54
49
|
serial: string;
|
|
55
50
|
label: string;
|
package/dist/shared/ios.js
CHANGED
|
@@ -125,20 +125,33 @@ export class IosSimulatorTransport {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
selectDevice(serial) {
|
|
128
|
+
return this.pick(serial, true);
|
|
129
|
+
}
|
|
130
|
+
/** selectDevice's answer without the pin (see DeviceTransport.resolveDevice). */
|
|
131
|
+
resolveDevice(serial) {
|
|
132
|
+
return this.pick(serial, false);
|
|
133
|
+
}
|
|
134
|
+
pick(serial,
|
|
135
|
+
// false = report the choice without recording it: no selection set or cleared, no forward
|
|
136
|
+
// invalidated.
|
|
137
|
+
commit) {
|
|
128
138
|
const devices = this.listDevices();
|
|
129
139
|
if (devices === null) {
|
|
130
140
|
return {
|
|
131
141
|
ok: false,
|
|
132
142
|
error: "Could not list iOS simulators (xcrun simctl failed). Check Xcode and retry.",
|
|
143
|
+
instructs: true,
|
|
133
144
|
devices: [],
|
|
134
145
|
};
|
|
135
146
|
}
|
|
136
147
|
const prior = this.selectedDevice?.serial ?? null;
|
|
137
148
|
const pin = (device) => {
|
|
138
|
-
if (
|
|
139
|
-
this.
|
|
149
|
+
if (commit) {
|
|
150
|
+
if (this.selectedDevice && this.selectedDevice.serial !== device.serial) {
|
|
151
|
+
this.forwarded = false;
|
|
152
|
+
}
|
|
153
|
+
this.selectedDevice = { serial: device.serial, label: device.label };
|
|
140
154
|
}
|
|
141
|
-
this.selectedDevice = { serial: device.serial, label: device.label };
|
|
142
155
|
return {
|
|
143
156
|
ok: true,
|
|
144
157
|
serial: device.serial,
|
|
@@ -152,6 +165,7 @@ export class IosSimulatorTransport {
|
|
|
152
165
|
return {
|
|
153
166
|
ok: false,
|
|
154
167
|
error: `iOS Simulator ${serial} is not booted. Booted: ${this.describeDevices(devices)}`,
|
|
168
|
+
instructs: false,
|
|
155
169
|
devices,
|
|
156
170
|
};
|
|
157
171
|
}
|
|
@@ -164,6 +178,7 @@ export class IosSimulatorTransport {
|
|
|
164
178
|
return {
|
|
165
179
|
ok: false,
|
|
166
180
|
error: `SLACK_RADAR_IOS_SIMULATOR_UDID=${envUdid} is not booted. Booted: ${this.describeDevices(devices)}`,
|
|
181
|
+
instructs: false,
|
|
167
182
|
devices,
|
|
168
183
|
};
|
|
169
184
|
}
|
|
@@ -172,17 +187,20 @@ export class IosSimulatorTransport {
|
|
|
172
187
|
const match = devices.find((device) => device.serial === this.selectedDevice.serial);
|
|
173
188
|
if (match)
|
|
174
189
|
return pin(match);
|
|
175
|
-
|
|
190
|
+
if (commit)
|
|
191
|
+
this.clearSelectedDevice();
|
|
176
192
|
}
|
|
177
193
|
if (devices.length === 1)
|
|
178
194
|
return pin(devices[0]);
|
|
179
195
|
if (devices.length === 0) {
|
|
180
|
-
|
|
196
|
+
if (commit)
|
|
197
|
+
this.clearSelectedDevice();
|
|
181
198
|
return { ok: true, serial: null };
|
|
182
199
|
}
|
|
183
200
|
return {
|
|
184
201
|
ok: false,
|
|
185
202
|
error: `Multiple iOS simulators are booted; specify which one. Booted: ${this.describeDevices(devices)}.`,
|
|
203
|
+
instructs: true,
|
|
186
204
|
devices,
|
|
187
205
|
};
|
|
188
206
|
}
|
|
@@ -38,6 +38,25 @@ export interface DeviceInfo {
|
|
|
38
38
|
/** Platform discriminator for mixed or platform-specific device UIs. */
|
|
39
39
|
platform?: string;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* The outcome of choosing a device (selectDevice / resolveDevice). On success `serial` is null
|
|
43
|
+
* when nothing is attached (the caller's forward path reports no-device on its own); `switched`
|
|
44
|
+
* is true when the pick differs from the session's prior device; `devices` is the listing the
|
|
45
|
+
* pick was made from where the transport has one. On failure `error` is human-readable and
|
|
46
|
+
* `instructs` says whether that wording tells the user what to do next (set here, where the
|
|
47
|
+
* wording is written, so no client has to guess it from the prose).
|
|
48
|
+
*/
|
|
49
|
+
export type DevicePick = {
|
|
50
|
+
ok: true;
|
|
51
|
+
serial: string | null;
|
|
52
|
+
switched?: boolean;
|
|
53
|
+
devices?: DeviceInfo[];
|
|
54
|
+
} | {
|
|
55
|
+
ok: false;
|
|
56
|
+
error: string;
|
|
57
|
+
instructs: boolean;
|
|
58
|
+
devices: DeviceInfo[];
|
|
59
|
+
};
|
|
41
60
|
export interface DeviceTransport {
|
|
42
61
|
/**
|
|
43
62
|
* Human-readable platform name (e.g. "android", "ios").
|
|
@@ -251,15 +270,17 @@ export interface DeviceTransport {
|
|
|
251
270
|
* session's prior device: a switch invalidates device-scoped session state, and the
|
|
252
271
|
* orchestrator owns the reset.
|
|
253
272
|
*/
|
|
254
|
-
selectDevice?(serial: string | null):
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
273
|
+
selectDevice?(serial: string | null): DevicePick;
|
|
274
|
+
/**
|
|
275
|
+
* selectDevice's answer WITHOUT the pin: the same choice and the same errors, from the same
|
|
276
|
+
* code, so the two cannot disagree about which device wins. Records no new selection, drops no
|
|
277
|
+
* env pin, invalidates no forward. The listing itself still runs, and a pin whose device has
|
|
278
|
+
* vanished is reconciled away exactly as any listing reconciles it, so getSelectedDevice() can
|
|
279
|
+
* go from a serial to null across this call; it can never go to a NEW serial. For a caller that
|
|
280
|
+
* must decide whether to proceed at all before it touches anything, such as an unattended
|
|
281
|
+
* re-arm that refuses to adopt different hardware. Required wherever selectDevice is.
|
|
282
|
+
*/
|
|
283
|
+
resolveDevice?(serial: string | null): DevicePick;
|
|
263
284
|
/**
|
|
264
285
|
* The device pinned by the last successful selectDevice, or null when none is pinned.
|
|
265
286
|
* The enable body and the web /health response surface this so a user can see which
|
|
@@ -273,16 +294,7 @@ export interface DeviceTransport {
|
|
|
273
294
|
* Async variant of selectDevice for non-blocking boot/enable flows. Optional; platforms
|
|
274
295
|
* without an async device-listing path may omit it (the dashboard guards on presence).
|
|
275
296
|
*/
|
|
276
|
-
selectDeviceAsync?(serial: string | null): Promise<
|
|
277
|
-
ok: true;
|
|
278
|
-
serial: string | null;
|
|
279
|
-
switched?: boolean;
|
|
280
|
-
devices: DeviceInfo[];
|
|
281
|
-
} | {
|
|
282
|
-
ok: false;
|
|
283
|
-
error: string;
|
|
284
|
-
devices: DeviceInfo[];
|
|
285
|
-
}>;
|
|
297
|
+
selectDeviceAsync?(serial: string | null): Promise<DevicePick>;
|
|
286
298
|
/**
|
|
287
299
|
* Async variant of reassertForward for non-blocking boot/enable flows. Optional.
|
|
288
300
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire vocabulary shared by the dashboard server and its browser client. Types only, no runtime
|
|
3
|
+
* code and no imports, so both tsconfigs can `import type` it and the browser bundle is unchanged.
|
|
4
|
+
* docs/wire-contract.md is the prose half; this file is the machine-readable one.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A refusal marker on a failed /enable reply: the route will answer every later UNATTENDED
|
|
8
|
+
* attempt the same way, so the client's automation stops and hands the next press to the user.
|
|
9
|
+
* - self_arm_blocked: this process may not arm the device on its own (agent-spawned, or
|
|
10
|
+
* SLACK_RADAR_NO_ARM).
|
|
11
|
+
* - device_changed: the attached hardware differs from what this process last armed; adopting
|
|
12
|
+
* it is a human decision.
|
|
13
|
+
*/
|
|
14
|
+
export type EnableRefusal = "self_arm_blocked" | "device_changed";
|
|
15
|
+
/**
|
|
16
|
+
* The stream proxy's CURRENT diagnosis of an outage, stamped on `_status` frames. Not a log of
|
|
17
|
+
* what was diagnosed: a later frame's reason replaces an earlier one.
|
|
18
|
+
* - no_session: the device-side radar session has ended (socket absent); only a re-enable fixes
|
|
19
|
+
* this, so a client may act on it.
|
|
20
|
+
* - undiagnosed: an earlier diagnosis no longer holds (a later probe did not find the session
|
|
21
|
+
* absent). It is not a diagnosis and carries no cause; a client drops whatever it latched
|
|
22
|
+
* from the earlier reason. A frame with NO reason says nothing about the diagnosis.
|
|
23
|
+
*/
|
|
24
|
+
export type StatusReason = "no_session" | "undiagnosed";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire vocabulary shared by the dashboard server and its browser client. Types only, no runtime
|
|
3
|
+
* code and no imports, so both tsconfigs can `import type` it and the browser bundle is unchanged.
|
|
4
|
+
* docs/wire-contract.md is the prose half; this file is the machine-readable one.
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
@@ -449,16 +449,36 @@ let app = ReloadingApplication.shared
|
|
|
449
449
|
// bare binary is .prohibited, which would show no dock icon at all.
|
|
450
450
|
app.setActivationPolicy(.regular)
|
|
451
451
|
|
|
452
|
-
// A bare binary like this one has no storyboard, so nothing builds the
|
|
453
|
-
//
|
|
454
|
-
//
|
|
455
|
-
//
|
|
452
|
+
// A bare binary like this one has no storyboard, so nothing builds the menus a normal app gets
|
|
453
|
+
// for free, and a key equivalent with no menu item to route to silently does nothing. Cmd+Q had no
|
|
454
|
+
// "Quit" item, so the only way to close was the window's own red button. Cmd+C, Cmd+V, Cmd+X,
|
|
455
|
+
// Cmd+A and Cmd+Z had no Edit items, so copy and paste in the dashboard only worked from the
|
|
456
|
+
// right-click menu: WebKit's context menu dispatches its own actions, but the keyboard shortcuts
|
|
457
|
+
// go through the menu bar. The Edit items carry the standard responder-chain selectors with no
|
|
458
|
+
// target, which is how every AppKit app wires them; the focused web editor (the SQL box, a filter
|
|
459
|
+
// field, a text selection) is the responder that handles them, exactly as it does for the context
|
|
460
|
+
// menu. Menu titles are what the keyboard needs, not decoration: without a menu bar of its own
|
|
461
|
+
// this window still gets the standard behaviour these titles name.
|
|
456
462
|
let mainMenu = NSMenu()
|
|
457
463
|
let appMenuItem = NSMenuItem()
|
|
458
464
|
mainMenu.addItem(appMenuItem)
|
|
459
465
|
let appMenu = NSMenu()
|
|
460
466
|
appMenu.addItem(NSMenuItem(title: "Quit Slack Radar", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
|
|
461
467
|
appMenuItem.submenu = appMenu
|
|
468
|
+
let editMenuItem = NSMenuItem()
|
|
469
|
+
mainMenu.addItem(editMenuItem)
|
|
470
|
+
let editMenu = NSMenu(title: "Edit")
|
|
471
|
+
// Selector(("undo:")) rather than #selector: undo/redo are responder-chain actions with no single
|
|
472
|
+
// declaring class to name, and the string form is the documented way to reference them.
|
|
473
|
+
editMenu.addItem(NSMenuItem(title: "Undo", action: Selector(("undo:")), keyEquivalent: "z"))
|
|
474
|
+
// An uppercase key equivalent means Shift is part of the shortcut: Shift+Cmd+Z, the standard Redo.
|
|
475
|
+
editMenu.addItem(NSMenuItem(title: "Redo", action: Selector(("redo:")), keyEquivalent: "Z"))
|
|
476
|
+
editMenu.addItem(NSMenuItem.separator())
|
|
477
|
+
editMenu.addItem(NSMenuItem(title: "Cut", action: #selector(NSText.cut(_:)), keyEquivalent: "x"))
|
|
478
|
+
editMenu.addItem(NSMenuItem(title: "Copy", action: #selector(NSText.copy(_:)), keyEquivalent: "c"))
|
|
479
|
+
editMenu.addItem(NSMenuItem(title: "Paste", action: #selector(NSText.paste(_:)), keyEquivalent: "v"))
|
|
480
|
+
editMenu.addItem(NSMenuItem(title: "Select All", action: #selector(NSText.selectAll(_:)), keyEquivalent: "a"))
|
|
481
|
+
editMenuItem.submenu = editMenu
|
|
462
482
|
app.mainMenu = mainMenu
|
|
463
483
|
|
|
464
484
|
let delegate = AppDelegate()
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
--accent:#0e9f6e; --accent-bg:#d6f3e6; --accent-text:#0a7d56;
|
|
36
36
|
--blue:#1d6fd0; --blue-2:#2f6bbf; --purple:#7a3fd0;
|
|
37
37
|
--warn:#b06c00; --warn-2:#8a5a00; --error:#d83a30; --error-2:#e0473d;
|
|
38
|
+
/* Amber for small semibold TEXT on the light page (the head, tail and reason spans, the Reconnect label): #b06c00 measures 3.89:1 against --bg and 4.21:1 on --surface, under WCAG AA's 4.5:1 for text that size; #8a5a00 measures 5.47:1 and 5.93:1. Same value as --warn-2 on purpose. Borders keep --warn. */
|
|
39
|
+
--warn-text:#8a5a00;
|
|
38
40
|
--hover:#eaf1f8; --sel:#d4e6f7; --hover-soft:#eaf1f8; --sel-soft:#dbe9f7;
|
|
39
41
|
--shadow:rgba(20,40,70,.18); --overlay:rgba(20,30,45,.28);
|
|
40
42
|
--chip-net-bg:#dbeafe; --chip-rtm-bg:#ecddfb; --chip-clog-bg:#d6f3e6; --chip-trace-bg:#faedcf; --chip-log-bg:#e7ebf0; --chip-log-fg:#4a5666;
|
|
@@ -52,9 +54,16 @@
|
|
|
52
54
|
#app { height:100%; display:flex; flex-direction:column; min-height:0; }
|
|
53
55
|
h1 { font-size:13px; font-weight:600; color:var(--muted-2); margin:0 0 6px; letter-spacing:.04em; display:flex; align-items:center; gap:8px; flex-wrap:wrap; flex:0 0 auto; }
|
|
54
56
|
.conn { font-size:13px; font-weight:600; }
|
|
55
|
-
.conn.connected { color:var(--accent); } .conn.waiting { color:var(--warn); }
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
.conn.connected { color:var(--accent); } .conn.waiting { color:var(--warn-text, var(--warn)); }
|
|
58
|
+
/* The status row: the recovery tail plus the reason / pick-error spans, on a line of its own (rendered last in the h1 so it takes the line below the controls and never pushes them down; they may still wrap for width reasons of their own) that stays while the Reconnect button shows, and exactly one text line tall: the reason never wraps, it ellipsizes with the full wording on hover, so its members can mount and unmount without changing the header's height. The reason spans drop to regular weight so the seam between the automation's status and the server's reason is visible. */
|
|
59
|
+
/* min-width:0 on the row itself is load-bearing: as an h1 flex item its automatic minimum is its content-based minimum (min-content, which for these nowrap children is the full wording's width), and without it the row grows past the header and the reason is clipped at the window edge instead of ellipsizing. */
|
|
60
|
+
.statusrow { flex-basis:100%; min-width:0; display:flex; flex-wrap:nowrap; align-items:center; gap:8px; min-height:1.5em; }
|
|
61
|
+
.statusrow .conn { white-space:nowrap; }
|
|
62
|
+
.statusrow .conn[title] { cursor:help; }
|
|
63
|
+
.statusrow .reason { font-weight:400; flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; cursor:help; }
|
|
64
|
+
/* min-width holds the button's own width across its "Reconnect Radar" / "enabling…" relabel (the wider label measures ~150px; the headroom covers a wider fallback glyph). What keeps the button and the chip after it from shifting at an ATTEMPT boundary is the header's markup order: the changing recovery tail renders after them, on its own status row, and the conn span before them holds its text between the outage's two ends (a device-list change aside). */
|
|
65
|
+
.reconnect { background:var(--surface); border:1px solid var(--warn); color:var(--warn-text, var(--warn)); border-radius:8px; padding:4px 12px; min-width:160px; text-align:center; font:inherit; font-size:12px; font-weight:600; cursor:pointer; }
|
|
66
|
+
.reconnect:hover { border-color:var(--warn-2); } .reconnect:disabled { opacity:.75; cursor:default; }
|
|
58
67
|
.profilewrap { font-size:12px; color:var(--blue-2); } .profilewrap b { color:var(--text); }
|
|
59
68
|
.profilewrap select { background:var(--surface); border:1px solid var(--border-2); border-radius:6px; color:var(--text); padding:3px 6px; font:inherit; font-size:11px; margin-left:4px; cursor:pointer; }
|
|
60
69
|
h1 .version { margin-left:auto; font-size:11px; font-weight:400; color:var(--muted-2); letter-spacing:0; }
|
|
@@ -139,6 +148,13 @@
|
|
|
139
148
|
.ffilterwrap:focus-within { border-color:var(--accent); }
|
|
140
149
|
.ffilterwrap .ffilter { flex:1; min-width:80px; background:transparent; border:none; padding:3px 4px; font:inherit; font-size:12.5px; color:var(--text); }
|
|
141
150
|
.ffilterwrap .ffilter:focus { outline:none; }
|
|
151
|
+
/* The placeholder is the standing syntax reminder, so it needs real contrast: the browser
|
|
152
|
+
default grey lands near 2:1 on the light theme. --muted-2 clears 6:1 on both themes. */
|
|
153
|
+
.ffilterwrap .ffilter::placeholder { color:var(--muted-2); opacity:1; }
|
|
154
|
+
/* With pills present the hint is 27 monospace characters; below that width it hard-clips
|
|
155
|
+
mid-word, so the input drops to its own row instead. Without :has() the input keeps its
|
|
156
|
+
80px minimum and the hint clips; cosmetic, and every browser the dashboard runs in has it. */
|
|
157
|
+
.ffilterwrap:has(.fpill) .ffilter { min-width:28ch; }
|
|
142
158
|
.feedbar input { background:var(--surface-2); border:1px solid var(--border-2); border-radius:8px; color:var(--text); padding:7px 10px; font:inherit; font-size:12.5px; }
|
|
143
159
|
.feedbar input:focus { outline:none; border-color:var(--accent); }
|
|
144
160
|
.ffilterclear { position:absolute; right:8px; top:9px; cursor:pointer; color:var(--muted-2); background:var(--surface); border-radius:50%; width:16px; height:16px; line-height:14px; text-align:center; font-size:10px; }
|
|
@@ -162,6 +178,14 @@
|
|
|
162
178
|
.fpill-neg { background:var(--lvl-err-bg); border-color:var(--error-2); color:var(--error-2); }
|
|
163
179
|
.fpill-neg .fpill-sign { color:var(--error-2); }
|
|
164
180
|
.fpill-re, .fpill-quote { font-family:ui-monospace,Menlo,Consolas,monospace; }
|
|
181
|
+
/* A phrase pill is tinted and carries curly marks outside the ellipsizing body, so it reads as
|
|
182
|
+
a phrase even when a long pasted line truncates. */
|
|
183
|
+
.fpill-quote { background:var(--surface-3); }
|
|
184
|
+
.fpill-q { color:var(--muted-2); }
|
|
185
|
+
/* A negated phrase pill (-"log", the documented way to exclude by text on Live) carries both
|
|
186
|
+
classes at equal specificity; the compound keeps the negation red on the background, same
|
|
187
|
+
reasoning as the negated kind pills below. */
|
|
188
|
+
.fpill-neg.fpill-quote { background:var(--lvl-err-bg); }
|
|
165
189
|
.fpill-bad { background:var(--lvl-warn-bg); border-color:var(--warn); color:var(--warn-2); }
|
|
166
190
|
/* Kind-name pills on the Live view. Match the row's type chip color so "clog" reads the
|
|
167
191
|
same whether you see it in the pill or in the row's tchip. */
|