feat(extensions): add extension loader infrastructure #3

Merged
padreug merged 15 commits from feature/extension-loader into dev 2026-04-02 18:47:55 +00:00
Showing only changes of commit a574a5b817 - Show all commits

View file

@ -191,6 +191,31 @@ export interface ExtensionContext {
log(level: 'debug' | 'info' | 'warn' | 'error', message: string, ...args: any[]): void log(level: 'debug' | 'info' | 'warn' | 'error', message: string, ...args: any[]): void
} }
/**
* HTTP route handler types
* Used by extensions that expose HTTP endpoints (e.g. LNURL, .well-known)
*/
export interface HttpRequest {
method: string
path: string
params: Record<string, string>
query: Record<string, string>
headers: Record<string, string>
body?: any
}
export interface HttpResponse {
status: number
body: any
headers?: Record<string, string>
}
export interface HttpRoute {
method: 'GET' | 'POST'
path: string
handler: (req: HttpRequest) => Promise<HttpResponse>
}
/** /**
* Extension interface - what extensions must implement * Extension interface - what extensions must implement
*/ */
@ -217,6 +242,12 @@ export interface Extension {
* Return true if extension is healthy * Return true if extension is healthy
*/ */
healthCheck?(): Promise<boolean> healthCheck?(): Promise<boolean>
/**
* Get HTTP routes exposed by this extension
* The main HTTP server will mount these routes
*/
getHttpRoutes?(): HttpRoute[]
} }
/** /**