@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
80 lines (79 loc) • 3.63 kB
TypeScript
import { NeuroLink } from "../neurolink.js";
import type { ClassifierRouterConfig, ConversationMemoryConfig, LoopSessionState, SessionVariableValue, SkillsConfig, ToolRoutingConfig } from "../types/index.js";
export declare class GlobalSessionManager {
private static instance;
private loopSession;
/** Optional tool-routing config set by CLI handlers before SDK construction. */
private _toolRoutingConfig;
/** Optional classifier-router config set by CLI handlers before SDK construction. */
private _classifierRouterConfig;
/** Optional skills config set by CLI handlers before SDK construction. */
private _skillsConfig;
private _fileToolRoots;
static getInstance(): GlobalSessionManager;
setLoopSession(config?: ConversationMemoryConfig): string;
/**
* Restore a loop session with an existing sessionId and NeuroLink instance
* Used for conversation restoration
*/
restoreLoopSession(sessionId: string, neurolinkInstance: NeuroLink, config?: ConversationMemoryConfig, sessionVariables?: Record<string, SessionVariableValue>): void;
/**
* Update session variables during restoration
*/
restoreSessionVariables(variables: Record<string, SessionVariableValue>): void;
/**
* Check if a session is currently active
*/
hasActiveSession(): boolean;
/**
* Get current session metadata for restoration purposes
*/
getSessionMetadata(): {
sessionId?: string;
conversationMemoryConfig?: ConversationMemoryConfig;
sessionVariables: Record<string, SessionVariableValue>;
isActive: boolean;
};
/**
* Update the sessionId of the current session (used during restoration)
*/
updateSessionId(newSessionId: string): void;
getLoopSession(): LoopSessionState | null;
clearLoopSession(): void;
/**
* Store a tool-routing config to be injected at SDK construction time.
* Call this BEFORE `getOrCreateNeuroLink()` inside a command handler.
* When a loop session is already active the config is ignored (the instance
* already exists).
*/
setToolRoutingConfig(config: ToolRoutingConfig): void;
/**
* Store a classifier-router config to be injected at SDK construction time.
* Call this BEFORE `getOrCreateNeuroLink()` inside a command handler.
* When a loop session is already active the config is ignored (the instance
* already exists).
*/
setClassifierRouterConfig(config: ClassifierRouterConfig): void;
/**
* Store a skills config to be injected at SDK construction time.
* Call this BEFORE `getOrCreateNeuroLink()` inside a command handler.
* When a loop session is already active the config is ignored (the instance
* already exists).
*/
setSkillsConfig(config: SkillsConfig): void;
/**
* Store file-tool roots (`--tool-root`) to be injected at SDK construction
* time as `tools.fileRoots`. Call this BEFORE `getOrCreateNeuroLink()`.
* When a loop session is already active the roots are ignored (the
* instance already exists).
*/
setFileToolRoots(roots: string[] | undefined): void;
getOrCreateNeuroLink(): NeuroLink;
getCurrentSessionId(): string | undefined;
setSessionVariable(key: string, value: SessionVariableValue): void;
getSessionVariable(key: string): SessionVariableValue | undefined;
getSessionVariables(): Record<string, SessionVariableValue>;
unsetSessionVariable(key: string): boolean;
clearSessionVariables(): void;
}
export declare const globalSession: GlobalSessionManager;