Skip to content

Commit 5dcf58b

Browse files
Copilothotlong
andauthored
fix: use String() coercion for header values and add TODO comment for kernel cache API
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/35f9d46b-5132-451b-89f4-7dbee7066a1f Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent e75eb0b commit 5dcf58b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/runtime/src/dispatcher-plugin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function mountRouteOnServer(route: RouteDefinition, server: IHttpServer, routePa
4242
// Apply headers from the route result if available
4343
if (result.headers) {
4444
for (const [k, v] of Object.entries(result.headers)) {
45-
res.header(k, v as string);
45+
res.header(k, String(v));
4646
}
4747
} else {
4848
res.header('Content-Type', 'text/event-stream');
@@ -480,7 +480,9 @@ export function createDispatcherPlugin(config: DispatcherPluginConfig = {}): Plu
480480
// If AIServicePlugin.start() ran before DispatcherPlugin.start()
481481
// (possible when plugin start order differs from registration order),
482482
// the 'ai:routes' trigger fires with no listener. The AIServicePlugin
483-
// caches the routes on the kernel as __aiRoutes so we can recover here.
483+
// caches the routes on the kernel as __aiRoutes (see AIServicePlugin.start())
484+
// as an internal cross-plugin protocol so we can recover them here.
485+
// TODO: replace with a formal kernel.getCachedRoutes('ai') API in a future release.
484486
const cachedRoutes = (kernel as any).__aiRoutes as RouteDefinition[] | undefined;
485487
if (cachedRoutes && Array.isArray(cachedRoutes) && cachedRoutes.length > 0) {
486488
let registered = 0;

0 commit comments

Comments
 (0)