@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
48 lines • 2.7 kB
TypeScript
import type { PathSpec } from '../../types.ts';
import type { LangfuseConfig } from '../../vfs/langfuse/config.ts';
import { ApiError } from '../api/errors.ts';
export declare class LangfuseApiError extends ApiError {
readonly errors: readonly unknown[];
constructor(message: string, errors?: readonly unknown[], status?: number | null);
}
/**
* Await a Langfuse fetch, translating a 404 into ENOENT.
*
* Every other status stays a LangfuseApiError: only "this VFS does not
* exist" is a filesystem-level missing file.
*/
export declare function fetchOrEnoent<T>(pending: Promise<T>, path: PathSpec): Promise<T>;
export interface LangfuseTransport {
request(path: string, query?: Record<string, string | number | undefined>): Promise<unknown>;
}
export declare class HttpLangfuseTransport implements LangfuseTransport {
protected readonly fetch: typeof fetch;
private readonly host;
private readonly auth;
private readonly timeout;
constructor(opts: Pick<LangfuseConfig, 'publicKey' | 'secretKey' | 'host' | 'timeout'>);
request(path: string, query?: Record<string, string | number | undefined>): Promise<unknown>;
}
export interface FetchTracesOptions {
limit?: number;
sessionId?: string | null | undefined;
fromTimestamp?: string | null | undefined;
}
/** The root observations of the newest traces, one or more per trace. */
export declare function fetchTraces(transport: LangfuseTransport, opts?: FetchTracesOptions): Promise<Record<string, unknown>[]>;
/** One trace: its root observation with the rest and its scores added. */
export declare function fetchTrace(transport: LangfuseTransport, traceId: string): Promise<Record<string, unknown>>;
/** The distinct sessions of the newest traces, newest first. */
export declare function fetchSessions(transport: LangfuseTransport, opts?: {
limit?: number;
fromTimestamp?: string | null | undefined;
}): Promise<string[]>;
export declare function fetchPrompts(transport: LangfuseTransport): Promise<Record<string, unknown>[]>;
export declare function fetchPrompt(transport: LangfuseTransport, name: string, version?: number | null): Promise<Record<string, unknown>>;
export declare function fetchDatasets(transport: LangfuseTransport): Promise<Record<string, unknown>[]>;
export declare function fetchDatasetItems(transport: LangfuseTransport, datasetName: string, opts?: {
limit?: number;
}): Promise<Record<string, unknown>[]>;
/** The experiments run on a dataset, or only the one named `runName`. */
export declare function fetchDatasetRuns(transport: LangfuseTransport, datasetName: string, runName?: string): Promise<Record<string, unknown>[]>;
//# sourceMappingURL=client.d.ts.map