{"id":18810,"library":"soclaw-middleware-anything","title":"Soclaw Middleware Anything","description":"Gateway middleware node runtime v1.0.4 that embeds Express health endpoints and routes remote WebSocket commands to a local command-registry. Supports Node modules, Python/ESM subprocesses, and CLI-scripted execution. Manifest-driven command loading from built-in JSON, environment variables, or runtime API injection. Requires Node.js ≥18. Built with esbuild to produce dist/ entry points. Key differentiator: dynamic command injection without modifying the core package, via external manifest files, env vars, or programmatic applyManifestLayer. Includes a CLI binary for debugging/scripting. Uses cross-env for Windows compatibility. Release cadence: unknown, single published version.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/sobey/soclaw-middleware-anything","tags":["javascript","soclaw","gateway","middleware","websocket","cli","manifest","express","automation"],"install":[{"cmd":"npm install soclaw-middleware-anything","lang":"bash","label":"npm"},{"cmd":"yarn add soclaw-middleware-anything","lang":"bash","label":"yarn"},{"cmd":"pnpm add soclaw-middleware-anything","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"HTTP health check and service endpoints","package":"express","optional":true},{"reason":"WebSocket client (GatewayClient)","package":"ws","optional":true}],"imports":[{"note":"Package is CJS, named exports may not be available via ESM","wrong":"","symbol":"default","correct":"import soclaw from 'soclaw-middleware-anything'"},{"note":"Package is CJS, named exports may not be available via ESM","wrong":"import { GatewayClient } from 'soclaw-middleware-anything'","symbol":"GatewayClient","correct":"const { GatewayClient } = require('soclaw-middleware-anything')"},{"note":"Internal module, not exported from package root","wrong":"const { bootstrapCommandRegistry } = require('soclaw-middleware-anything')","symbol":"bootstrapCommandRegistry","correct":"const { bootstrapCommandRegistry } = require('soclaw-middleware-anything/dist/command')"},{"note":"Internal module, not exported from package root","wrong":"","symbol":"applyManifestLayer","correct":"const { applyManifestLayer } = require('soclaw-middleware-anything/dist/command')"}],"quickstart":{"code":"const { GatewayClient } = require('soclaw-middleware-anything');\nconst client = new GatewayClient({\n  gateway: process.env.GATEWAY_URL ?? 'ws://localhost:8080',\n  nodeId: process.env.NODE_ID ?? 'node-1'\n});\nclient.on('message', (msg) => {\n  console.log('Received:', msg);\n});\nclient.connect();","lang":"javascript","description":"Initialize GatewayClient to connect to a WebSocket gateway, listen for messages, and handle commands."},"warnings":[{"fix":"Use correct paths like require('soclaw-middleware-anything/dist/command')","message":"Internal module paths: require('soclaw-middleware-anything/dist/...') required for submodules; package root exports only limited API","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Run npm run build after cloning repository","message":"Build step required for development: npm run build must be run before first test or local link to generate dist/","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace openMacApp with modules array in manifest JSON","message":"openMacApp field in manifest is deprecated and will be ignored with a warning; use modules instead","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use cross-platform scripts (Python or Node) instead of .bat/.cmd","message":"Windows subprocess support: .bat/.cmd files run as subprocess on Windows only; on non-Windows they are skipped with a warning","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Keep src/command/index.js as external in build script","message":"Dynamic require of command handlers fails if bundled; command index must be external in esbuild config","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Place manifest files carefully or use absolute paths","message":"Path resolution in manifests: moduleRoot is relative to manifest file location, not CWD","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm run build in the package directory","cause":"dist/ not built (only when using from git clone)","error":"Error: Cannot find module 'soclaw-middleware-anything/dist/index.js'"},{"fix":"Ensure esbuild external: ['./command/index'] or equivalent","cause":"Command index bundled incorrectly; runtime expects separate file","error":"Error: Cannot find module './command/index'"},{"fix":"Replace openMacApp with modules array","cause":"Manifest JSON uses deprecated openMacApp","error":"Warning: 'openMacApp' field is deprecated, please use 'modules' instead"},{"fix":"Upgrade Node.js to >=18","cause":"Node.js version <18 does not support certain syntax","error":"SyntaxError: Unexpected token '.' (Windows path separator)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}