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

@omnitype-code/adapter-sdk

v2.0.0

Published

OmniType v2 — SDK for writing tool adapters

Downloads

111

Readme

@omnitype-code/adapter-sdk

The adapter layer for OmniType v2 deterministic attribution.

This SDK is for AI tool authors and open-source contributors who want to add OmniType attribution support to a coding tool (Cursor, Windsurf, Cline, a custom CLI, etc.).

If you are an AI tool end user looking to track attribution in your own workflow, install the VSCode extension instead.


How the tier system works

Every file edit tracked by OmniType gets an attribution tier:

| Tier | Name | How it's produced | Confidence | |---|---|---|---| | T0 | Deterministic | AI tool embeds @omnitype-code/agent-sdk directly | 100% | | T1 | Hook-inferred | preToolUse hook fires before each tool call | 85% | | T2 | Retrospective | Transcript scavenger reads session logs after the fact | 60% | | T3 | Filesystem-only | File watcher sees a change with no session context | 30% |

The goal is to get as much attribution as possible at T0 or T1. T3 spans have origin='unknown' — they are never assumed to be AI.


Option A — Embed the Agent SDK (T0 path)

Use @omnitype-code/agent-sdk if your tool writes files directly (not via shell hooks).

npm install @omnitype-code/agent-sdk
import { OmniTypeAgent } from '@omnitype-code/agent-sdk';

// On session start (once per AI conversation)
const agent = await OmniTypeAgent.tryConnect({
  workspace: '/path/to/git/repo',
  sessionId: crypto.randomUUID(),
  model: 'claude-sonnet-4-6',
  tool: 'my-tool',
});

// Wrap every file write — produces T0 (deterministic) attribution
if (agent) {
  await agent.withEdit('src/foo.ts', newContent, async (absPath, content) => {
    await fs.writeFile(absPath, content, 'utf-8');
  });
} else {
  // Daemon not running — write normally, attribution will be T3
  await fs.writeFile(absPath, newContent, 'utf-8');
}

// On session end
await agent?.end('tool-exit');

tryConnect returns null if the daemon isn't running — your tool continues working normally and writes are tracked at T3 by the filesystem watcher.

Fine-grained API

// Manual txn control (for multi-file edits)
const txn = await agent.beginTxn(['src/a.ts', 'src/b.ts']);
await writeA();
await writeB();
await agent.commitTxn(txn, [
  { path: 'src/a.ts', preHash, postHash, splices },
  { path: 'src/b.ts', preHash, postHash, splices },
]);

// Emit the prompt (privacy-safe — only hash stored by default)
await agent.emitPrompt(promptText, /* shareText= */ false);

Option B — Write a Manifest (T1 path)

If your tool runs shell commands that can be intercepted via hooks, write a 30-line JSON manifest.

Create .omnitype/adapters/my-tool/manifest.json:

{
  "id": "my-tool",
  "version": "1.0.0",
  "display_name": "My AI Tool",
  "tool_binary": "my-tool",
  "trust": { "trust_circle": 2 },
  "declared_capabilities": [
    "tool.identity",
    "session.id",
    "hook.preToolUse",
    "operation.editOp.path_only"
  ],
  "hooks": {
    "preToolUse": {
      "install_path": "~/.config/my-tool/hooks/preToolUse.sh",
      "one_liner": "echo '{\"type\":\"hook\",\"tool\":\"my-tool\",\"session\":\"$SESSION_ID\",\"file\":\"$FILE\"}' >> ${OMNITYPE_HOOKS_DIR}/event-$(date +%s%N).json"
    }
  },
  "normalize": [
    {
      "match": { "tool_name": "write_file" },
      "emit": "EditOp",
      "path_from": "$.arguments.path",
      "origin": "ai"
    }
  ]
}

Then run:

omnitype-daemon install-hooks

The daemon will install the hook and start receiving T1 events from your tool.

Trust circles

| Circle | Level | Who uses it | |---|---|---| | 1 | Verified partner | Claude Code, Cursor, Windsurf (manifests maintained by OmniType) | | 2 | Community verified | Cline, Copilot (community-maintained, OmniType-reviewed) | | 3 | Community | Unreviewed third-party manifests |

T0 is only achievable via the Agent SDK. Community (circle 3) adapters are capped at T1.


The attribution guarantee

OmniType v2 never assumes an unknown write is AI-generated.

  • origin='unknown' means: a file changed, but we don't know who wrote it.
  • origin='ai' requires positive evidence: an active AI session txn, a signed Agent SDK event, or a hook payload.
  • This is enforced in the SQLite materializer — there is no code path that promotes 'unknown' to 'ai'.

Verifying your adapter

# Check your adapter is installed and recognised
omnitype-daemon doctor

# See live attribution as you code
omnitype-daemon blame src/foo.ts

# Check tier breakdown for the workspace
omnitype-daemon health

Filing issues

Open an issue at github.com/omnitype-code/omnitype-v2 with the label adapter.

Include the output of omnitype-daemon doctor and omnitype-daemon health --json.