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/iibb

v0.4.0

Published

Ingresos Brutos (Argentine gross income tax) agent toolkit for the Vercel AI SDK 6. Pure calculation helpers for retention + perception + DDJJ assembly across CABA (AGIP), Provincia de Buenos Aires (ARBA) and Convenio Multilateral (CM-05). Adapter pattern

Readme

@ar-agents/iibb

Ingresos Brutos (Argentine gross income tax) agent toolkit for the Vercel AI SDK 6+. Pure calculation helpers for retention, perception, and monthly DDJJ assembly across CABA, Provincia de Buenos Aires, and Convenio Multilateral.

pnpm add @ar-agents/iibb

What this package does

  • Pure math for retentions, perceptions, and DDJJ assembly. No network, no I/O. Unit-testable.
  • Adapter pattern for jurisdictional portals (AGIP, ARBA, Comisión Arbitral). Since v0.2: real AgipPublicAdapter (CABA, no auth) + ArbaCitAdapter (BSAS, host wires CIT-authenticated fetcher). HttpPadronAdapter is the abstract base so hosts can subclass for any DGR.
  • Two regimes: LOCAL (single jurisdiction) and CONVENIO MULTILATERAL Article 2 (general regime, distribution by coeficiente unificado).

What this package does NOT do

  • Submit DDJJ to a real portal. Each jurisdiction requires fiscal-clave-based authentication; submission is left to the adapter, and the v0.1 adapter stubs throw IibbUnconfiguredError.
  • Carry rate-books. Rates change with every annual regulation and per activity (CIIU/NAES). You bring the rate-book; the package does the math.
  • Handle CM special regimes (Articles 6-13: construction, transport, professionals, etc.). v0.1 covers Article 2 (general regime) only.
  • FX or other-than-ARS currencies. All amounts are ARS centavos integers.

Quick start

import { Experimental_Agent as Agent } from "ai";
import {
  iibbTools,
  RateBook,
  computeDdjj,
  calculateRetention,
} from "@ar-agents/iibb";
import { anthropic } from "@ai-sdk/anthropic";

// Pure: no agent needed.
const result = computeDdjj({
  period: "2026-05",
  regime: "local",
  filerCode: "CABA",
  lines: [
    {
      dateIso: "2026-05-05",
      jurisdiction: "CABA",
      activityCode: "620100", // CIIU/NAES code
      baseImponibleCentavos: 1_000_000, // ARS 10.000
    },
  ],
  rateBook: new RateBook([
    { jurisdiction: "CABA", activityCode: "620100", rate: 0.05 },
  ]),
});

console.log(result.totals.taxDueCentavos); // 50_000 cents (ARS 500)

Wired as agent tools:

const agent = new Agent({
  model: anthropic("claude-sonnet-4-7"),
  tools: iibbTools(), // 4 tools: calc_retention, calc_perception, compute_ddjj, lookup_padron
  system: "Eres un contador asistente para sociedades-IA argentinas.",
});

Convenio Multilateral example

const result = computeDdjj({
  period: "2026-05",
  regime: "cm",
  filerCode: "CM",
  rateBook,
  cmCoefficients: { CABA: 0.6, BSAS: 0.4 }, // sums to 1.0
  lines: [...],
});
// result.byJurisdiction → [{ jurisdiction: "CABA", ... }, { jurisdiction: "BSAS", ... }]
// result.cmCoefficients echoes back the input.

Padrón lookup

CABA — no auth needed:

import { iibbTools, AgipPublicAdapter } from "@ar-agents/iibb";

const tools = iibbTools({
  adapters: { CABA: new AgipPublicAdapter() },
});

const status = await tools.iibb_lookup_padron.execute({
  cuit: "20417581015",
  jurisdiction: "CABA",
});
// → { cuit: "...", jurisdiction: "CABA", inscribed: true, regime: "local" } | null

BSAS — host wires a CIT-authenticated fetcher:

import { ArbaCitAdapter } from "@ar-agents/iibb";

const authedFetch = async (url, init) =>
  fetch(url, { ...init, headers: { ...init?.headers, cookie: `JSESSIONID=${process.env.ARBA_CIT_SESSION}` } });

const tools = iibbTools({
  adapters: { BSAS: new ArbaCitAdapter({ fetch: authedFetch }) },
});

Any other DGR — subclass HttpPadronAdapter:

import { HttpPadronAdapter, type JurisdictionCode, type Padron } from "@ar-agents/iibb";

class DgrSantaFeAdapter extends HttpPadronAdapter {
  readonly jurisdiction: JurisdictionCode = "SF";
  protected buildLookupRequest(cuit: string) {
    return { url: `https://api.santafe.gov.ar/iibb/padron/${cuit}` };
  }
  protected parseLookupResponse(text: string, cuit: string): Padron | null {
    const j = JSON.parse(text);
    return j.activo ? { cuit, jurisdiction: "SF", inscribed: true, regime: "local" } : null;
  }
}

Errors

import {
  IibbError,
  IibbUnconfiguredError, // adapter not wired
  IibbValidationError,   // bad input (bad period, mismatched jurisdiction, etc.)
  IibbRateNotFoundError, // rate-book missing an (jurisdiction, activityCode) entry
} from "@ar-agents/iibb";

Constraints (quick reference)

  • Centavos for all amounts (ARS integers). No floats.
  • Rates are fractions (0.035 = 3.5%). Never percentages.
  • Period is YYYY-MM. The validator rejects anything else.
  • CM coefficients sum to 1.0 ±0.001 tolerance.

For LLM agents using these tools, see AGENTS.md.

License

MIT — Nazareno Clemente [email protected]