From f05cb5a27149d605f8bf491b601fbee39a413b6a Mon Sep 17 00:00:00 2001 From: redshift <213178690+1ftredsh@users.noreply.github.com> Date: Mon, 24 Aug 2026 21:07:00 +0100 Subject: [PATCH] feat: wire routstrModelsPubkey through daemon Add RoutstrdConfig.routstrModelsPubkey and pass it to ModelManager and the HTTP handler deps, forwarding it into routeRequests so the models allowlist pubkey (kind 38423) can be set independently of the audit pubkey (kind 38425). --- src/daemon/http/index.ts | 11 +++++++++-- src/daemon/index.ts | 2 ++ src/utils/config.ts | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/daemon/http/index.ts b/src/daemon/http/index.ts index c7ad64a..17e694a 100644 --- a/src/daemon/http/index.ts +++ b/src/daemon/http/index.ts @@ -66,8 +66,10 @@ type DaemonDeps = { getModelProviders: (modelId: string) => Promise; refreshProvidersAndModels: () => Promise; mode?: ClientMode; - /** Nostr hex pubkey for routstr review/model events (kind 38425/38423). */ + /** Nostr hex pubkey for routstr review/audit events (kind 38425). */ routstrPubkey?: string; + /** Nostr hex pubkey for the routstr-21 model list only (kind 38423). Falls back to routstrPubkey. */ + routstrModelsPubkey?: string; providerManager: ProviderManager; refundClient: any; requestResponseLogSink?: RequestResponseLogSink; @@ -386,8 +388,10 @@ export function createDaemonRequestHandler(deps: { mode?: "xcashu" | "apikeys"; /** Default max_tokens/max_output_tokens to inject when the client omits one. */ maxTokens: number; - /** Nostr hex pubkey for routstr review/model events (kind 38425/38423). */ + /** Nostr hex pubkey for routstr review/audit events (kind 38425). */ routstrPubkey?: string; + /** Nostr hex pubkey for the routstr-21 model list only (kind 38423). Falls back to routstrPubkey. */ + routstrModelsPubkey?: string; usageTrackingDriver: UsageTrackingDriver; providerManager: ProviderManager; refundClient: any; @@ -1763,6 +1767,9 @@ export function createDaemonRequestHandler(deps: { ? { requestResponseLogSink: deps.requestResponseLogSink } : {}), ...(deps.routstrPubkey ? { routstrPubkey: deps.routstrPubkey } : {}), + ...(deps.routstrModelsPubkey + ? { routstrModelsPubkey: deps.routstrModelsPubkey } + : {}), }); // Bridge the Web `Response` to the Node `ServerResponse`: status + diff --git a/src/daemon/index.ts b/src/daemon/index.ts index 19518bd..5d7dac0 100644 --- a/src/daemon/index.ts +++ b/src/daemon/index.ts @@ -128,6 +128,7 @@ async function main(): Promise { logger: daemonSdkLogger, eventStoreDbPath: `${CONFIG_DIR}/events.db`, routstrPubkey: config.routstrPubkey, + routstrModelsPubkey: config.routstrModelsPubkey, nostrRelays: config.relays, }); // Create shared ProviderManager for consistent failure tracking across all requests @@ -216,6 +217,7 @@ async function main(): Promise { mode: config.mode || "apikeys", maxTokens: config.maxTokens ?? 64000, routstrPubkey: config.routstrPubkey, + routstrModelsPubkey: config.routstrModelsPubkey, usageTrackingDriver, providerManager, refundClient, diff --git a/src/utils/config.ts b/src/utils/config.ts index 49a193e..59f785c 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -48,8 +48,10 @@ export interface RoutstrdConfig { * Defaults to daemonUrl or localhost:{port} if not set. */ authUrl?: string; nsec?: string; - /** Nostr hex pubkey for routstr review/model events (kind 38425/38423). */ + /** Nostr hex pubkey for routstr review/audit events (kind 38425). */ routstrPubkey?: string; + /** Nostr hex pubkey for the routstr-21 model list only (kind 38423). Falls back to routstrPubkey. */ + routstrModelsPubkey?: string; /** Nostr relay URLs for provider/model discovery (kinds 38421/38423/38425). * When unset, each method uses its own built-in defaults. */ relays?: string[];