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

@framers/agentos-ext-code-safety

v0.2.1

Published

Static analysis guardrail for detecting dangerous code patterns in AgentOS

Readme

@framers/agentos-ext-code-safety

Static-analysis guardrail for @framers/agentos. Scans code that agents emit (in chat, in forged tools, in generated artifacts) for dangerous patterns before the code is shown to the user or executed in any sandbox.

What it does

Extracts code fences from agent output, parses them, and runs each block through a configurable rule set. Default rules cover:

  • Filesystem destruction (rm -rf /, recursive deletes)
  • Process control (fork bombs, unrestricted exec)
  • Network exfiltration to non-allowlisted hosts
  • Hard-coded secrets (API keys, tokens, private keys)
  • Eval-style dynamic code execution
  • Known-bad patterns from the OWASP LLM Top 10

Rules are pluggable; bring your own and the engine merges them with defaults.

Install

npm install @framers/agentos-ext-code-safety

Peer dependency: @framers/agentos.

Quickstart

import { AgentOS } from '@framers/agentos';
import { createCodeSafetyGuardrail } from '@framers/agentos-ext-code-safety';

const agentos = new AgentOS();
await agentos.initialize({
  extensionManifest: {
    packs: [
      {
        factory: () =>
          createCodeSafetyGuardrail({
            languages: ['typescript', 'javascript', 'python', 'shell'],
            extraRules: [],
          }),
        enabled: true,
      },
    ],
  },
});

Public API

  • CodeFenceExtractor — pulls fenced code blocks from prose
  • CodeSafetyScanner — runs fence content through rules
  • CodeSafetyGuardrail — guardrail wiring the scanner for the AgentOS contract
  • DefaultRules — the built-in rule pack
  • createCodeSafetyGuardrail(options?) — factory returning an ExtensionPack
  • createExtensionPack(context) — auto-discoverable factory used by AgentOS extension auto-pickup

See src/types.ts for CodeSafetyPackOptions.

Examples

  • test/ — fixtures across the supported languages plus rule-authoring patterns

Lazy loading and optional install

This package is an optional dependency of @framers/agentos-extensions-registry. The registry ships catalog metadata; createCuratedManifest() calls import.meta.resolve() per entry and silently skips anything not installed. npm install @framers/agentos-ext-code-safety is the gate.

Unlike the other guardrail packs, code-safety is regex-only. There is no model to lazy-load. The default rule set ships in-process and adds zero cold-start cost. Custom rules merge in at activation through extraRules.

The guardrail registers with config.evaluateStreamingChunks = true and runs in Phase 2 of the two-phase dispatcher (parallel classifiers). Dangerous fence patterns (filesystem destruction, secrets, eval) return BLOCK; lower-severity matches return FLAG. Worst-action aggregation across all Phase 2 classifiers picks the strictest decision.

For the full DI model and the end-to-end walkthrough that places this pack in the dispatcher, see How extensions stay optional and lazy and the auto-loading guide.

License

Apache 2.0 — see the repo root LICENSE.