@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
59 lines (58 loc) • 2.81 kB
TypeScript
/**
* Built-in skill stores + the storage-config factory.
*
* First-party backends: in-process memory (tests, embedded), filesystem
* (curator-style JSON alongside Claude-skills-style markdown — `<name>.md`
* or `<name>/SKILL.md` with YAML frontmatter), S3 (skillStoreS3.ts, optional
* @aws-sdk/client-s3 peer), and Redis (skillStoreRedis.ts, pooled core
* client). Anything else plugs in via `{ type: "custom", store }`.
*/
import type { SkillDefinition, SkillIndexItem, SkillStore, SkillsStorageConfig } from "../types/index.js";
/** In-process store backed by a Map. */
export declare class InMemorySkillStore implements SkillStore {
private skills;
/** skill id → relative path → content. */
private resources;
constructor(seed?: SkillDefinition[], resources?: Record<string, Record<string, string>>);
get(id: string): Promise<SkillDefinition | null>;
put(skill: SkillDefinition): Promise<void>;
delete(id: string): Promise<void>;
index(): Promise<SkillIndexItem[]>;
getResource(id: string, resourcePath: string): Promise<string | null>;
}
/**
* Directory-backed store. Read layouts:
* - `<dir>/<id>.json` — JSON SkillDefinition (mutable)
* - `<dir>/<name>.md` — frontmatter markdown (read-only source)
* - `<dir>/<name>/SKILL.md` — Claude-skills directory layout (read-only source);
* sibling files become on-demand resources (read_skill_resource)
* Mutations always write `<id>.json`; a JSON file shadows a markdown skill
* with the same id, so updating a markdown-sourced skill "copies up" to JSON.
*/
export declare class FileSystemSkillStore implements SkillStore {
private readonly baseDir;
private cache;
/** skill id → directory, for skills loaded from the SKILL.md layout. */
private skillDirs;
constructor(baseDir: string);
invalidate(): void;
get(id: string): Promise<SkillDefinition | null>;
/**
* Resources exist only for directory-layout skills (`<name>/SKILL.md`) —
* every sibling file of SKILL.md is addressable by its relative path.
* The REAL path must stay inside the skill directory: lexical
* containment alone would follow a symlink planted inside the skill dir
* to anywhere on the host.
*/
getResource(id: string, resourcePath: string): Promise<string | null>;
put(skill: SkillDefinition): Promise<void>;
delete(id: string): Promise<void>;
index(): Promise<SkillIndexItem[]>;
/**
* Scan the directory into an id→skill map. Markdown sources load first
* so JSON files (the mutable layer) shadow them on id collision.
*/
private load;
}
/** Resolve a storage config to a concrete store. Defaults to memory. */
export declare function createSkillStore(config?: SkillsStorageConfig): SkillStore;