mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-05 20:38:22 +00:00
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:
@@ -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 +
|
||||
|
||||
@@ -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
@@ -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[];
|
||||
|
||||
Reference in New Issue
Block a user