vasp-sdk
v1.0.3
Published
SDK for Vectorized Agent Synaptic Protocol (VASP) enabling AI-to-AI state synchronization and task delegation
Maintainers
Readme
Vectorized Agent Synaptic Protocol (VASP) SDK
A transport-agnostic, lightweight JavaScript SDK enabling AIs to coordinate sessions, synchronize conversational state, and delegate tasks across different runtimes, applications, and LLM backends.
Features
- 🤖 AI-to-AI Handshake Negotiation (
hello): Session setup with automated ACK check handshakes. - 🧠 State & Memory Synchronization (
memory.sync): Pack and transmit conversation memory deltas (S-Deltas) without token-heavy full chat histories. - 📝 Task Delegation & Tool Requests (
task.request): Request other agents to execute tasks (e.g., query APIs, search databases) and receive structured tool results. - 🔌 Transport Agnostic: Works seamlessly over WebSockets, HTTP REST APIs, Chrome Extension messaging ports, or IPC channels.
Installation
Once published to NPM:
npm install vasp-sdkOr install directly from your repository:
npm install git+https://github.com/Aadithyanas/wpbot.git#mainQuick Start Guide
1. Initializing the Synaptic Gateway (Server Router)
Expose a VASP Gateway to manage active sessions and validate incoming frames.
const { VaspGateway } = require("vasp-sdk");
// Create Gateway Instance
const gateway = new VaspGateway({ gatewayId: "nexa-synaptic-router" });
// Bind Memory Sync Observer
gateway.onMemorySync(async (packet, replySender) => {
console.log(`Received context delta from ${packet.from.agent}:`, packet.delta.content);
// Save to vector database / pgvector...
// Reply back to notify client of ingestion
if (replySender) {
await replySender({
version: "1.0",
id: `msg_sync_ack_${Date.now()}`,
timestamp: Date.now(),
type: "memory.sync",
from: { agent: "nexa-synaptic-router" },
to: { agent: packet.from.agent },
delta: { role: "assistant", content: "Context delta received and indexed." }
});
}
});
// Link incoming network frames to Gateway handler
// (Example: Express WebSocket Server)
wss.on("connection", (ws) => {
ws.on("message", async (data) => {
const packet = JSON.parse(data);
await gateway.handleIncoming(packet, async (replyPacket) => {
ws.send(JSON.stringify(replyPacket));
});
});
});2. Initializing the Edge Client (Active UI Tab/Agent)
Instantiate a VaspClient and plug in a transport callback to send packets.
const { VaspClient } = require("vasp-sdk");
const WebSocket = require("ws");
const ws = new WebSocket("ws://localhost:8080");
// Initialize Client Instance
const client = new VaspClient({
sessionId: "sess_chrome_sync_101",
senderId: "claude-agent-aadithyan",
targetId: "nexa-synaptic-router",
onSend: async (packet) => {
// Transmit packet over WebSockets
ws.send(JSON.stringify(packet));
}
});
// Bind incoming network frames to client handler
ws.on("message", (data) => {
const packet = JSON.parse(data);
client.handleIncoming(packet);
});
// Establish connection handshake
ws.on("open", async () => {
try {
console.log("WebSocket open. Initiating handshake...");
await client.handshake();
console.log("Synaptic session established!");
// Send a conversation memory update (S-Delta)
await client.sendMemorySync("User wants to build a CRM database table named LeadFlow");
} catch (err) {
console.error("Session initialization failed:", err.message);
}
});API Specifications
VaspClient
constructor({ sessionId, senderId, targetId, onSend })async handshake(): Sendshelloand awaitshello_ackreply.async sendMemorySync(content, [metadata]): Dispatches dialog state deltas.async sendTaskRequest(taskName, args, [priority]): Requests tool execution.handleIncoming(packet): Feeds incoming network payloads back into the client engine.- Listeners:
onMemorySync(callback)onTaskResponse(callback)onCapabilities(callback)onError(callback)
VaspGateway
constructor({ gatewayId })validatePacket(packet): Validates format version and parameters.async handleIncoming(packet, replySender): Parses and routes client frames.- Listeners:
onHello(callback)onMemorySync(callback)onTaskRequest(callback)onError(callback)
🛠️ VASP Project Synapse CLI
The SDK includes a built-in CLI to manage state handovers directly inside your local developer workspace (such as in Cursor, VS Code, or shell-based agents).
1. Initialize Synapse Files
Creates the hidden .vasp/ folder containing default synapse.json (state tracking) and plan.md (active checklist).
npx vasp init2. Record Workspace Changes
Manually updates the local synapse.json file with git diff stats. You can optionally log the active AI model name and focused files:
npx vasp record --model claude-3-opus --focus controllers/whatsappController.js3. Start Auto-Watcher Daemon (Automatic Sync)
Starts a background watcher to automatically monitor and record file changes, updating your .vasp/synapse.json history on every file save:
npx vasp watch4. Display Synaptic State (Handover Prompt)
Outputs a compiled, structured Markdown prompt representing the project state. Feed this output directly to the new model when switching AIs to instantly align context:
npx vasp statusLicense
MIT License. © 2026 Aadithyan A. S., Nexa AI Core Team.
