[AI] api: add browser entry point

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
github-actions[bot]
2026-04-17 21:50:56 +01:00
parent 05f4b84a85
commit f3850cae1d

View File

@@ -0,0 +1,25 @@
import { init as initLootCore } from '@actual-app/core/server/main';
import type { InitConfig, lib } from '@actual-app/core/server/main';
export * from './methods';
export * as utils from './utils';
let internalLib: typeof lib | null = null;
export async function init(config: InitConfig = {}) {
internalLib = await initLootCore(config);
return internalLib;
}
export async function shutdown() {
if (internalLib) {
try {
await internalLib.send('sync');
} catch {
// most likely no budget loaded, so sync failed
}
await internalLib.send('close-budget');
internalLib = null;
}
}