@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.
- package/LICENSE +21 -0
- package/README.md +677 -0
- package/dist/backends.d.ts +54 -0
- package/dist/cli.js +8254 -0
- package/dist/client.d.ts +52 -0
- package/dist/client.js +667 -0
- package/dist/config.d.ts +126 -0
- package/dist/daemon.d.ts +57 -0
- package/dist/defaults.d.ts +20 -0
- package/dist/doctor.d.ts +29 -0
- package/dist/engine-worker.js +256 -0
- package/dist/gateway.d.ts +36 -0
- package/dist/http.d.ts +9 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +3520 -0
- package/dist/kev.d.ts +5 -0
- package/dist/local/decide.d.ts +63 -0
- package/dist/local/engine-types.d.ts +36 -0
- package/dist/local/engine.d.ts +29 -0
- package/dist/local/input.d.ts +4 -0
- package/dist/local/runner.d.ts +71 -0
- package/dist/local/store.d.ts +159 -0
- package/dist/packs/core/fixtures/calibration.jsonl +40 -0
- package/dist/packs/core/fixtures/heldout.jsonl +40 -0
- package/dist/packs/core/pack.yaml +50 -0
- package/dist/profile.d.ts +77 -0
- package/dist/protocol.d.ts +148 -0
- package/dist/qualification.d.ts +22 -0
- package/dist/response.d.ts +10 -0
- package/dist/router.d.ts +62 -0
- package/dist/runtime.d.ts +22 -0
- package/package.json +82 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Sys1Config } from "./config.ts";
|
|
2
|
+
import { type InstalledModel } from "./local/store.ts";
|
|
3
|
+
import type { BackendCandidate, BackendCapabilities } from "./router.ts";
|
|
4
|
+
export declare const HOSTED_BACKEND_NAME = "typesafe";
|
|
5
|
+
export interface RuntimeBackend extends BackendCandidate {
|
|
6
|
+
adapter?: "systemone" | "kev";
|
|
7
|
+
base_url: string;
|
|
8
|
+
headers: Record<string, string>;
|
|
9
|
+
/** Model id forwarded in the request body when the caller did not pin one. */
|
|
10
|
+
default_model: string;
|
|
11
|
+
/**
|
|
12
|
+
* Present when this backend is a builtin local model served by the
|
|
13
|
+
* in-process runner rather than an HTTP endpoint. `base_url` is empty.
|
|
14
|
+
*/
|
|
15
|
+
builtin?: {
|
|
16
|
+
model: InstalledModel;
|
|
17
|
+
path: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface ProbeResult {
|
|
21
|
+
available: boolean;
|
|
22
|
+
models: string[];
|
|
23
|
+
latency_ms: number | null;
|
|
24
|
+
detail: string | null;
|
|
25
|
+
}
|
|
26
|
+
export declare function extractModelIds(body: unknown): string[];
|
|
27
|
+
export declare function extractBackendCapabilities(body: unknown): BackendCapabilities | null;
|
|
28
|
+
/**
|
|
29
|
+
* Build the runtime backend list from config and environment. The hosted Jev
|
|
30
|
+
* backend exists only when enabled and an API key is present in the configured
|
|
31
|
+
* env var; keys are read from the environment, never from the config file.
|
|
32
|
+
* When `home` is given and `local.enabled` is on, every installed GGUF joins
|
|
33
|
+
* as a builtin `local-<id>` pseudo-backend served by the in-process runner.
|
|
34
|
+
* Only config.local.model is eligible for automatic local routing. Other
|
|
35
|
+
* installed models and URL-registered backends require an explicit request pin.
|
|
36
|
+
*/
|
|
37
|
+
export declare function runtimeBackends(config: Sys1Config, env: NodeJS.ProcessEnv, home?: string): RuntimeBackend[];
|
|
38
|
+
export declare function probeBackend(backend: RuntimeBackend, timeoutMs: number, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<ProbeResult>;
|
|
39
|
+
export declare function probeAll(backends: RuntimeBackend[], timeoutMs: number, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<Map<string, ProbeResult>>;
|
|
40
|
+
export type ForwardResult = {
|
|
41
|
+
kind: "response";
|
|
42
|
+
status: number;
|
|
43
|
+
body: string;
|
|
44
|
+
content_type: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "transport";
|
|
47
|
+
detail: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Forward one already-validated System One request body to a backend. Only
|
|
51
|
+
* transport failures (no HTTP response at all) report `transport`; any HTTP
|
|
52
|
+
* response — including backend errors — is definitive and passed through.
|
|
53
|
+
*/
|
|
54
|
+
export declare function forwardToBackend(backend: RuntimeBackend, rawBody: string, resolvedModel: string | undefined, timeoutMs: number, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<ForwardResult>;
|