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

@ai-sdk/harness-acp

v1.0.65

Published

Readme

AI SDK - ACP Harness

HarnessV1 adapter backed by an NPM-installed Agent Client Protocol version 1 implementation. The adapter ships a bridge process that runs inside a sandbox and talks to the host over a WebSocket on a sandbox-proxied loopback port. The configured ACP implementation runs alongside the bridge inside the sandbox.

Setup

npm i @ai-sdk/harness-acp @ai-sdk/harness @ai-sdk/sandbox-vercel

The bridge installs the configured ACP implementation inside the sandbox the first time the session starts.

Usage

This example connects HarnessAgent to Codex ACP using direct OpenAI authentication:

import { HarnessAgent } from '@ai-sdk/harness/agent';
import { createACP } from '@ai-sdk/harness-acp';
import { createCredentialRequestTransformation } from '@ai-sdk/harness/utils';
import { createVercelNetworkSandboxSession } from '@ai-sdk/sandbox-vercel';

const codexACP = createACP({
  harnessId: 'acp-codex',
  source: {
    type: 'npm-simple',
    packageName: '@agentclientprotocol/codex-acp',
    packageVersion: '1.1.4',
  },
  executable: 'codex-acp',
  modelMapping: {
    type: 'session-config-option',
    path: 'model',
  },
  credentialEnv: ['CODEX_API_KEY', 'OPENAI_API_KEY'],
  credentialBrokering: ({ env, sandboxEnv }) => {
    const environmentVariableName = env.CODEX_API_KEY
      ? 'CODEX_API_KEY'
      : 'OPENAI_API_KEY';
    const credential = env[environmentVariableName];
    const sandboxCredential = sandboxEnv?.[environmentVariableName];
    if (!credential || !sandboxCredential) return [];
    return [
      createCredentialRequestTransformation({
        matchUrl: 'https://api.openai.com/v1',
        matchHeaders: {
          Authorization: `Bearer ${sandboxCredential}`,
        },
        transformHeaders: { Authorization: `Bearer ${credential}` },
      }),
    ];
  },
  instructionMapping: {
    type: 'launch-env-json',
    variable: 'CODEX_CONFIG',
    path: ['developer_instructions'],
  },
  permissionModeMapping: {
    'allow-reads': null,
    'allow-edits': null,
    'allow-all': { type: 'session-mode', modeId: 'agent-full-access' },
  },
  authentication: {
    methodId: 'api-key',
  },
});

const agent = new HarnessAgent({
  harness: codexACP,
});

const sandboxSession = await createVercelNetworkSandboxSession({
  runtime: 'node24',
  ports: [4000],
  template: await agent.getSandboxTemplate(),
});
const session = await agent.createSession({ sandboxSession });
try {
  const result = await agent.generate({
    session,
    prompt: 'Inspect this project and summarize its purpose.',
  });
  console.log(result.text);
} finally {
  await session.destroy();
  await sandboxSession.destroy();
}

Set CODEX_API_KEY or OPENAI_API_KEY in the host environment. Sandboxes that support additive request transformations receive only credential placeholders; the real value is injected only when a matching outbound request contains the expected placeholder. Other sandboxes retain the legacy behavior of forwarding the value to the ACP process. Codex ACP supports only permissionMode: 'allow-all' because its restrictive modes enable Codex's internal sandbox. A bridge-backed ACP harness requires a sandbox with at least one exposed port.

modelMapping is required because ACP implementations expose different model selection operations. Use session-config-option with the ACP configuration option ID as path, or session-model with the JSON-RPC request property as path for implementations such as Grok Build that use the legacy session/set_model method. No model operation is sent when HarnessAgent has no model configured.

Use instructionMapping when the ACP implementation exposes a native system or developer prompt. A session-meta mapping writes HarnessAgent instructions below the ACP session request's _meta field. A launch-env-json mapping merges them into a JSON environment variable before the implementation starts. A filesystem mapping writes instructions to a markdown file at a relative path under the implementation's effective $HOME. Without a mapping, the adapter preserves its backward-compatible behavior and prepends instructions to the first user prompt.

Skills are written to .agents/skills below the ACP implementation's effective $HOME and discovered natively by the implementation. Set skillsDirectory to another relative path, such as .claude/skills, when required by the implementation.