{"_id":"@ai-manifests/aar-manifest","name":"@ai-manifests/aar-manifest","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ai-manifests/aar-manifest","version":"1.0.0","description":"TypeScript reference implementation of the Agent Acknowledgment Record (AAR)","author":{"name":"David H. Friedel Jr. — MarketAlly Pte Ltd"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"scripts":{"build":"tsc","test":"vitest run"},"license":"Apache-2.0","homepage":"https://aar-manifest.dev","repository":{"type":"git","url":"https://git.marketally.com/ai-manifests/aar-ref-lib-ts"},"devDependencies":{"@types/node":"^20.0.0","typescript":"^5.5.0","vitest":"^3.0.0"},"_id":"@ai-manifests/aar-manifest@1.0.0","gitHead":"1c528353e074541900e6e7e1a0b1f04b1c1907b4","_nodeVersion":"20.19.4","_npmVersion":"10.8.2","dist":{"integrity":"sha512-vbZrfUFQeR8kiQ83laDHGDtVHqatKSB0SOihHmBrO0vJo3pWGPxmvr2fGUzWY4eXZmPhhsUUTQKmUhq63DrlFQ==","shasum":"6625fcfaaef7374b73b7d7c52bbf9cb6f363aeb7","tarball":"https://registry.npmjs.org/@ai-manifests/aar-manifest/-/aar-manifest-1.0.0.tgz","fileCount":16,"unpackedSize":49880,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCFQRpLdmEV+D+7rI5VeAeSl2+TpnPNKxuTEcW6R68PRwIgUgI+Vh9mcPVA30Eeby7h/lDJAh8vLwuHPGMSJB48yg8="}]},"_npmUser":{"name":"logikonline","email":"dave@marketally.com"},"directories":{},"maintainers":[{"name":"logikonline","email":"dave@marketally.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aar-manifest_1.0.0_1780369352849_0.2141642553365335"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-02T03:02:32.708Z","1.0.0":"2026-06-02T03:02:33.010Z","modified":"2026-06-02T03:02:33.307Z"},"maintainers":[{"name":"logikonline","email":"dave@marketally.com"}],"description":"TypeScript reference implementation of the Agent Acknowledgment Record (AAR)","homepage":"https://aar-manifest.dev","repository":{"type":"git","url":"https://git.marketally.com/ai-manifests/aar-ref-lib-ts"},"author":{"name":"David H. Friedel Jr. — MarketAlly Pte Ltd"},"license":"Apache-2.0","readme":"# aar-ref-lib-ts\n\n[![npm](https://img.shields.io/npm/v/@ai-manifests/aar-manifest.svg?label=npm)](https://www.npmjs.com/package/@ai-manifests/aar-manifest)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![Spec](https://img.shields.io/badge/spec-aar--manifest.dev-informational)](https://aar-manifest.dev)\n\nTypeScript reference implementation of the [Agent Acknowledgment Record\n(AAR)](https://aar-manifest.dev) — the append-only, hash-chained ledger that\nstores and aggregates AAP acknowledgment events, with Merkle checkpoints and the\nnormative §9 `default` reputation algorithm.\n\n## Install\n\n```bash\nnpm install @ai-manifests/aar-manifest\n```\n\n## What's in the box\n\n| Module | Spec | Purpose |\n|--------|------|---------|\n| `entries` | §3, §5, §8 | `RecordEntry`, `Checkpoint`, `ReputationResult` |\n| `ledger` | §3, §4 | `canonicalize`, `computeEntryHash`, `computeCommitment`, `buildGenesis`, `appendEvent`, `verifyChain` |\n| `checkpoint` | §5 | `merkleRoot`, `buildInclusionProof`, `verifyInclusionProof`, `buildCheckpoint` |\n| `aggregation` | §9 | `aggregateReputation` — the normative `default` algorithm |\n| `store` | §3/§4/§8 | `InMemoryLedger` — accept, withdraw, query, verify, reputation |\n\n## Usage\n\n```typescript\nimport { InMemoryLedger, type AapEvent } from '@ai-manifests/aar-manifest';\n\nconst ledger = new InMemoryLedger({ aggregatorDid: 'did:tutus:0xagg' });\n\nconst ev: AapEvent = {\n  id: 'urn:uuid:…',\n  type: 'ENDORSEMENT',\n  issuedAt: '2026-05-20T14:32:00Z',\n  issuer: { did: 'did:web:alice' },\n  subject: { did: 'did:web:bob' },\n};\n\nledger.accept(ev);                 // appends a chained Record Entry; throws on duplicate id (§4.1.2)\nledger.verify(true);               // re-checks the chain and recomputes every entryHash (§4)\nconst rep = ledger.reputation('did:web:bob', {\n  settlementVerified: (e) => /* check the rail */ false,\n});\n```\n\n## The `default` aggregation (spec §9)\n\n```\nweight(a) = type_weight × issuer_trust × value_weight × witness_factor\n          × time_decay × (withdrawn ? 0 : 1) × settlement_factor\n```\n\n- `value_weight = 1 + log10(1 + usd)` applies only when settlement is verified (§6.3).\n- `settlement_factor = 0.5` when a value is **claimed but unverified** (discourages fake economic claims, T2/T10), else 1.\n- After summing, the **issuer-diversity penalty** (§9.5) scales the aggregate by `diversity / 0.3` when Simpson diversity over distinct issuers/controllers is below 0.3.\n- Recursive issuer trust is bounded at depth 2 with an attestation fallback (§9.4); supply your own `issuerTrust` resolver, or an `attestation` resolver to use the `ATTESTATION_TRUST` constants.\n\n`aggregateReputation` returns a full `ReputationResult` (aggregate score, sample\nsize, staleness, per-type breakdown, issuer diversity, settlement-backed\nfraction, withdrawal rate, confidence) — the AAR §8 `ReputationSource` shape ADP\nconsumes.\n\n## Hash chaining & checkpoints\n\n`entryHash` is computed over the immutable content (everything except\n`entryHash` and the mutable status fields `withdrawn` / `withdrawalRef`), so a\nwithdrawal can flip those fields without breaking chain continuity (§3.2, §4.2,\n§7.4). `buildCheckpoint` produces a signed, prev-chained Merkle commitment over\nan interval; `buildInclusionProof` / `verifyInclusionProof` give standard\nsingle-entry inclusion proofs (§5.4).\n\n## How It Composes\n\n```\naap-manifest   constructs and weights acknowledgment events\naar-manifest   stores, chains, federates, and aggregates them   (this library)\naar-validate   audits a ledger's chain, sequencing, and replay\n```\n\n## Build & test\n\n```bash\nnpm install\nnpm run build\nnpm test\n```\n\n## License\n\nApache-2.0 — see [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE).\n","readmeFilename":"README.md","_rev":"1-6f13c79ccd5de63c23b7ebc822c3f0cd"}