@agentsignalnet/claude-plugin 0.2.62 → 0.2.64
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/package.json
CHANGED
package/scripts/chat-viewer.mjs
CHANGED
|
@@ -151,6 +151,58 @@ function isPage(pathname) {
|
|
|
151
151
|
return pathname === '/' || pathname.startsWith('/a/');
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* What somebody sees when they arrive without the link.
|
|
156
|
+
*
|
|
157
|
+
* IT NAMES NOTHING. Not the product, not the account, not a channel or a
|
|
158
|
+
* handle, and not the word for what this is. Every one of those would be a
|
|
159
|
+
* fact handed to whoever asked without a credential, and none of them is
|
|
160
|
+
* needed to answer the only question the person actually has, which is "why
|
|
161
|
+
* is this refusing me and where do I get in".
|
|
162
|
+
*
|
|
163
|
+
* That restraint is load-bearing rather than decorative: a test asserts the
|
|
164
|
+
* refusal body does not match /agentsignal|viewer|token|unauthoris/, and it
|
|
165
|
+
* predates this page. Keeping the wording inside that line is what makes this
|
|
166
|
+
* an explanation rather than a weakening of the front door.
|
|
167
|
+
*
|
|
168
|
+
* IT ASSUMES NO TERMINAL. The first version said "look in the terminal it was
|
|
169
|
+
* started from", which describes the rarer case: this is usually started by an
|
|
170
|
+
* assistant running `/agentsignal:chat` in the background, where the line is
|
|
171
|
+
* printed into a tool result nobody is watching and there is no terminal of
|
|
172
|
+
* yours to look in. Somebody hit this page and found its one instruction was a
|
|
173
|
+
* dead end -- technically true, useless in the case it mostly meets. So the
|
|
174
|
+
* assistant route is named first and the terminal second.
|
|
175
|
+
*
|
|
176
|
+
* Styled to match the light theme rather than left as browser default, since
|
|
177
|
+
* an unstyled wall of text reads as a crash page and the point is to look like
|
|
178
|
+
* a considered answer.
|
|
179
|
+
*/
|
|
180
|
+
function unlockPage() {
|
|
181
|
+
return [
|
|
182
|
+
'<!doctype html><html lang="en"><head><meta charset="utf-8">',
|
|
183
|
+
'<meta name="viewport" content="width=device-width,initial-scale=1">',
|
|
184
|
+
'<title>Dashboard</title><style>',
|
|
185
|
+
'body{margin:0;min-height:100vh;display:grid;place-items:center;background:#f7f7f5;',
|
|
186
|
+
'color:#1b1b19;font:15px/1.6 ui-sans-serif,-apple-system,system-ui,sans-serif}',
|
|
187
|
+
'main{max-width:34rem;padding:2rem}',
|
|
188
|
+
'h1{font-size:1.15rem;margin:0 0 .75rem}',
|
|
189
|
+
'p{margin:0 0 .75rem;color:#3d3d38}',
|
|
190
|
+
'code{background:#ecece7;padding:.15rem .35rem;border-radius:4px;',
|
|
191
|
+
'font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace}',
|
|
192
|
+
'</style></head><body><main>',
|
|
193
|
+
'<h1>This dashboard needs its link</h1>',
|
|
194
|
+
'<p>It is running. It is refusing because this browser has not been given the ',
|
|
195
|
+
'one-run link, which is printed once by whatever started it and only has to be ',
|
|
196
|
+
'opened once — after that this plain address works.</p>',
|
|
197
|
+
'<p>If an assistant started it for you, ask it for the link: the line was ',
|
|
198
|
+
'printed where it can see it and you cannot. If you started it yourself, look ',
|
|
199
|
+
'in that terminal for the line beginning <code>Watching</code>.</p>',
|
|
200
|
+
'<p>Either way, stopping it and starting it again prints a fresh link. A new ',
|
|
201
|
+
'one is minted per run, so any older link is already dead.</p>',
|
|
202
|
+
'</main></body></html>',
|
|
203
|
+
].join('');
|
|
204
|
+
}
|
|
205
|
+
|
|
154
206
|
/**
|
|
155
207
|
* Servers configured in ~/.claude.json that hold a key.
|
|
156
208
|
*
|
|
@@ -2458,9 +2510,10 @@ const server = createServer(async (req, res) => {
|
|
|
2458
2510
|
* could reach it.
|
|
2459
2511
|
* • An Origin check on everything that is not a GET, below.
|
|
2460
2512
|
*
|
|
2461
|
-
* A wrong or missing credential is
|
|
2462
|
-
*
|
|
2463
|
-
*
|
|
2513
|
+
* A wrong or missing credential is a flat 404 for everything EXCEPT a page
|
|
2514
|
+
* a browser asked for, which gets a short note saying a link is needed. See
|
|
2515
|
+
* `unlockPage` for why that exception is worth making and why it gives away
|
|
2516
|
+
* nothing the asker did not already have.
|
|
2464
2517
|
*/
|
|
2465
2518
|
const cookies = String(req.headers.cookie ?? '')
|
|
2466
2519
|
.split(';')
|
|
@@ -2476,6 +2529,37 @@ const server = createServer(async (req, res) => {
|
|
|
2476
2529
|
cookies[COOKIE] === token;
|
|
2477
2530
|
|
|
2478
2531
|
if (!presented) {
|
|
2532
|
+
// A LOCKED DOOR CAN STILL SAY IT IS A DOOR.
|
|
2533
|
+
//
|
|
2534
|
+
// Every unauthenticated request used to get the same flat 404, so that a
|
|
2535
|
+
// scanner learned nothing from one. For a page a person typed, that is the
|
|
2536
|
+
// wrong trade: `http://127.0.0.1:8899` is exactly what somebody types after
|
|
2537
|
+
// bookmarking the clean address, or coming back in another browser, or
|
|
2538
|
+
// clearing cookies -- and a bare 404 is indistinguishable from a dead
|
|
2539
|
+
// server. Somebody hit it and reported the viewer broken; it was working
|
|
2540
|
+
// perfectly and had no way to say so.
|
|
2541
|
+
//
|
|
2542
|
+
// The secrecy was buying almost nothing anyway. Reading this body needs a
|
|
2543
|
+
// same-origin read, which means a process on this machine -- and a local
|
|
2544
|
+
// process can already see the port with `lsof`, so it learns nothing here
|
|
2545
|
+
// it could not learn there. A hostile PAGE in the browser cannot read a
|
|
2546
|
+
// cross-origin response at all; it could always detect that something
|
|
2547
|
+
// answers on the port, and still cannot see a word of this.
|
|
2548
|
+
//
|
|
2549
|
+
// So: pages explain, everything else stays flat. No channel names, no
|
|
2550
|
+
// account, no token -- nothing about WHOSE viewer this is, only that a
|
|
2551
|
+
// link is needed and where the link comes from.
|
|
2552
|
+
if (req.method === 'GET' && isPage(url.pathname)) {
|
|
2553
|
+
// no-store because this is served at the same address the real page will
|
|
2554
|
+
// be. A cached 401 at `/` would greet the person again after the cookie
|
|
2555
|
+
// was granted, which is the original complaint with extra steps.
|
|
2556
|
+
res.writeHead(401, {
|
|
2557
|
+
'Content-Type': 'text/html; charset=utf-8',
|
|
2558
|
+
'Cache-Control': 'no-store',
|
|
2559
|
+
});
|
|
2560
|
+
res.end(unlockPage());
|
|
2561
|
+
return;
|
|
2562
|
+
}
|
|
2479
2563
|
res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
2480
2564
|
res.end('Not found.');
|
|
2481
2565
|
return;
|