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

@coderifts/openai-agents

v0.1.0

Published

CodeRifts contract governance for the OpenAI Agents SDK — a tool-input guardrail that gates contract mutations before a tool runs, plus REQUEST_APPROVAL mapped to the SDK's native approval surface.

Readme

@coderifts/openai-agents

CodeRifts contract governance for the OpenAI Agents SDK.

A tool-input guardrail decides, before a tool runs, whether the call is a governed contract mutation. It gates a tool even when CodeRifts never wrapped that tool's implementation — so you can govern third-party or hand-written tools you do not own.

Install

npm install @coderifts/openai-agents @openai/agents @coderifts/sdk

@openai/agents is a peer dependency (>=0.17.0); @coderifts/sdk is a dependency.

Use

import { Agent, run, tool } from '@openai/agents';
import { CodeRifts } from '@coderifts/sdk';
import { withCodeRiftsGuardrail } from '@coderifts/openai-agents';

const client = new CodeRifts({ apiKey: process.env.CODERIFTS_API_KEY });
const { guardrail, needsApproval } = withCodeRiftsGuardrail({
  client,
  operation: 'merge',
  readPrior: (p) => fs.readFileSync(p, 'utf8'),   // the `before` side
});

const writeFile = tool({
  name: 'write_file',
  description: 'Write a file.',
  parameters: z.object({ path: z.string(), content: z.string() }),
  inputGuardrails: [guardrail],
  needsApproval,                                   // REQUEST_APPROVAL suspends for a human
  execute: async ({ path, content }) => { /* ... */ },
});

attachGuardrailToEach(tools, guardrail) attaches it across a list you already have.

Verdict mapping

| execution_action | Behaviour | |---|---| | CONTINUE, CONTINUE_WITH_MONITORING | allow() — the tool runs | | REQUEST_APPROVAL | guardrail allows, needsApproval returns true → the SDK emits a RunToolApprovalItem and suspends for a human | | STOP / BLOCK | rejectContent() with the WHY + remediation | | anything unrecognised | rejectContent(), message names it as not permission (fail closed) | | unreadable arguments / missing path on a mutator | rejectContent() fail-closed | | non-contract path, read-only tool | allow() with no API call |

rejectContent, not throwException: a governance deny must teach. throwException aborts the whole run with a tripwire and the model learns nothing.

One preflight per tool call. The guardrail and the needsApproval resolver share a memo keyed by the SDK's callId, so enabling approvals does not double your API spend.

Coverage

With the CodeRifts guardrail attached to a tool, that tool is governed even if CodeRifts never wrapped its implementation — so an agent can adopt governance for third-party or hand-written tools it does not own, and a blocked contract change returns the reason and remediation to the model rather than failing opaquely. The claim changes from per-table to per-tool-with-guardrail — not to per-agent: tool input guardrails are attached per tool, there is no agent-wide form, and we demonstrated that the same ungoverned tool still mutates an OpenAPI spec when the guardrail is not attached to it. Handoff sub-agents, hosted tools, and direct client calls outside run() remain ungated. Enforcement independent of the developer's diligence still lives downstream, at the contract-gate on the pull request and the deploy-gate in CI.

What this does not cover

  1. Tools without the guardrail attached. There is no agent-wide form — 'toolInputGuardrails' in agent is false, and the Agent's inputGuardrails is a different type that validates the agent's input, not tool calls. attachGuardrailToEach covers exactly the list you pass it.
  2. Handoff sub-agents. A sub-agent's tools are separate tool objects and do not inherit it.
  3. Hosted / built-in tools (codeInterpreterTool, applyPatchTool). Built by SDK factories; you would have to interpose your own wrapper to add inputGuardrails.
  4. Direct client calls outside run(). They never reach the runner, so no guardrail fires.

License

MIT