{"_id":"@ar-agents/fecred","_rev":"6-68e62a24380aa55e0a1fb4c37c873ddd","name":"@ar-agents/fecred","dist-tags":{"latest":"0.3.0"},"versions":{"0.2.0":{"name":"@ar-agents/fecred","version":"0.2.0","keywords":["fecred","wsfecred","factura-de-credito-electronica","fce","mipyme","afip","arca","factura-electronica","argentina","ai-sdk","vercel-ai","agent","ar-agents","sociedades-ia"],"author":{"name":"Nazareno Clemente","email":"naza@naza.ar"},"license":"MIT","_id":"@ar-agents/fecred@0.2.0","maintainers":[{"name":"naza-ar","email":"clementenaza@gmail.com"}],"homepage":"https://github.com/ar-agents/ar-agents/tree/main/packages/fecred","bugs":{"url":"https://github.com/ar-agents/ar-agents/issues"},"dist":{"shasum":"6437a93309185d781b78808e04880e2a9ac2877e","tarball":"https://registry.npmjs.org/@ar-agents/fecred/-/fecred-0.2.0.tgz","fileCount":12,"integrity":"sha512-4A+noVbYwAcU31iKfhDGrlrrkjEgNnZlDwgTjC1GwxtO2kiiUMNqXB66cKrR+jeYk6LBqtCv+Ng0z2T2ZbCw/A==","signatures":[{"sig":"MEQCIBWlOicnPLuOVCmHCnKvdir38hq8AWJWXU0o8JMj5hZ4AiAT/3mvlDHdqnps1gj1mFK3rBfw1HiyLxTJwQrOCpGAhw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ar-agents%2ffecred@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":245827},"main":"./dist/index.cjs","type":"module","_from":"file:ar-agents-fecred-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./tools.manifest.json":"./tools.manifest.json"},"funding":{"url":"https://github.com/sponsors/naza00000","type":"github"},"scripts":{"test":"vitest run","build":"tsup","clean":"rm -rf dist","validate":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"naza-ar","email":"clementenaza@gmail.com"},"_resolved":"/tmp/d7869ddf0250ad733b15c9bb389d8249/ar-agents-fecred-0.2.0.tgz","_integrity":"sha512-4A+noVbYwAcU31iKfhDGrlrrkjEgNnZlDwgTjC1GwxtO2kiiUMNqXB66cKrR+jeYk6LBqtCv+Ng0z2T2ZbCw/A==","deprecated":"Older versions contained personal PII (test fixtures) and have been superseded. Upgrade to @ar-agents/fecred@>=0.2.1, rebuilt from scrubbed source. Removal of the old tarballs has been requested from npm support.","repository":{"url":"git+https://github.com/ar-agents/ar-agents.git","type":"git","directory":"packages/fecred"},"_npmVersion":"10.8.2","description":"Agent toolkit for AFIP/ARCA WSFECred (Factura de Credito Electronica MiPyME): check if a counterparty is obligated to the FCE regime, list received FCEs, and accept or reject them. Pair with @ar-agents/identity for WSAA cert + signature handling.","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@ar-agents/core":"^0.1.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.175","zod":"^4.4.3","tsup":"^8.3.5","vitest":"^2.1.8","typescript":"^5.9.3","@types/node":"^20.19.39"},"peerDependencies":{"ai":">=6.0.0","zod":">=3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fecred_0.2.0_1781280168544_0.016678713441642623","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@ar-agents/fecred","version":"0.2.1","keywords":["fecred","wsfecred","factura-de-credito-electronica","fce","mipyme","afip","arca","factura-electronica","argentina","ai-sdk","vercel-ai","agent","ar-agents","sociedades-ia"],"author":{"name":"Nazareno Clemente","email":"naza@naza.ar"},"license":"MIT","_id":"@ar-agents/fecred@0.2.1","maintainers":[{"name":"naza-ar","email":"clementenaza@gmail.com"}],"homepage":"https://github.com/ar-agents/ar-agents/tree/main/packages/fecred","bugs":{"url":"https://github.com/ar-agents/ar-agents/issues"},"dist":{"shasum":"7684e74ad217d7e69c419cf8ed190b62b644310f","tarball":"https://registry.npmjs.org/@ar-agents/fecred/-/fecred-0.2.1.tgz","fileCount":12,"integrity":"sha512-72CXoJRxmqwypvsTKa9dvQkvTMHRv4TNr7qGRvuWTJ2Pz3T2MLE8bm+LGwlZLuWl37MKE3zyMuDPjFStdzJA6A==","signatures":[{"sig":"MEYCIQC80Ck/IQkQXmLMbZCLfS8X1uKbZ//COpNCCDZ06nBK9AIhALKnwt9E3l7LIXSdfdCdEUzxn80AdTALFZPdfT0l7Rph","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ar-agents%2ffecred@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":246158},"main":"./dist/index.cjs","type":"module","_from":"file:ar-agents-fecred-0.2.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./tools.manifest.json":"./tools.manifest.json"},"funding":{"url":"https://github.com/sponsors/naza00000","type":"github"},"scripts":{"test":"vitest run","build":"tsup","clean":"rm -rf dist","validate":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"naza-ar","email":"clementenaza@gmail.com"},"_resolved":"/tmp/a5550f7f66ce56d85737f817cc124b92/ar-agents-fecred-0.2.1.tgz","_integrity":"sha512-72CXoJRxmqwypvsTKa9dvQkvTMHRv4TNr7qGRvuWTJ2Pz3T2MLE8bm+LGwlZLuWl37MKE3zyMuDPjFStdzJA6A==","repository":{"url":"git+https://github.com/ar-agents/ar-agents.git","type":"git","directory":"packages/fecred"},"_npmVersion":"10.8.2","description":"Agent toolkit for AFIP/ARCA WSFECred (Factura de Credito Electronica MiPyME): check if a counterparty is obligated to the FCE regime, list received FCEs, and accept or reject them. Pair with @ar-agents/identity for WSAA cert + signature handling.","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@ar-agents/core":"^0.2.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.175","zod":"^4.4.3","tsup":"^8.3.5","vitest":"^2.1.8","typescript":"^5.9.3","@types/node":"^20.19.39"},"peerDependencies":{"ai":">=6.0.0","zod":">=3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fecred_0.2.1_1782389697564_0.2586892742504334","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@ar-agents/fecred","version":"0.2.2","keywords":["fecred","wsfecred","factura-de-credito-electronica","fce","mipyme","afip","arca","factura-electronica","argentina","ai-sdk","vercel-ai","agent","ar-agents","sociedades-ia"],"author":{"name":"Nazareno Clemente","email":"naza@naza.ar"},"license":"MIT","_id":"@ar-agents/fecred@0.2.2","maintainers":[{"name":"naza-ar","email":"clementenaza@gmail.com"}],"homepage":"https://github.com/ar-agents/ar-agents/tree/main/packages/fecred","bugs":{"url":"https://github.com/ar-agents/ar-agents/issues"},"dist":{"shasum":"0f60855cd3f07c36020a9edf0546427ff394f0ff","tarball":"https://registry.npmjs.org/@ar-agents/fecred/-/fecred-0.2.2.tgz","fileCount":12,"integrity":"sha512-+Y+hE4bbjRHy2q52d+cS3YLUXcGuLNZnLZ6yhSJUA7OsB8gfQy8br1QvvDEvHibgFYGV5Rj3Rl1hoke+D1iZig==","signatures":[{"sig":"MEUCIQC81hPLjzgkjlfoZT7AYfg1zgYXQGJ6VMG5Iips9k6T3AIgL6S8Fr0h0gT/iEm0rxKIteMsO/UVkqswRJGIatjcOD8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ar-agents%2ffecred@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":244252},"main":"./dist/index.cjs","type":"module","_from":"file:ar-agents-fecred-0.2.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./tools.manifest.json":"./tools.manifest.json"},"funding":{"url":"https://github.com/sponsors/naza00000","type":"github"},"scripts":{"test":"vitest run","build":"tsup","clean":"rm -rf dist","validate":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"naza-ar","email":"clementenaza@gmail.com"},"_resolved":"/tmp/40e969dc219148b89bf4b48ed237e25c/ar-agents-fecred-0.2.2.tgz","_integrity":"sha512-+Y+hE4bbjRHy2q52d+cS3YLUXcGuLNZnLZ6yhSJUA7OsB8gfQy8br1QvvDEvHibgFYGV5Rj3Rl1hoke+D1iZig==","repository":{"url":"git+https://github.com/ar-agents/ar-agents.git","type":"git","directory":"packages/fecred"},"_npmVersion":"10.9.8","description":"Agent toolkit for AFIP/ARCA WSFECred (Factura de Credito Electronica MiPyME): check if a counterparty is obligated to the FCE regime, list received FCEs, and accept or reject them. Pair with @ar-agents/identity for WSAA cert + signature handling.","directories":{},"_nodeVersion":"22.23.0","dependencies":{"@ar-agents/core":"^0.3.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.0","zod":"^4.4.3","tsup":"^8.3.5","vitest":"^2.1.8","typescript":"^5.9.3","@types/node":"^20.19.39"},"peerDependencies":{"ai":">=6.0.0","zod":">=3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fecred_0.2.2_1782899912935_0.15652590096678054","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@ar-agents/fecred","version":"0.2.3","keywords":["fecred","wsfecred","factura-de-credito-electronica","fce","mipyme","afip","arca","factura-electronica","argentina","ai-sdk","vercel-ai","agent","ar-agents","sociedades-ia"],"author":{"name":"Nazareno Clemente","email":"naza@naza.ar"},"license":"MIT","_id":"@ar-agents/fecred@0.2.3","maintainers":[{"name":"naza-ar","email":"clementenaza@gmail.com"}],"homepage":"https://github.com/ar-agents/ar-agents/tree/main/packages/fecred","bugs":{"url":"https://github.com/ar-agents/ar-agents/issues"},"dist":{"shasum":"62d2cc07304e63fa8bc74134101645a6b3bb5ec9","tarball":"https://registry.npmjs.org/@ar-agents/fecred/-/fecred-0.2.3.tgz","fileCount":12,"integrity":"sha512-2eCWteh5Zx++HrZuYJsGBPMvBW3GfDit1ydcDSQzgSWRgPJWUUGhnuEK/FRoLsXdc/qUAV48YoHMhHh5FfnzKg==","signatures":[{"sig":"MEYCIQDWkSM3w/0PeUSrcJJAoFq3QwyVB2fmkaPHO+JOLVtyzwIhAIAC2ilcUVIPQeyYditg56nWQeeSlD1skHgZmxs93j4L","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ar-agents%2ffecred@0.2.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":244434},"main":"./dist/index.cjs","type":"module","_from":"file:ar-agents-fecred-0.2.3.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./tools.manifest.json":"./tools.manifest.json"},"funding":{"url":"https://github.com/sponsors/naza00000","type":"github"},"scripts":{"test":"vitest run","build":"tsup","clean":"rm -rf dist","validate":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"naza-ar","email":"clementenaza@gmail.com"},"_resolved":"/tmp/d31b4b601d9e394d6a8962f58551d046/ar-agents-fecred-0.2.3.tgz","_integrity":"sha512-2eCWteh5Zx++HrZuYJsGBPMvBW3GfDit1ydcDSQzgSWRgPJWUUGhnuEK/FRoLsXdc/qUAV48YoHMhHh5FfnzKg==","repository":{"url":"git+https://github.com/ar-agents/ar-agents.git","type":"git","directory":"packages/fecred"},"_npmVersion":"10.9.8","description":"Agent toolkit for AFIP/ARCA WSFECred (Factura de Credito Electronica MiPyME): check if a counterparty is obligated to the FCE regime, list received FCEs, and accept or reject them. Pair with @ar-agents/identity for WSAA cert + signature handling.","directories":{},"_nodeVersion":"22.23.1","dependencies":{"@ar-agents/core":"^0.4.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.0","zod":"^4.4.3","tsup":"^8.3.5","vitest":"^2.1.8","typescript":"^5.9.3","@types/node":"^20.19.39"},"peerDependencies":{"ai":">=6.0.0","zod":">=3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fecred_0.2.3_1783077265659_0.7206927393405853","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@ar-agents/fecred","version":"0.3.0","description":"Agent toolkit for AFIP/ARCA WSFECred (Factura de Credito Electronica MiPyME): check if a counterparty is obligated to the FCE regime, list received FCEs, and accept or reject them. Pair with @ar-agents/identity for WSAA cert + signature handling.","keywords":["fecred","wsfecred","factura-de-credito-electronica","fce","mipyme","afip","arca","factura-electronica","argentina","ai-sdk","vercel-ai","agent","ar-agents","sociedades-ia"],"license":"MIT","author":{"name":"Nazareno Clemente","email":"naza@naza.ar"},"funding":{"type":"github","url":"https://github.com/sponsors/naza00000"},"homepage":"https://github.com/ar-agents/ar-agents/tree/main/packages/fecred","repository":{"type":"git","url":"git+https://github.com/ar-agents/ar-agents.git","directory":"packages/fecred"},"bugs":{"url":"https://github.com/ar-agents/ar-agents/issues"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./tools.manifest.json":"./tools.manifest.json"},"peerDependencies":{"ai":">=6.0.0","zod":">=3.0.0"},"devDependencies":{"@types/node":"^20.19.39","ai":"^7.0.0","tsup":"^8.3.5","typescript":"^5.9.3","vitest":"^2.1.8","zod":"^4.4.3"},"publishConfig":{"access":"public","provenance":true},"engines":{"node":">=20.0.0"},"dependencies":{"@ar-agents/core":"^0.4.1"},"scripts":{"build":"tsup","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","typecheck":"tsc --noEmit","validate":"publint && attw --pack .","clean":"rm -rf dist"},"_id":"@ar-agents/fecred@0.3.0","_integrity":"sha512-edHmyPUdYRBUMpr9v1YqljwefLx9uozGbjmxEAA+F11pWoqJKBkjQZccXsfgMNGE1cmWe2DtWeTMcWFdX5d8sg==","_resolved":"/tmp/ab1fd6ccb10a82451ce2b8ddc14ca8ae/ar-agents-fecred-0.3.0.tgz","_from":"file:ar-agents-fecred-0.3.0.tgz","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-edHmyPUdYRBUMpr9v1YqljwefLx9uozGbjmxEAA+F11pWoqJKBkjQZccXsfgMNGE1cmWe2DtWeTMcWFdX5d8sg==","shasum":"25b5b37027b78dcfa31bb7d007be1d59d5b4bfca","tarball":"https://registry.npmjs.org/@ar-agents/fecred/-/fecred-0.3.0.tgz","fileCount":12,"unpackedSize":257921,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ar-agents%2ffecred@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHeCjl7NrTw49ElOWSY7UErxh6/IMw9brKiFVC8RV6ORAiEAvA8aQepBaVCu8dy8mPlv9gsX6zMLlpQz0U14xIZVeck="}]},"_npmUser":{"name":"naza-ar","email":"clementenaza@gmail.com"},"directories":{},"maintainers":[{"name":"naza-ar","email":"clementenaza@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fecred_0.3.0_1783086479336_0.33934122024481783"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-12T16:02:48.416Z","modified":"2026-07-03T13:47:59.812Z","0.2.0":"2026-06-12T16:02:48.668Z","0.2.1":"2026-06-25T12:14:57.773Z","0.2.2":"2026-07-01T09:58:33.083Z","0.2.3":"2026-07-03T11:14:25.809Z","0.3.0":"2026-07-03T13:47:59.516Z"},"bugs":{"url":"https://github.com/ar-agents/ar-agents/issues"},"author":{"name":"Nazareno Clemente","email":"naza@naza.ar"},"license":"MIT","homepage":"https://github.com/ar-agents/ar-agents/tree/main/packages/fecred","keywords":["fecred","wsfecred","factura-de-credito-electronica","fce","mipyme","afip","arca","factura-electronica","argentina","ai-sdk","vercel-ai","agent","ar-agents","sociedades-ia"],"repository":{"type":"git","url":"git+https://github.com/ar-agents/ar-agents.git","directory":"packages/fecred"},"description":"Agent toolkit for AFIP/ARCA WSFECred (Factura de Credito Electronica MiPyME): check if a counterparty is obligated to the FCE regime, list received FCEs, and accept or reject them. Pair with @ar-agents/identity for WSAA cert + signature handling.","maintainers":[{"name":"naza-ar","email":"clementenaza@gmail.com"}],"readme":"# @ar-agents/fecred\n\nAgent toolkit for AFIP/ARCA **WSFECred** (Registro de Facturas de Credito Electronica MiPyME, RG 4367). Check if a counterparty is obligated to the FCE regime, list received FCEs, and accept or reject them within the legal window.\n\n```sh\npnpm add @ar-agents/fecred\n```\n\n## What this package does\n\n- **`HttpFecredAdapter`**: real adapter that POSTs SOAP to AFIP WSFECred (homo or prod). Caller supplies a WSAA access ticket for the `wsfecred` service; the adapter handles envelope construction, SOAPAction header, and response parsing.\n- **`InMemoryFecredAdapter`**: deterministic adapter for integration tests + demos. Seed received FCEs and obligated CUITs; accept/reject mutate the in-memory state with AFIP-realistic semantics.\n- **`UnconfiguredFecredAdapter`**: explicit throws-on-every-call default, so an agent without creds never silently lies.\n- **Five Vercel AI SDK tools**: `fecred_check_obligation`, `fecred_list_received`, `fecred_accept_invoice`, `fecred_reject_invoice`, `fecred_health`.\n\n## When to use this vs the sibling packages\n\n| You want to...                                                  | Use                       |\n| --------------------------------------------------------------- | ------------------------- |\n| Issue a regular factura (A/B/C) and get a CAE                   | `@ar-agents/facturacion`  |\n| Validate that a received factura's CAE is real                  | `@ar-agents/wscdc`        |\n| Know if your invoice to a big buyer MUST be an FCE              | **this package**          |\n| Manage FCEs you received: list, accept, reject                  | **this package**          |\n\nThe FCE regime applies when a MiPyME invoices a large company above a threshold amount (`montoDesde`). AFIP updates that threshold periodically (for example the April 2026 update to roughly ARS 5.5M); `fecred_check_obligation` returns the live value, so never hardcode it.\n\n## Quick start\n\n```ts\nimport { HttpFecredAdapter, type AccessTicket } from \"@ar-agents/fecred\";\n\n// Acquire a TA from your WSAA flow first, service id \"wsfecred\":\n//   const ta = await acquireWsaaTicket(\"wsfecred\", { certPem, keyPem });\nconst ticket: AccessTicket = /* ... */ undefined!;\n\nconst fecred = new HttpFecredAdapter({ env: \"prod\", ticket });\n\n// 1. Before issuing: must this invoice be an FCE?\nconst oblig = await fecred.checkObligation({ cuitConsultada: \"30-50000001-8\" });\nif (oblig.obligado && invoiceTotal >= (oblig.montoDesde ?? Infinity)) {\n  // Issue FCE type 201/206/211 via @ar-agents/facturacion.\n}\n\n// 2. As receptor: what is pending acceptance?\nconst pending = await fecred.listComprobantes({\n  rol: \"Receptor\",\n  estadoCmp: \"Recepcionado\",\n  fechaTipo: \"Emision\",\n});\n\n// 3. Accept one (IRREVERSIBLE legal act):\nconst r = await fecred.acceptInvoice({\n  idFactura: { cuitEmisor: \"20-12345678-6\", codTipoCmp: 201, ptoVta: 3, nroCmp: 42 },\n  saldoAceptado: 8_000_000,\n  codMoneda: \"PES\",\n  cotizacionMonedaUlt: 1,\n});\n```\n\nWired as agent tools:\n\n```ts\nimport { Experimental_Agent as Agent } from \"ai\";\nimport { fecredTools, HttpFecredAdapter } from \"@ar-agents/fecred\";\nimport { anthropic } from \"@ai-sdk/anthropic\";\n\nconst agent = new Agent({\n  model: anthropic(\"claude-sonnet-4-7\"),\n  tools: fecredTools({\n    adapter: new HttpFecredAdapter({ env: \"prod\", ticket }),\n  }),\n  system: \"Sos un agente que gestiona Facturas de Credito Electronica recibidas.\",\n});\n```\n\n## The legal window\n\nA received FCE that is not rejected within the legal acceptance window (15 corridos days from puesta a disposicion) is **tacitly accepted** and becomes a negotiable credit title. Run `fecred_list_received` regularly and surface anything close to `fechaVenAcep`.\n\n## In-memory testing\n\n```ts\nimport { InMemoryFecredAdapter, fecredTools } from \"@ar-agents/fecred\";\n\nconst adapter = new InMemoryFecredAdapter({\n  obligatedCuits: [\"30-50000001-8\"],\n  montoDesde: 5_500_000, // configurable; the real value comes from AFIP\n  comprobantes: [/* seeded FecredComprobante objects */],\n});\n\nconst tools = fecredTools({ adapter });\n```\n\n## Errors\n\n```ts\nimport {\n  FecredError,\n  FecredValidationError,  // bad input, do NOT retry\n  FecredProtocolError,    // network / HTTP / SOAP fault, may retry\n  FecredUnconfiguredError,\n} from \"@ar-agents/fecred\";\n```\n\nA `resultado: \"R\"` in an accept/reject response is NOT thrown: it means AFIP refused the operation (already accepted, out of window, etc.) and the `errors[]` array explains why.\n\n## Constraints\n\n- **Dates are YYYY-MM-DD** (xsd:date). This differs from WSFE/WSCDC's YYYYMMDD.\n- **FCE comprobante type codes**: 201 (FCE A), 206 (FCE B), 211 (FCE C), plus their nota de debito/credito variants.\n- **WSAA service id is `wsfecred`** and requires its own authorization in the AFIP portal, separate from `wsfe` and `wscdc`.\n- **Rejection requires at least one motivo** with `codMotivo`, `descMotivo`, and `justificacion` (max 250 chars each).\n\nFor LLM agents using these tools, see [AGENTS.md](./AGENTS.md).\n\n## License\n\nMIT, Nazareno Clemente <naza@naza.ar>\n","readmeFilename":"README.md"}