From 977ca522736bba53172e010494de5ac59fdb2a4a Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Fri, 5 Jun 2026 01:22:21 +0900 Subject: refactor(host): expose getHostAPI(); host-bin drops duplicate adapter; storage-sqlite manifest honesty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit host CR-1: createHost.getHostAPI() returns the canonical post-activation HostAPI (registration closed) via a single builder — host-bin deletes its buildPostActivationHostAPI duplicate and calls host.getHostAPI(). storage-sqlite CR-2: remove false contributes.services:["storage"] (backend is a kernel bootstrap dep injected as HostDeps.storageFactory, not a bus service); document the intentional no-op activate. typecheck clean, 218 tests pass, biome clean; live boot + curl verified. --- packages/host-bin/src/main.ts | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) (limited to 'packages/host-bin') diff --git a/packages/host-bin/src/main.ts b/packages/host-bin/src/main.ts index e26b8c6..0cb0d37 100644 --- a/packages/host-bin/src/main.ts +++ b/packages/host-bin/src/main.ts @@ -8,7 +8,6 @@ import { createHost, type EventsEmitter, type Extension, - type HostAPI, type HostDeps, type Logger, type PermissionGate, @@ -54,41 +53,6 @@ function createNoopEvents(): EventsEmitter { return { emit: () => {} }; } -function buildPostActivationHostAPI( - host: { - getProviders: () => ReadonlyMap; - getTools: () => ReadonlyMap; - getAuthProviders: () => ReadonlyMap; - getAuthProvider: (id: string) => unknown; - }, - deps: HostDeps, -): HostAPI { - const notAvailable = () => { - throw new Error("Registration not available after activation"); - }; - return { - defineTool: notAvailable, - defineProvider: notAvailable, - defineAuth: notAvailable, - on: (hook, handler) => deps.bus.on(hook, handler), - addFilter: (hook, fn) => deps.bus.addFilter(hook, fn), - provideService: (handle, impl) => deps.bus.provideService(handle, impl), - getService: (handle) => deps.bus.getService(handle), - storage: (namespace: string) => deps.storageFactory(namespace), - config: deps.config, - secrets: deps.secrets, - permissions: deps.permissions, - events: deps.events, - logger: deps.logger, - getProviders: () => host.getProviders() as ReturnType, - getTools: () => host.getTools() as ReturnType, - getAuthProviders: () => host.getAuthProviders() as ReturnType, - getAuthProvider: (id: string) => - host.getAuthProvider(id) as ReturnType, - scheduler: { register: (job: ScheduledJob) => deps.scheduler.register(job) }, - }; -} - const CORE_EXTENSIONS: readonly Extension[] = [ storageSqliteExt, conversationStoreExt, @@ -131,7 +95,7 @@ async function boot(): Promise { } } - const hostAPI = buildPostActivationHostAPI(host, deps); + const hostAPI = host.getHostAPI(); const app = createServer(hostAPI); // Port precedence: BACKEND_PORT (the rewrite's assigned port) → PORT → default. -- cgit v1.2.3