Files
paperclip/ui/src/adapters/disabled-store.ts
T
HenkDz 14d59da316 feat(adapters): external adapter plugin system with dynamic UI parser
- Plugin loader: install/reload/remove/reinstall external adapters
  from npm packages or local directories
- Plugin store persisted at ~/.paperclip/adapter-plugins.json
- Self-healing UI parser resolution with version caching
- UI: Adapter Manager page, dynamic loader, display registry
  with humanized names for unknown adapter types
- Dev watch: exclude adapter-plugins dir from tsx watcher
  to prevent mid-request server restarts during reinstall
- All consumer fallbacks use getAdapterLabel() for consistent display
- AdapterTypeDropdown uses controlled open state for proper close behavior
- Remove hermes-local from built-in UI (externalized to plugin)
- Add docs for external adapters and UI parser contract
2026-04-03 21:11:20 +01:00

34 lines
1003 B
TypeScript

/**
* Client-side store for disabled adapter types.
*
* Hydrated from the server's GET /api/adapters response.
* Provides synchronous reads so module-level constants can filter against it.
* Falls back to "nothing disabled" before the first hydration.
*
* Usage in components:
* useQuery + adaptersApi.list() populates the store automatically.
*
* Usage in non-React code:
* import { isAdapterTypeHidden } from "@/adapters/disabled-store";
*/
let disabledTypes = new Set<string>();
/** Check if an adapter type is hidden from menus (sync read). */
export function isAdapterTypeHidden(type: string): boolean {
return disabledTypes.has(type);
}
/** Get all hidden adapter types (sync read). */
export function getHiddenAdapterTypes(): Set<string> {
return disabledTypes;
}
/**
* Hydrate the store from a server response.
* Called by components that fetch the adapters list.
*/
export function setDisabledAdapterTypes(types: string[]): void {
disabledTypes = new Set(types);
}