/** * Minimal TypeSafe System One client. * * No SDK dependency, for the same reason as the OpenAI client: the package ships three runtime * dependencies and none of them opens a socket. `@typesafe-ai/sdk` could only be a dev dependency, * and `dist/cli` is part of the published tarball, so an installed `email-content annotate` would * fail to load it. The surface used here is one POST. * * This is the second place in the codebase that sends message content off the machine, under the * same terms as the first: only reachable from `email-content annotate`, opt in, fails closed * without a key. See docs/threat-model.md, "Configured exception: LLM annotation". */ import { ApiError, type ApiConfig, type Usage } from './http'; /** * Pinned rather than `jev-latest`: labels are stored with the model that produced them, and an * alias that silently moves would put two models' output under one name. */ export declare const TYPESAFE_DEFAULT_MODEL = "jev-1.13.0"; export type TypeSafeConfig = ApiConfig; export interface ChoiceQuestion { type: 'choice'; instructions: string | Record; criteria: Record | null>; } export interface SystemOneRequest { state: unknown; questions: Record; } /** One answer as returned. Fields are unvalidated until the annotator checks them. */ export interface ChoiceAnswer { choice?: unknown; probabilities?: unknown; confidence?: unknown; } export interface SystemOneResponse { answers: Record; } /** The narrow surface the annotator depends on, so its validation can be tested without a network. */ export interface SystemOneClient { readonly model: string; ask(request: SystemOneRequest): Promise; } export declare class TypeSafeError extends ApiError { constructor(message: string, status: number, retryable: boolean); } /** Load configuration from the environment, after process.loadEnvFile(). */ export declare function typeSafeConfigFromEnv(model: string, overrides?: Partial): TypeSafeConfig; export declare class TypeSafeClient implements SystemOneClient { private readonly config; /** Input tokens are reported as prompt tokens, output tokens as completion tokens. */ readonly usage: Usage; constructor(config: TypeSafeConfig); get model(): string; /** * Ask a set of questions about one state. * * Retries on rate limits (429), overload (529) and other server errors. Anything else, a 422 * validation failure in particular, is a bug in the request and is not retried. Error messages * carry the status only, never the response body: a validation error may echo the state back, * and the state is private mail. */ ask(request: SystemOneRequest): Promise; } //# sourceMappingURL=typesafe-client.d.ts.map