@slack/radar-mcp 1.5.0 → 1.6.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,25 @@
1
+ # Vendored browser runtime (no build step)
2
+
3
+ The dashboard UI uses Preact (+ Hooks) and htm, loaded in the browser as ES modules with
4
+ no bundler. The `.module.js` files are NOT committed here: they are copied from
5
+ `node_modules` into `dist/web/public/vendor/` at build time by `scripts/copy-vendor.mjs`
6
+ and shipped in the npm tarball (`files: ["dist"]`).
7
+
8
+ Third-party, redistributed unmodified, pinned by integrity hash in `package-lock.json`:
9
+
10
+ - Preact + Preact Hooks (MIT) https://preactjs.com
11
+ - htm (Apache-2.0) https://github.com/developit/htm
12
+
13
+ Why this shape:
14
+
15
+ - `preact` and `htm` are **devDependencies**, so Dependabot tracks them and opens
16
+ version-bump PRs. Exact versions are pinned in `package-lock.json`.
17
+ - Consumers still get the `npx @slack/radar-mcp@latest` no-build experience: the files are
18
+ already in the tarball, the browser fetches them, no bundler runs anywhere.
19
+ - The browser resolves the bare `preact` specifier via the import map in `index.html`.
20
+
21
+ To update: merge the Dependabot PR (or bump the devDependency), then `npm install && npm
22
+ run build`. No manual file copying.
23
+
24
+ The upstream files reference source maps that are not shipped; a devtools 404 for the
25
+ `.map` is harmless, and the static route serves `.js` only.
@@ -0,0 +1,2 @@
1
+ import{options as n}from"preact";var t,r,u,i,o=0,f=[],c=n,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,p=c.__;function s(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,y(D,n)}function y(n,u,i){var o=s(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.__f)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=!1,i=o.__c.props!==n;if(o.__c.__H.__.some(function(n){if(n.__N){u=!0;var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),c){var f=c.call(this,n,t,r);return u?f||i:f}return!u||i};r.__f=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function h(n,u){var i=s(t++,3);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__H.__h.push(i))}function _(n,u){var i=s(t++,4);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__h.push(i))}function A(n){return o=5,T(function(){return{current:n}},[])}function F(n,t,r){o=6,_(function(){if("function"==typeof n){var r=n(t());return function(){n(null),r&&"function"==typeof r&&r()}}if(n)return n.current=t(),function(){return n.current=null}},null==r?r:r.concat(n))}function T(n,r){var u=s(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q(n,t){return o=8,T(function(){return n},t)}function x(n){var u=r.context[n.__c],i=s(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function P(n,t){c.useDebugValue&&c.useDebugValue(t?t(n):n)}function b(n){var u=s(t++,10),i=d();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function g(){var n=s(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++}return n.__}function j(){for(var n;n=f.shift();){var t=n.__H;if(n.__P&&t)try{t.__h.some(z),t.__h.some(B),t.__h=[]}catch(r){t.__h=[],c.__e(r,n.__v)}}}c.__b=function(n){r=null,e&&e(n)},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),p&&p(n,t)},c.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(i.__h.length&&j(),t=0)),u=r},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),u=r=null},c.__c=function(n,t){t.some(function(n){try{n.__h.some(z),n.__h=n.__h.filter(function(n){return!n.__||B(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],c.__e(r,n.__v)}}),l&&l(n,t)},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.some(function(n){try{z(n)}catch(n){t=n}}),r.__H=void 0,t&&c.__e(t,r.__v))};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,35);k&&(t=requestAnimationFrame(r))}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t}function B(n){var t=r;n.__c=n.__(),r=t}function C(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return"function"==typeof t?t(n):t}export{q as useCallback,x as useContext,P as useDebugValue,h as useEffect,b as useErrorBoundary,g as useId,F as useImperativeHandle,_ as useLayoutEffect,T as useMemo,y as useReducer,A as useRef,d as useState};
2
+ //# sourceMappingURL=hooks.module.js.map
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2018 Google Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1 @@
1
+ var n=function(t,s,r,e){var u;s[0]=0;for(var h=1;h<s.length;h++){var p=s[h++],a=s[h]?(s[0]|=p?1:2,r[s[h++]]):s[++h];3===p?e[0]=a:4===p?e[1]=Object.assign(e[1]||{},a):5===p?(e[1]=e[1]||{})[s[++h]]=a:6===p?e[1][s[++h]]+=a+"":p?(u=t.apply(a,n(t,a,r,["",null])),e.push(u),a[0]?s[0]|=2:(s[h-2]=0,s[h]=u)):e.push(a)}return e},t=new Map;export default function(s){var r=t.get(this);return r||(r=new Map,t.set(this,r)),(r=n(this,r.get(s)||(r.set(s,r=function(n){for(var t,s,r=1,e="",u="",h=[0],p=function(n){1===r&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?h.push(0,n,e):3===r&&(n||e)?(h.push(3,n,e),r=2):2===r&&"..."===e&&n?h.push(4,n,0):2===r&&e&&!n?h.push(5,0,!0,e):r>=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e=""},a=0;a<n.length;a++){a&&(1===r&&p(),p(a));for(var l=0;l<n[a].length;l++)t=n[a][l],1===r?"<"===t?(p(),h=[h],r=3):e+=t:4===r?"--"===e&&">"===t?(r=1,e=""):e=t+e[0]:u?t===u?u="":e+=t:'"'===t||"'"===t?u=t:">"===t?(p(),r=1):r&&("="===t?(r=5,s=e,e=""):"/"===t&&(r<5||">"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(p(),r=2):e+=t),3===r&&"!--"===e&&(r=4,h=h[0])}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present Jason Miller
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ var n,l,u,t,i,r,o,e,f,c,a,s,h,p,v,y,d={},w=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,g=Array.isArray;function m(n,l){for(var u in l)n[u]=l[u];return n}function b(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function k(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===e[o]&&(e[o]=l.defaultProps[o]);return x(l,e,i,r,null)}function x(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u:o,__i:-1,__u:0};return null==o&&null!=l.vnode&&l.vnode(e),e}function M(){return{current:null}}function S(n){return n.children}function C(n,l){this.props=n,this.context=l}function $(n,l){if(null==l)return n.__?$(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?$(n):null}function I(n){if(n.__P&&n.__d){var u=n.__v,t=u.__e,i=[],r=[],o=m({},u);o.__v=u.__v+1,l.vnode&&l.vnode(o),q(n.__P,o,u,n.__n,n.__P.namespaceURI,32&u.__u?[t]:null,i,null==t?$(u):t,!!(32&u.__u),r),o.__v=u.__v,o.__.__k[o.__i]=o,D(i,o,r),u.__e=u.__=null,o.__e!=t&&P(o)}}function P(n){if(null!=(n=n.__)&&null!=n.__c)return n.__e=n.__c.base=null,n.__k.some(function(l){if(null!=l&&null!=l.__e)return n.__e=n.__c.base=l.__e}),P(n)}function A(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!H.__r++||r!=l.debounceRendering)&&((r=l.debounceRendering)||o)(H)}function H(){try{for(var n,l=1;i.length;)i.length>l&&i.sort(e),n=i.shift(),l=i.length,I(n)}finally{i.length=H.__r=0}}function L(n,l,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,_,g,m=t&&t.__k||w,b=l.length;for(f=T(u,l,m,f,b),s=0;s<b;s++)null!=(p=u.__k[s])&&(h=-1!=p.__i&&m[p.__i]||d,p.__i=s,_=q(n,p,h,i,r,o,e,f,c,a),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&J(h.ref,null,p),a.push(p.ref,p.__c||v,p)),null==y&&null!=v&&(y=v),(g=!!(4&p.__u))||h.__k===p.__k?(f=j(p,f,n,g),g&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==_?f=_:v&&(f=v.nextSibling),p.__u&=-7);return u.__e=y,f}function T(n,l,u,t,i){var r,o,e,f,c,a=u.length,s=a,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=n.__k[r]=x(null,o,null,null,null):g(o)?o=n.__k[r]=x(S,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=n.__k[r]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[r]=o,f=r+h,o.__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=O(o,u,f,s))&&(s--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>a?h--:i<a&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(s)for(r=0;r<a;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=$(e)),K(e,e));return t}function j(n,l,u,t){var i,r;if("function"==typeof n.type){for(i=n.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=n,l=j(i[r],l,u,t));return l}n.__e!=l&&(t&&(l&&n.type&&!l.parentNode&&(l=$(n)),u.insertBefore(n.__e,l||null)),l=n.__e);do{l=l&&l.nextSibling}while(null!=l&&8==l.nodeType);return l}function F(n,l){return l=l||[],null==n||"boolean"==typeof n||(g(n)?n.some(function(n){F(n,l)}):l.push(n)),l}function O(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],a=null!=c&&0==(2&c.__u);if(null===c&&null==e||a&&e==c.key&&f==c.type)return u;if(t>(a?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return-1}function z(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||_.test(l)?u:u+"px"}function N(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||z(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||z(n.style,l,u[l])}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(s,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u[a]=t[a]:(u[a]=h,n.addEventListener(l,r?v:p,r)):n.removeEventListener(l,r?v:p,r);else{if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u))}}function V(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u[c])u[c]=h++;else if(u[c]<t[a])return;return t(l.event?l.event(u):u)}}}function q(n,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,d,_,k,x,M,$,I,P,A,H,T,j=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(s=l.__b)&&s(u);n:if("function"==typeof j){h=e.length;try{if(x=u.props,M=j.prototype&&j.prototype.render,$=(s=j.contextType)&&i[s.__c],I=s?$?$.props.value:s.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:(M?u.__c=p=new j(x,I):(u.__c=p=new C(x,I),p.constructor=j,p.render=Q),$&&$.sub(p),p.state||(p.state={}),p.__n=i,v=p.__d=!0,p.__h=[],p._sb=[]),M&&null==p.__s&&(p.__s=p.state),M&&null!=j.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=m({},p.__s)),m(p.__s,j.getDerivedStateFromProps(x,p.__s))),y=p.props,d=p.state,p.__v=u,v)M&&null==j.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),M&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(M&&null==j.getDerivedStateFromProps&&x!==y&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(x,I),u.__v==t.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(x,p.__s,I)){u.__v!=t.__v&&(p.props=x,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u)}),w.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&e.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(x,p.__s,I),M&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(y,d,_)})}if(p.context=I,p.props=x,p.__P=n,p.__e=!1,P=l.__r,A=0,M)p.state=p.__s,p.__d=!1,P&&P(u),s=p.render(p.props,p.state,p.context),w.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,P&&P(u),s=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++A<25);p.state=p.__s,null!=p.getChildContext&&(i=m(m({},i),p.getChildContext())),M&&!v&&null!=p.getSnapshotBeforeUpdate&&(_=p.getSnapshotBeforeUpdate(y,d)),H=null!=s&&s.type===S&&null==s.key?E(s.props.children):s,f=L(n,g(H)?H:[H],u,t,i,r,o,e,f,c,a),p.base=u.__e,u.__u&=-161,p.__h.length&&e.push(p),k&&(p.__E=p.__=null)}catch(n){if(e.length=h,u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;null!=o&&(o[o.indexOf(f)]=null),u.__e=f}else{if(null!=o)for(T=o.length;T--;)b(o[T]);B(u)}else u.__e=t.__e,!u.__k&&t.__k&&(u.__k=t.__k),n.then||B(u);l.__e(n,u,t)}}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=G(t.__e,u,t,i,r,o,e,c,a);return(s=l.diffed)&&s(u),128&u.__u?void 0:f}function B(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(B))}function D(n,u,t){for(var i=0;i<t.length;i++)J(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function E(n){return"object"!=typeof n||null==n||n.__b>0?n:g(n)?n.map(E):void 0!==n.constructor?null:m({},n)}function G(u,t,i,r,o,e,f,c,a){var s,h,p,v,y,w,_,m=i.props||d,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(s=0;s<e.length;s++)if((y=e[s])&&"setAttribute"in y==!!x&&(x?y.localName==x:3==y.nodeType)){u=y,e[s]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l.__m&&l.__m(t,e),c=!1),e=null}if(null==x)m===k||c&&u.data==k||(u.data=k);else{if(e="textarea"==x&&null!=k.defaultValue?null:e&&n.call(u.childNodes),!c&&null!=e)for(m={},s=0;s<u.attributes.length;s++)m[(y=u.attributes[s]).name]=y.value;for(s in m)y=m[s],"dangerouslySetInnerHTML"==s?p=y:"children"==s||s in k||"value"==s&&"defaultValue"in k||"checked"==s&&"defaultChecked"in k||N(u,s,null,y,o);for(s in k)y=k[s],"children"==s?v=y:"dangerouslySetInnerHTML"==s?h=y:"value"==s?w=y:"checked"==s?_=y:c&&"function"!=typeof y||m[s]===y||N(u,s,y,m[s],o);if(h)c||p&&(h.__html==p.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(p&&(u.innerHTML=""),L("template"==t.type?u.content:u,g(v)?v:[v],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&$(i,0),c,a),null!=e)for(s=e.length;s--;)b(e[s]);c&&"textarea"!=x||(s="value","progress"==x&&null==w?u.removeAttribute("value"):null!=w&&(w!==u[s]||"progress"==x&&!w||"option"==x&&w!=m[s])&&N(u,s,w,m[s],o),s="checked",null!=_&&_!=u[s]&&N(u,s,_,m[s],o))}return u}function J(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u))}else n.current=u}catch(n){l.__e(n,t)}}function K(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||J(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=i.__n=null}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&K(i[r],u,t||"function"!=typeof n.type);t||b(n.__e),n.__c=n.__=n.__e=void 0}function Q(n,l,u){return this.constructor(n,u)}function R(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l.__&&l.__(u,t),o=(r="function"==typeof i)?null:i&&i.__k||t.__k,e=[],f=[],q(t,u=(!r&&i||t).__k=k(S,null,[u]),o||d,d,t.namespaceURI,!r&&i?[i]:o?null:t.firstChild?n.call(t.childNodes):null,e,!r&&i?i:o?o.__e:t.firstChild,r,f),D(e,u,f),u.props.children=null}function U(n,l){R(n,l,U)}function W(l,u,t){var i,r,o,e,f=m({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),x(l.type,f,i||l.key,r||l.ref,null)}function X(n){function l(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l.__c]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&u.forEach(function(n){n.__e=!0,A(n)})},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n)}}),n.children}return l.__c="__cC"+y++,l.__=n,l.Provider=l.__l=(l.Consumer=function(n,l){return n.children(l)}).contextType=l,l}n=w.slice,l={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&void 0===n.constructor},C.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=m({},this.state),"function"==typeof n&&(n=n(m({},u),this.props)),n&&m(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),A(this))},C.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),A(this))},C.prototype.render=S,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n,l){return n.__v.__b-l.__v.__b},H.__r=0,f=Math.random().toString(8),c="__d"+f,a="__a"+f,s=/(PointerCapture)$|Capture$/i,h=0,p=V(!1),v=V(!0),y=0;export{C as Component,S as Fragment,W as cloneElement,X as createContext,k as createElement,M as createRef,k as h,U as hydrate,t as isValidElement,l as options,R as render,F as toChildArray};
2
+ //# sourceMappingURL=preact.module.js.map
@@ -12,6 +12,23 @@ declare const WEB_PORT: number;
12
12
  * without a socket. `cap` defaults to the live ceiling.
13
13
  */
14
14
  export declare function shouldDropLogFrame(replay: boolean, writableLength: number, cap?: number): boolean;
15
+ /**
16
+ * Write the starting spec for a server that is taking ownership of this port. MUST be
17
+ * called only AFTER a successful listen() bind, never at module load: importing this
18
+ * module (which bin.ts does before it knows whether the port is free) must not touch
19
+ * the shared spec file, or a second launcher would wipe the spec of the dashboard that
20
+ * already owns the port. The post-bind caller is the sole legitimate writer.
21
+ */
22
+ export declare function seedInitialSpec(): void;
23
+ /**
24
+ * Wipe stale pulled-DB copies and arm the cleanup-on-exit handlers for THIS process. MUST be
25
+ * called only AFTER a successful listen() bind, never at module load: the pulled-DB tmp dir is
26
+ * scoped by WEB_PORT, so it is SHARED by every launcher that imports this module on the same
27
+ * port. A second launcher that loses the bind must not rmSync that dir, or it wipes the
28
+ * running dashboard's pulled-DB cache and breaks its open DB-browser tab until it re-pulls.
29
+ * Same post-bind discipline as seedInitialSpec: the port owner is the sole legitimate writer.
30
+ */
31
+ export declare function cleanupOnBind(): void;
15
32
  export declare function createServer(): http.Server;
16
33
  /**
17
34
  * Finish a /detail proxy response after an upstream error or timeout. The success
@@ -5,11 +5,11 @@ import path from "path";
5
5
  import { spawn } from "child_process";
6
6
  import { fileURLToPath } from "url";
7
7
  import { AndroidTransport, resolveAdbPath } from "../shared/android.js";
8
- import { RADAR_HOST, RADAR_PORT, WEB_PORT_DEFAULT } from "../shared/constants.js";
8
+ import { RADAR_HOST, RADAR_PORT, RADAR_VERSION, WEB_PORT_DEFAULT } from "../shared/constants.js";
9
9
  import { cleanupPulledDatabases, initializeDatabasePath, listDatabases, pullDatabase, pulledSize, queryDatabase, resetDbState, } from "../shared/db.js";
10
10
  import { LogSession } from "./log-session.js";
11
11
  import { BLANK_SPEC, coerceSpec, validateSpec } from "./spec.js";
12
- import { screenCapabilities, grantScreenConsent, hasScreenConsent, detectDisplay, displayNote, captureScreenshot, startLive, addViewer, removeViewer, primeIfNeeded, startRecording, stopRecording, recordingPath, resetScreenState, registerScreenCleanup, resolveFfmpeg, ffmpegInstallHint, SCREEN_BOUNDARY, } from "../shared/screen.js";
12
+ import { screenCapabilities, refreshScreenCapabilities, grantScreenConsent, hasScreenConsent, detectDisplay, displayNote, captureScreenshot, startLive, addViewer, removeViewer, primeIfNeeded, startRecording, stopRecording, recordingPath, resetScreenState, registerScreenCleanup, resolveFfmpeg, ffmpegInstallHint, SCREEN_BOUNDARY, } from "../shared/screen.js";
13
13
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
14
  const WEB_PORT = Number(process.env.SLACK_RADAR_WEB_PORT ?? WEB_PORT_DEFAULT);
15
15
  const INDEX_PATH = path.join(__dirname, "public", "index.html");
@@ -104,25 +104,56 @@ function initialSpec() {
104
104
  return BLANK_SPEC;
105
105
  }
106
106
  }
107
- writeSpec(initialSpec());
108
- // Initialize the database path with the web server port, so concurrent dashboards
109
- // on different ports do not collide in tmpdir.
107
+ /**
108
+ * Write the starting spec for a server that is taking ownership of this port. MUST be
109
+ * called only AFTER a successful listen() bind, never at module load: importing this
110
+ * module (which bin.ts does before it knows whether the port is free) must not touch
111
+ * the shared spec file, or a second launcher would wipe the spec of the dashboard that
112
+ * already owns the port. The post-bind caller is the sole legitimate writer.
113
+ */
114
+ export function seedInitialSpec() {
115
+ writeSpec(initialSpec());
116
+ }
117
+ // Initialize the database path with the web server port, so concurrent dashboards on
118
+ // different ports do not collide in tmpdir. This only COMPUTES a path string (no filesystem
119
+ // write), so it is safe to run at module load even for a launcher that loses the port bind.
110
120
  initializeDatabasePath(WEB_PORT);
111
- // Pulled DB copies are plaintext message stores; never let them linger across runs.
112
- // Clean on start, and on the process signals the bin wires for shutdown.
113
- cleanupPulledDatabases();
114
- for (const sig of ["SIGINT", "SIGTERM", "exit"]) {
115
- process.once(sig, cleanupPulledDatabases);
121
+ /**
122
+ * Wipe stale pulled-DB copies and arm the cleanup-on-exit handlers for THIS process. MUST be
123
+ * called only AFTER a successful listen() bind, never at module load: the pulled-DB tmp dir is
124
+ * scoped by WEB_PORT, so it is SHARED by every launcher that imports this module on the same
125
+ * port. A second launcher that loses the bind must not rmSync that dir, or it wipes the
126
+ * running dashboard's pulled-DB cache and breaks its open DB-browser tab until it re-pulls.
127
+ * Same post-bind discipline as seedInitialSpec: the port owner is the sole legitimate writer.
128
+ */
129
+ export function cleanupOnBind() {
130
+ // Pulled DB copies are plaintext message stores; never let them linger across runs.
131
+ cleanupPulledDatabases();
132
+ for (const sig of ["SIGINT", "SIGTERM", "exit"]) {
133
+ process.once(sig, cleanupPulledDatabases);
134
+ }
116
135
  }
117
136
  export function createServer() {
118
137
  registerScreenCleanup(); // tear down any live screen cast on process exit/signals
119
138
  const server = http.createServer((req, res) => {
120
139
  const url = req.url ?? "";
121
- if (url === "/" || url === "/index.html") {
140
+ const urlPath = url.split("?")[0];
141
+ if (urlPath === "/" || urlPath === "/index.html") {
122
142
  serveIndex(res);
123
143
  return;
124
144
  }
145
+ // Dashboard client modules (vendor/, next/). GET serves the body; HEAD serves headers
146
+ // only (a proxy/cache validator hitting a real asset should not get a 404).
147
+ const inm = req.headers["if-none-match"];
148
+ if ((req.method === "GET" || req.method === "HEAD") && serveStatic(urlPath, res, req.method === "HEAD", Array.isArray(inm) ? inm[0] : inm)) {
149
+ return;
150
+ }
125
151
  if (url === "/spec" && req.method === "GET") {
152
+ // Version marker for a second launcher's adopt path: it can compare this against its own
153
+ // RADAR_VERSION and warn on a mismatch (it still adopts; it never kills the holder).
154
+ // A header, not a body field, so the /spec fingerprint and the client's change-detection
155
+ // key (JSON.stringify of the body) stay byte-identical.
156
+ res.setHeader("X-Radar-Version", RADAR_VERSION);
126
157
  sendJson(res, 200, loadSpec());
127
158
  return;
128
159
  }
@@ -196,6 +227,88 @@ function serveIndex(res) {
196
227
  res.end(`Failed to read ${INDEX_PATH}: ${e.message}`);
197
228
  }
198
229
  }
230
+ // Static assets for the dashboard client. The dashboard was historically one
231
+ // self-contained index.html; the UI is being migrated to Preact components (container by
232
+ // container), which the browser fetches as ES modules over HTTP. This serves only the
233
+ // vendored runtime (vendor/) and the UI modules (next/): locked to those two dirs, .js
234
+ // only, no path traversal, from the known public root. The listener is already
235
+ // loopback-only (bin.ts), so this adds no network exposure.
236
+ const PUBLIC_DIR = path.join(__dirname, "public");
237
+ // vendor/ exists today; next/ is populated by the in-progress Preact UI migration (the very
238
+ // next PRs). Keeping it here now means those module fetches resolve the moment they land; until
239
+ // then a /next/* request is a harmless 404 (the dir does not exist, readFileSync misses).
240
+ const STATIC_DIRS = ["vendor", "next"];
241
+ // Canonicalized public root, resolved once at module load. The realpath containment check
242
+ // below compares a resolved file path against this; if we compared against the raw PUBLIC_DIR
243
+ // while the install prefix itself is a symlink (a global npm prefix, or macOS /tmp ->
244
+ // /private/tmp), realpathSync(full) would resolve the prefix too and never start with the
245
+ // un-resolved PUBLIC_DIR, so EVERY legitimate module would 403 and the UI would silently fail
246
+ // to load. Resolve the root the same way so the comparison is apples-to-apples. Falls back to
247
+ // PUBLIC_DIR if the dir does not exist yet (e.g. a build without vendored assets).
248
+ const PUBLIC_REAL = (() => {
249
+ try {
250
+ return fs.realpathSync(PUBLIC_DIR);
251
+ }
252
+ catch {
253
+ return PUBLIC_DIR;
254
+ }
255
+ })();
256
+ // Cache policy for vendored modules: revalidate every time (no-cache), but serve a cheap 304
257
+ // when the file is unchanged via an ETag derived from its size+mtime. This cuts redundant
258
+ // transfers WITHOUT the stale-after-upgrade footgun a plain max-age would create: the module
259
+ // URLs are version-less and have no content hash, so an npm upgrade that swaps vendor/ would
260
+ // otherwise serve stale JS from a long-lived cache for up to the max-age window.
261
+ // `clean` is the already-query-stripped request path. `isHead` sends headers with no body.
262
+ function serveStatic(clean, res, isHead, ifNoneMatch) {
263
+ const top = clean.split("/")[1];
264
+ if (!STATIC_DIRS.includes(top))
265
+ return false;
266
+ if (!clean.endsWith(".js"))
267
+ return false; // only JS modules; no arbitrary file types
268
+ const full = path.normalize(path.join(PUBLIC_DIR, clean));
269
+ // Lexical containment: the normalized path must stay under PUBLIC_DIR (defeats ../).
270
+ if (full !== PUBLIC_DIR && !full.startsWith(PUBLIC_DIR + path.sep)) {
271
+ res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
272
+ res.end("forbidden");
273
+ return true;
274
+ }
275
+ try {
276
+ // path.normalize is lexical only; a symlink inside vendor/ could still point outside the
277
+ // root. Resolve the real path and re-check containment against the canonicalized root
278
+ // (PUBLIC_REAL, not the raw PUBLIC_DIR) before reading.
279
+ const real = fs.realpathSync(full);
280
+ if (real !== PUBLIC_REAL && !real.startsWith(PUBLIC_REAL + path.sep)) {
281
+ res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
282
+ res.end("forbidden");
283
+ return true;
284
+ }
285
+ // Weak ETag from size + mtime: changes whenever the file is rebuilt/upgraded, so a stale
286
+ // browser copy revalidates to a fresh body instead of being served from cache.
287
+ const st = fs.statSync(real);
288
+ const etag = `W/"${st.size.toString(16)}-${Math.round(st.mtimeMs).toString(16)}"`;
289
+ if (ifNoneMatch === etag) {
290
+ res.writeHead(304, { ETag: etag, "Cache-Control": "no-cache" });
291
+ res.end();
292
+ return true;
293
+ }
294
+ const body = fs.readFileSync(real);
295
+ // Set Content-Length explicitly so a HEAD mirrors the GET's framing (RFC 7230): a
296
+ // cache validator doing HEAD gets the size, and GET returns a real length not chunked.
297
+ // no-cache = always revalidate (cheap 304 above); never serve a stale module after upgrade.
298
+ res.writeHead(200, {
299
+ "Content-Type": "text/javascript; charset=utf-8",
300
+ "Content-Length": body.length,
301
+ "Cache-Control": "no-cache",
302
+ ETag: etag,
303
+ });
304
+ res.end(isHead ? undefined : body);
305
+ }
306
+ catch {
307
+ res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
308
+ res.end("not found");
309
+ }
310
+ return true;
311
+ }
199
312
  function sendJson(res, status, payload) {
200
313
  // A device probe can fire both "end" and "error"/"timeout" for one request, so its
201
314
  // callbacks may call sendJson twice. The second writeHead would throw
@@ -253,11 +366,20 @@ function handleHealth(res) {
253
366
  // drop), so guard the response to exactly one write. Without this the second sendJson
254
367
  // does a second writeHead -> ERR_HTTP_HEADERS_SENT -> uncaught -> the whole server dies.
255
368
  let replied = false;
256
- const reply = (device) => {
369
+ // The bound profile, read from the device ping body. This is the TRUTH about which
370
+ // profile owns the socket (the app that bound first), unlike the host-side activate
371
+ // guess in getActiveUserId() which can drift. The dashboard shows this so it never
372
+ // claims a profile you are not actually seeing.
373
+ const reply = (device, boundUserId, boundProfile) => {
257
374
  if (replied)
258
375
  return;
259
376
  replied = true;
260
- sendJson(res, 200, { device, screen: screenCapabilities() });
377
+ sendJson(res, 200, {
378
+ device,
379
+ screen: screenCapabilities(),
380
+ boundUserId: boundUserId ?? null,
381
+ boundProfile: boundProfile ?? null,
382
+ });
261
383
  };
262
384
  const probe = http.request({
263
385
  host: RADAR_HOST,
@@ -266,8 +388,38 @@ function handleHealth(res) {
266
388
  method: "GET",
267
389
  timeout: 2500,
268
390
  }, (up) => {
269
- up.resume();
270
- up.on("end", () => reply(up.statusCode === 200));
391
+ // The ping body is the device's own small JSON status. Bound the accumulation anyway so
392
+ // a misbehaving/compromised local endpoint cannot grow it without limit (matches the
393
+ // bounded-read posture elsewhere in this file). 64KB is far above any real ping body;
394
+ // once tripped we stop appending and parse what we have (a truncated body simply fails
395
+ // the JSON.parse below and falls back to no bound profile, which is the safe default).
396
+ const MAX_PING_BODY = 64 * 1024;
397
+ let body = "";
398
+ up.on("data", (c) => {
399
+ if (body.length < MAX_PING_BODY)
400
+ body += c;
401
+ });
402
+ up.on("end", () => {
403
+ const ok = up.statusCode === 200;
404
+ let uid = null;
405
+ let profile = null;
406
+ // Only trust the body on a 200. A device 5xx-ing with a stale ping body must NOT
407
+ // surface a bound profile while device:false — that would let the dashboard show a
408
+ // confident profile label for an unhealthy device.
409
+ if (ok) {
410
+ try {
411
+ const p = JSON.parse(body);
412
+ if (p.android_user_id != null)
413
+ uid = String(p.android_user_id);
414
+ if (typeof p.profile === "string")
415
+ profile = p.profile;
416
+ }
417
+ catch {
418
+ // non-JSON / partial body: device is up but we cannot name the profile
419
+ }
420
+ }
421
+ reply(ok, uid, profile);
422
+ });
271
423
  up.on("error", () => reply(false));
272
424
  });
273
425
  probe.on("error", () => reply(false));
@@ -546,8 +698,28 @@ async function handleDbQuery(req, res) {
546
698
  function handleScreen(req, res) {
547
699
  const url = req.url ?? "";
548
700
  // Capabilities + consent state. Always available; drives the overlay's degrade UI.
701
+ // ?refresh=1 re-probes ffmpeg/scrcpy (asynchronously, so it never blocks the event
702
+ // loop / live stream) before reading, so a user who installs ffmpeg then reopens the
703
+ // overlay is detected without a server restart. Without refresh it reads the cache.
549
704
  if (url.startsWith("/screen/caps")) {
550
- sendJson(res, 200, { ...screenCapabilities(), consent: hasScreenConsent() });
705
+ const refresh = new URL(url, "http://localhost").searchParams.get("refresh") === "1";
706
+ if (refresh) {
707
+ void (async () => {
708
+ // refreshScreenCapabilities cannot throw today, but a future edit that lets a rejection
709
+ // escape would leave this request hanging until the client's 3s timeout. Guard it: on a
710
+ // failed re-probe, still answer with the (cached) capabilities rather than nothing.
711
+ try {
712
+ await refreshScreenCapabilities();
713
+ }
714
+ catch {
715
+ // fall through to the cached capabilities below
716
+ }
717
+ sendJson(res, 200, { ...screenCapabilities(), consent: hasScreenConsent() });
718
+ })();
719
+ }
720
+ else {
721
+ sendJson(res, 200, { ...screenCapabilities(), consent: hasScreenConsent() });
722
+ }
551
723
  return;
552
724
  }
553
725
  // Grant consent for this process. Required before any pixels are mirrored.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slack/radar-mcp",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "MCP server and web dashboard for on-device debugging of the Slack Android app via ADB",
5
5
  "type": "module",
6
6
  "main": "dist/mcp/index.js",
@@ -16,7 +16,8 @@
16
16
  "scripts": {
17
17
  "clean": "rm -rf dist",
18
18
  "prebuild": "npm run clean",
19
- "build": "tsc && cp -r src/web/public dist/web/public && chmod +x dist/mcp/index.js dist/web/bin.js",
19
+ "copy-vendor": "node scripts/copy-vendor.mjs",
20
+ "build": "tsc && cp -r src/web/public dist/web/public && npm run copy-vendor && chmod +x dist/mcp/index.js dist/web/bin.js",
20
21
  "start": "node dist/mcp/index.js",
21
22
  "start:web": "node dist/web/bin.js",
22
23
  "watch": "tsc --watch",
@@ -49,6 +50,8 @@
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/node": "^22.10.5",
53
+ "htm": "^3.1.1",
54
+ "preact": "^10.29.3",
52
55
  "typescript": "^5.7.2"
53
56
  }
54
57
  }