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).
This commit is contained in:
redshift
2026-08-24 21:07:00 +01:00
parent c25273cbb0
commit f05cb5a271
3 changed files with 14 additions and 3 deletions
+9 -2
View File
@@ -66,8 +66,10 @@ type DaemonDeps = {
getModelProviders: (modelId: string) => Promise<any>;
refreshProvidersAndModels: () => Promise<void>;
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 +
+2
View File
@@ -128,6 +128,7 @@ async function main(): Promise<void> {
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<void> {
mode: config.mode || "apikeys",
maxTokens: config.maxTokens ?? 64000,
routstrPubkey: config.routstrPubkey,
routstrModelsPubkey: config.routstrModelsPubkey,
usageTrackingDriver,
providerManager,
refundClient,
+3 -1
View File
@@ -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[];