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

@llm-ports/adapter-codex

v0.1.0-alpha.35

Published

Subprocess-driven adapter for OpenAI Codex CLI. Runs `codex exec --json` as a subprocess, parses its JSON event stream, and emits @llm-ports contract events. Shape A: passthrough governance (operator supplies OpenAI credentials to codex directly; @llm-por

Downloads

112

Readme

@llm-ports/adapter-codex

Subprocess-driven adapter for OpenAI Codex CLI. Wraps codex exec --json as an in-process LLMPort.runAgent implementation.

What this adapter does

  • Spawns codex exec as a subprocess with a caller-supplied prompt.
  • Parses codex's --json output stream into @llm-ports/observability-contract events.
  • Returns an AgentResult compatible with the standard LLMPort interface.

Shape A: passthrough governance

For alpha.28, this adapter operates in passthrough mode. The operator supplies codex with its own OpenAI credentials (via env vars or ~/.codex/auth.toml); @llm-ports's registry does NOT route codex's LLM traffic. The port owns lifecycle observability and orchestration; the LLM calls themselves fly directly from codex to OpenAI.

The alternative (routing codex's LLM traffic through @llm-ports) would require a local OpenAI Responses API gateway that's substantial to build and fragile to maintain. Per the 2026-07-22 architectural decision, that direction is not on the roadmap.

Usage

import { createCodexAdapter } from "@llm-ports/adapter-codex";
import { createCollectingSink } from "@llm-ports/observability-contract";

const sink = createCollectingSink();

const adapter = createCodexAdapter({
  cliPath: "codex", // or absolute path
  defaultSandbox: "workspace-write",
  defaultModel: "gpt-5-codex",
  env: {
    OPENAI_API_KEY: process.env.OPENAI_API_KEY!,
  },
  observability: { sink },
});

const port = adapter.createLLMPort();

const result = await port.runAgent({
  taskType: "code-review",
  messages: [
    {
      role: "user",
      content: "Add a docstring to the top-level function in main.ts.",
    },
  ],
  tools: {}, // ignored; codex uses its own built-in tools
  providerExtras: {
    codex: {
      workingDirectory: "E:\\projects\\my-repo",
      sandbox: "workspace-write",
    },
  },
});

console.log(result.text);
console.log(`Codex emitted ${sink.events.length} observability events`);

Options

CodexAdapterOptions

  • cliPath?: string — Path to the codex binary. Defaults to "codex".
  • defaultSandbox?: "read-only" | "workspace-write" | "danger-full-access" — Default sandbox mode. Defaults to "workspace-write".
  • defaultModel?: string — Default model to pass to codex via -m. Optional.
  • env?: Record<string, string> — Environment variables merged over process.env. Where you set OPENAI_API_KEY.
  • observability?: { sink, source?, context? } — Optional observability configuration. When supplied, the adapter emits lifecycle events to sink for every runAgent call.
  • timeoutMs?: number — Subprocess timeout. Defaults to 30 minutes.

RunAgentOptions.providerExtras.codex (required)

  • workingDirectory: string — Required. The git repo codex operates in.
  • sandbox?: "read-only" | "workspace-write" | "danger-full-access" — Overrides defaultSandbox per call.
  • autoApprove?: boolean — Skip all confirmation prompts (--dangerously-bypass-approvals-and-sandbox). Default false.
  • model?: string — Overrides defaultModel per call.
  • imageFiles?: string[] — Image files to attach to the initial prompt.

Non-runAgent methods

generateText, generateStructured, streamText, and streamStructured throw AdapterInternalError. Codex is an agent runtime, not a raw completion runtime. Consumers who need raw completions route those task types to an in-process adapter (@llm-ports/adapter-openai, @llm-ports/adapter-anthropic, etc.).

License

MIT.