agent-tool-forge 0.4.9 → 0.4.10
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/lib/auth.d.ts +1 -1
- package/lib/config-schema.js +0 -5
- package/lib/forge-service.js +19 -7
- package/lib/sidecar.js +1 -1
- package/package.json +1 -1
package/lib/auth.d.ts
CHANGED
package/lib/config-schema.js
CHANGED
|
@@ -96,11 +96,6 @@ export function validateConfig(raw = {}) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// auth.mode = 'verify' requires signingKey
|
|
99
|
-
if (raw.auth?.mode === 'verify' && !raw.auth?.signingKey) {
|
|
100
|
-
errors.push('auth.signingKey is required when auth.mode is "verify"');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// verify mode always requires a signingKey
|
|
104
99
|
if (raw.auth?.mode === 'verify' && !raw.auth?.signingKey) {
|
|
105
100
|
errors.push('auth.signingKey is required when auth.mode is "verify". Set it in forge.config.json or via a ${ENV_VAR} reference.');
|
|
106
101
|
}
|
package/lib/forge-service.js
CHANGED
|
@@ -328,10 +328,10 @@ export function createSidecarRouter(ctx, options = {}) {
|
|
|
328
328
|
if (sidecarPath === '/agent-api/tools' && req.method === 'GET') {
|
|
329
329
|
return handleToolsList(req, res, ctx);
|
|
330
330
|
}
|
|
331
|
-
if (
|
|
331
|
+
if (sidecarPath.startsWith('/forge-admin/agents')) {
|
|
332
332
|
return handleAgents(req, res, ctx);
|
|
333
333
|
}
|
|
334
|
-
if (
|
|
334
|
+
if (sidecarPath.startsWith('/forge-admin/config')) {
|
|
335
335
|
return handleAdminConfig(req, res, ctx);
|
|
336
336
|
}
|
|
337
337
|
|
|
@@ -341,7 +341,7 @@ export function createSidecarRouter(ctx, options = {}) {
|
|
|
341
341
|
try {
|
|
342
342
|
sendJson(res, 200, await ctx.evalStore.getEvalSummary());
|
|
343
343
|
} catch (err) {
|
|
344
|
-
sendJson(res, 500, { error: 'Failed to fetch eval summary' });
|
|
344
|
+
if (!res.headersSent) sendJson(res, 500, { error: 'Failed to fetch eval summary' });
|
|
345
345
|
}
|
|
346
346
|
} else if (ctx.db) {
|
|
347
347
|
try {
|
|
@@ -367,7 +367,7 @@ export function createSidecarRouter(ctx, options = {}) {
|
|
|
367
367
|
try {
|
|
368
368
|
sendJson(res, 200, await ctx.evalStore.listRuns(limit, offset));
|
|
369
369
|
} catch (err) {
|
|
370
|
-
sendJson(res, 500, { error: 'Failed to fetch eval runs' });
|
|
370
|
+
if (!res.headersSent) sendJson(res, 500, { error: 'Failed to fetch eval runs' });
|
|
371
371
|
}
|
|
372
372
|
} else if (ctx.db) {
|
|
373
373
|
try {
|
|
@@ -383,7 +383,7 @@ export function createSidecarRouter(ctx, options = {}) {
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
// ── Widget static file serving ─────────────────────────────────────────
|
|
386
|
-
if (
|
|
386
|
+
if (sidecarPath.startsWith('/widget/')) {
|
|
387
387
|
serveWidgetFile(req, res, widgetDir, sendJson);
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
@@ -661,10 +661,22 @@ function createDirectServer() {
|
|
|
661
661
|
if (sidecarPath === '/agent-api/tools' && req.method === 'GET') {
|
|
662
662
|
return handleToolsList(req, res, sidecarCtx);
|
|
663
663
|
}
|
|
664
|
-
if (
|
|
664
|
+
if (sidecarPath.startsWith('/forge-admin/agents')) {
|
|
665
|
+
const authCheck = applyRouteAuth(req, sidecarCtx, 2);
|
|
666
|
+
if (!authCheck.ok) {
|
|
667
|
+
if (authCheck.status === 401) res.setHeader('WWW-Authenticate', 'Bearer');
|
|
668
|
+
json(res, authCheck.status, { error: authCheck.error });
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
665
671
|
return handleAgents(req, res, sidecarCtx);
|
|
666
672
|
}
|
|
667
|
-
if (
|
|
673
|
+
if (sidecarPath.startsWith('/forge-admin/config')) {
|
|
674
|
+
const authCheck = applyRouteAuth(req, sidecarCtx, 2);
|
|
675
|
+
if (!authCheck.ok) {
|
|
676
|
+
if (authCheck.status === 401) res.setHeader('WWW-Authenticate', 'Bearer');
|
|
677
|
+
json(res, authCheck.status, { error: authCheck.error });
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
668
680
|
return handleAdminConfig(req, res, sidecarCtx);
|
|
669
681
|
}
|
|
670
682
|
}
|
package/lib/sidecar.js
CHANGED
|
@@ -155,7 +155,7 @@ export async function createSidecar(config = {}, options = {}) {
|
|
|
155
155
|
|
|
156
156
|
// Re-exports for advanced consumers
|
|
157
157
|
export { buildSidecarContext, createSidecarRouter } from './forge-service.js';
|
|
158
|
-
export { createAuth } from './auth.js';
|
|
158
|
+
export { createAuth, resolveSecret, authenticateAdmin } from './auth.js';
|
|
159
159
|
export { reactLoop } from './react-engine.js';
|
|
160
160
|
export { mergeDefaults, validateConfig, CONFIG_DEFAULTS } from './config-schema.js';
|
|
161
161
|
export { getDb } from './db.js';
|