diff --git a/AGENTS.md b/AGENTS.md index 6c88f558e2..c53122c1e1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -101,7 +101,7 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import). ## Testing -- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (4,000+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests. +- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (4,100+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests. - Before any npm publish: `npm run release:gate` must pass. It installs the packed tarballs into a clean home and runs capture, recovery, restart, export/import, MCP and status checks against the installed CLI (see CONTRIBUTING.md, Release process) - Mock pattern: `vi.mock("iii-sdk")` with mock `sdk.trigger`, `kv.get/set/list` - Test files go in `test/` with `.test.ts` extension @@ -114,4 +114,4 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import). - 6 MCP resources, 3 MCP prompts - 12 hooks, 17 skills - 322+ iii functions -- 4,000+ tests +- 4,100+ tests diff --git a/README.md b/README.md index 0cc41b258a..b371b080e4 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1307,7 +1307,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ar-SA.md b/READMEs/README.ar-SA.md index 3199b8a8d7..432c2446ec 100644 --- a/READMEs/README.ar-SA.md +++ b/READMEs/README.ar-SA.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.bn-BD.md b/READMEs/README.bn-BD.md index 8fe8425a88..8a85ba1375 100644 --- a/READMEs/README.bn-BD.md +++ b/READMEs/README.bn-BD.md @@ -69,7 +69,7 @@ 54 MCP টুল 12 অটো হুক 0 এক্সটার্নাল ডিবি - 4,000+ টেস্ট পাস + 4,100+ টেস্ট পাস

@@ -1255,7 +1255,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.cs-CZ.md b/READMEs/README.cs-CZ.md index d0960e654a..6733e9778b 100644 --- a/READMEs/README.cs-CZ.md +++ b/READMEs/README.cs-CZ.md @@ -69,7 +69,7 @@ 54 MCP nástrojů 12 automatických hooks 0 externích databází - 4,000+ testů úspěšně proběhlo + 4,100+ testů úspěšně proběhlo

@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.da-DK.md b/READMEs/README.da-DK.md index 0c124bb1b3..986f11e1c0 100644 --- a/READMEs/README.da-DK.md +++ b/READMEs/README.da-DK.md @@ -69,7 +69,7 @@ 54 MCP-værktøjer 12 automatiske hooks 0 eksterne databaser - 4,000+ beståede tests + 4,100+ beståede tests

@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.de-DE.md b/READMEs/README.de-DE.md index 25d246df90..7a7aee598b 100644 --- a/READMEs/README.de-DE.md +++ b/READMEs/README.de-DE.md @@ -69,7 +69,7 @@ 54 MCP-Tools 12 Auto-Hooks 0 externe DBs - 4,000+ bestandene Tests + 4,100+ bestandene Tests

@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.el-GR.md b/READMEs/README.el-GR.md index 9fdaf0a8ed..da436a98c1 100644 --- a/READMEs/README.el-GR.md +++ b/READMEs/README.el-GR.md @@ -69,7 +69,7 @@ 54 εργαλεία MCP 12 αυτόματα hooks 0 εξωτερικές βάσεις δεδομένων - 4,000+ επιτυχημένες δοκιμές + 4,100+ επιτυχημένες δοκιμές

@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.es-ES.md b/READMEs/README.es-ES.md index 9e646f18ae..9a2add4427 100644 --- a/READMEs/README.es-ES.md +++ b/READMEs/README.es-ES.md @@ -69,7 +69,7 @@ 54 tools MCP 12 hooks automáticos 0 bases de datos externas - 4,000+ tests superados + 4,100+ tests superados

@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.fi-FI.md b/READMEs/README.fi-FI.md index 0af45964b9..f0d7093a4f 100644 --- a/READMEs/README.fi-FI.md +++ b/READMEs/README.fi-FI.md @@ -69,7 +69,7 @@ 54 MCP-työkalua 12 automaattista hookia 0 ulkoista tietokantaa - 4,000+ testiä läpäisty + 4,100+ testiä läpäisty

@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.fr-FR.md b/READMEs/README.fr-FR.md index 6e8a3510ae..60ed0f017a 100644 --- a/READMEs/README.fr-FR.md +++ b/READMEs/README.fr-FR.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1250,7 +1250,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.he-IL.md b/READMEs/README.he-IL.md index 6cd626a723..580e9069b0 100644 --- a/READMEs/README.he-IL.md +++ b/READMEs/README.he-IL.md @@ -71,7 +71,7 @@ 54 כלי MCP 12 hooks אוטומטיים 0 מסדי נתונים חיצוניים - 4,000+ בדיקות עוברות + 4,100+ בדיקות עוברות

@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.hi-IN.md b/READMEs/README.hi-IN.md index c8fbebef85..04eb563111 100644 --- a/READMEs/README.hi-IN.md +++ b/READMEs/README.hi-IN.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1256,7 +1256,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.hu-HU.md b/READMEs/README.hu-HU.md index 864dbdb03c..2951739da5 100644 --- a/READMEs/README.hu-HU.md +++ b/READMEs/README.hu-HU.md @@ -69,7 +69,7 @@ 54 MCP eszköz 12 automatikus hook 0 külső adatbázis - 4,000+ sikeres teszt + 4,100+ sikeres teszt

@@ -1239,7 +1239,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.id-ID.md b/READMEs/README.id-ID.md index 37ee206858..b9b300ebfc 100644 --- a/READMEs/README.id-ID.md +++ b/READMEs/README.id-ID.md @@ -69,7 +69,7 @@ 54 tool MCP 12 hook otomatis 0 DB eksternal - 4,000+ pengujian lolos + 4,100+ pengujian lolos

@@ -1256,7 +1256,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.it-IT.md b/READMEs/README.it-IT.md index 8bf8a07fc9..76c4267bd3 100644 --- a/READMEs/README.it-IT.md +++ b/READMEs/README.it-IT.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ja-JP.md b/READMEs/README.ja-JP.md index ce2d9dee07..5f3bd8dd2d 100644 --- a/READMEs/README.ja-JP.md +++ b/READMEs/README.ja-JP.md @@ -69,7 +69,7 @@ 54 MCP ツール 12 自動 hooks 外部 DB 0 個 - 4,000+ 件のテストが成功 + 4,100+ 件のテストが成功

@@ -1255,7 +1255,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ko-KR.md b/READMEs/README.ko-KR.md index 9958760be9..75ea0ac701 100644 --- a/READMEs/README.ko-KR.md +++ b/READMEs/README.ko-KR.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1254,7 +1254,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.nb-NO.md b/READMEs/README.nb-NO.md index 56ebebc6ba..59f55f0809 100644 --- a/READMEs/README.nb-NO.md +++ b/READMEs/README.nb-NO.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.nl-NL.md b/READMEs/README.nl-NL.md index 569d1fb29c..d5f8c62a3d 100644 --- a/READMEs/README.nl-NL.md +++ b/READMEs/README.nl-NL.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.pl-PL.md b/READMEs/README.pl-PL.md index bdbe4eea32..d20aa558c1 100644 --- a/READMEs/README.pl-PL.md +++ b/READMEs/README.pl-PL.md @@ -69,7 +69,7 @@ 54 narzędzia MCP 12 automatycznych hooków 0 zewnętrznych baz danych - 4,000+ zaliczonych testów + 4,100+ zaliczonych testów

@@ -1239,7 +1239,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.pt-BR.md b/READMEs/README.pt-BR.md index b076d8d82e..c6c37e69f3 100644 --- a/READMEs/README.pt-BR.md +++ b/READMEs/README.pt-BR.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.pt-PT.md b/READMEs/README.pt-PT.md index 36ff810e19..0b57b1b8db 100644 --- a/READMEs/README.pt-PT.md +++ b/READMEs/README.pt-PT.md @@ -69,7 +69,7 @@ 54 ferramentas MCP 12 hooks automáticos 0 bases de dados externas - 4,000+ testes aprovados + 4,100+ testes aprovados

@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ro-RO.md b/READMEs/README.ro-RO.md index 890afccaef..3e1f4c5870 100644 --- a/READMEs/README.ro-RO.md +++ b/READMEs/README.ro-RO.md @@ -69,7 +69,7 @@ 54 de instrumente MCP 12 hook-uri automate 0 baze de date externe - 4,000+ teste trecute + 4,100+ teste trecute

@@ -1235,7 +1235,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ru-RU.md b/READMEs/README.ru-RU.md index af94d55bbb..3ea4e5de29 100644 --- a/READMEs/README.ru-RU.md +++ b/READMEs/README.ru-RU.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.sv-SE.md b/READMEs/README.sv-SE.md index a130b39bd2..3c3e72e866 100644 --- a/READMEs/README.sv-SE.md +++ b/READMEs/README.sv-SE.md @@ -69,7 +69,7 @@ 54 MCP-verktyg 12 automatiska hooks 0 externa databaser - 4,000+ godkända tester + 4,100+ godkända tester

@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.th-TH.md b/READMEs/README.th-TH.md index b549a34e6a..76671822b6 100644 --- a/READMEs/README.th-TH.md +++ b/READMEs/README.th-TH.md @@ -69,7 +69,7 @@ 54 เครื่องมือ MCP 12 hook อัตโนมัติ ไม่ต้องพึ่ง external DB เลย - ผ่านการทดสอบ 4,000+ รายการ + ผ่านการทดสอบ 4,100+ รายการ

@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.tl-PH.md b/READMEs/README.tl-PH.md index 2d4dcfe47d..ff68ebdba6 100644 --- a/READMEs/README.tl-PH.md +++ b/READMEs/README.tl-PH.md @@ -69,7 +69,7 @@ 54 MCP tool 12 awtomatikong hook 0 panlabas na DB - 4,000+ pumapasang test + 4,100+ pumapasang test

@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.tr-TR.md b/READMEs/README.tr-TR.md index 0b08152ae9..a5d36b5299 100644 --- a/READMEs/README.tr-TR.md +++ b/READMEs/README.tr-TR.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.uk-UA.md b/READMEs/README.uk-UA.md index ad26bff5c1..4033a79f17 100644 --- a/READMEs/README.uk-UA.md +++ b/READMEs/README.uk-UA.md @@ -69,7 +69,7 @@ 54 інструменти MCP 12 автоматичних хуків 0 зовнішніх БД - 4,000+ тестів пройдено + 4,100+ тестів пройдено

@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ur-PK.md b/READMEs/README.ur-PK.md index 62602b9130..53f941522e 100644 --- a/READMEs/README.ur-PK.md +++ b/READMEs/README.ur-PK.md @@ -71,7 +71,7 @@ 54 MCP ٹولز 12 خودکار ہکس 0 خارجی ڈیٹابیسز - 4,000+ ٹیسٹس پاس ہو رہے ہیں + 4,100+ ٹیسٹس پاس ہو رہے ہیں

@@ -1246,7 +1246,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.vi-VN.md b/READMEs/README.vi-VN.md index 3a7879a3f5..2be083144f 100644 --- a/READMEs/README.vi-VN.md +++ b/READMEs/README.vi-VN.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,000+ tests passing + 4,100+ tests passing

@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.zh-CN.md b/READMEs/README.zh-CN.md index b12e7fe2fd..a96226f914 100644 --- a/READMEs/README.zh-CN.md +++ b/READMEs/README.zh-CN.md @@ -69,7 +69,7 @@ 54 个 MCP 工具 12 个自动 hooks 0 个外部数据库 - 4,000+ 项测试通过 + 4,100+ 项测试通过

@@ -1252,7 +1252,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.zh-TW.md b/READMEs/README.zh-TW.md index bfd866fee0..5ed8dc3dce 100644 --- a/READMEs/README.zh-TW.md +++ b/READMEs/README.zh-TW.md @@ -69,7 +69,7 @@ 54 個 MCP 工具 12 個自動 hooks 0 個外部資料庫 - 4,000+ 測試通過 + 4,100+ 測試通過

@@ -1244,7 +1244,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,000+ tests +npm test # 4,100+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/assets/tags/light/stat-tests.svg b/assets/tags/light/stat-tests.svg index 915e1bab9d..7248bfad00 100644 --- a/assets/tags/light/stat-tests.svg +++ b/assets/tags/light/stat-tests.svg @@ -1,5 +1,5 @@ - + - 4000+ + 4100+ TESTS PASSING diff --git a/assets/tags/stat-tests.svg b/assets/tags/stat-tests.svg index 99b680533e..e51099c87f 100644 --- a/assets/tags/stat-tests.svg +++ b/assets/tags/stat-tests.svg @@ -1,5 +1,5 @@ - + - 4000+ + 4100+ TESTS PASSING diff --git a/scripts/docs-sync.state.json b/scripts/docs-sync.state.json index 0538665c6a..bf7cab5337 100644 --- a/scripts/docs-sync.state.json +++ b/scripts/docs-sync.state.json @@ -20,13 +20,13 @@ "12" ], "tests": [ - "4000+" + "4100+" ], "functions": [ "322" ], "sourceFiles": [ - "254" + "255" ], "loc": [ "58000" diff --git a/scripts/release-gate/summary-recovery.mjs b/scripts/release-gate/summary-recovery.mjs index fa7908f9b6..781455845c 100644 --- a/scripts/release-gate/summary-recovery.mjs +++ b/scripts/release-gate/summary-recovery.mjs @@ -41,6 +41,8 @@ const sha = (file) => createHash("sha256").update(readFileSync(file)).digest("he let port, modelPort, modelServer, secret, installed, packageBefore, boot = 0; let heldCompression = null, failSummary = false, phase = "setup"; const markers = { BASE: "RECOVERED_BASE_COBALT", FINAL: "RECOVERED_FINAL_JUNIPER", LATE: "RECOVERED_LATE_QUARTZ" }; +// A reasoning model cut at max_tokens returns only partial reasoning; this fixture makes that reasoning parse as valid XML. +const truncation = { session: "truncated-reasoning-session", accepted: "TRUNCATION_ACCEPTED_SAGE", marker: "TRUNCATED_REASONING_ONYX" }; function log(message) { const line = `[${((Date.now() - began) / 1000).toFixed(1)}s] ${message}`; console.log(line); appendFileSync(join(out, "gate.log"), `${line}\n`); @@ -155,7 +157,19 @@ async function startModel() { const item = { phase, boot, operation: compress ? "compression" : "summary", prompt }; modelRequests.push(item); let content; - if (compress) { + const truncatedCompression = compress && prompt.includes("GATE_INPUT_TRUNCATED"); + if (truncatedCompression || (summarize && phase === "truncated-reasoning-is-rejected")) { + const partial = compress + ? `Draft: decision${truncation.marker}${truncation.marker}The draft names ${truncation.marker} before the budget ran out.truncationfixture.txt8` + : `Draft: ${truncation.marker}The draft names ${truncation.marker} before the budget ran out.${truncation.marker}fixture.txttruncation`; + item.outcome = "truncated-reasoning"; item.response = partial; + response.writeHead(200, { "content-type": "application/json" }); + response.end(JSON.stringify({ choices: [{ finish_reason: "length", message: { role: "assistant", content: null, reasoning: partial } }] })); + return; + } + if (compress && prompt.includes("GATE_INPUT_ACCEPTED")) { + content = `decision${truncation.accepted}The verified result is ${truncation.accepted}.The local fixture completed processing and verified ${truncation.accepted}.truncationfixture.txt8`; + } else if (compress) { const token = prompt.match(/GATE_INPUT_(BASE|FINAL|LATE)\b/)?.[1]; assert(token, "Compression request lost the retained raw fixture"); item.token = token; @@ -232,14 +246,14 @@ async function crashDaemon() { await poll("crashed daemon ports closed", async () => (await Promise.all(daemonPorts().map(portFree))).every(Boolean), 15_000); modelServer.closeAllConnections(); ownedPids.clear(); log(`Native CLI boot ${boot} terminated`); } -function event(token) { - return { hookType: "post_tool_use", sessionId, project, cwd: root, timestamp: new Date().toISOString(), eventId: `summary-gate-${token.toLowerCase()}`, data: { tool_name: "Bash", tool_input: { command: `printf GATE_INPUT_${token}` }, tool_response: `GATE_INPUT_${token}: tool completed` } }; +function event(token, session = sessionId) { + return { hookType: "post_tool_use", sessionId: session, project, cwd: root, timestamp: new Date().toISOString(), eventId: `summary-gate-${token.toLowerCase()}`, data: { tool_name: "Bash", tool_input: { command: `printf GATE_INPUT_${token}` }, tool_response: `GATE_INPUT_${token}: tool completed` } }; } async function snapshot(name) { const data = await rest("/export", undefined, { record: false }); writeFileSync(join(out, `${name}.json`), JSON.stringify(data, null, 2) + "\n"); return data; } -const observations = (data) => data.observations?.[sessionId] ?? []; +const observations = (data, session = sessionId) => data.observations?.[session] ?? []; const summaryFor = (data) => data.summaries?.find((summary) => summary.sessionId === sessionId); async function waitSummary(expected) { return poll(`summary contains ${expected.join(", ")}`, async () => { @@ -305,6 +319,28 @@ async function main() { assert(!wire.some((entry) => /retry|repair/.test(entry.path)), "Recovery must use the autonomous runtime path"); assert(!modelRequests.some((entry) => entry.error), "The fixture rejected an unexpected model request"); }); + await scenario("truncated-reasoning-is-rejected", async () => { + const session = truncation.session; + const exported = () => rest("/export", undefined, { record: false }); + await rest("/session/start", { sessionId: session, project, cwd: root }); + await rest("/observe", event("ACCEPTED", session)); + await poll("accepted compression", async () => observations(await exported(), session).some((row) => row.title === truncation.accepted && row.compression?.status === "complete")); + // Summarize before the truncated compression so two provider errors stay below the circuit breaker threshold. + const summary = await rest("/summarize", { sessionId: session }); + assert.equal(summary.success, false, "A summary reply cut at max_tokens must not succeed"); + assert.match(summary.error, /max_tokens/); + await rest("/observe", event("TRUNCATED", session)); + const failed = await poll("truncated compression rejected", async () => { + const row = observations(await exported(), session).find((item) => JSON.stringify(item.source ?? "").includes("GATE_INPUT_TRUNCATED")); + return row?.compression?.status === "failed" ? row : false; + }); + assert.equal(failed.compression.error, "compression_failed"); + const truncatedCalls = modelRequests.filter((request) => request.phase === phase && request.outcome === "truncated-reasoning"); + assert(truncatedCalls.some((request) => request.operation === "summary"), "The summary request must reach the truncating fixture"); + assert(truncatedCalls.some((request) => request.operation === "compression"), "The compression request must reach the truncating fixture"); + const after = await snapshot("after-truncated-reasoning"); + assert(!JSON.stringify(after).includes(truncation.marker), "Truncated reasoning must never be stored as model output"); + }); await scenario("installed-package-unchanged", async () => { assert.deepEqual(packageManifest(), packageBefore); assert.equal(sha(artifact.tarball), artifact.tarballSha256); }); diff --git a/src/functions/status.ts b/src/functions/status.ts index 9192c9de66..55be06dc92 100644 --- a/src/functions/status.ts +++ b/src/functions/status.ts @@ -2,6 +2,7 @@ import type { IndexLegStatus, IndexPersistenceStatus } from "../state/index-pers import type { VectorBackfillState } from "./search.js"; import { describeGraphCompactBoot, type GraphCompactBootStatus } from "./graph-compact-boot.js"; import type { CaptureStatus } from "./capture.js"; +import type { LlmUsageTotals } from "../providers/usage.js"; import type { GraphIndexMigrationStatus } from "../state/graph-index-migration.js"; export type StatusLevel = "ok" | "info" | "warn" | "error"; @@ -62,6 +63,7 @@ export interface StatusInputs { functionMetrics: FunctionMetricInput[]; provider: string; embeddingProvider: string; + llmUsage?: LlmUsageTotals | null; flags: StatusFlag[]; index: { bm25Documents: number; @@ -117,6 +119,7 @@ export interface StatusReport { embeddings: string; circuitBreaker: StatusInputs["circuitBreaker"]; offWithoutLlm: string[]; + usage: LlmUsageTotals | null; }; index: StatusInputs["index"] & { breakdown: IndexBreakdown | null }; indexPersistence: IndexPersistenceStatus | null; @@ -511,6 +514,7 @@ export function evaluateStatus(input: StatusInputs): StatusReport { embeddings: input.embeddingProvider, circuitBreaker: input.circuitBreaker, offWithoutLlm: noLlm ? OFF_WITHOUT_LLM : [], + usage: input.llmUsage ?? null, }, index: { ...input.index, breakdown: indexBreakdown(input.index) }, indexPersistence: persistence, @@ -650,6 +654,17 @@ function processHealth(report: StatusReport): string { return status; } +function describeLlmUsage(usage: LlmUsageTotals): string { + const tokens = `${usage.promptTokens.toLocaleString("en-US")} prompt + ${usage.completionTokens.toLocaleString("en-US")} completion tokens`; + const cost = + usage.costUsd === null + ? "cost not reported by the provider" + : usage.costUsd > 0 && usage.costUsd < 0.0001 + ? "<$0.0001" + : `$${usage.costUsd.toFixed(4)}`; + return `${plural(usage.calls, "call")} · ${tokens} · ${cost}`; +} + function escapeHtml(value: unknown): string { return String(value ?? "") .replace(/&/g, "&") @@ -855,6 +870,7 @@ ${row("Viewer port", escapeHtml(ports.viewer ?? "not running"))} ${row("LLM", escapeHtml(report.provider.llm === "noop" ? "none configured" : (report.provider.route ?? report.provider.llm)))} ${report.provider.offWithoutLlm.length ? row("Off without an LLM", escapeHtml(report.provider.offWithoutLlm.join(", ")) + `

${escapeHtml(LLM_KEY_FIX)}

`) : ""} ${row("Embeddings", escapeHtml(report.provider.embeddings === "none" ? "none (keyword search only)" : report.provider.embeddings))} +${report.provider.usage && report.provider.usage.calls > 0 ? row("LLM usage since start", escapeHtml(describeLlmUsage(report.provider.usage))) : ""} ${row("Circuit breaker", escapeHtml(report.provider.circuitBreaker ? `${report.provider.circuitBreaker.state ?? "unknown"} (${report.provider.circuitBreaker.failures ?? 0} failures)` : "not in use"))}

Search index

diff --git a/src/providers/openai.ts b/src/providers/openai.ts index 6e2e9c2c6c..b868f73b67 100644 --- a/src/providers/openai.ts +++ b/src/providers/openai.ts @@ -1,6 +1,7 @@ import type { MemoryProvider } from "../types.js"; import { getEnvVar } from "../config.js"; import { fetchWithTimeout } from "./_fetch.js"; +import { recordLlmUsage } from "./usage.js"; import { DEFAULT_AZURE_API_VERSION, buildAuthHeaders, @@ -108,14 +109,25 @@ export class OpenAIProvider implements MemoryProvider { const data = (await response.json()) as { choices?: Array<{ - message?: { content?: string; reasoning?: string; reasoning_content?: string }; + finish_reason?: string; + message?: { content?: string | null; reasoning?: string; reasoning_content?: string }; }>; + usage?: unknown; }; - const message = data.choices?.[0]?.message; + recordLlmUsage(data.usage); + const choice = data.choices?.[0]; + const message = choice?.message; const content = message?.content; if (content) { return content; } + // A reasoning model that hits max_tokens returns only its partial chain of + // thought; returning that would store it as the compression result. + if (choice?.finish_reason === "length") { + throw new Error( + `OpenAI response hit max_tokens (${this.maxTokens}) before any content — raise MAX_TOKENS or lower OPENAI_REASONING_EFFORT.`, + ); + } const reasoning = message?.reasoning ?? message?.reasoning_content; if (reasoning) { return reasoning; diff --git a/src/providers/usage.ts b/src/providers/usage.ts new file mode 100644 index 0000000000..8123c7ee2c --- /dev/null +++ b/src/providers/usage.ts @@ -0,0 +1,28 @@ +export interface LlmUsageTotals { + calls: number; + promptTokens: number; + completionTokens: number; + costUsd: number | null; +} + +const totals: LlmUsageTotals = { calls: 0, promptTokens: 0, completionTokens: 0, costUsd: null }; + +export function recordLlmUsage(usage: unknown): void { + if (!usage || typeof usage !== "object") return; + const u = usage as { prompt_tokens?: unknown; completion_tokens?: unknown; cost?: unknown }; + totals.calls += 1; + if (typeof u.prompt_tokens === "number") totals.promptTokens += u.prompt_tokens; + if (typeof u.completion_tokens === "number") totals.completionTokens += u.completion_tokens; + if (typeof u.cost === "number") totals.costUsd = (totals.costUsd ?? 0) + u.cost; +} + +export function getLlmUsage(): LlmUsageTotals { + return { ...totals }; +} + +export function resetLlmUsageForTests(): void { + totals.calls = 0; + totals.promptTokens = 0; + totals.completionTokens = 0; + totals.costUsd = null; +} diff --git a/src/triggers/api.ts b/src/triggers/api.ts index e7176ca9a4..9043c14ff0 100644 --- a/src/triggers/api.ts +++ b/src/triggers/api.ts @@ -14,6 +14,7 @@ import { addSessionToProjectIndex } from "../state/session-index.js"; import { getLatestHealth } from "../health/monitor.js"; import type { MetricsStore } from "../eval/metrics-store.js"; import type { ResilientProvider } from "../providers/resilient.js"; +import { getLlmUsage } from "../providers/usage.js"; import { III_PINNED_VERSION, VERSION } from "../version.js"; import { CONSOLIDATION_COUNTS_REUSE_MS, CONSOLIDATION_LAST_RUN_KEY, PROCEDURAL_MIN_SESSIONS_PER_PATTERN, describeConsolidation, type ConsolidationRunRecord, type ConsolidationStatus } from "../functions/consolidation-status.js"; import { UNINDEXED_SCAN_REUSE_MS, evaluateStatus, prefersHtml, renderStatusHtml, singleFlight, type GraphStatsInput, type StatusReport } from "../functions/status.js"; @@ -439,6 +440,7 @@ export function createStatusReporter(sdk: IIIClient, kv: StateKV, deps: StatusRe functionMetrics: functionMetrics ?? [], provider: detectLlmProviderKind(), embeddingProvider: describeEmbeddingProvider(), + llmUsage: getLlmUsage(), flags: buildConfigFlags(), index: { bm25Documents: idx.size, diff --git a/test/fetch-timeout.test.ts b/test/fetch-timeout.test.ts index 0019a7708e..2f92013b23 100644 --- a/test/fetch-timeout.test.ts +++ b/test/fetch-timeout.test.ts @@ -552,6 +552,39 @@ describe("OpenAIProvider thinking-model fallback", () => { expect(out).toBe("older shape"); }); + const emptyReasoningReplies = [null, ""].flatMap((content) => + (["reasoning", "reasoning_content"] as const).map((field) => ({ content, field })), + ); + + it.each( + emptyReasoningReplies.flatMap((reply) => (["compress", "summarize"] as const).map((method) => ({ ...reply, method }))), + )("$method rejects a reply cut at max_tokens with content $content and only $field", async ({ content, field, method }) => { + mockOpenAIResponse({ + choices: [{ finish_reason: "length", message: { content, [field]: "The user is asking me to reply with" } }], + }); + const provider = new OpenAIProvider("test-key", "gpt-5.6-luna", 16); + await expect(provider[method]("system", "user")).rejects.toThrow(/max_tokens \(16\)/); + }); + + it.each(emptyReasoningReplies)( + "keeps the $field fallback when the reply finished normally with content $content", + async ({ content, field }) => { + mockOpenAIResponse({ + choices: [{ finish_reason: "stop", message: { content, [field]: "complete answer" } }], + }); + const provider = new OpenAIProvider("test-key", "gpt-5.6-luna", 1024); + expect(await provider.summarize("system", "user")).toBe("complete answer"); + }, + ); + + it("returns nonempty content even when the reply hit max_tokens", async () => { + mockOpenAIResponse({ + choices: [{ finish_reason: "length", message: { content: "partial but real", reasoning: "ignore" } }], + }); + const provider = new OpenAIProvider("test-key", "gpt-5.6-luna", 16); + expect(await provider.compress("system", "user")).toBe("partial but real"); + }); + it("content wins over both reasoning fields when present", async () => { mockOpenAIResponse({ choices: [ diff --git a/test/llm-usage.test.ts b/test/llm-usage.test.ts new file mode 100644 index 0000000000..c70509bf9f --- /dev/null +++ b/test/llm-usage.test.ts @@ -0,0 +1,49 @@ +import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; +import { OpenAIProvider } from "../src/providers/openai.js"; +import { getLlmUsage, resetLlmUsageForTests } from "../src/providers/usage.js"; + +function mockReply(body: object): void { + vi.spyOn(globalThis, "fetch").mockImplementation( + (async () => + new Response(JSON.stringify(body), { + status: 200, + headers: { "content-type": "application/json" }, + })) as typeof fetch, + ); +} + +describe("LLM usage totals", () => { + beforeEach(() => resetLlmUsageForTests()); + afterEach(() => vi.restoreAllMocks()); + + it("adds tokens and cost from each reply that reports usage", async () => { + const provider = new OpenAIProvider("k", "m", 100); + mockReply({ + choices: [{ message: { content: "a" } }], + usage: { prompt_tokens: 4000, completion_tokens: 120, cost: 0.00032 }, + }); + await provider.compress("s", "u"); + vi.restoreAllMocks(); + mockReply({ + choices: [{ message: { content: "b" } }], + usage: { prompt_tokens: 1000, completion_tokens: 30, cost: 0.0001 }, + }); + await provider.summarize("s", "u"); + + const totals = getLlmUsage(); + expect(totals).toMatchObject({ calls: 2, promptTokens: 5000, completionTokens: 150 }); + expect(totals.costUsd).toBeCloseTo(0.00042, 8); + }); + + it("keeps cost null when the provider reports tokens but no cost", async () => { + mockReply({ choices: [{ message: { content: "a" } }], usage: { prompt_tokens: 10, completion_tokens: 2 } }); + await new OpenAIProvider("k", "m", 100).compress("s", "u"); + expect(getLlmUsage()).toEqual({ calls: 1, promptTokens: 10, completionTokens: 2, costUsd: null }); + }); + + it("leaves the totals untouched when a reply has no usage", async () => { + mockReply({ choices: [{ message: { content: "a" } }] }); + await new OpenAIProvider("k", "m", 100).compress("s", "u"); + expect(getLlmUsage()).toEqual({ calls: 0, promptTokens: 0, completionTokens: 0, costUsd: null }); + }); +}); diff --git a/test/status.test.ts b/test/status.test.ts index ca4748af74..5d26a061b1 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -404,6 +404,26 @@ describe("renderStatusHtml", () => { expect(html).toContain(`

${heading}

`); } }); + + it("reports LLM usage totals and shows them on the page", () => { + const usage = { calls: 2, promptTokens: 5000, completionTokens: 150, costUsd: 0.00042 }; + const report = evaluateStatus(inputs({ llmUsage: usage })); + expect(report.provider.usage).toEqual(usage); + expect(renderStatusHtml(report, "n")).toContain("2 calls · 5,000 prompt + 150 completion tokens · $0.0004"); + }); + + it("does not show a small nonzero cost as zero", () => { + const report = evaluateStatus(inputs({ llmUsage: { calls: 1, promptTokens: 50, completionTokens: 5, costUsd: 0.00001 } })); + expect(renderStatusHtml(report, "n")).toContain("· <$0.0001"); + }); + + it("says when the provider reports no cost, and hides the row before any call", () => { + const noCost = evaluateStatus(inputs({ llmUsage: { calls: 1, promptTokens: 10, completionTokens: 2, costUsd: null } })); + expect(renderStatusHtml(noCost, "n")).toContain("cost not reported by the provider"); + const idle = evaluateStatus(inputs({ llmUsage: { calls: 0, promptTokens: 0, completionTokens: 0, costUsd: null } })); + expect(renderStatusHtml(idle, "n")).not.toContain("LLM usage since start"); + expect(evaluateStatus(inputs()).provider.usage).toBeNull(); + }); }); describe("status for beginners", () => {