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

@better-openclaw/core

v1.0.31

Published

Core logic for better-openclaw: schemas, service registry, resolver, composer, validators and generators

Readme

@better-openclaw/core

The core engine responsible for parsing configurations, resolving dependencies, formatting outputs, and generating production-ready AI agent Docker Compose stacks with support for 8 agent frameworks.

Features

  • Multi-Agent Framework Registry: Choose from 8 pluggable agent frameworks (OpenClaw, CoPaw, NanoClaw, NanoBot, ZeroClaw, MemU, Claude Code, Codex) as primary orchestrator, with optional companion frameworks for hybrid stacks. Framework definitions live in src/frameworks/ and use a registry pattern.
  • Service Registry: A unified, expandable catalog of 94+ pre-configured Docker services (e.g., Traefik, PostgreSQL, Qdrant, Ollama, N8N, SearXNG, Scrapling, etc.) categorized by function (databases, models, scrapers, tools).
  • Dependency Resolution Engine: Automatically detects and resolves required services. Framework-specific mandatory services are injected automatically (e.g., MemU requires PostgreSQL, non-OpenClaw frameworks skip Convex/Mission-Control/Tailscale).
  • Skill Injection (SKILL.md): Deep integration with AI agent workflows. Packages specialized SKILL.md instructions into volume mounts for AI tools like the browser integration or tinyfish.
  • Intelligent Networking & Proxies: Fully integrated reverse proxy generation (Caddy and Traefik) with auto-SSL domain generation and WebSocket streaming support (flush_interval -1) for noVNC/KasmVNC desktop sandbox services.
  • Cross-Platform & Heterogeneous Topologies: Supports generating stacks for local (Docker Desktop), vps (cloud), and homelab deployments. It explicitly supports a hybrid native-docker model via deploymentType: "bare-metal".
  • GPU Passthrough Support: Automatically injects NVIDIA or AMD runtime flags to AI services if the gpuRequired flag is detected on the requested service and enabled by the user.

Programmatic API

You can use the generation engine programmatically within any Node.js or TypeScript application:

import { generate, type GenerationInput } from "@better-openclaw/core";

const input: GenerationInput = {
	projectName: "my-agent-stack",
	services: ["postgresql", "ollama", "n8n"],
	skillPacks: ["local-ai"],
	proxy: "caddy",
	domain: "my-ai.example.com",
	gpu: true,
	platform: "linux/amd64",
	deployment: "vps",
	deploymentType: "docker", // or "bare-metal"
	generateSecrets: true,
	openclawVersion: "latest",
	monitoring: true,
	primaryFramework: "zeroclaw",       // Choose from 8 agent frameworks
	companionFrameworks: ["copaw"],     // Optional companion frameworks
};

// Generates the Compose YAML, configs, skills, and .env securely.
const result = generate(input);

console.log(result.files["docker-compose.yaml"]); 
console.log(result.metadata.estimatedMemoryMB);

Service Definition Format

The Core reads from src/services/definitions/. New services should expose a standardized ServiceDefinition:

export const myCoolService: ServiceDefinition = {
	id: "my-cool-service",
	name: "Cool AI Service",
	description: "Provides an API for cool operations.",
	category: "tools",
	image: "cool/service:latest",
	ports: [{ port: 8080, public: true }],
	environment: { API_KEY: "${SECRET_KEY}" },
	dependsOn: ["postgres-database"],
};

Adding Skills

Skills are markdown instructions or code bundles mapped to specific tools. They are defined in skills/manifest.json. During generation, if a SkillPack is explicitly selected or implicitly included via an auto-installing service, the Core locates the corresponding files and mounts them into the generated stack's Volume pathways.

PaaS Deployers

The core includes deployer clients for pushing generated stacks directly to self-hosted PaaS platforms:

| Provider | Module | Auth | |-------------|------------------------|-------------------------| | Dokploy | deployers/dokploy.ts | x-api-key header | | Coolify | deployers/coolify.ts | Authorization: Bearer |

All deployers implement the PaasDeployer interface (defined in deployers/types.ts). To add a new provider, implement the interface and register it in deployers/index.ts.

import { getDeployer, getAvailableDeployers } from "@better-openclaw/core";

// List available providers
const providers = getAvailableDeployers(); // ["dokploy", "coolify"]

// Deploy a stack
const deployer = getDeployer("dokploy");
const result = await deployer.deploy({
  target: { instanceUrl: "https://dokploy.example.com", apiKey: "..." },
  projectName: "my-stack",
  composeYaml: "...",
  envContent: "...",
});

Operations Logger

The core ships a centralized OperationsLogger used by all packages (CLI, API, MCP) to produce structured, NDJSON log files tracking every significant operation — generation pipelines, deployments, file writes, API requests, and MCP tool calls.

Programmatic Usage

import { OperationsLogger, ConsoleSink, CallbackSink } from "@better-openclaw/core";
import { FileSink } from "@better-openclaw/core/logger/sinks/file-sink";

const logger = new OperationsLogger({
  source: "cli",                // "cli" | "api" | "mcp" | "web" | "core"
  sinks: [
    new ConsoleSink(),          // Human-readable terminal output
    new FileSink(),             // NDJSON file (~/.better-openclaw/logs/operations.log)
  ],
  minLevel: "info",             // "debug" | "info" | "warn" | "error"
});

// Basic logging
logger.info("generation", "Starting stack generation", { projectName: "my-stack" });
logger.warn("validation", "Port conflict detected", { port: 8080 });
logger.error("deployment", "Deploy failed", new Error("timeout"), { provider: "dokploy" });

// Timed operations (auto-logs duration + outcome)
const result = await logger.timed("deployment", "Deploying to Dokploy", async () => {
  return await deployer.deploy(input);
});

// Child loggers (inherit correlationId)
const childLogger = logger.child({ source: "core" });

// Pass to generate()
const output = generate(input, { logger });

Log File Location

| Default | ~/.better-openclaw/logs/operations.log | |---------|------------------------------------------| | Override | OPENCLAW_LOG_DIR env var | | Format | NDJSON (one JSON object per line, jq-friendly) | | Rotation | 10 MB per file, 5 rotated files (~60 MB total) |

Environment Variables

| Variable | Default | Description | |----------|---------|-------------| | OPENCLAW_LOG_DIR | ~/.better-openclaw/logs/ | Log directory path | | OPENCLAW_LOG_LEVEL | info | Minimum log level | | OPENCLAW_LOG_MAX_SIZE | 10485760 (10 MB) | Max file size before rotation | | OPENCLAW_LOG_MAX_FILES | 5 | Number of rotated files to keep |

Sensitive Data

The logger automatically redacts known sensitive keys (apiKey, password, token, secret, authorization, credentials, private_key) from context before writing to any sink.

Development

pnpm build  # Compiles TypeScript via tsdown
pnpm test   # Executes integration tests verifying generating valid stacks
pnpm lint   # Executes Biome linting rules