Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

network-ai

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

network-ai - npm Package Compare versions

Comparing version
3.4.1
to
3.5.0
+124
dist/lib/blackboard-backend.d.ts
/**
* Pluggable Backend API for Named Blackboards
*
* Defines the `BlackboardBackend` interface that abstracts the storage layer
* used by `SharedBlackboard`. Two built-in implementations are provided:
*
* - `FileBackend` — persisted to disk via LockedBlackboard (default)
* - `MemoryBackend` — pure in-memory, no disk writes (testing / ephemeral boards)
*
* Custom backends (Redis, CRDT, cloud storage, etc.) can be implemented by
* satisfying the `BlackboardBackend` interface and passing the instance to
* `orchestrator.getBlackboard(name, { backend: myBackend })`.
*
* @module BlackboardBackend
* @version 1.0.0
* @license MIT
*/
import type { BlackboardEntry } from './locked-blackboard';
export type { BlackboardEntry };
/**
* Storage abstraction for a `SharedBlackboard` instance.
*
* Implement this interface to plug in any storage backend:
* file system, Redis, an in-memory Map, a cloud KV store, etc.
*
* @example
* ```typescript
* class RedisBackend implements BlackboardBackend {
* constructor(private client: RedisClient) {}
* read(key: string) { ... }
* write(key, value, sourceAgent, ttl) { ... }
* delete(key) { ... }
* listKeys() { ... }
* getSnapshot() { ... }
* }
* const board = orchestrator.getBlackboard('prod', { backend: new RedisBackend(client) });
* ```
*/
export interface BlackboardBackend {
/**
* Read a single entry. Returns `null` if not found or expired.
*/
read(key: string): BlackboardEntry | null;
/**
* Write a value. Returns the stored entry including generated metadata.
* @param key The entry key
* @param value Any JSON-serializable value
* @param sourceAgent The agent performing the write
* @param ttl Optional time-to-live in seconds
*/
write(key: string, value: unknown, sourceAgent: string, ttl?: number): BlackboardEntry;
/**
* Delete an entry by key. Returns `true` if it existed.
*/
delete(key: string): boolean;
/**
* Return all non-expired keys.
*/
listKeys(): string[];
/**
* Return a full snapshot of all non-expired entries, keyed by entry key.
*/
getSnapshot(): Record<string, BlackboardEntry>;
}
/**
* File-backed persistent storage using `LockedBlackboard`.
*
* All writes are atomic and file-locked. Data survives process restarts.
* This is the default backend used when no `backend` option is provided to
* `orchestrator.getBlackboard()`.
*
* @example
* ```typescript
* const board = orchestrator.getBlackboard('reports', {
* backend: new FileBackend('./data/reports'),
* });
* ```
*/
export declare class FileBackend implements BlackboardBackend {
private lb;
constructor(basePath: string);
read(key: string): BlackboardEntry | null;
write(key: string, value: unknown, sourceAgent: string, ttl?: number): BlackboardEntry;
delete(key: string): boolean;
listKeys(): string[];
getSnapshot(): Record<string, BlackboardEntry>;
}
/**
* Pure in-memory backend — data lives only for the lifetime of the process.
*
* Ideal for:
* - Unit testing (no temp directories, instant, isolated)
* - Short-lived ephemeral boards
* - Read-heavy caches that don't need persistence
*
* Thread-safety note: Node.js is single-threaded; no locking is needed for
* in-process use. For multi-process scenarios use `FileBackend` or a
* distributed backend (Redis, etc.).
*
* @example
* ```typescript
* const board = orchestrator.getBlackboard('ephemeral', {
* backend: new MemoryBackend(),
* });
* ```
*/
export declare class MemoryBackend implements BlackboardBackend {
private store;
private isExpired;
read(key: string): BlackboardEntry | null;
write(key: string, value: unknown, sourceAgent: string, ttl?: number): BlackboardEntry;
delete(key: string): boolean;
listKeys(): string[];
getSnapshot(): Record<string, BlackboardEntry>;
/**
* Clear all entries. Useful for test teardown.
*/
clear(): void;
/**
* Returns the current entry count (including expired entries not yet evicted).
*/
size(): number;
}
//# sourceMappingURL=blackboard-backend.d.ts.map
{"version":3,"file":"blackboard-backend.d.ts","sourceRoot":"","sources":["../../lib/blackboard-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,YAAY,EAAE,eAAe,EAAE,CAAC;AAMhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,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AG,OAAO;IAI5B,QAAQ,IAAI,MAAM,EAAE;IAMpB,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAU9C;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,IAAI,IAAI,MAAM;CAGf"}
"use strict";
/**
* Pluggable Backend API for Named Blackboards
*
* Defines the `BlackboardBackend` interface that abstracts the storage layer
* used by `SharedBlackboard`. Two built-in implementations are provided:
*
* - `FileBackend` — persisted to disk via LockedBlackboard (default)
* - `MemoryBackend` — pure in-memory, no disk writes (testing / ephemeral boards)
*
* Custom backends (Redis, CRDT, cloud storage, etc.) can be implemented by
* satisfying the `BlackboardBackend` interface and passing the instance to
* `orchestrator.getBlackboard(name, { backend: myBackend })`.
*
* @module BlackboardBackend
* @version 1.0.0
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryBackend = exports.FileBackend = void 0;
const locked_blackboard_1 = require("./locked-blackboard");
// ============================================================================
// FILE BACKEND (default — wraps LockedBlackboard)
// ============================================================================
/**
* File-backed persistent storage using `LockedBlackboard`.
*
* All writes are atomic and file-locked. Data survives process restarts.
* This is the default backend used when no `backend` option is provided to
* `orchestrator.getBlackboard()`.
*
* @example
* ```typescript
* const board = orchestrator.getBlackboard('reports', {
* backend: new FileBackend('./data/reports'),
* });
* ```
*/
class FileBackend {
lb;
constructor(basePath) {
this.lb = new locked_blackboard_1.LockedBlackboard(basePath);
}
read(key) {
return this.lb.read(key);
}
write(key, value, sourceAgent, ttl) {
return this.lb.write(key, value, sourceAgent, ttl);
}
delete(key) {
return this.lb.delete(key);
}
listKeys() {
return this.lb.listKeys();
}
getSnapshot() {
return this.lb.getSnapshot();
}
}
exports.FileBackend = FileBackend;
// ============================================================================
// MEMORY BACKEND (pure in-memory, no disk)
// ============================================================================
/**
* Pure in-memory backend — data lives only for the lifetime of the process.
*
* Ideal for:
* - Unit testing (no temp directories, instant, isolated)
* - Short-lived ephemeral boards
* - Read-heavy caches that don't need persistence
*
* Thread-safety note: Node.js is single-threaded; no locking is needed for
* in-process use. For multi-process scenarios use `FileBackend` or a
* distributed backend (Redis, etc.).
*
* @example
* ```typescript
* const board = orchestrator.getBlackboard('ephemeral', {
* backend: new MemoryBackend(),
* });
* ```
*/
class MemoryBackend {
store = new Map();
isExpired(entry) {
if (!entry.ttl)
return false;
return Date.now() > new Date(entry.timestamp).getTime() + entry.ttl * 1000;
}
read(key) {
const entry = this.store.get(key);
if (!entry || this.isExpired(entry))
return null;
return entry;
}
write(key, value, sourceAgent, ttl) {
const existing = this.store.get(key);
const version = existing ? existing.version + 1 : 1;
const entry = {
key,
value,
source_agent: sourceAgent,
timestamp: new Date().toISOString(),
ttl: ttl ?? null,
version,
};
this.store.set(key, entry);
return entry;
}
delete(key) {
return this.store.delete(key);
}
listKeys() {
return Array.from(this.store.entries())
.filter(([, entry]) => !this.isExpired(entry))
.map(([key]) => key);
}
getSnapshot() {
const result = {};
for (const [key, entry] of this.store.entries()) {
if (!this.isExpired(entry)) {
result[key] = entry;
}
}
return result;
}
/**
* Clear all entries. Useful for test teardown.
*/
clear() {
this.store.clear();
}
/**
* Returns the current entry count (including expired entries not yet evicted).
*/
size() {
return this.store.size;
}
}
exports.MemoryBackend = MemoryBackend;
//# sourceMappingURL=blackboard-backend.js.map
{"version":3,"file":"blackboard-backend.js","sourceRoot":"","sources":["../../lib/blackboard-backend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,2DAAuD;AA2DvD,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAE/E;;;;;;;;;;;;;GAaG;AACH,MAAa,WAAW;IACd,EAAE,CAAmB;IAE7B,YAAY,QAAgB;QAC1B,IAAI,CAAC,EAAE,GAAG,IAAI,oCAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,GAAW;QACd,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC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AC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;CACF;AA9DD,sCA8DC"}
+21
-1

@@ -13,2 +13,3 @@ /**

import type { ConflictResolutionStrategy, AgentPriority, LockedBlackboardOptions } from './lib/locked-blackboard';
import type { BlackboardBackend } from './lib/blackboard-backend';
import { QualityGateAgent } from './lib/blackboard-validator';

@@ -222,2 +223,19 @@ import type { ValidationConfig, AIReviewCallback } from './lib/blackboard-validator';

validationConfig?: Partial<ValidationConfig>;
/**
* Pluggable storage backend for this board.
*
* - Omit (default): `FileBackend` — persisted to disk at `<workspacePath>/boards/<name>/`
* - `new MemoryBackend()`: pure in-memory, no disk writes
* - Custom class implementing `BlackboardBackend`: Redis, CRDT, cloud KV, etc.
*
* @example
* ```typescript
* // Ephemeral board (testing / short-lived tasks)
* const board = orchestrator.getBlackboard('tmp', { backend: new MemoryBackend() });
*
* // Custom Redis backend
* const board = orchestrator.getBlackboard('prod', { backend: new RedisBackend(client) });
* ```
*/
backend?: BlackboardBackend;
}

@@ -290,3 +308,3 @@ /** A single task within a parallel execution batch. */

private agentNamespaces;
constructor(basePath: string);
constructor(backendOrPath: string | BlackboardBackend);
/**

@@ -658,2 +676,4 @@ * Register a verified agent identity. Only agents with registered tokens

export type { ConflictResolutionStrategy, AgentPriority, LockedBlackboardOptions };
export { FileBackend, MemoryBackend } from './lib/blackboard-backend';
export type { BlackboardBackend } from './lib/blackboard-backend';
export { Logger, LogLevel } from './lib/logger';

@@ -660,0 +680,0 @@ export type { LogEntry, LogTransport, LoggerConfig } from './lib/logger';

+5
-5

@@ -273,3 +273,3 @@ "use strict";

`;
(0, fs_1.writeFileSync)(this.blackboardPath, content, 'utf-8');
(0, fs_1.writeFileSync)(this.blackboardPath, content, { encoding: 'utf-8', mode: 0o600 });
}

@@ -367,3 +367,3 @@ computeHash(content) {

`;
(0, fs_1.writeFileSync)(this.blackboardPath, content, 'utf-8');
(0, fs_1.writeFileSync)(this.blackboardPath, content, { encoding: 'utf-8', mode: 0o600 });
}

@@ -382,3 +382,3 @@ finally {

const filePath = (0, path_1.join)(this.pendingDir, `${change.change_id}.json`);
(0, fs_1.writeFileSync)(filePath, JSON.stringify(change, null, 2));
(0, fs_1.writeFileSync)(filePath, JSON.stringify(change, null, 2), { encoding: 'utf-8', mode: 0o600 });
}

@@ -394,3 +394,3 @@ archivePendingChange(change) {

if ((0, fs_1.existsSync)(sourcePath)) {
(0, fs_1.writeFileSync)(archivePath, JSON.stringify(change, null, 2));
(0, fs_1.writeFileSync)(archivePath, JSON.stringify(change, null, 2), { encoding: 'utf-8', mode: 0o600 });
(0, fs_1.unlinkSync)(sourcePath);

@@ -756,3 +756,3 @@ }

`;
(0, fs_1.writeFileSync)(this.blackboardPath, content, 'utf-8');
(0, fs_1.writeFileSync)(this.blackboardPath, content, { encoding: 'utf-8', mode: 0o600 });
}

@@ -759,0 +759,0 @@ // ==========================================================================

{
"name": "network-ai",
"version": "3.4.1",
"version": "3.5.0",
"description": "AI agent orchestration framework for TypeScript/Node.js - plug-and-play multi-agent coordination with 12 frameworks (LangChain, AutoGen, CrewAI, OpenAI Assistants, LlamaIndex, Semantic Kernel, Haystack, DSPy, Agno, MCP, OpenClaw). Built-in security, swarm intelligence, and agentic workflow patterns.",

@@ -18,3 +18,4 @@ "main": "dist/index.js",

"test:phase5": "npx ts-node test-phase5.ts",
"test:all": "npx ts-node test-standalone.ts && npx ts-node test-security.ts && npx ts-node test-adapters.ts && npx ts-node test-priority.ts && npx ts-node test-phase4.ts && npx ts-node test-phase5.ts",
"test:phase5b": "npx ts-node test-phase5b.ts",
"test:all": "npx ts-node test-standalone.ts && npx ts-node test-security.ts && npx ts-node test-adapters.ts && npx ts-node test-priority.ts && npx ts-node test-phase4.ts && npx ts-node test-phase5.ts && npx ts-node test-phase5b.ts",
"setup": "npx ts-node setup.ts",

@@ -21,0 +22,0 @@ "setup:check": "npx ts-node setup.ts --check",

@@ -7,3 +7,3 @@ # Network-AI: Multi-Agent Orchestration Framework

[![CodeQL](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/codeql.yml/badge.svg)](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/codeql.yml)
[![Release](https://img.shields.io/badge/release-v3.4.1-blue.svg)](https://github.com/jovanSAPFIONEER/Network-AI/releases)
[![Release](https://img.shields.io/badge/release-v3.5.0-blue.svg)](https://github.com/jovanSAPFIONEER/Network-AI/releases)
[![npm](https://img.shields.io/npm/dw/network-ai.svg?label=npm%20downloads)](https://www.npmjs.com/package/network-ai)

@@ -17,3 +17,3 @@ [![ClawHub](https://img.shields.io/badge/ClawHub-network--ai-orange.svg)](https://clawhub.ai/skills/network-ai)

[![AgentSkills](https://img.shields.io/badge/AgentSkills-compatible-orange.svg)](https://agentskills.io)
[![Tests](https://img.shields.io/badge/tests-497%20passing-brightgreen.svg)](#testing)
[![Tests](https://img.shields.io/badge/tests-552%20passing-brightgreen.svg)](#testing)
[![Adapters](https://img.shields.io/badge/frameworks-12%20supported-blueviolet.svg)](#adapter-system)

@@ -218,2 +218,3 @@ [![RSS Feed](https://img.shields.io/badge/RSS-releases-orange?logo=rss)](https://github.com/jovanSAPFIONEER/Network-AI/releases.atom)

|-- test-phase5.ts # Phase 5 Named Multi-Blackboard tests (35 tests)
|-- test-phase5b.ts # Phase 5 Part 2 Pluggable Backend tests (55 tests)
|-- test-ai-quality.ts # AI quality gate demo

@@ -300,2 +301,3 @@ |-- test.ts # Full integration test suite

npm run test:phase5 # Phase 5 Named Multi-Blackboard (35 tests)
npm run test:phase5b # Phase 5 Part 2 Pluggable Backend (55 tests)
npm run test:all # All suites in sequence

@@ -302,0 +304,0 @@ ```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet