// The host side of the reconcile (design §2). We PUT the declarative entry list to the provider // endpoint and let the host diff by `external_id` (stable ids, orphan drop, manual entries untouched). // Done through `pf.request` rather than the typed `pf.api.*` deliberately: under the packaged runner // the facade is built by the runner's *bundled* SDK copy, whose generated client may predate an // endpoint — the untyped request seam is version-skew-proof (same reasoning as `servePluginUi`). import type { Punktfunk } from "@punktfunk/host"; import { PROVIDER_ID } from "./const.js"; import type { ProviderEntryInput } from "./wire.js"; /** Full-replace reconcile: the host makes the library match `entries` exactly for this provider. */ export const reconcileProvider = ( pf: Punktfunk, entries: ProviderEntryInput[], ): Promise => pf.request("PUT", `/library/provider/${PROVIDER_ID}`, entries); /** Clean uninstall: remove every entry this provider owns. */ export const deleteProvider = (pf: Punktfunk): Promise => pf.request("DELETE", `/library/provider/${PROVIDER_ID}`);