{"_id":"@custos-solana/ai","_rev":"6-f25d115f8d0a34d7390944fdb37bdc19","name":"@custos-solana/ai","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@custos-solana/ai","version":"0.1.0","keywords":["solana","wallet","security","transaction","simulation","web3","sdk","custos"],"author":{"name":"Team Too Hard"},"license":"MIT","_id":"@custos-solana/ai@0.1.0","maintainers":[{"name":"viettien539","email":"tien.vo539@gmail.com"}],"homepage":"https://github.com/NeitLN/Custos-Solana#readme","bugs":{"url":"https://github.com/NeitLN/Custos-Solana/issues"},"dist":{"shasum":"2d602c8369da833339bfc9156d7a1488d5232a42","tarball":"https://registry.npmjs.org/@custos-solana/ai/-/ai-0.1.0.tgz","fileCount":27,"integrity":"sha512-zK5zS4+53QKcSO4tBs2p2yFX3NhZDfyxbhsYUMvi/R76HiZvDtWoLopffX6jgX7el6bMlcMzjS2qDUlZvSQkRA==","signatures":[{"sig":"MEQCIA9IGLlvpXCXojHZgI9vLPe4kPOQ60DBR9etp+gZBtbqAiAZPiWhJXx+H6U46Mb28LK00P1A9h8U1dsBE06y4Iv1rQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":100662},"main":"./src/index.ts","type":"module","types":"./src/index.ts","exports":{".":"./src/index.ts"},"gitHead":"da0e1a452bec13e77cd535b004724e864b436449","scripts":{"build":"tsc -p tsconfig.build.json","prepack":"npm run build"},"_npmUser":{"name":"viettien539","email":"tien.vo539@gmail.com"},"deprecated":"Hong: main tro vao TS nguon. Dung 0.1.1 tro len.","repository":{"url":"git+https://github.com/NeitLN/Custos-Solana.git","type":"git","directory":"packages/ai"},"_npmVersion":"11.6.2","description":"Lớp diễn giải tiếng Việt cho Custos. Biến kết quả luật thành câu người thường đọc được — không bao giờ tự quyết định mức độ nguy hiểm.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@custos-solana/core":"^0.1.0","@custos-solana/types":"^0.1.0"},"publishConfig":{"main":"./dist/index.js","types":"./dist/index.d.ts","access":"public","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"_hasShrinkwrap":false,"devDependencies":{"@anthropic-ai/sdk":"^0.120.0"},"_npmOperationalInternal":{"tmp":"tmp/ai_0.1.0_1788163485097_0.30827158175737157","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@custos-solana/ai","version":"0.1.1","keywords":["solana","wallet","security","transaction","simulation","web3","sdk","custos"],"author":{"name":"Team Too Hard"},"license":"MIT","_id":"@custos-solana/ai@0.1.1","maintainers":[{"name":"viettien539","email":"tien.vo539@gmail.com"}],"homepage":"https://github.com/NeitLN/Custos-Solana#readme","bugs":{"url":"https://github.com/NeitLN/Custos-Solana/issues"},"dist":{"shasum":"8336a0a12641ea1b10f077b1275337f5f6085598","tarball":"https://registry.npmjs.org/@custos-solana/ai/-/ai-0.1.1.tgz","fileCount":19,"integrity":"sha512-ApLxN1xqkxdJ2X3OaohdMjqFUgLQqCafCohNmLZqLJQBdoRKjCGriB54BDOtZsyHnY32tP/6KHT6NHX1XYJE5g==","signatures":[{"sig":"MEUCIQCqcvP59sU3fneFkjXhE3m4IGKLOnXK7stPbiNyGuqbtAIgWMJVlwxz4nPmibNjFxmUufHbCU+7NvUi7bGRxkAQSTA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55395},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"7a59e732fa1d8223752027f8c0171a033dfda29f","_npmUser":{"name":"viettien539","email":"tien.vo539@gmail.com"},"repository":{"url":"git+https://github.com/NeitLN/Custos-Solana.git","type":"git","directory":"packages/ai"},"_npmVersion":"11.6.2","description":"Lớp diễn giải tiếng Việt cho Custos. Biến kết quả luật thành câu người thường đọc được — không bao giờ tự quyết định mức độ nguy hiểm.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@custos-solana/core":"^0.1.0","@custos-solana/types":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"@anthropic-ai/sdk":"^0.120.0"},"_npmOperationalInternal":{"tmp":"tmp/ai_0.1.1_1788164976691_0.7650349474776506","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@custos-solana/ai","version":"0.1.2","keywords":["solana","wallet","security","transaction","simulation","web3","sdk","custos"],"author":{"name":"Team Too Hard"},"license":"MIT","_id":"@custos-solana/ai@0.1.2","maintainers":[{"name":"viettien539","email":"tien.vo539@gmail.com"}],"homepage":"https://github.com/NeitLN/Custos-Solana#readme","bugs":{"url":"https://github.com/NeitLN/Custos-Solana/issues"},"dist":{"shasum":"3adb28413656ab872d51d477efa9949223c79c6e","tarball":"https://registry.npmjs.org/@custos-solana/ai/-/ai-0.1.2.tgz","fileCount":19,"integrity":"sha512-tG3uhRXi/RYC+W+NXY1Sapl7pGzV1dQ1KtiWZ1d8zKmSeAkliKy51Z3CXJ28WFPhve/GkZcz0RZTuXkZZEz7cw==","signatures":[{"sig":"MEQCIANHAoDWXVQpf3B3Wi8NjWk7tqJYVDWPi6TV2M5TwLvbAiAMYJeHcR6c61NvV5Tb92AEa2kbYHBpiW9TzdBRdk9AiQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56308},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"121cc27025ca3e7e6fb8de667dade9239669649b","_npmUser":{"name":"viettien539","email":"tien.vo539@gmail.com"},"repository":{"url":"git+https://github.com/NeitLN/Custos-Solana.git","type":"git","directory":"packages/ai"},"_npmVersion":"11.6.2","description":"Lớp diễn giải tiếng Việt cho Custos. Biến kết quả luật thành câu người thường đọc được — không bao giờ tự quyết định mức độ nguy hiểm.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@custos-solana/core":"^0.1.0","@custos-solana/types":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"@anthropic-ai/sdk":"^0.120.0"},"peerDependencies":{"@anthropic-ai/sdk":"^0.120.0"},"peerDependenciesMeta":{"@anthropic-ai/sdk":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ai_0.1.2_1788273405342_0.03111579591631841","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@custos-solana/ai","version":"0.2.0","keywords":["solana","wallet","security","transaction","simulation","web3","sdk","custos"],"author":{"name":"Team Too Hard"},"license":"MIT","_id":"@custos-solana/ai@0.2.0","maintainers":[{"name":"viettien539","email":"tien.vo539@gmail.com"}],"homepage":"https://github.com/NeitLN/Custos-Solana#readme","bugs":{"url":"https://github.com/NeitLN/Custos-Solana/issues"},"dist":{"shasum":"8fe83b46d98f7f99a36a6fff26e37a6ad0d3f14f","tarball":"https://registry.npmjs.org/@custos-solana/ai/-/ai-0.2.0.tgz","fileCount":19,"integrity":"sha512-GDmBA2oChfBCv9mHRdQCTOKeanLTOMi7J5ze+Tu1/lnMHPTzS0rLu3nSDbumgaOswnZ0vbKCnZORtnrvvHH3cg==","signatures":[{"sig":"MEQCIEpDBWEaIkhEj1vC72tIOkcXvH7eHk+26TwAuWAEM/DUAiBTKx9lAspx/o9PB4sLuqPoFsyLqOD5Fq/ykxgdmHm8yQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71758},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./anthropic":{"types":"./dist/anthropic.d.ts","default":"./dist/anthropic.js"}},"gitHead":"da0c427d66d7d97dc855643a4be086282d0e93c2","_npmUser":{"name":"viettien539","email":"tien.vo539@gmail.com"},"repository":{"url":"git+https://github.com/NeitLN/Custos-Solana.git","type":"git","directory":"packages/ai"},"_npmVersion":"11.6.2","description":"Lớp diễn giải tiếng Việt cho Custos. Biến kết quả luật thành câu người thường đọc được — không bao giờ tự quyết định mức độ nguy hiểm.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@custos-solana/core":"^0.1.0","@custos-solana/types":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"@anthropic-ai/sdk":"^0.120.0"},"peerDependencies":{"@anthropic-ai/sdk":"^0.120.0"},"peerDependenciesMeta":{"@anthropic-ai/sdk":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ai_0.2.0_1788720155720_0.0953947033975624","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"_id":"@custos-solana/ai@0.3.0","bugs":{"url":"https://github.com/NeitLN/Custos-Solana/issues"},"dist":{"shasum":"696183a43d456a097bb846f08944f0869f244777","tarball":"https://registry.npmjs.org/@custos-solana/ai/-/ai-0.3.0.tgz","fileCount":19,"integrity":"sha512-g4Ydmi87W8ause07ZlxVE4IOkvD+rmX0P823TO2YpjpPiydCMS0p3rdHN5hGaB9A91ZxxL9COnqHpWGSxSYH7w==","signatures":[{"sig":"MEQCIGmVRY9vD8EtnDFjA1WqXTLiX8rFXSpxzzuVbIQC/bUlAiAdCpxmlDZ+Ta+Vg/6GpJNI7rN2ySumPcZira+j8kpovA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCM0NuqVBp5kPL8PXRh8c7hOS8Gw3bPxJmaluCXaGM6QgIhANUYuLmbXKQSAqVegbVutg258deV9GZeW90ZsbvHHpkj"}],"unpackedSize":86212},"main":"./dist/index.js","name":"@custos-solana/ai","type":"module","types":"./dist/index.d.ts","author":{"name":"Team Too Hard"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./anthropic":{"types":"./dist/anthropic.d.ts","default":"./dist/anthropic.js"}},"gitHead":"df3cce4b32a37ce88dca51f18e2eca5803582077","license":"MIT","version":"0.3.0","_npmUser":{"name":"viettien539","email":"tien.vo539@gmail.com"},"homepage":"https://github.com/NeitLN/Custos-Solana#readme","keywords":["solana","wallet","security","transaction","simulation","web3","sdk","custos"],"repository":{"url":"git+https://github.com/NeitLN/Custos-Solana.git","type":"git","directory":"packages/ai"},"_npmVersion":"11.6.2","description":"Lớp diễn giải tiếng Việt cho Custos. Biến kết quả luật thành câu người thường đọc được — không bao giờ tự quyết định mức độ nguy hiểm.","directories":{},"maintainers":[{"name":"viettien539","email":"tien.vo539@gmail.com"}],"_nodeVersion":"24.12.0","dependencies":{"@custos-solana/core":"^0.2.0","@custos-solana/types":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"@anthropic-ai/sdk":"^0.120.0"},"peerDependencies":{"@anthropic-ai/sdk":"^0.120.0"},"peerDependenciesMeta":{"@anthropic-ai/sdk":{"optional":true}},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai_0.3.0_1790441126953_0.5424256832187366"}}},"time":{"created":"2026-08-31T08:04:44.671Z","modified":"2026-09-26T16:45:27.312Z","0.1.0":"2026-08-31T08:04:45.255Z","0.1.1":"2026-08-31T08:29:36.828Z","0.1.2":"2026-09-01T14:36:45.454Z","0.2.0":"2026-09-06T18:42:35.848Z","0.3.0":"2026-09-26T16:45:27.040Z"},"bugs":{"url":"https://github.com/NeitLN/Custos-Solana/issues"},"author":{"name":"Team Too Hard"},"license":"MIT","homepage":"https://github.com/NeitLN/Custos-Solana#readme","keywords":["solana","wallet","security","transaction","simulation","web3","sdk","custos"],"repository":{"url":"git+https://github.com/NeitLN/Custos-Solana.git","type":"git","directory":"packages/ai"},"description":"Lớp diễn giải tiếng Việt cho Custos. Biến kết quả luật thành câu người thường đọc được — không bao giờ tự quyết định mức độ nguy hiểm.","maintainers":[{"name":"viettien539","email":"tien.vo539@gmail.com"}],"readme":"# @custos-solana/ai\n\nLớp diễn giải của [Custos](https://github.com/NeitLN/Custos-Solana): biến kết quả luật\nthành câu tiếng Việt người thường đọc được.\n\n```\nnpm i @custos-solana/ai\n```\n\n## Điều gói này KHÔNG làm\n\n**Nó không quyết định mức độ nguy hiểm.** `level` đến từ engine luật tất định trong\n`@custos-solana/core`; gói này không tạo và không sửa nó. Trường riêng của nó là `aiAdvisory`,\nvà giá trị duy nhất nó được phép đặt là `\"review_required\"` — yêu cầu người dùng tự\nkiểm tra.\n\nRanh giới này là quyết định thiết kế, không phải giới hạn kỹ thuật. Một mô hình ngôn\nngữ có thể bị prompt injection từ tên token hoặc metadata trong chính giao dịch đang\nxét. Nếu nó được phép hạ `danger` xuống `safe` thì kẻ tấn công chỉ cần đặt tên token\ncho khéo.\n\n## Dùng không cần mô hình\n\n```ts\nimport { inspect } from \"@custos-solana/core\";\nimport { dienGiaiKhongAI, boiThoiHan } from \"@custos-solana/ai\";\n\nconst kq = await inspect(\n  { connection, interpret: boiThoiHan(dienGiaiKhongAI) },\n  tx,\n  { locale: \"vi\", nguoiDung: viNguoiDung.toBase58() },\n);\n```\n\n`dienGiaiKhongAI` chạy hoàn toàn bằng mẫu câu — không gọi mạng, không tốn token, và\nmọi mã lý do đều có sẵn một câu tiếng Việt. `boiThoiHan` bọc thêm thời hạn: quá hạn\nthì trả câu dự phòng thay vì để người dùng ngồi nhìn màn hình ký.\n\nCắm mô hình thật thì thay `dienGiaiKhongAI` bằng interpreter của bạn. Giao diện là\nmột hàm, nên bên tích hợp tự chọn nhà cung cấp.\n\n## Adapter Anthropic — và vì sao nó không làm gói này nặng thêm\n\n```ts\n// ĐƯỜNG DUY NHẤT kể từ 0.2.0 — subpath, chạy ở môi trường Node:\nimport { dungGoiAnthropic } from \"@custos-solana/ai/anthropic\";\n```\n\n> **Breaking change ở 0.2.0.** Bản 0.1.2 cho phép `import { dungGoiAnthropic } from\n> \"@custos-solana/ai\"`. Đường đó đã bỏ.\n>\n> **Vì sao đáng phá:** entry mặc định re-export adapter, nên mọi bundler trình duyệt\n> phải đi vào đồ thị của `@anthropic-ai/sdk` để biết nó không cần — Vite in ra hàng\n> loạt cảnh báo `Module \"node:fs\" has been externalized`. Bundle cuối không chứa SDK\n> (đã kiểm bằng grep), nhưng một gói bảo mật không nên bắt người dùng tự chứng minh\n> điều đó. Sau khi tách: **0 cảnh báo**.\n>\n> **Cách chuyển:** đổi một dòng import sang subpath. Không có API nào khác đổi.\n\n`@anthropic-ai/sdk` là **optional peer dependency**, và adapter nạp nó bằng `await\nimport()` chứ không phải `import` ở đầu file. Hai điều đó cộng lại nghĩa là:\n\n- cài `@custos-solana/ai` một mình vẫn chạy đủ đường tất định `dienGiaiKhongAI`;\n- SDK không đi vào bundle trình duyệt của bên tích hợp.\n\nVế thứ hai được **đo** chứ không suy: bản build công khai ngày 04/09 nặng 654 KB và\nkhông chứa chuỗi `anthropic` nào. Nếu ai đó đổi lời gọi động thành `import` tĩnh thì\nbuild vẫn xanh và test vẫn xanh — chỉ có bản công khai nặng thêm, mang theo code của\nmột SDK gọi API có khoá. Nên có một bài kiểm canh đúng chỗ đó:\n`packages/core/test/khongKeoSdk.test.ts`.\n\n## Phiên bản — đọc trước khi cài\n\n| Bản | Có neo grounding? | Ghi chú |\n|---|---|---|\n| `0.1.2` | **KHÔNG** | Đã lên registry TRƯỚC khi bản vá được thêm. Đo được: **9/10** lời bịa tới được người dùng. **Đừng dùng.** |\n| `0.2.0` | Có | **Đã phát hành lên npm** và đã nghiệm thu trên chính gói registry: **10/10** bẫy bị chặn, 0 lọt |\n\nVersion npm là bất biến, nên `0.1.2` không sửa đè được — chỉ phát hành bản mới.\n\n> `npm install @custos-solana/ai` nay lấy về `0.2.0`. Nếu bạn đang dùng `0.1.2`,\n> nâng lên: đó là bản để lời bịa của mô hình đi thẳng tới câu người dùng đọc trước\n> khi ký.\n\nCả hai con số trên đều đo bằng cùng một bộ mười bẫy, chạy từ một project trống ngoài\nmonorepo, cài **từ registry** — không `file:`, không `overrides`:\n\n```bash\nnpm run thu-goi-registry            # bản latest\nnode scripts/thu-goi-registry.mjs 0.1.2   # bản cũ, để đối chiếu\n```\n\nỞ cả hai bản, **0/10 bẫy làm đổi `level`**: engine luật tất định không bị chạm kể cả\nkhi lớp neo còn thiếu. Lớp neo bảo vệ *lời văn*, không bảo vệ verdict — nói quá thành\n\"AI hạ được cảnh báo\" là bịa theo hướng bất lợi cho chính mình.\n\n**Hai mức xác minh khác nhau, đừng lẫn:**\n\n- *Đã kiểm tarball local* — gói `npm pack` từ source hiện tại đã được cài vào một\n  project ngoài monorepo và chạy thật. `npm run thu-goi` làm việc này.\n- *Đã kiểm registry* — bản trên npm đã được tải về và soi. Chỉ nói được câu này\n  **sau khi** bản mới thực sự lên registry.\n\nChính khoảng cách giữa hai mức đó đã sinh ra sự cố `0.1.2`: source đúng, tarball\nlocal đúng, mọi test xanh — và bản trên registry thì không. Nay cả hai mức đều\nđược đo, và kết quả mức thứ hai nằm ở `data/registry/ket-qua.json`. `scripts/dong-goi-sdk.mjs` nay\ntừ chối đóng gói hoặc publish nếu artifact thiếu dấu ấn bản vá.\n\nMIT\n","readmeFilename":"README.md"}