@hraness/sys1 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,52 @@
1
+ import { type SystemOneRequest, type SystemOneResponse } from "./protocol.ts";
2
+ export type { Answer, ChoiceAnswer, ChoiceQuestion, EntryType, JsonValue, NoulAnswer, NoulQuestion, Question, ScoreAnswer, ScoreQuestion, SystemOneRequest, SystemOneResponse, } from "./protocol.ts";
3
+ export declare const DEFAULT_BASE_URL = "http://127.0.0.1:13900";
4
+ export type ClientErrorCode = "invalid_options" | "invalid_request" | "aborted" | "timeout" | "transport_error" | "http_error" | "response_too_large" | "invalid_response";
5
+ /** Never includes request bodies, credentials, URLs, or untrusted server errors. */
6
+ export declare class Sys1ClientError extends Error {
7
+ readonly code: ClientErrorCode;
8
+ readonly status: number | undefined;
9
+ constructor(code: ClientErrorCode, status?: number);
10
+ }
11
+ export interface ClientOptions {
12
+ /** Use only for a direct Kev endpoint. Sys1 gateways declare their own adapter. */
13
+ adapter?: "systemone" | "kev";
14
+ /** An explicit HTTP(S) endpoint root; /v1/systemone is appended. */
15
+ baseUrl?: string;
16
+ /** Explicit headers, including Authorization if needed. Never read from env. */
17
+ headers?: HeadersInit;
18
+ /** Total HTTP request and response-body deadline, 1..300000 ms. Default 30000. */
19
+ timeoutMs?: number;
20
+ /** Optional transport injection. It must respect Fetch semantics. */
21
+ fetch?: typeof globalThis.fetch;
22
+ }
23
+ export interface EvaluationOptions {
24
+ signal?: AbortSignal;
25
+ }
26
+ export interface RouteMetadata {
27
+ /** Native Kev probabilities retain their published two-decimal precision. */
28
+ adapter?: "kev";
29
+ probabilityDecimals?: 2;
30
+ backend?: string;
31
+ attempts?: number;
32
+ local?: {
33
+ /** Adapter identity, not a claim of calibrated probabilities. */
34
+ adapter: string;
35
+ minCoverage?: number;
36
+ minConcentration?: number;
37
+ };
38
+ }
39
+ export interface EvaluationResult {
40
+ response: SystemOneResponse;
41
+ /** Empty for direct endpoints that do not supply Sys1 routing headers. */
42
+ metadata: RouteMetadata;
43
+ }
44
+ export interface Sys1Client {
45
+ /** Makes exactly one HTTP attempt. Never retries, starts a daemon, or falls back. */
46
+ evaluate(request: SystemOneRequest, options?: EvaluationOptions): Promise<EvaluationResult>;
47
+ }
48
+ /** A dependency-light client. No filesystem, environment, native runtime, or daemon access. */
49
+ export declare function createClient(options?: ClientOptions): Sys1Client;
50
+ export { PROTOCOL_LIMITS, answerSchema, questionSchema, noulQuestionSchema, choiceQuestionSchema, scoreQuestionSchema, noulAnswerSchema, choiceAnswerSchema, scoreAnswerSchema, systemOneRequestSchema, systemOneResponseSchema, } from "./protocol.ts";
51
+ export { createProfile, Sys1ProfileError } from "./profile.ts";
52
+ export type { DecisionProfile, ProfileDefinition, ReadonlyProfileDefinition, ProfileErrorCode, } from "./profile.ts";