agents-relay 2.0.269 → 2.0.270

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.
@@ -1,7 +1,8 @@
1
1
  // Only public, non-sensitive, version-independent app-shell assets are cached.
2
2
  // Never intercept /api/*, /events, /dashboard-config.js or navigations.
3
- const CACHE = 'agents-relay-pwa-shell-v2';
4
- const ASSETS = ['/dashboard.css', '/dashboard.js', '/vendor/markdown-it.min.js', '/pwa.js', '/manifest.webmanifest',
3
+ const CACHE = 'agents-relay-pwa-shell-v3';
4
+ // JavaScript and CSS are release-specific and must not be cached by a Service Worker.
5
+ const ASSETS = ['/pwa.js', '/manifest.webmanifest',
5
6
  '/icons/icon-180.png', '/icons/icon-192.png', '/icons/icon-512.png'];
6
7
  const ALLOWED = new Set(ASSETS);
7
8
  self.addEventListener('install', event => {
@@ -20,6 +20,13 @@ export function dashboardSourceRevision() {
20
20
  }
21
21
  }
22
22
  export const dashboardIndexHtml = readFileSync(new URL('../dashboard/index.html', import.meta.url), 'utf8');
23
+ /** Cache-bust executable app assets at the URL boundary. Public CDN cache rules may
24
+ * override no-cache for up to four hours; a release-specific URL must never
25
+ * reuse an older JavaScript or CSS response while /api/version is current. */
26
+ export const dashboardPageHtml = dashboardIndexHtml
27
+ .replace('href="/dashboard.css"', `href="/dashboard.css?v=${encodeURIComponent(dashboardVersion)}"`)
28
+ .replace('src="/vendor/markdown-it.min.js"', `src="/vendor/markdown-it.min.js?v=${encodeURIComponent(dashboardVersion)}"`)
29
+ .replace('src="/dashboard.js"', `src="/dashboard.js?v=${encodeURIComponent(dashboardVersion)}"`);
23
30
  export const dashboardClientJs = readFileSync(new URL('../dashboard/dashboard.js', import.meta.url), 'utf8');
24
31
  export const dashboardMarkdownJs = readFileSync(new URL('../dashboard/vendor/markdown-it.min.js', import.meta.url), 'utf8');
25
32
  export const dashboardJelFunction = readFileSync(new URL('../dashboard/jel-function.js', import.meta.url), 'utf8').trimEnd();
package/dist/dashboard.js CHANGED
@@ -27,7 +27,7 @@ function isTaskId(candidate) {
27
27
  return candidate.length > 0;
28
28
  }
29
29
  export { dashboardHtml, dashboardVersion, dashboardSourceRevision } from './dashboard-html.js';
30
- import { dashboardIndexHtml, dashboardConfigScript, dashboardVersion } from './dashboard-html.js';
30
+ import { dashboardPageHtml, dashboardConfigScript, dashboardVersion } from './dashboard-html.js';
31
31
  export function serveDashboard(store, port = 8787, bus, refreshMs = 300000, jobId, usageRegistry, overviewProvider, webhook, statusProvider, githubUsageProvider, exactJobProvider, actions, routerTestProvider, decisionAuditProvider) {
32
32
  const legacyActions = typeof exactJobProvider === 'object' && exactJobProvider !== null ? exactJobProvider : undefined;
33
33
  const legacyExactJobProvider = !exactJobProvider && githubUsageProvider ? githubUsageProvider : undefined;
@@ -137,7 +137,7 @@ export function serveDashboard(store, port = 8787, bus, refreshMs = 300000, jobI
137
137
  const server = createServer(async (req, res) => {
138
138
  if (req.method === 'GET' && req.url === '/') {
139
139
  res.writeHead(200, { 'content-type': 'text/html; charset=utf-8', 'cache-control': 'no-store', 'x-content-type-options': 'nosniff' });
140
- res.end(dashboardIndexHtml);
140
+ res.end(dashboardPageHtml);
141
141
  return;
142
142
  }
143
143
  if (req.method === 'GET' && req.url === '/dashboard-config.js') {
@@ -145,7 +145,10 @@ export function serveDashboard(store, port = 8787, bus, refreshMs = 300000, jobI
145
145
  res.end(dashboardConfigScript());
146
146
  return;
147
147
  }
148
- const asset = req.method === 'GET' ? dashboardStaticAssets[req.url ?? ''] : undefined;
148
+ const staticUrl = new URL(req.url ?? '/', 'http://127.0.0.1');
149
+ // Reject arbitrary query variants; accept only the active package version.
150
+ const validStaticQuery = !staticUrl.search || (staticUrl.searchParams.size === 1 && staticUrl.searchParams.get('v') === dashboardVersion);
151
+ const asset = req.method === 'GET' && validStaticQuery ? dashboardStaticAssets[staticUrl.pathname] : undefined;
149
152
  if (asset) {
150
153
  try {
151
154
  const content = await readFile(new URL('../dashboard/' + asset[0], import.meta.url));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "2.0.269",
3
+ "version": "2.0.270",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "repository": {
6
6
  "type": "git",