NOVA Documentation
JavaScript / TypeScript
On this page
- Create a clientPoint the client at the local NOVA service.
- Inspect service and modelCheck health and retrieve model metadata before choosing the request shape.
- Call prediction or memory operationsSend the matching feature vector or use the documented memory methods.
- Handle the resultRead the response, handle connection or input errors, and pass data to your application or StateGraph.
The npm SDK exposes a client for the local NOVA server and a native workflow engine. Start the server before testing network calls.
The nova-llm npm package provides strict TypeScript definitions, native ESM & CommonJS modules, and a built-in REST client and StateGraph workflow engine.
8.1 Installation & Client Initialization
Install from npm:
npm install nova-llmInitialize NovaClient:
import { NovaClient } from 'nova-llm';
const client = new NovaClient({
baseUrl: 'http://127.0.0.1:8000', // Default local serving URL
timeout: 30000, // 30-second timeout
headers: {
'X-Custom-Client': 'NodeJS-Worker'
}
});8.2 Deterministic Inference & Model Introspection
// Check service health
const health = await client.health();
console.log('Serving Status:', health.status);
// Query model metadata
const info = await client.getModelInfo();
console.log(`Model: ${info.model_name} | State Dim: ${info.state_dim} | Memory Slots: ${info.memory_capacity}`);
// Run inference with execution trace
const features = [0.25, -0.80, 0.45, 0.10, -0.60, 0.35, -0.15, 0.90];
const prediction = await client.predict(features, { returnTrace: true });
console.log('Prediction Vector:', prediction.prediction);
console.log('Novelty:', prediction.avg_novelty);
console.log('Uncertainty:', prediction.avg_uncertainty);
console.log('Refinement Passes:', prediction.compute_action);8.3 Dynamic Resonance Memory CRUD Operations
// 1. Inspect DRM Memory Bank
const { records, total } = await client.memory.inspect();
console.log(`Total Stored Memory Records: ${total}`);
// 2. Commit a new transactional memory record
const writeResult = await client.memory.write({
key: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
value: [1.0, 0.0, 0.5],
confidence: 0.95,
metadata: { source: 'edge_sensor_1', tag: 'calibration_anchor' }
});
console.log('Memory Written:', writeResult.record_id, writeResult.status);
// 3. Delete record by ID
const deleteResult = await client.memory.delete(writeResult.record_id);
console.log('Memory Deleted:', deleteResult.status);8.4 Full-Stack Agentic StateGraph & Pipeline Engine
Build production-grade agentic routing workflows directly in Node.js or the browser without LangGraph:
import { NovaClient, Graph } from 'nova-llm';
const client = new NovaClient();
const graph = new Graph('multimodal_agent');
// Node 1: Ingestion & Feature Normalization
graph.addNode('ingest', (state) => ({
normalized: state.raw.map((v: number) => Math.max(-1, Math.min(1, v)))
}));
// Node 2: Deterministic Model Inference
graph.addNode('inference', async (state) => {
const res = await client.predict(state.normalized);
return {
output: res.prediction,
novelty: res.avg_novelty,
uncertainty: res.avg_uncertainty
};
});
// Node 3: Anomaly Handler
graph.addNode('record_anomaly', async (state) => {
await client.memory.write({
key: state.normalized,
value: state.output,
confidence: 0.80,
metadata: { reason: 'high_novelty_edge_event' }
});
return { action: 'ANOMALY_COMMITTED_TO_MEMORY' };
});
// Node 4: Standard Response
graph.addNode('dispatch_result', (state) => ({
action: 'DISPATCHED_TO_USER'
}));
// Setup Routing
graph.setEntryPoint('ingest');
graph.addEdge('ingest', 'inference');
graph.addConditionalEdge('inference', (state) =>
state.novelty > 0.5 ? 'record_anomaly' : 'dispatch_result'
);
graph.addTerminal('record_anomaly');
graph.addTerminal('dispatch_result');
// Execute Workflow
const finalState = await graph.run({
raw: [0.15, -0.92, 0.44, 0.12, -0.35, 0.88, -0.11, 0.75]
});
console.log('Execution History:', finalState._history.join(' -> '));
console.log('Final Action:', finalState.action);8.5 TypeScript Type Definitions
export interface ClientOptions {
baseUrl?: string;
timeout?: number;
headers?: Record<string, string>;
}
export interface PredictResponse {
prediction: number[] | number[][];
avg_novelty: number;
avg_uncertainty: number;
compute_action: number;
trace?: {
steps: Array<{
step: number;
novelty: number;
uncertainty: number;
refinement_passes: number;
}>;
};
}
export interface MemoryRecord {
id: string;
confidence: number;
utility: number;
age: number;
metadata?: Record<string, any>;
}