/** * Gonka Adapter — Governance layer for decentralized GPU inference networks * * Replaces Gonka's primitive allowlist.csv + manual governance votes with * APS delegation chains: automatic expiry, monotonic narrowing, cascade * revocation, signed receipts for off-chain devshard settlement. * * No Gonka SDK dependency. All types are local interfaces. */ import { type RevocationCheckOptions } from '../core/delegation.js'; import type { Delegation, ActionReceipt, SignedPassport } from '../types/passport.js'; export interface GonkaInferenceRequest { model: string; prompt: string; maxTokens?: number; hostAddress?: string; epochId?: number; devshardId?: string; } export interface GonkaHostConfig { passport: SignedPassport; delegation: Delegation; privateKey: string; allowedModels?: string[]; maxInferencesPerEpoch?: number; onReceipt?: (r: ActionReceipt) => void; onDenied?: (info: { host: string; reason: string; }) => void; /** Trust anchors for this gate: issuer public keys whose countersignature * is accepted. A NON-EMPTY list requires a valid countersignature from one * of them. An empty list, or omitting it, means this gate holds no * anchors; it does not mean "trust anyone". */ trustedIssuers?: string[]; /** Explicit wildcard trust: admit a passport whose only authority is its * own signature. Required to admit a self-signed credential, because a * signature that verifies under a key the passport itself supplied is not * an authorization by a trusted issuer. Default false. */ allowSelfSigned?: boolean; /** Revocation posture applied to the delegation check before every * governed call. This adapter is an execution gate: it verifies the * delegation immediately before the tool runs, which is exactly where a * caller who will not act on unknown revocation state says so. Pass * { revocationCheckPolicy: 'fail_closed', cachedRevocationState } to * refuse when revocation evidence is absent or stale. Omitted leaves the * previous behaviour, signature and expiry only. */ revocation?: RevocationCheckOptions; } export interface GonkaInferenceReceipt { receipt: ActionReceipt; model: string; epochId?: number; devshardId?: string; inferenceHash: string; } export interface GonkaHostVerification { authorized: boolean; reason: string; scope: string; hostAddress: string; model: string; } /** Verify a host has authority to serve inference for a model */ export declare function verifyGonkaHost(hostAddress: string, model: string, config: GonkaHostConfig): GonkaHostVerification; /** Govern an inference request -- check delegation, model, rate limits */ export declare function governGonkaInference(request: GonkaInferenceRequest, execute: (req: GonkaInferenceRequest) => Promise<{ response: string; tokensUsed: number; }>, config: GonkaHostConfig): Promise<{ result: { response: string; tokensUsed: number; }; receipt: GonkaInferenceReceipt; } | { denied: true; reason: string; receipt: ActionReceipt; }>; /** Create a devshard session receipt (off-chain proof for settlement) */ export declare function createDevshardReceipt(devshardId: string, inferenceCount: number, totalTokens: number, participants: string[], config: Pick): ActionReceipt; /** Convert APS delegation to Gonka-compatible allowlist entry */ export declare function delegationToAllowlistEntry(delegation: Delegation, passport: SignedPassport): { address: string; model: string; scope: string[]; expiresAtBlock?: number; }; /** Convert Gonka epoch timing to APS delegation expiry */ export declare function epochToDelegationExpiry(currentEpoch: number, epochDurationBlocks: number, epochsValid: number): Date; /** Validate PoC (Proof-of-Compute) participation receipt */ export declare function verifyPoCParticipation(hostAddress: string, epochId: number, weight: number, config: Pick): ActionReceipt; //# sourceMappingURL=gonka.d.ts.map