Files
gods-eye-view/src/standalone/toolCatalog.js
T
Sameh Khamis d9ecd126c8 Let the app run under a panel page's document base
A panel page loads the app with <base> pointing at the app's server, so
addresses the app builds resolve against the document base instead of
the page location, and hash updates stay on the page's own address.
The dev server answers panel origins with CORS on the API routes too.
2026-10-02 15:21:37 -07:00

30 lines
727 B
JavaScript

/** The standalone tool catalog for voice, loaded the first time voice needs it. */
let pending = null;
export function loadToolCatalog() {
pending ??= Promise.all([
import('../tools/index.js'),
import('../tools/services.js'),
]).then(
([
{ composeCatalog, coreTools, catalogForSurface },
{ createToolServices },
]) =>
catalogForSurface(
composeCatalog({
tools: coreTools,
services: createToolServices({
fetchImpl: (...args) => globalThis.fetch(...args),
appUrl: new URL(globalThis.document.baseURI).origin,
}),
}),
'voice',
),
);
pending.catch(() => {
pending = null;
});
return pending;
}