mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
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.
30 lines
727 B
JavaScript
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;
|
|
}
|