Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1import type * as core from "./core.js";2import type { $ZodType } from "./schemas.js";3 4export const $output: unique symbol = Symbol("ZodOutput");5export type $output = typeof $output;6export const $input: unique symbol = Symbol("ZodInput");7export type $input = typeof $input;8 9export type $replace<Meta, S extends $ZodType> = Meta extends $output10 ? core.output<S>11 : Meta extends $input12 ? core.input<S>13 : Meta extends (infer M)[]14 ? $replace<M, S>[]15 : Meta extends (...args: infer P) => infer R16 ? (17 ...args: {18 [K in keyof P]: $replace<P[K], S>; // tuple19 }20 ) => $replace<R, S>21 : // handle objects22 Meta extends object23 ? { [K in keyof Meta]: $replace<Meta[K], S> }24 : Meta;25 26type MetadataType = object | undefined;27export class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {28 _meta!: Meta;29 _schema!: Schema;30 _map: WeakMap<Schema, $replace<Meta, Schema>> = new WeakMap();31 _idmap: Map<string, Schema> = new Map();32 33 add<S extends Schema>(34 schema: S,35 ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]36 ): this {37 const meta: any = _meta[0];38 this._map.set(schema, meta!);39 if (meta && typeof meta === "object" && "id" in meta) {40 this._idmap.set(meta.id!, schema);41 }42 return this as any;43 }44 45 clear(): this {46 this._map = new WeakMap();47 this._idmap = new Map();48 return this;49 }50 51 remove(schema: Schema): this {52 const meta: any = this._map.get(schema);53 if (meta && typeof meta === "object" && "id" in meta) {54 this._idmap.delete(meta.id!);55 }56 this._map.delete(schema);57 return this;58 }59 60 get<S extends Schema>(schema: S): $replace<Meta, S> | undefined {61 // return this._map.get(schema) as any;62 63 // inherit metadata64 const p = schema._zod.parent as Schema;65 if (p) {66 const pm: any = { ...(this.get(p) ?? {}) };67 delete pm.id; // do not inherit id68 const f = { ...pm, ...this._map.get(schema) } as any;69 return Object.keys(f).length ? f : undefined;70 }71 return this._map.get(schema) as any;72 }73 74 has(schema: Schema): boolean {75 return this._map.has(schema);76 }77}78 79export interface JSONSchemaMeta {80 id?: string | undefined;81 title?: string | undefined;82 description?: string | undefined;83 deprecated?: boolean | undefined;84 [k: string]: unknown;85}86 87export interface GlobalMeta extends JSONSchemaMeta {}88 89// registries90export function registry<T extends MetadataType = MetadataType, S extends $ZodType = $ZodType>(): $ZodRegistry<T, S> {91 return new $ZodRegistry<T, S>();92}93 94interface GlobalThisWithRegistry {95 /**96 * The globalRegistry instance shared across both CommonJS and ESM builds.97 * By attaching the registry to `globalThis`, this property ensures a single, deduplicated instance98 * is used regardless of whether the package is loaded via `require` (CJS) or `import` (ESM).99 * This prevents dual package hazards and keeps registry state consistent.100 */101 __zod_globalRegistry?: $ZodRegistry<GlobalMeta>;102}103 104(globalThis as GlobalThisWithRegistry).__zod_globalRegistry ??= registry<GlobalMeta>();105export const globalRegistry: $ZodRegistry<GlobalMeta> = (globalThis as GlobalThisWithRegistry).__zod_globalRegistry!;106 