{"_id":"@demystify/gateway-moat","_rev":"5-4a10e585c1fc56d0fbc5dd446ed814c9","name":"@demystify/gateway-moat","dist-tags":{"latest":"0.6.0"},"versions":{"0.3.0":{"name":"@demystify/gateway-moat","version":"0.3.0","author":{"name":"Demystify Systems"},"license":"MIT","_id":"@demystify/gateway-moat@0.3.0","maintainers":[{"name":"demystifier09","email":"me@demystifysystem.com"}],"homepage":"https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway/moat","bugs":{"url":"https://github.com/demystify-systems/ai-services-tools/issues"},"dist":{"shasum":"8127ce5676f8f50c0731195714c18cb2f734f414","tarball":"https://registry.npmjs.org/@demystify/gateway-moat/-/gateway-moat-0.3.0.tgz","fileCount":19,"integrity":"sha512-8no8pEruf2RVg+GxTwmyN+uylQDIgH6QDCl9LKgm8Pi3DPqYDfD/XrMRAs96Zlf3X7UnKv5W36bwkpVHtpRAbg==","signatures":[{"sig":"MEUCIAszXpRM0zhFfZ3HtSzDliCCSc+lMZSJ5i5XHH44ZrCEAiEAw6gb5y3wCxSGeQwT9liXQXaI/6ITYd4j9bVw72YYmUA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":611970},"main":"./dist/index.js","type":"module","_from":"file:demystify-gateway-moat-0.3.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"eslint . && prettier --check src test","test":"tsc --noEmit && vitest run","build":"tsup src/index.ts src/server.ts --format esm --dts --sourcemap --clean","start":"node dist/server.js","typecheck":"tsc --noEmit"},"_npmUser":{"name":"demystifier09","email":"me@demystifysystem.com"},"_resolved":"/tmp/4f900694e4b870f5962cc78c95488739/demystify-gateway-moat-0.3.0.tgz","_integrity":"sha512-8no8pEruf2RVg+GxTwmyN+uylQDIgH6QDCl9LKgm8Pi3DPqYDfD/XrMRAs96Zlf3X7UnKv5W36bwkpVHtpRAbg==","repository":{"url":"git+https://github.com/demystify-systems/ai-services-tools.git","type":"git","directory":"modules/dmstfy-gateway/moat"},"_npmVersion":"10.9.8","description":"dmstfy-gateway moat layer: multi-tenant AI gateway (tenancy, keys, limits, budgets, routing, queueing) on Hono","directories":{},"_nodeVersion":"22.23.1","dependencies":{"pg":"^8.13.1","zod":"^3.24.0","hono":"^4.6.14","ioredis":"^5.4.2","@hono/node-server":"^1.13.7","@demystify/platform-cache":"^0.3.0","@demystify/platform-state":"^0.3.0","@demystify/platform-profiles":"^0.3.0","@demystify/platform-observability":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^3.0.0","prettier":"^3.4.2","@types/pg":"^8.11.10","@eslint/js":"^9.17.0","typescript":"~5.7.2","@types/node":"^22.10.2","typescript-eslint":"^8.18.1","@electric-sql/pglite":"^0.2.17","@stryker-mutator/core":"^9.6.1","@demystify/platform-contracts":"^0.3.0","@stryker-mutator/vitest-runner":"^9.6.1"},"_npmOperationalInternal":{"tmp":"tmp/gateway-moat_0.3.0_1786507739378_0.002049169734189782","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@demystify/gateway-moat","version":"0.4.0","author":{"name":"Demystify Systems"},"license":"MIT","_id":"@demystify/gateway-moat@0.4.0","maintainers":[{"name":"demystifier09","email":"me@demystifysystem.com"}],"homepage":"https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway/moat","bugs":{"url":"https://github.com/demystify-systems/ai-services-tools/issues"},"dist":{"shasum":"7190c22e5dd0318086b4b8a587fc94ed74bc585b","tarball":"https://registry.npmjs.org/@demystify/gateway-moat/-/gateway-moat-0.4.0.tgz","fileCount":34,"integrity":"sha512-jvcsZcUaTSS69lTyKA2dwY0WNOD8lHEqJIJOGEvuKBs5y51zsP8hHV9c5ErXNrl/+ZDHDkvSaYXG/FOGP11MhQ==","signatures":[{"sig":"MEUCIQDEQ0V7x6oE7AQgD4nmMXS60MGpJ4vevstR16M1/I9LVQIgD7YPyqwS8aakWTCFHOa+crOvf6puZnJCHVhqt2cZp5g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2247124},"main":"./dist/index.js","type":"module","_from":"file:demystify-gateway-moat-0.4.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./core":{"types":"./dist/core-only.d.ts","import":"./dist/core-only.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"scripts":{"lint":"eslint . && prettier --check src test","test":"tsc --noEmit && vitest run","build":"tsup src/index.ts src/core-only.ts src/server.ts --format esm --dts --sourcemap --clean","start":"node dist/server.js","typecheck":"tsc --noEmit"},"_npmUser":{"name":"demystifier09","email":"me@demystifysystem.com"},"_resolved":"/tmp/aaa11bce931fb53cdee1defd4b457c22/demystify-gateway-moat-0.4.0.tgz","_integrity":"sha512-jvcsZcUaTSS69lTyKA2dwY0WNOD8lHEqJIJOGEvuKBs5y51zsP8hHV9c5ErXNrl/+ZDHDkvSaYXG/FOGP11MhQ==","repository":{"url":"git+https://github.com/demystify-systems/ai-services-tools.git","type":"git","directory":"modules/dmstfy-gateway/moat"},"_npmVersion":"10.9.8","description":"dmstfy-gateway moat layer: multi-tenant AI gateway (tenancy, keys, limits, budgets, routing, queueing) on Hono","directories":{},"_nodeVersion":"22.23.1","dependencies":{"zod":"^3.24.0","@demystify/platform-cache":"^0.3.0","@demystify/platform-state":"^0.3.0","@demystify/platform-profiles":"^0.3.0","@demystify/platform-observability":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^3.0.0","prettier":"^3.4.2","@types/pg":"^8.11.10","@eslint/js":"^9.17.0","typescript":"~5.7.2","@types/node":"^22.10.2","typescript-eslint":"^8.18.1","@electric-sql/pglite":"^0.2.17","@stryker-mutator/core":"^9.6.1","@demystify/platform-contracts":"^0.3.0","@stryker-mutator/vitest-runner":"^9.6.1"},"optionalDependencies":{"pg":"^8.13.1","hono":"^4.6.14","ioredis":"^5.4.2","@hono/node-server":"^1.13.7"},"_npmOperationalInternal":{"tmp":"tmp/gateway-moat_0.4.0_1786685723138_0.41292863921864353","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@demystify/gateway-moat","version":"0.4.1","author":{"name":"Demystify Systems"},"license":"MIT","_id":"@demystify/gateway-moat@0.4.1","maintainers":[{"name":"demystifier09","email":"me@demystifysystem.com"}],"homepage":"https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway/moat","bugs":{"url":"https://github.com/demystify-systems/ai-services-tools/issues"},"dist":{"shasum":"0ae1b36424b1063e66ff60b6fad47163d9140245","tarball":"https://registry.npmjs.org/@demystify/gateway-moat/-/gateway-moat-0.4.1.tgz","fileCount":35,"integrity":"sha512-pDQBzLY6rVvmnX328pCiJpgUpxdhCPXX+jjoCCs1IkPELSdr5B1DXIfA312xaV1cz+ZlpxEwt9UMbCeavYxu7Q==","signatures":[{"sig":"MEYCIQDgMDJK/2y8O/iUwTcaS3ImSrxrLeRlHAgcNJWYr+OaWwIhAJaLhbl5qTEQMxhMtUbu2orBDmDq7RqyT3n0DLpElJYD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2249191},"main":"./dist/index.js","type":"module","_from":"file:demystify-gateway-moat-0.4.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./core":{"types":"./dist/core-only.d.ts","import":"./dist/core-only.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"scripts":{"lint":"eslint . && prettier --check src test","test":"tsc --noEmit && vitest run","build":"tsup src/index.ts src/core-only.ts src/server.ts --format esm --dts --sourcemap --clean","start":"node dist/server.js","typecheck":"tsc --noEmit"},"_npmUser":{"name":"demystifier09","email":"me@demystifysystem.com"},"_resolved":"/tmp/248ffbd6acd5bc4c74803ba693019553/demystify-gateway-moat-0.4.1.tgz","_integrity":"sha512-pDQBzLY6rVvmnX328pCiJpgUpxdhCPXX+jjoCCs1IkPELSdr5B1DXIfA312xaV1cz+ZlpxEwt9UMbCeavYxu7Q==","repository":{"url":"git+https://github.com/demystify-systems/ai-services-tools.git","type":"git","directory":"modules/dmstfy-gateway/moat"},"_npmVersion":"10.9.8","description":"dmstfy-gateway moat layer: multi-tenant AI gateway (tenancy, keys, limits, budgets, routing, queueing) on Hono","directories":{},"_nodeVersion":"22.23.2","dependencies":{"zod":"^3.24.0","@demystify/platform-cache":"^0.3.0","@demystify/platform-state":"^0.3.0","@demystify/platform-profiles":"^0.3.0","@demystify/platform-observability":"^0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^3.0.0","prettier":"^3.4.2","@types/pg":"^8.11.10","@eslint/js":"^9.17.0","typescript":"~5.7.2","@types/node":"^22.10.2","typescript-eslint":"^8.18.1","@electric-sql/pglite":"^0.2.17","@stryker-mutator/core":"^9.6.1","@demystify/platform-contracts":"^0.3.0","@stryker-mutator/vitest-runner":"^9.6.1"},"optionalDependencies":{"pg":"^8.13.1","hono":"^4.6.14","ioredis":"^5.4.2","@hono/node-server":"^1.13.7"},"_npmOperationalInternal":{"tmp":"tmp/gateway-moat_0.4.1_1786703358434_0.4403742086156721","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@demystify/gateway-moat","version":"0.5.0","author":{"name":"Demystify Systems"},"license":"MIT","_id":"@demystify/gateway-moat@0.5.0","maintainers":[{"name":"demystifier09","email":"me@demystifysystem.com"}],"homepage":"https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway/moat","bugs":{"url":"https://github.com/demystify-systems/ai-services-tools/issues"},"dist":{"shasum":"38d2752b64b349a5c04f83a5fcd7a2ad12e25811","tarball":"https://registry.npmjs.org/@demystify/gateway-moat/-/gateway-moat-0.5.0.tgz","fileCount":35,"integrity":"sha512-DIGP0PlcuRbVOcK4DEm2dCWLfNuuPfKfsnuK2Ium7caMIB4liBuTntpgMl9c27uaJg3MPFs0SNJ1d+cjiKHt7w==","signatures":[{"sig":"MEUCIE0YpIl/2pdZqUJRx4DW5NxBb/Z9cJ3FtU2DP6BBxX5MAiEA2WT/8YXg5ZaGnDoT334DAYPZBerD7zsI8zsOISnFSDo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2264000},"main":"./dist/index.js","type":"module","_from":"file:demystify-gateway-moat-0.5.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./core":{"types":"./dist/core-only.d.ts","import":"./dist/core-only.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"scripts":{"lint":"eslint . && prettier --check src test","test":"tsc --noEmit && vitest run","build":"tsup src/index.ts src/core-only.ts src/server.ts --format esm --dts --sourcemap --clean","start":"node dist/server.js","typecheck":"tsc --noEmit"},"_npmUser":{"name":"demystifier09","email":"me@demystifysystem.com"},"_resolved":"/tmp/d424c6563c26eced184851ef4b7d6a4e/demystify-gateway-moat-0.5.0.tgz","_integrity":"sha512-DIGP0PlcuRbVOcK4DEm2dCWLfNuuPfKfsnuK2Ium7caMIB4liBuTntpgMl9c27uaJg3MPFs0SNJ1d+cjiKHt7w==","repository":{"url":"git+https://github.com/demystify-systems/ai-services-tools.git","type":"git","directory":"modules/dmstfy-gateway/moat"},"_npmVersion":"10.9.8","description":"dmstfy-gateway moat layer: multi-tenant AI gateway (tenancy, keys, limits, budgets, routing, queueing) on Hono","directories":{},"_nodeVersion":"22.23.2","dependencies":{"zod":"^3.24.0","@demystify/platform-cache":"^0.3.0","@demystify/platform-state":"^0.3.0","@demystify/platform-profiles":"^0.3.0","@demystify/platform-observability":"^0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^3.0.0","prettier":"^3.4.2","@types/pg":"^8.11.10","@eslint/js":"^9.17.0","typescript":"~5.7.2","@types/node":"^22.10.2","typescript-eslint":"^8.18.1","@electric-sql/pglite":"^0.2.17","@stryker-mutator/core":"^9.6.1","@demystify/platform-contracts":"^0.3.0","@stryker-mutator/vitest-runner":"^9.6.1"},"optionalDependencies":{"pg":"^8.13.1","hono":"^4.6.14","ioredis":"^5.4.2","@hono/node-server":"^1.13.7"},"_npmOperationalInternal":{"tmp":"tmp/gateway-moat_0.5.0_1786714292997_0.8660398728572909","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@demystify/gateway-moat","version":"0.6.0","description":"dmstfy-gateway moat layer: multi-tenant AI gateway (tenancy, keys, limits, budgets, routing, queueing) on Hono","type":"module","license":"MIT","author":{"name":"Demystify Systems"},"homepage":"https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway/moat","repository":{"type":"git","url":"git+https://github.com/demystify-systems/ai-services-tools.git","directory":"modules/dmstfy-gateway/moat"},"engines":{"node":">=22"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./core":{"types":"./dist/core-only.d.ts","import":"./dist/core-only.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"dependencies":{"@demystify/platform-cache":"^0.3.0","@demystify/platform-observability":"^0.3.0","@demystify/platform-profiles":"^0.3.0","@demystify/platform-state":"^0.3.0","zod":"^3.24.0"},"devDependencies":{"@demystify/platform-contracts":"^0.3.0","@electric-sql/pglite":"^0.2.17","@eslint/js":"^9.17.0","@stryker-mutator/core":"^9.6.1","@stryker-mutator/vitest-runner":"^9.6.1","@types/node":"^22.10.2","@types/pg":"^8.11.10","eslint":"^9.17.0","prettier":"^3.4.2","tsup":"^8.3.5","typescript":"~5.7.2","typescript-eslint":"^8.18.1","vitest":"^3.0.0"},"optionalDependencies":{"hono":"^4.6.14","@hono/node-server":"^1.13.7","ioredis":"^5.4.2","pg":"^8.13.1"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup src/index.ts src/core-only.ts src/server.ts --format esm --dts --sourcemap --clean","typecheck":"tsc --noEmit","lint":"eslint . && prettier --check src test","test":"tsc --noEmit && vitest run","start":"node dist/server.js"},"_id":"@demystify/gateway-moat@0.6.0","bugs":{"url":"https://github.com/demystify-systems/ai-services-tools/issues"},"_integrity":"sha512-3G4EhYKPaIb/KxVaFtVgc2+azV+zPslZjZrE8xVNRDvmCfeOseLpPUwbeh/l4x1Lz7BnpNCWqpKygj36FkCnbw==","_resolved":"/tmp/6c69b38906754596a84e168b5ea78fa6/demystify-gateway-moat-0.6.0.tgz","_from":"file:demystify-gateway-moat-0.6.0.tgz","_nodeVersion":"22.23.2","_npmVersion":"10.9.8","dist":{"integrity":"sha512-3G4EhYKPaIb/KxVaFtVgc2+azV+zPslZjZrE8xVNRDvmCfeOseLpPUwbeh/l4x1Lz7BnpNCWqpKygj36FkCnbw==","shasum":"99814aaa3be7949032ff4a220c3bece58c3296cd","tarball":"https://registry.npmjs.org/@demystify/gateway-moat/-/gateway-moat-0.6.0.tgz","fileCount":35,"unpackedSize":2270176,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDbMEygDaKgngWwdPT9I8hnXZIqSbo9vp82QHkMbithngIgK64xKB77BgL6YtJemA0A0VuXJhikPY17jkJaK4Q4x1s="}]},"_npmUser":{"name":"demystifier09","email":"me@demystifysystem.com"},"directories":{},"maintainers":[{"name":"demystifier09","email":"me@demystifysystem.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gateway-moat_0.6.0_1787120849198_0.9396162155236072"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-12T04:08:59.266Z","modified":"2026-08-19T06:27:29.595Z","0.3.0":"2026-08-12T04:08:59.594Z","0.4.0":"2026-08-14T05:35:23.380Z","0.4.1":"2026-08-14T10:29:18.616Z","0.5.0":"2026-08-14T13:31:33.152Z","0.6.0":"2026-08-19T06:27:29.424Z"},"bugs":{"url":"https://github.com/demystify-systems/ai-services-tools/issues"},"author":{"name":"Demystify Systems"},"license":"MIT","homepage":"https://github.com/demystify-systems/ai-services-tools/tree/main/modules/dmstfy-gateway/moat","repository":{"type":"git","url":"git+https://github.com/demystify-systems/ai-services-tools.git","directory":"modules/dmstfy-gateway/moat"},"description":"dmstfy-gateway moat layer: multi-tenant AI gateway (tenancy, keys, limits, budgets, routing, queueing) on Hono","maintainers":[{"name":"demystifier09","email":"me@demystifysystem.com"}],"readme":"# @demystify/gateway-moat\n\nModel routing, rate limiting, budgets and a usage ledger — as a **library**.\n\n## Serverless: import `/core`\n\n```ts\nimport {\n  Router, ProviderHealthTracker, RateLimiter, BudgetService,\n  UsageService, KeysService, MemoryRepo, MemoryLimitStore,\n  MockBackend, InMemoryEventBus, SystemClock, DEFAULT_ROUTER_CONFIG,\n} from \"@demystify/gateway-moat/core\";\n```\n\n`/core` has **no Hono, no ioredis, no pg**. `hono`, `@hono/node-server`, `ioredis` and\n`pg` are `optionalDependencies` used only by the service entry points, so a Vercel or\nLambda bundle that imports `/core` does not carry a Redis client it has no use for.\n\nThe package root re-exports `createApp`, which pulls the HTTP layer in — that is what\nmade an earlier version unusable on serverless. Import the subpath.\n\n## What it gives you\n\n| Concern | Class |\n|---|---|\n| Alias chains + failover on 429/5xx/timeout | `Router` |\n| Circuit breaker with cooldown and probe | `ProviderHealthTracker` |\n| Reservation-based rate limiting | `RateLimiter` |\n| Reserve → settle spend ceilings | `BudgetService` |\n| Append-only ledger, **integer µUSD** | `UsageService` |\n| Per-tenant virtual keys (`dmk_` + 32 hex) | `KeysService` |\n| Exact + semantic response caching | `SemanticCacheService` |\n\nEvery one works with the in-memory adapters and needs **no infrastructure**:\n`MemoryRepo`, `MemoryLimitStore`, `MemoryQueueStore`, `MemorySemanticCache`,\n`InMemoryEventBus`, `MockBackend`.\n\n## Entry points\n\n| Subpath | For |\n|---|---|\n| `/core` | **serverless and libraries** — pure, no service deps |\n| `.` | everything, including `createApp` (drags in Hono) |\n| `/server` | running the gateway as a service |\n\n## What it does NOT do\n\n- It is **not** a hosted service. Nothing is deployed; you run what you need.\n- The Postgres and Redis adapters are opt-in and live behind the optional deps.\n- Money is integer micro-USD. `UsageService.record` **rejects a non-integer cost**\n  rather than rounding it.\n\nMIT.\n","readmeFilename":"README.md"}