
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
openai-swarmjs
Advanced tools
Agentic framework inspired from OpenAI's swarm framework in Python for TypeScript and JavaScript.
git clone https://github.com/yourusername/swarmjs.git
cd swarmjs
npm install
.env
file in the root directory and add your OpenAI API key:OPENAI_API_KEY=your_api_key_here
DEBUG=false # Set to true for detailed logging
swarmjs/
├── core/
│ ├── swarm.ts
│ └── types.ts
├── lib/
│ └── swarms/
│ └── DagSwarm.ts
├── examples/
│ ├── simple-agent.ts
│ └── simple-dag-swarm.ts
├── repl.ts
└── package.json
A basic implementation using a single agent to create customized greetings based on timezone:
npm run example:simple-agent
# or
ts-node examples/simple-agent.ts
A more complex implementation using Directed Acyclic Graph (DAG) for planning and execution:
npm run example:dag-swarm
# or
ts-node examples/simple-dag-swarm.ts
Set the DEBUG
environment variable to true
in your .env
file or when running the command:
DEBUG=true npm run example:simple-agent
examples
directoryrunExample
function from repl.ts
package.json
for easy executionExample:
import { runExample } from '../repl';
import { Agent } from '../core/types';
// Define your agent and functions
const myAgent: Agent = {
// Agent configuration
};
runExample('MyExample', () => myAgent);
npm run build
This will:
dist
directorynode dist/examples/simple-agent.js
Add these scripts to your package.json
:
{
"scripts": {
"build": "tsc",
"start": "ts-node repl.ts",
"example:simple-agent": "ts-node examples/simple-agent.ts",
"example:dag-swarm": "ts-node examples/simple-dag-swarm.ts",
"dev": "ts-node-dev --respawn --transpile-only repl.ts",
"lint": "eslint . --ext .ts",
"test": "jest"
}
}
Add these to your package.json
:
{
"dependencies": {
"openai": "^4.0.0",
"dotenv": "^16.0.0",
"chalk": "^4.1.2"
},
"devDependencies": {
"@types/node": "^16.0.0",
"typescript": "^4.5.0",
"ts-node": "^10.0.0",
"ts-node-dev": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.0",
"jest": "^27.0.0",
"@types/jest": "^27.0.0",
"ts-jest": "^27.0.0"
}
}
Add this tsconfig.json
to your project root:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"outDir": "./dist",
"rootDir": "./",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
},
"include": ["./**/*.ts"],
"exclude": ["node_modules", "dist"]
}
MIT
For support, please open an issue in the GitHub repository.
MIT License - see LICENSE for details
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
Agentic framework inspired from OpenAI's swarm framework for TS, JS
The npm package openai-swarmjs receives a total of 152 weekly downloads. As such, openai-swarmjs popularity was classified as not popular.
We found that openai-swarmjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.