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

@amail/plugin-sdk

v0.1.0

Published

AMail plugin contract. Locked at end of Phase 2 — stable surface for plugin authors.

Readme

@amail/plugin-sdk

The locked plugin contract for AMail. Phases 3 (sandbox), 4 (HR plugin), and 7 (PR proposer) all build on the types exported from this package — do not change the shapes here without a phase-spanning review.

Installation

pnpm add -D @amail/plugin-sdk
# or
npm install --save-dev @amail/plugin-sdk

Requires Node ≥ 20.

What's in dist/

  • index.js / index.d.ts — the public API (AmailPlugin, ToolSchema, etc.)
  • manifest.jsparseManifest, PluginManifestSchema, helpers
  • context.jsAmailRuntimeContext, AttachmentRef, defaultV1Entitlement
  • types.js — plugin/tool/skill types
  • bin/amail-plugin-check.js — the amail-plugin-check CLI

amail-plugin-check CLI

A npx-able validator that runs the same Zod schema the marketplace scan workflow runs. Authors should run it before opening a submission PR so they get all the field-level errors locally — no Docker required.

# From inside a plugin package directory:
npx @amail/plugin-sdk amail-plugin-check

# Also import the plugin entry and verify manifest ↔ entry tool-name parity
# (catches "I forgot to register the new tool in both places"):
npx @amail/plugin-sdk amail-plugin-check --load

What a plugin exports

A plugin package's entrypoint must export a default value conforming to AmailPlugin:

import type { AmailPlugin } from "@amail/plugin-sdk";

const plugin: AmailPlugin = {
  id: "my-vertical",
  version: "0.1.0",
  tools: [
    {
      name: "doThing",
      description: "Do the vertical-specific thing.",
      input_schema: { type: "object", properties: { /* … */ } },
    },
  ],
  handlers: {
    doThing: async (args, ctx) => {
      ctx.logger.info("doing thing", { thread: ctx.threadId });
      return { ok: true, data: { /* … */ } };
    },
  },
  defaultSkills: [
    { name: "Vertical Skill", body: "# Steps\n\n1. …\n2. …\n" },
  ],
  amailFragment: "## Vertical vocabulary\n\nTickets have a Vendor field…",
};

export default plugin;

The instance loads plugins listed in the INSTANCE_PLUGINS env var (comma- separated package names). At boot the host:

  1. await imports each plugin
  2. validates that no two plugins declare the same tool name (fail-fast)
  3. merges plugin tools into the registry and defaultSkills into the skill set (S3-authored skills win on collision, so operators can override)
  4. concatenates amailFragment strings into the effective Amail.md shown to the agent.

The determinism rule (read this before writing a handler)

The core runtime caches every tool call by (emailMessageId, toolName, sha256(canonicalJSON(args))) in the tool_executions collection (TTL 7 days). On a cache hit, the cached result is returned to the model and PostToolUse / ThreadClosed hooks are skipped so external side effects don't fire twice.

That has three consequences for handler authors:

  1. Handlers must be deterministic given (args, ctx) — same input must produce the same observable outcome. If you need server-side dedup (e.g. an external API's idempotency key), derive it from args / ctx, not from Date.now().
  2. Do NOT add your own idempotency layer for the same triplet. It will fight the core cache and double-count.
  3. Throwing vs returning { ok: false }: a returned { ok: false } is intentional and is cached (re-running would just fail again). A thrown exception is treated as a transient error and is not cached, leaving the next retry free to re-attempt.

What the runtime context gives you

AmailRuntimeContext:

| Field | Use it for | |---|---| | instanceId | scoping plugin-internal state to the instance | | threadId | every external action that needs the AMail thread reference | | skill | log attribution; "auto" if the agent picked the tool freely | | emailMessageId | informational only — do NOT use as your own dedup key | | s3.read / s3.write | persistent plugin state, scoped to plugins/{pluginId}/ | | attachments.list / attachments.fetch | inbound email attachments | | llm.complete | internal LLM calls (e.g. classification, summarisation) | | logger.info / logger.error | structured logs propagated to the host |

Phase 2 plugins run in-process so process.env, raw aws-sdk, raw Mongo, etc. all technically work. Phase 3 will isolate the worker and block everything outside this context — code against the context only and you get a free migration.

Versioning

Released to public npm via Changesets alongside @amail/plugin-host. Major bumps follow a 6-month deprecation window with two preview releases (per plan.md decision #14).

Any PR in the upstream repo that modifies packages/plugin-sdk/ or packages/plugin-host/ must include a .changeset/*.md file describing the change — CI enforces this.

License

MIT — see LICENSE.