agents-relay 2.0.269 → 2.0.271
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/dashboard/dashboard.js +31 -6
- package/dashboard/service-worker.js +3 -2
- package/dist/dashboard-html.js +7 -0
- package/dist/dashboard.js +6 -3
- package/package.json +1 -1
package/dashboard/dashboard.js
CHANGED
|
@@ -356,18 +356,43 @@ function openJobDetails(){
|
|
|
356
356
|
const inputs=uniqueInputs(candidates,objective);
|
|
357
357
|
showDetailsDialog('Job',job.id,job.title,objective,inputs,readerReviewComments(job));
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function taskReaderEnvelope(task){
|
|
360
|
+
const raw=detailText(task.input);
|
|
361
|
+
if(!raw.startsWith('{'))return null;
|
|
362
|
+
try{
|
|
363
|
+
const parsed=JSON.parse(raw);
|
|
364
|
+
return parsed&&typeof parsed==='object'&&!Array.isArray(parsed)?parsed:null;
|
|
365
|
+
}catch{return null;}
|
|
366
|
+
}
|
|
367
|
+
function taskReaderObjective(task,envelope=taskReaderEnvelope(task)){
|
|
368
|
+
const explicit=detailText(task.objective)||detailText(envelope?.taskObjective)||detailText(envelope?.objective);
|
|
369
|
+
if(explicit)return explicit;
|
|
360
370
|
const title=detailText(task.title);
|
|
361
|
-
//
|
|
371
|
+
// A serialized Script/DAG execution envelope is not a natural-language objective.
|
|
372
|
+
// Until an actual Task objective is persisted, use its title rather than inventing one.
|
|
373
|
+
if(envelope)return title||'Task '+task.id;
|
|
362
374
|
if(title&&/\s/.test(title))return title;
|
|
363
|
-
const
|
|
364
|
-
|
|
375
|
+
const first=detailText(task.input).split(/\n\s*\n/).map(item=>item.trim())
|
|
376
|
+
.find(item=>item&&!/^(Job ID|Task ID|Review head SHA|Execution ID):/i.test(item));
|
|
365
377
|
return first||title||'Task '+task.id;
|
|
366
378
|
}
|
|
379
|
+
function taskReaderInputs(task,envelope=taskReaderEnvelope(task)){
|
|
380
|
+
if(!envelope)return [{content:task.input}];
|
|
381
|
+
const inputs=[];
|
|
382
|
+
const request=detailText(envelope.taskInput)||detailText(envelope.input)||detailText(envelope.prompt);
|
|
383
|
+
const instruction=detailText(envelope.instruction)||detailText(envelope.instructions);
|
|
384
|
+
if(request)inputs.push({source:'Task request',content:request});
|
|
385
|
+
if(instruction)inputs.push({source:'Execution instructions',content:instruction});
|
|
386
|
+
// For unknown JSON input contracts, preserve the full input without turning it
|
|
387
|
+
// into a fake objective. Known DAG transport fields are not user-facing content.
|
|
388
|
+
if(!inputs.length)inputs.push({content:'```json\n'+JSON.stringify(envelope,null,2)+'\n```'});
|
|
389
|
+
return inputs;
|
|
390
|
+
}
|
|
367
391
|
function openTaskDetails(task){
|
|
368
392
|
const job=selected();
|
|
369
|
-
const
|
|
370
|
-
const
|
|
393
|
+
const envelope=taskReaderEnvelope(task);
|
|
394
|
+
const objective=taskReaderObjective(task,envelope);
|
|
395
|
+
const candidates=taskReaderInputs(task,envelope);
|
|
371
396
|
for(const attachment of task.attachments||[])candidates.push({source:'Attachment',content:attachment});
|
|
372
397
|
const inputs=uniqueInputs(candidates,objective);
|
|
373
398
|
showDetailsDialog('Task',task.id,task.title,objective,inputs,readerReviewComments(job,task));
|
|
@@ -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-
|
|
4
|
-
|
|
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 => {
|
package/dist/dashboard-html.js
CHANGED
|
@@ -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 {
|
|
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(
|
|
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
|
|
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));
|