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

@ar-agents/mi-argentina

v0.1.0

Published

Mi Argentina (gov OIDC) as drop-in tools for the Vercel AI SDK. Login-with-Mi-Argentina, PKCE, ID-token JWT verification, userinfo. Web Crypto only — runs on Edge Runtime. Discovery via .well-known. Pluggable state adapter for the OAuth code/state/nonce.

Readme

@ar-agents/mi-argentina

Mi Argentina (the Argentine government's OIDC) as a drop-in tool collection for the Vercel AI SDK 6, plus a pure-Web-Crypto OIDC client you can use directly from any server-side handler.

pnpm add @ar-agents/mi-argentina ai zod

Part of the Arg toolkit — open infrastructure for the Argentine AI agent jurisdiction.

What this gives you

  • MiArgentinaClient — minimal, Edge-Runtime-friendly OIDC client. PKCE, OIDC discovery (/.well-known/openid-configuration), RS256 ID-token verification, JWKS caching, refresh tokens, end-session.
  • miArgentinaTools(client) — five Vercel AI SDK tools: start_login, complete_login, get_user_profile, verify_id_token, refresh_token.
  • State adaptersInMemoryStateAdapter for dev, VercelKVStateAdapter for prod, MiArgentinaStateAdapter interface for anything else.

Web Crypto only — no node:crypto, no Node-only APIs. Works on Vercel Edge, Cloudflare Workers, Deno, any V8 isolate, and Node 20+.

Quick start (server route)

import {
  MiArgentinaClient,
  InMemoryStateAdapter,
} from "@ar-agents/mi-argentina";

const client = new MiArgentinaClient({
  config: {
    clientId: process.env.MI_ARGENTINA_CLIENT_ID!,
    clientSecret: process.env.MI_ARGENTINA_CLIENT_SECRET!,
    redirectUri: "https://yourapp.com/api/auth/callback",
    provider: "miargentina", // or "miargentina_sandbox"
    defaultScopes: ["openid", "profile", "email", "cuil"],
  },
  state: new InMemoryStateAdapter(), // swap for VercelKVStateAdapter in prod
});

// route: GET /api/auth/login
const { url } = await client.getAuthorizationUrl();
return Response.redirect(url);

// route: GET /api/auth/callback?code=...&state=...
const { tokens, idToken, profile } = await client.exchangeCode({
  code: searchParams.get("code")!,
  state: searchParams.get("state")!,
  fetchUserInfo: true,
});
// tokens.accessToken, idToken.claims.sub, profile.cuil — all verified.

With the Vercel AI SDK

import { Experimental_Agent as Agent, stepCountIs } from "ai";
import {
  MiArgentinaClient,
  miArgentinaTools,
  VercelKVStateAdapter,
} from "@ar-agents/mi-argentina";
import { kv } from "@vercel/kv";

const client = new MiArgentinaClient({
  config: { /* …as above… */ },
  state: new VercelKVStateAdapter(kv),
});

const agent = new Agent({
  model: "anthropic/claude-sonnet-4-6",
  tools: miArgentinaTools(client),
  stopWhen: stepCountIs(8),
});

const { text } = await agent.generate({
  prompt: "El usuario quiere loguearse con Mi Argentina y mostrar su perfil.",
});

Because the OAuth dance is fundamentally human-in-the-loop, the agent will:

  1. Call mi_argentina_start_login to obtain a URL.
  2. Hand the URL to the user, who completes the consent in their browser.
  3. Receive code + state from the callback handler in your app.
  4. Call mi_argentina_complete_login with both — gets back the verified profile.

Endpoints

The package ships two presets:

| Preset | Issuer | | ------------------------ | --------------------------------------- | | miargentina (default) | https://miargentina.gob.ar | | miargentina_sandbox | https://sandbox.miargentina.gob.ar |

For maximum resilience against provider URL changes, run discovery once at boot:

await client.discover(); // refreshes endpoints from /.well-known/openid-configuration

For other AR OIDC providers (e.g., a private SSO that mirrors the OIDC standard), use provider: "custom" and pass endpoints explicitly.

Tool surface

| Tool | Purpose | | --------------------------------- | ---------------------------------------------------------------- | | mi_argentina_start_login | Build the authorization URL + persist PKCE/state/nonce. | | mi_argentina_complete_login | Exchange code for tokens, verify the ID token. | | mi_argentina_get_user_profile | Fetch the OIDC userinfo endpoint with a Bearer access token. | | mi_argentina_verify_id_token | Verify a JWT signature, issuer, audience, expiration, nonce. | | mi_argentina_refresh_token | Exchange a refresh token for a fresh access token. |

See AGENTS.md for tool-selection guidance from the agent author's perspective.

Security model

  • PKCE always. RFC 7636 S256, 384 bits of verifier entropy. Mi Argentina rejects non-PKCE flows.
  • State is single-use. The state adapter atomically consumes the entry on callback (getdel on Upstash KV; delete then read elsewhere). Replays return StateMismatchError.
  • ID token verification is mandatory. Signature (RS256) + issuer + audience + expiration + nonce. There is no "skip verification" mode.
  • JWKS cached 5 minutes. Survives short-lived JWKS endpoint blips; fresh enough that key rotation lands within minutes.
  • No node:crypto. Web Crypto API throughout — runs everywhere.

Provisioning a real client

You need to register your application with Mi Argentina to get client_id / client_secret. Today the canonical reference is argob.github.io/mi-argentina-docs. The procurement steps are documented separately in AGENTS.md.

License

MIT © Nazareno Clemente