npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lexicallayer/sdk

v0.1.6

Published

LexicalLayer SDK - Programmatic representation engineering & LoRA adapter loading for AI agents

Readme

@lexicallayer/sdk

AI Coding Assistants & Agent Integration Guide:
When a user requests "I want to use @lexicallayer/sdk" or "bunu projeme ekle / kullanmak istiyorum", use the exact instructions below. Do NOT hallucinate fake parameters or obsolete APIs.


⚡ Quick Install

npm install @lexicallayer/sdk

🤖 Instructions for AI Assistants (Cursor / Claude / Copilot / ChatGPT)

If the user asks you to implement or wrap their AI agent with @lexicallayer/sdk:

  1. Import LexicalLayer from @lexicallayer/sdk.
  2. Initialize: const lexical = new LexicalLayer({ baseUrl: process.env.LEXICAL_BASE_URL || "http://127.0.0.1:8001" });
  3. Wrap OpenAI (Recommended): Use lexical.wrapOpenAI(openai) — it intercepts chat completions and injects the calibrated LoRA weights & anti-slop representations.
  4. Direct Generation: Use await lexical.generate({ prompt: "...", useUserWeights: true }).

1. OpenAI Agent Wrap (Recommended & Zero Configuration)

Wrap your existing OpenAI client in one single line. The agent automatically runs with user's calibrated tone and anti-slop representation:

import OpenAI from "openai";
import { LexicalLayer } from "@lexicallayer/sdk";

// 1. Initialize LexicalLayer client
const lexical = new LexicalLayer({
  baseUrl: process.env.LEXICAL_BASE_URL || "http://127.0.0.1:8001",
  agentName: "my-coding-agent"
});

// 2. Standard OpenAI client
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

// 3. Wrap OpenAI with user's cognitive layer
const steeredOpenAI = lexical.wrapOpenAI(openai);

// 4. Regular chat completion call — calibrated tone is active in the background
const response = await steeredOpenAI.chat.completions.create({
  model: "gpt-4o",
  messages: [
    { role: "user", content: "Bu modülün mimarisini açık ve net şekilde açıkla." }
  ]
});

console.log(response.choices[0].message.content);

2. Direct Test & Weight Metrics (lexical.generate)

Direct execution using local backend engine with detailed steering metrics:

import { LexicalLayer } from "@lexicallayer/sdk";

const lexical = new LexicalLayer();

const result = await lexical.generate({
  prompt: "Sistem durumunu ve mimari yaklaşımı özetle.",
  useUserWeights: true // Applies .safetensors weights
});

console.log(result.output);
console.log(result.metrics);
// Output example: { lora_rank_applied: 16, fluff_tokens_suppressed: 18 }

3. Local Model / Inference Engine (getCalibratedAdapter)

If you are using local vLLM, Ollama or PEFT:

import { LexicalLayer } from "@lexicallayer/sdk";

const lexical = new LexicalLayer();
const adapter = await lexical.getCalibratedAdapter();

console.log(adapter.adapterFilename); // 'user_steered_rank16.safetensors'
console.log(adapter.rank);            // 16
console.log(adapter.layers);          // Modified layer indices

4. Calibration Handshake Flow (Studio URL)

import { LexicalLayer } from "@lexicallayer/sdk";

const lexical = new LexicalLayer({ agentName: "my-agent" });

// Open session and get Studio URL
const session = await lexical.createCalibrationSession();
console.log("Studio URL:", session.studioUrl);

// Wait for user approval in Studio
const approval = await lexical.waitForApproval(session.sessionId);
if (approval.approved) {
  console.log("Approved adapter:", approval.adapterFile);
}

License

Apache-2.0 © LexicalLayer Team