agent-comms 9.0.12 → 9.0.13
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +2 -0
- package/dist/bridges/user/web/dist/bundle.js +1 -1
- package/dist/bridges/user/web/dist/index.html +1 -7
- package/dist/bridges/user/web/dist/sw.js +1 -1
- package/dist/bridges/user/web/hosted-dashboard.d.ts +10 -0
- package/dist/bridges/user/web/hosted-dashboard.d.ts.map +1 -0
- package/dist/bridges/user/web/hosted-dashboard.js +10 -0
- package/dist/bridges/user/web/hosted-dashboard.js.map +1 -0
- package/dist/bridges/user/web/web-access.d.ts +0 -2
- package/dist/bridges/user/web/web-access.d.ts.map +1 -1
- package/dist/bridges/user/web/web-access.js +1 -2
- package/dist/bridges/user/web/web-access.js.map +1 -1
- package/package.json +1 -1
- package/src/bridges/user/web/dist/bundle.js +1 -1
- package/src/bridges/user/web/dist/index.html +1 -7
- package/src/bridges/user/web/dist/sw.js +1 -1
- package/src/bridges/user/web/hosted-dashboard.ts +11 -0
- package/src/bridges/user/web/web-access.ts +1 -3
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' ws://127.0.0.1:* http://127.0.0.1:* ws://localhost:* http://localhost:*; worker-src 'self'; manifest-src 'self'; base-uri 'none'; form-action 'none'">
|
|
6
7
|
<title>Agent Comms</title>
|
|
7
8
|
<meta name="theme-color" content="#16213e">
|
|
8
9
|
<link rel="manifest" href="./manifest.json">
|
|
@@ -10,12 +11,5 @@
|
|
|
10
11
|
</head>
|
|
11
12
|
<body>
|
|
12
13
|
<div id="root"></div>
|
|
13
|
-
<script>
|
|
14
|
-
if ("serviceWorker" in navigator) {
|
|
15
|
-
window.addEventListener("load", function () {
|
|
16
|
-
navigator.serviceWorker.register("./sw.js");
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
</script>
|
|
20
14
|
</body>
|
|
21
15
|
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e=`agent-comms-
|
|
1
|
+
(function(){var e=`agent-comms-v2`,t=[{"revision":"fa356ca4b2a4b6ec4a929516b593a3e4","url":"mesh-worker.js"},{"revision":"053013aa131ee0e62e4492d27f4beb90","url":"index.html"},{"revision":"acb589210914ac93762291f24b3f6492","url":"bundle.js"}].map(e=>e.url);self.addEventListener(`install`,n=>{n.waitUntil(self.caches.open(e).then(async e=>e.addAll(t)).then(async()=>self.skipWaiting()))});var n=`agent-comms-`;self.addEventListener(`activate`,t=>{t.waitUntil(self.caches.keys().then(async t=>Promise.all(t.filter(t=>t.startsWith(n)&&t!==e).map(async e=>self.caches.delete(e)))))});var r=200,i=300;function a(e,t){return e.method===`GET`&&t.status>=r&&t.status<i}function o(e){return e.type===`basic`&&e.status>=r&&e.status<i&&(e.headers.get(`content-type`)??``).startsWith(`text/html`)}var s=500,c=new URL(`index.html`,self.location.href).href;self.addEventListener(`fetch`,t=>{let n=new URL(t.request.url);if(t.request.mode===`navigate`){t.respondWith(fetch(t.request,{cache:`no-cache`}).then(n=>{if(t.request.method===`GET`&&o(n)){let t=n.clone();self.caches.open(e).then(async e=>e.put(c,t))}return n}).then(async t=>t.status<s?t:await(await self.caches.open(e)).match(c)??t).catch(async()=>self.caches.open(e).then(async e=>e.match(c)).then(e=>e??new Response(`Offline`,{status:503}))));return}if(n.pathname.startsWith(`/api/`)){t.respondWith(fetch(t.request).then(n=>{if(a(t.request,n)){let r=n.clone();self.caches.open(e).then(async e=>e.put(t.request,r))}return n}).catch(async()=>self.caches.open(e).then(async e=>e.match(t.request)).then(e=>e??new Response(`Offline`,{status:503}))));return}t.respondWith(self.caches.open(e).then(async e=>e.match(t.request)).then(async n=>n||fetch(t.request).then(n=>{if(a(t.request,n)){let r=n.clone();self.caches.open(e).then(async e=>e.put(t.request,r))}return n})))})})();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the hosted dashboard is served from. One definition, imported by everything that names the hosted origin: the bridge's admission of it (web-access.ts) and the tests that stand in for it.
|
|
3
|
+
*
|
|
4
|
+
* The origin is the unit a browser keeps storage apart by, so it is also the line between the dashboard and every other page that shares a host with it.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** The origin of the dashboard deployed to GitHub Pages. It discovers a bridge's server by probing loopback ports and then opens its `/ws/mesh` socket cross-origin, so its Origin is admitted from a client on this machine; every other foreign origin is refused. */
|
|
8
|
+
export const HOSTED_DASHBOARD_ORIGIN = "https://exadev.github.io";
|
|
9
|
+
|
|
10
|
+
/** The address a person opens to reach the hosted dashboard: its origin and the path its site is published under. */
|
|
11
|
+
export const HOSTED_DASHBOARD_URL = `${HOSTED_DASHBOARD_ORIGIN}/agent-comms/`;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import * as crypto from "node:crypto";
|
|
8
8
|
import * as net from "node:net";
|
|
9
9
|
import * as os from "node:os";
|
|
10
|
+
import { HOSTED_DASHBOARD_ORIGIN } from "./hosted-dashboard.js";
|
|
10
11
|
|
|
11
12
|
/** The environment variable that opts the web server into binding beyond loopback. Its value is an IP address literal to bind: `0.0.0.0` or `::` for every interface, or one interface's own address. */
|
|
12
13
|
export const WEB_HOST_ENV = "AGENT_COMMS_WEB_HOST";
|
|
@@ -38,9 +39,6 @@ const HTTP_FOUND = 302;
|
|
|
38
39
|
/** The authentication scheme of an `Authorization` header carrying the token. Scheme names are case-insensitive (RFC 9110 section 11.1). */
|
|
39
40
|
const BEARER_SCHEME = "bearer";
|
|
40
41
|
|
|
41
|
-
/** The origin of the dashboard deployed to GitHub Pages. It discovers a bridge's server by probing loopback ports and then opens its `/ws/mesh` socket cross-origin, so its Origin is admitted from a client on this machine; every other foreign origin is refused. */
|
|
42
|
-
export const HOSTED_DASHBOARD_ORIGIN = "https://exadev.github.io";
|
|
43
|
-
|
|
44
42
|
/** How long the address sets derived from the machine's interfaces and hostname are reused. Reading them costs a system call per interface, which every request would otherwise pay; this bounds how long a newly attached interface waits to be recognised. */
|
|
45
43
|
const INTERFACE_CACHE_MS = 5000;
|
|
46
44
|
|