From d08d63ddd4142a29c227e5a7f137e6a05552ad3e Mon Sep 17 00:00:00 2001 From: Rex57 <203883624+Rex57@users.noreply.github.com> Date: Thu, 8 Oct 2026 14:38:53 +0800 Subject: [PATCH 1/5] fix(openai): fail on a reply cut at max_tokens instead of returning partial reasoning When a reasoning model spends the whole max_tokens budget on reasoning, an OpenAI-compatible API answers 200 with finish_reason "length", no content and a partial reasoning field. The reasoning fallback returned that fragment as a successful result, so compression stored chain-of-thought as the summary. Throw a clear error for that case and keep the fallback for replies that finished normally. Signed-off-by: Rex57 <203883624+Rex57@users.noreply.github.com> --- src/providers/openai.ts | 11 ++++++++++- test/fetch-timeout.test.ts | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/providers/openai.ts b/src/providers/openai.ts index 46500cf87b..847f103456 100644 --- a/src/providers/openai.ts +++ b/src/providers/openai.ts @@ -118,14 +118,23 @@ export class OpenAIProvider implements MemoryProvider { const data = (await response.json()) as { choices?: Array<{ + finish_reason?: string; message?: { content?: string; reasoning?: string; reasoning_content?: string }; }>; }; - const message = data.choices?.[0]?.message; + 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/test/fetch-timeout.test.ts b/test/fetch-timeout.test.ts index 1240e7603b..6adecba711 100644 --- a/test/fetch-timeout.test.ts +++ b/test/fetch-timeout.test.ts @@ -547,6 +547,28 @@ describe("OpenAIProvider thinking-model fallback", () => { expect(out).toBe("older shape"); }); + it("throws instead of returning partial reasoning when the reply hit max_tokens", async () => { + mockOpenAIResponse({ + choices: [ + { + finish_reason: "length", + message: { content: null, reasoning: "The user is asking me to reply with" }, + }, + ], + }); + const provider = new OpenAIProvider("test-key", "gpt-5.6-luna", 16); + await expect(provider.compress("system", "user")).rejects.toThrow(/max_tokens \(16\)/); + }); + + it("keeps the reasoning fallback when the reply finished normally", async () => { + mockOpenAIResponse({ + choices: [{ finish_reason: "stop", message: { content: "", reasoning_content: "complete answer" } }], + }); + const provider = new OpenAIProvider("test-key", "gpt-5.6-luna", 1024); + const out = await provider.compress("system", "user"); + expect(out).toBe("complete answer"); + }); + it("content wins over both reasoning fields when present", async () => { mockOpenAIResponse({ choices: [ From b99b3999f22c967ef17370a29d8ef186823db120 Mon Sep 17 00:00:00 2001 From: Rex57 <203883624+Rex57@users.noreply.github.com> Date: Thu, 8 Oct 2026 14:46:12 +0800 Subject: [PATCH 2/5] feat(status): report LLM token usage and cost since start OpenAI-compatible replies carry a usage object, and OpenRouter includes the exact charge (usage.cost) in every reply, but the provider read only the message and dropped it. Keep process totals of calls, prompt tokens, completion tokens and cost, and show them under provider.usage in GET /agentmemory/status and on the status page. Replies without usage change nothing, and no request field is added. Signed-off-by: Rex57 <203883624+Rex57@users.noreply.github.com> --- src/functions/status.ts | 11 +++++++++ src/providers/openai.ts | 3 +++ src/providers/usage.ts | 28 +++++++++++++++++++++++ src/triggers/api.ts | 2 ++ test/llm-usage.test.ts | 49 +++++++++++++++++++++++++++++++++++++++++ test/status.test.ts | 15 +++++++++++++ 6 files changed, 108 insertions(+) create mode 100644 src/providers/usage.ts create mode 100644 test/llm-usage.test.ts diff --git a/src/functions/status.ts b/src/functions/status.ts index fdf2c2b14c..b39d512f3a 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"; export type StatusLevel = "ok" | "info" | "warn" | "error"; @@ -57,6 +58,7 @@ export interface StatusInputs { functionMetrics: FunctionMetricInput[]; provider: string; embeddingProvider: string; + llmUsage?: LlmUsageTotals | null; flags: StatusFlag[]; index: { bm25Documents: number; @@ -110,6 +112,7 @@ export interface StatusReport { embeddings: string; circuitBreaker: StatusInputs["circuitBreaker"]; offWithoutLlm: string[]; + usage: LlmUsageTotals | null; }; index: StatusInputs["index"] & { breakdown: IndexBreakdown | null }; indexPersistence: IndexPersistenceStatus | null; @@ -494,6 +497,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, @@ -626,6 +630,12 @@ 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.toFixed(4)}`; + return `${plural(usage.calls, "call")} · ${tokens} · ${cost}`; +} + function escapeHtml(value: unknown): string { return String(value ?? "") .replace(/&/g, "&") @@ -832,6 +842,7 @@ ${row("Viewer port", escapeHtml(ports.viewer ?? "not running"))} ${row("LLM", escapeHtml(report.provider.llm === "noop" ? "none configured" : 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 847f103456..bddd9a57c9 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, @@ -121,7 +122,9 @@ export class OpenAIProvider implements MemoryProvider { finish_reason?: string; message?: { content?: string; reasoning?: string; reasoning_content?: string }; }>; + usage?: unknown; }; + recordLlmUsage(data.usage); const choice = data.choices?.[0]; const message = choice?.message; const content = message?.content; 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 80885c8fdd..cb09957838 100644 --- a/src/triggers/api.ts +++ b/src/triggers/api.ts @@ -12,6 +12,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"; @@ -428,6 +429,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/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 0059e4a2bd..639688dee1 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -356,6 +356,21 @@ 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("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", () => { From 3acc82891959f3be02f945e486c7748c3a9fcda3 Mon Sep 17 00:00:00 2001 From: Rex57 <203883624+Rex57@users.noreply.github.com> Date: Thu, 8 Oct 2026 14:46:12 +0800 Subject: [PATCH 3/5] docs: sync stats Signed-off-by: Rex57 <203883624+Rex57@users.noreply.github.com> --- AGENTS.md | 4 ++-- README.md | 6 +++--- READMEs/README.ar-SA.md | 6 +++--- READMEs/README.bn-BD.md | 6 +++--- READMEs/README.cs-CZ.md | 6 +++--- READMEs/README.da-DK.md | 6 +++--- READMEs/README.de-DE.md | 6 +++--- READMEs/README.el-GR.md | 6 +++--- READMEs/README.es-ES.md | 6 +++--- READMEs/README.fi-FI.md | 6 +++--- READMEs/README.fr-FR.md | 6 +++--- READMEs/README.he-IL.md | 6 +++--- READMEs/README.hi-IN.md | 6 +++--- READMEs/README.hu-HU.md | 6 +++--- READMEs/README.id-ID.md | 6 +++--- READMEs/README.it-IT.md | 6 +++--- READMEs/README.ja-JP.md | 6 +++--- READMEs/README.ko-KR.md | 6 +++--- READMEs/README.nb-NO.md | 6 +++--- READMEs/README.nl-NL.md | 6 +++--- READMEs/README.pl-PL.md | 6 +++--- READMEs/README.pt-BR.md | 6 +++--- READMEs/README.pt-PT.md | 6 +++--- READMEs/README.ro-RO.md | 6 +++--- READMEs/README.ru-RU.md | 6 +++--- READMEs/README.sv-SE.md | 6 +++--- READMEs/README.th-TH.md | 6 +++--- READMEs/README.tl-PH.md | 6 +++--- READMEs/README.tr-TR.md | 6 +++--- READMEs/README.uk-UA.md | 6 +++--- READMEs/README.ur-PK.md | 6 +++--- READMEs/README.vi-VN.md | 6 +++--- READMEs/README.zh-CN.md | 6 +++--- READMEs/README.zh-TW.md | 6 +++--- assets/tags/light/stat-tests.svg | 4 ++-- assets/tags/stat-tests.svg | 4 ++-- scripts/docs-sync.state.json | 4 ++-- 37 files changed, 107 insertions(+), 107 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b7b5bb4d1b..7b21505a30 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` (2,500+ 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` (2,600+ 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 - 311+ iii functions -- 2,500+ tests +- 2,600+ tests diff --git a/README.md b/README.md index 800aa73785..7082b64dab 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ 54 MCP tools12 auto hooks0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Custom plugin systems | `iii worker add ` | -**219 source files · ~52,000 LOC · 2,500+ tests · 311 functions · 60 KV scopes**, all on three primitives. No `agentmemory plugin install`. The plugin system is iii itself. +**220 source files · ~52,000 LOC · 2,600+ tests · 311 functions · 60 KV scopes**, all on three primitives. No `agentmemory plugin install`. The plugin system is iii itself. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 dc8c8ba4a9..31261fac28 100644 --- a/READMEs/README.ar-SA.md +++ b/READMEs/README.ar-SA.md @@ -73,7 +73,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1439,7 +1439,7 @@ fi | Prometheus / Grafana | OTEL في iii + مراقب الحالة الصحية | | أنظمة إضافات مخصصة | `iii worker add ` | -**219 ملف مصدري · ~52,000 سطر برمجي · 2,500+ اختبار · 311 دالة · 60 نطاق KV**، كل ذلك على ثلاث بنى أساسية. لا يوجد أمر `agentmemory plugin install`. نظام الإضافات هو iii نفسه. +**220 ملف مصدري · ~52,000 سطر برمجي · 2,600+ اختبار · 311 دالة · 60 نطاق KV**، كل ذلك على ثلاث بنى أساسية. لا يوجد أمر `agentmemory plugin install`. نظام الإضافات هو iii نفسه. --- @@ -1863,7 +1863,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 37e5e70e7c..e9356f8aab 100644 --- a/READMEs/README.bn-BD.md +++ b/READMEs/README.bn-BD.md @@ -71,7 +71,7 @@ 54 MCP টুল 12 অটো হুক 0 এক্সটার্নাল ডিবি - 2,500+ টেস্ট পাস + 2,600+ টেস্ট পাস

@@ -1437,7 +1437,7 @@ fi | Prometheus / Grafana | iii OTEL + হেলথ মনিটর | | কাস্টম প্লাগইন সিস্টেম | `iii worker add ` | -**219 সোর্স ফাইল · ~52,000 LOC · 2,500+ টেস্ট · 311 ফাংশন · 60 KV স্কোপ**, সবকিছু তিনটি প্রিমিটিভের উপর। কোনো `agentmemory plugin install` নেই। প্লাগইন সিস্টেমটাই iii নিজে। +**220 সোর্স ফাইল · ~52,000 LOC · 2,600+ টেস্ট · 311 ফাংশন · 60 KV স্কোপ**, সবকিছু তিনটি প্রিমিটিভের উপর। কোনো `agentmemory plugin install` নেই। প্লাগইন সিস্টেমটাই iii নিজে। --- @@ -1861,7 +1861,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 aaa98d2eea..5ed617e8f5 100644 --- a/READMEs/README.cs-CZ.md +++ b/READMEs/README.cs-CZ.md @@ -71,7 +71,7 @@ 54 MCP nástrojů 12 automatických hooks 0 externích databází - 2,500+ testů úspěšně proběhlo + 2,600+ testů úspěšně proběhlo

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Vlastní systémy pluginů | `iii worker add ` | -**219 zdrojových souborů · ~52,000 řádků kódu · 2,500+ testů · 311 funkcí · 60 KV scopes**, vše na třech primitivech. Žádné `agentmemory plugin install`. Systém pluginů je samo iii. +**220 zdrojových souborů · ~52,000 řádků kódu · 2,600+ testů · 311 funkcí · 60 KV scopes**, vše na třech primitivech. Žádné `agentmemory plugin install`. Systém pluginů je samo iii. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 84c5ab8f1d..40bd703e86 100644 --- a/READMEs/README.da-DK.md +++ b/READMEs/README.da-DK.md @@ -71,7 +71,7 @@ 54 MCP-værktøjer 12 automatiske hooks 0 eksterne databaser - 2,500+ beståede tests + 2,600+ beståede tests

@@ -1436,7 +1436,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Custom plugin-systemer | `iii worker add ` | -**219 kildefiler · ~52,000 LOC · 2,500+ tests · 311 funktioner · 60 KV-scopes**, alt på tre primitiver. Intet `agentmemory plugin install`. Plugin-systemet er iii selv. +**220 kildefiler · ~52,000 LOC · 2,600+ tests · 311 funktioner · 60 KV-scopes**, alt på tre primitiver. Intet `agentmemory plugin install`. Plugin-systemet er iii selv. --- @@ -1860,7 +1860,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 2620da4dbc..1233d6c4e1 100644 --- a/READMEs/README.de-DE.md +++ b/READMEs/README.de-DE.md @@ -71,7 +71,7 @@ 54 MCP-Tools 12 Auto-Hooks 0 externe DBs - 2,500+ bestandene Tests + 2,600+ bestandene Tests

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + Health-Monitor | | Eigene Plugin-Systeme | `iii worker add ` | -**219 Quelldateien · ~52,000 LOC · 2,500+ Tests · 311 Funktionen · 60 KV-Scopes**, alles auf drei Primitiven. Kein `agentmemory plugin install`. Das Plugin-System ist iii selbst. +**220 Quelldateien · ~52,000 LOC · 2,600+ Tests · 311 Funktionen · 60 KV-Scopes**, alles auf drei Primitiven. Kein `agentmemory plugin install`. Das Plugin-System ist iii selbst. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 a7048492f4..dfaf18e089 100644 --- a/READMEs/README.el-GR.md +++ b/READMEs/README.el-GR.md @@ -71,7 +71,7 @@ 54 εργαλεία MCP 12 αυτόματα hooks 0 εξωτερικές βάσεις δεδομένων - 2,500+ επιτυχημένες δοκιμές + 2,600+ επιτυχημένες δοκιμές

@@ -1438,7 +1438,7 @@ fi | Prometheus / Grafana | iii OTEL + monitor υγείας | | Προσαρμοσμένα συστήματα plugin | `iii worker add ` | -**219 αρχεία πηγαίου κώδικα · ~52,000 LOC · 2,500+ δοκιμές · 311 functions · 60 KV scopes**, όλα πάνω σε τρία primitives. Δεν υπάρχει `agentmemory plugin install`. Το σύστημα plugin είναι το ίδιο το iii. +**220 αρχεία πηγαίου κώδικα · ~52,000 LOC · 2,600+ δοκιμές · 311 functions · 60 KV scopes**, όλα πάνω σε τρία primitives. Δεν υπάρχει `agentmemory plugin install`. Το σύστημα plugin είναι το ίδιο το iii. --- @@ -1862,7 +1862,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 c680fec4a1..d61dfb2bc3 100644 --- a/READMEs/README.es-ES.md +++ b/READMEs/README.es-ES.md @@ -71,7 +71,7 @@ 54 tools MCP 12 hooks automáticos 0 bases de datos externas - 2,500+ tests superados + 2,600+ tests superados

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + monitor de salud | | Sistemas de plugins propios | `iii worker add ` | -**219 ficheros de código · ~52,000 LOC · 2,500+ tests · 311 funciones · 60 scopes KV**, todo sobre tres primitivos. No hay `agentmemory plugin install`. El sistema de plugins es iii mismo. +**220 ficheros de código · ~52,000 LOC · 2,600+ tests · 311 funciones · 60 scopes KV**, todo sobre tres primitivos. No hay `agentmemory plugin install`. El sistema de plugins es iii mismo. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 c56cf55680..b5bb068e6a 100644 --- a/READMEs/README.fi-FI.md +++ b/READMEs/README.fi-FI.md @@ -71,7 +71,7 @@ 54 MCP-työkalua 12 automaattista hookia 0 ulkoista tietokantaa - 2,500+ testiä läpäisty + 2,600+ testiä läpäisty

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + terveysmonitori | | Mukautetut plugin-järjestelmät | `iii worker add ` | -**219 lähdetiedostoa · ~52,000 LOC · 2,500+ testiä · 311 funktiota · 60 KV-scopea**, kaikki kolmen primitiivin päällä. Ei `agentmemory plugin install` -komentoa. Plugin-järjestelmä on iii itse. +**220 lähdetiedostoa · ~52,000 LOC · 2,600+ testiä · 311 funktiota · 60 KV-scopea**, kaikki kolmen primitiivin päällä. Ei `agentmemory plugin install` -komentoa. Plugin-järjestelmä on iii itse. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 e5f067ca37..b74fe16f72 100644 --- a/READMEs/README.fr-FR.md +++ b/READMEs/README.fr-FR.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1448,7 +1448,7 @@ fi | Prometheus / Grafana | iii OTEL + moniteur de santé | | Systèmes de plugins custom | `iii worker add ` | -**219 fichiers sources · ~52,000 LOC · 2,500+ tests · 311 fonctions · 60 scopes KV**, tout sur trois primitives. Pas de `agentmemory plugin install`. Le système de plugins, c'est iii lui-même. +**220 fichiers sources · ~52,000 LOC · 2,600+ tests · 311 fonctions · 60 scopes KV**, tout sur trois primitives. Pas de `agentmemory plugin install`. Le système de plugins, c'est iii lui-même. --- @@ -1872,7 +1872,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 6c969c8458..bc0821bab1 100644 --- a/READMEs/README.he-IL.md +++ b/READMEs/README.he-IL.md @@ -73,7 +73,7 @@ 54 כלי MCP 12 hooks אוטומטיים 0 מסדי נתונים חיצוניים - 2,500+ בדיקות עוברות + 2,600+ בדיקות עוברות

@@ -1439,7 +1439,7 @@ fi | Prometheus / Grafana | iii OTEL + מוניטור health | | מערכות plugin מותאמות אישית | `iii worker add ` | -**219 קבצי מקור · ~52,000 LOC · 2,500+ בדיקות · 311 פונקציות · 60 תחומי KV**, הכול על שלושה primitives. אין `agentmemory plugin install`. מערכת ה-plugin היא iii עצמו. +**220 קבצי מקור · ~52,000 LOC · 2,600+ בדיקות · 311 פונקציות · 60 תחומי KV**, הכול על שלושה primitives. אין `agentmemory plugin install`. מערכת ה-plugin היא iii עצמו. --- @@ -1863,7 +1863,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 fa5427fe98..f62657c1de 100644 --- a/READMEs/README.hi-IN.md +++ b/READMEs/README.hi-IN.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1449,7 +1449,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Custom plugin systems | `iii worker add ` | -**219 source files · ~52,000 LOC · 2,500+ tests · 311 functions · 60 KV scopes**, सब कुछ तीन primitives पर। कोई `agentmemory plugin install` नहीं। Plugin system iii स्वयं है। +**220 source files · ~52,000 LOC · 2,600+ tests · 311 functions · 60 KV scopes**, सब कुछ तीन primitives पर। कोई `agentmemory plugin install` नहीं। Plugin system iii स्वयं है। --- @@ -1873,7 +1873,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 7ac4d0327e..9332528f8a 100644 --- a/READMEs/README.hu-HU.md +++ b/READMEs/README.hu-HU.md @@ -71,7 +71,7 @@ 54 MCP eszköz 12 automatikus hook 0 külső adatbázis - 2,500+ sikeres teszt + 2,600+ sikeres teszt

@@ -1446,7 +1446,7 @@ A `/agentmemory/export` emellett elfogadja a `?maxSessions=`-t és a `?offset=`- | Prometheus / Grafana | iii OTEL + egészségfigyelő | | Egyéni plugin-rendszerek | `iii worker add ` | -**219 forrásfájl · ~52,000 LOC · 2,500+ teszt · 311 funkció · 60 KV-hatókör**, mindez három primitíven. Nincs `agentmemory plugin install`. A plugin-rendszer maga az iii. +**220 forrásfájl · ~52,000 LOC · 2,600+ teszt · 311 funkció · 60 KV-hatókör**, mindez három primitíven. Nincs `agentmemory plugin install`. A plugin-rendszer maga az iii. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 1e82a39ee9..9a0624d96e 100644 --- a/READMEs/README.id-ID.md +++ b/READMEs/README.id-ID.md @@ -71,7 +71,7 @@ 54 tool MCP 12 hook otomatis 0 DB eksternal - 2,500+ pengujian lolos + 2,600+ pengujian lolos

@@ -1447,7 +1447,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Sistem plugin custom | `iii worker add ` | -**219 file sumber · ~52,000 LOC · 2,500+ pengujian · 311 fungsi · 60 scope KV**, semua di atas tiga primitif. Tidak ada `agentmemory plugin install`. Sistem plugin-nya adalah iii itu sendiri. +**220 file sumber · ~52,000 LOC · 2,600+ pengujian · 311 fungsi · 60 scope KV**, semua di atas tiga primitif. Tidak ada `agentmemory plugin install`. Sistem plugin-nya adalah iii itu sendiri. --- @@ -1871,7 +1871,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 3d61a05f0a..0c2f987f25 100644 --- a/READMEs/README.it-IT.md +++ b/READMEs/README.it-IT.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + monitor di salute | | Sistemi di plugin personalizzati | `iii worker add ` | -**219 file sorgente · ~52,000 righe di codice · 2,500+ test · 311 funzioni · 60 scope KV**, tutto su tre primitive. Nessun `agentmemory plugin install`. Il sistema di plugin è iii stesso. +**220 file sorgente · ~52,000 righe di codice · 2,600+ test · 311 funzioni · 60 scope KV**, tutto su tre primitive. Nessun `agentmemory plugin install`. Il sistema di plugin è iii stesso. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 502b6d4c8b..d4c28c6955 100644 --- a/READMEs/README.ja-JP.md +++ b/READMEs/README.ja-JP.md @@ -71,7 +71,7 @@ 54 MCP ツール 12 自動 hooks 外部 DB 0 個 - 2,500+ 件のテストが成功 + 2,600+ 件のテストが成功

@@ -1445,7 +1445,7 @@ fi | Prometheus / Grafana | iii OTEL + ヘルスモニタ | | カスタムプラグインシステム | `iii worker add ` | -**219 ソースファイル · ~52,000 LOC · 2,500+ テスト · 311 functions · 60 KV スコープ** — すべて 3 つのプリミティブの上に。`agentmemory plugin install` はありません。プラグインシステムは iii そのものです。 +**220 ソースファイル · ~52,000 LOC · 2,600+ テスト · 311 functions · 60 KV スコープ** — すべて 3 つのプリミティブの上に。`agentmemory plugin install` はありません。プラグインシステムは iii そのものです。 --- @@ -1869,7 +1869,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 e929c0b316..4401b644fe 100644 --- a/READMEs/README.ko-KR.md +++ b/READMEs/README.ko-KR.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + health 모니터 | | 커스텀 플러그인 시스템 | `iii worker add ` | -**소스 파일 219개 · LOC ~52,000줄 · 테스트 2,500+개 · 함수 311개 · KV 스코프 60개**, 모두 세 가지 프리미티브 위에서 동작합니다. `agentmemory plugin install` 같은 것은 없습니다. 플러그인 시스템은 곧 iii 자체입니다. +**소스 파일 220개 · LOC ~52,000줄 · 테스트 2,600+개 · 함수 311개 · KV 스코프 60개**, 모두 세 가지 프리미티브 위에서 동작합니다. `agentmemory plugin install` 같은 것은 없습니다. 플러그인 시스템은 곧 iii 자체입니다. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 7715107ab2..5adad28118 100644 --- a/READMEs/README.nb-NO.md +++ b/READMEs/README.nb-NO.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1447,7 +1447,7 @@ fi | Prometheus / Grafana | iii OTEL + helseovervåker | | Egendefinerte plugin-systemer | `iii worker add ` | -**219 kildefiler · ~52,000 LOC · 2,500+ tester · 311 funksjoner · 60 KV-scopes**, alt på tre primitiver. Ingen `agentmemory plugin install`. Plugin-systemet er iii selv. +**220 kildefiler · ~52,000 LOC · 2,600+ tester · 311 funksjoner · 60 KV-scopes**, alt på tre primitiver. Ingen `agentmemory plugin install`. Plugin-systemet er iii selv. --- @@ -1871,7 +1871,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 4888039db6..e5bdf8b962 100644 --- a/READMEs/README.nl-NL.md +++ b/READMEs/README.nl-NL.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Custom plugin-systemen | `iii worker add ` | -**219 bronbestanden · ~52,000 LOC · 2,500+ tests · 311 functies · 60 KV-scopes**, allemaal op drie primitieven. Geen `agentmemory plugin install`. Het pluginsysteem is iii zelf. +**220 bronbestanden · ~52,000 LOC · 2,600+ tests · 311 functies · 60 KV-scopes**, allemaal op drie primitieven. Geen `agentmemory plugin install`. Het pluginsysteem is iii zelf. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 97c41857f7..3f16686eb2 100644 --- a/READMEs/README.pl-PL.md +++ b/READMEs/README.pl-PL.md @@ -71,7 +71,7 @@ 54 narzędzia MCP 12 automatycznych hooków 0 zewnętrznych baz danych - 2,500+ zaliczonych testów + 2,600+ zaliczonych testów

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + monitor stanu | | Niestandardowe systemy pluginów | `iii worker add ` | -**219 plików źródłowych · ~52,000 LOC · 2,500+ testów · 311 funkcji · 60 zakresów KV**, wszystko na trzech prymitywach. Nie ma `agentmemory plugin install`. Systemem pluginów jest sam iii. +**220 plików źródłowych · ~52,000 LOC · 2,600+ testów · 311 funkcji · 60 zakresów KV**, wszystko na trzech prymitywach. Nie ma `agentmemory plugin install`. Systemem pluginów jest sam iii. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 d9eeb24870..ca067d5499 100644 --- a/READMEs/README.pt-BR.md +++ b/READMEs/README.pt-BR.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1447,7 +1447,7 @@ fi | Prometheus / Grafana | iii OTEL + monitor de saúde | | Sistemas de plugin customizados | `iii worker add ` | -**219 arquivos de código · ~52,000 LOC · 2,500+ testes · 311 funções · 60 escopos KV**, tudo em cima de três primitivos. Sem `agentmemory plugin install`. O sistema de plugins é o próprio iii. +**220 arquivos de código · ~52,000 LOC · 2,600+ testes · 311 funções · 60 escopos KV**, tudo em cima de três primitivos. Sem `agentmemory plugin install`. O sistema de plugins é o próprio iii. --- @@ -1871,7 +1871,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 a1a5474cef..2e8ab34c17 100644 --- a/READMEs/README.pt-PT.md +++ b/READMEs/README.pt-PT.md @@ -71,7 +71,7 @@ 54 ferramentas MCP 12 hooks automáticos 0 bases de dados externas - 2,500+ testes aprovados + 2,600+ testes aprovados

@@ -1446,7 +1446,7 @@ O `/agentmemory/export` também aceita `?maxSessions=` e `?offset=` para dividir | Prometheus / Grafana | iii OTEL + monitor de saúde | | Sistemas de plugins personalizados | `iii worker add ` | -**219 ficheiros de código-fonte · ~52,000 LOC · 2,500+ testes · 311 funções · 60 âmbitos de KV**, tudo sobre três primitivos. Sem `agentmemory plugin install`. O sistema de plugins é o próprio iii. +**220 ficheiros de código-fonte · ~52,000 LOC · 2,600+ testes · 311 funções · 60 âmbitos de KV**, tudo sobre três primitivos. Sem `agentmemory plugin install`. O sistema de plugins é o próprio iii. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 f6bdb61b47..23b3e06a41 100644 --- a/READMEs/README.ro-RO.md +++ b/READMEs/README.ro-RO.md @@ -71,7 +71,7 @@ 54 de instrumente MCP 12 hook-uri automate 0 baze de date externe - 2,500+ teste trecute + 2,600+ teste trecute

@@ -1430,7 +1430,7 @@ fi | Prometheus / Grafana | iii OTEL + monitor de sănătate | | Sisteme de plugin-uri personalizate | `iii worker add ` | -**219 fișiere sursă · ~52,000 LOC · 2,500+ teste · 311 funcții · 60 domenii KV**, toate pe trei primitive. Niciun `agentmemory plugin install`. Sistemul de plugin-uri este chiar iii. +**220 fișiere sursă · ~52,000 LOC · 2,600+ teste · 311 funcții · 60 domenii KV**, toate pe trei primitive. Niciun `agentmemory plugin install`. Sistemul de plugin-uri este chiar iii. --- @@ -1854,7 +1854,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 f74bdbdc7a..981774184c 100644 --- a/READMEs/README.ru-RU.md +++ b/READMEs/README.ru-RU.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1446,7 +1446,7 @@ fi | Prometheus / Grafana | iii OTEL + монитор состояния | | Самописные плагинные системы | `iii worker add ` | -**219 исходных файлов · ~52,000 LOC · 2,500+ тестов · 311 функция · 60 KV-scope'ов**, всё на трёх примитивах. Никакого `agentmemory plugin install`. Плагинная система — это сам iii. +**220 исходных файлов · ~52,000 LOC · 2,600+ тестов · 311 функция · 60 KV-scope'ов**, всё на трёх примитивах. Никакого `agentmemory plugin install`. Плагинная система — это сам iii. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 97c427dbde..9bb5a18674 100644 --- a/READMEs/README.sv-SE.md +++ b/READMEs/README.sv-SE.md @@ -71,7 +71,7 @@ 54 MCP-verktyg 12 automatiska hooks 0 externa databaser - 2,500+ godkända tester + 2,600+ godkända tester

@@ -1437,7 +1437,7 @@ fi | Prometheus / Grafana | iii OTEL + hälsoövervakare | | Anpassade pluginsystem | `iii worker add ` | -**219 källkodsfiler · ~52,000 LOC · 2,500+ tester · 311 funktioner · 60 KV-scopes**, allt på tre primitiv. Inget `agentmemory plugin install`. Pluginsystemet är iii självt. +**220 källkodsfiler · ~52,000 LOC · 2,600+ tester · 311 funktioner · 60 KV-scopes**, allt på tre primitiv. Inget `agentmemory plugin install`. Pluginsystemet är iii självt. --- @@ -1861,7 +1861,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 5de7ed0972..c573564bd7 100644 --- a/READMEs/README.th-TH.md +++ b/READMEs/README.th-TH.md @@ -71,7 +71,7 @@ 54 เครื่องมือ MCP 12 hook อัตโนมัติ ไม่ต้องพึ่ง external DB เลย - ผ่านการทดสอบ 2,500+ รายการ + ผ่านการทดสอบ 2,600+ รายการ

@@ -1444,7 +1444,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Custom plugin systems | `iii worker add ` | -**219 source file · ~52,000 LOC · 2,500+ การทดสอบ · 311 function · 60 KV scope** ทั้งหมดอยู่บน primitive สามตัว ไม่มี `agentmemory plugin install` ระบบ plugin ก็คือ iii เองนั่นแหละ +**220 source file · ~52,000 LOC · 2,600+ การทดสอบ · 311 function · 60 KV scope** ทั้งหมดอยู่บน primitive สามตัว ไม่มี `agentmemory plugin install` ระบบ plugin ก็คือ iii เองนั่นแหละ --- @@ -1868,7 +1868,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 062f9784fa..8ed4151e02 100644 --- a/READMEs/README.tl-PH.md +++ b/READMEs/README.tl-PH.md @@ -71,7 +71,7 @@ 54 MCP tool 12 awtomatikong hook 0 panlabas na DB - 2,500+ pumapasang test + 2,600+ pumapasang test

@@ -1446,7 +1446,7 @@ Tinatanggap din ng `/agentmemory/export` ang `?maxSessions=` at `?offset=` para | Prometheus / Grafana | iii OTEL + health monitor | | Custom na plugin system | `iii worker add ` | -**219 na source file · ~52,000 LOC · 2,500+ na test · 311 na function · 60 na KV scope**, lahat sa tatlong primitive. Walang `agentmemory plugin install`. Ang plugin system mismo ay ang iii. +**220 na source file · ~52,000 LOC · 2,600+ na test · 311 na function · 60 na KV scope**, lahat sa tatlong primitive. Walang `agentmemory plugin install`. Ang plugin system mismo ay ang iii. --- @@ -1870,7 +1870,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 b55fb3cbd3..fb5aa6d393 100644 --- a/READMEs/README.tr-TR.md +++ b/READMEs/README.tr-TR.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1437,7 +1437,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Custom eklenti sistemleri | `iii worker add ` | -**219 kaynak dosya · ~52,000 LOC · 2,500+ test · 311 fonksiyon · 60 KV scope**, hepsi üç primitif üzerinde. `agentmemory plugin install` yok. Eklenti sistemi, iii'nin kendisidir. +**220 kaynak dosya · ~52,000 LOC · 2,600+ test · 311 fonksiyon · 60 KV scope**, hepsi üç primitif üzerinde. `agentmemory plugin install` yok. Eklenti sistemi, iii'nin kendisidir. --- @@ -1861,7 +1861,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 a6f8e22bb5..f7bf3db1b9 100644 --- a/READMEs/README.uk-UA.md +++ b/READMEs/README.uk-UA.md @@ -71,7 +71,7 @@ 54 інструменти MCP 12 автоматичних хуків 0 зовнішніх БД - 2,500+ тестів пройдено + 2,600+ тестів пройдено

@@ -1447,7 +1447,7 @@ fi | Prometheus / Grafana | iii OTEL + монітор стану здоров'я | | Власні системи плагінів | `iii worker add ` | -**219 вихідних файлів · ~52,000 LOC · 2,500+ тестів · 311 функцій · 60 KV-скоупів**, усе на трьох примітивах. Жодного `agentmemory plugin install`. Система плагінів — це сам iii. +**220 вихідних файлів · ~52,000 LOC · 2,600+ тестів · 311 функцій · 60 KV-скоупів**, усе на трьох примітивах. Жодного `agentmemory plugin install`. Система плагінів — це сам iii. --- @@ -1871,7 +1871,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 46955c26f1..004691a725 100644 --- a/READMEs/README.ur-PK.md +++ b/READMEs/README.ur-PK.md @@ -73,7 +73,7 @@ 54 MCP ٹولز 12 خودکار ہکس 0 خارجی ڈیٹابیسز - 2,500+ ٹیسٹس پاس ہو رہے ہیں + 2,600+ ٹیسٹس پاس ہو رہے ہیں

@@ -1432,7 +1432,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | کسٹم plugin سسٹمز | `iii worker add ` | -**219 سورس فائلز · ~52,000 لائنز کوڈ · 2,500+ ٹیسٹس · 311 فنکشنز · 60 KV اسکوپس**، سب تین primitives پر۔ کوئی `agentmemory plugin install` نہیں۔ plugin سسٹم خود iii ہی ہے۔ +**220 سورس فائلز · ~52,000 لائنز کوڈ · 2,600+ ٹیسٹس · 311 فنکشنز · 60 KV اسکوپس**، سب تین primitives پر۔ کوئی `agentmemory plugin install` نہیں۔ plugin سسٹم خود iii ہی ہے۔ --- @@ -1854,7 +1854,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 8704a42978..f09c333904 100644 --- a/READMEs/README.vi-VN.md +++ b/READMEs/README.vi-VN.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 2,500+ tests passing + 2,600+ tests passing

@@ -1437,7 +1437,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Hệ thống plugin tùy chỉnh | `iii worker add ` | -**219 file source · ~52,000 LOC · 2,500+ test · 311 function · 60 KV scope**, tất cả trên ba primitive. Không có `agentmemory plugin install`. Hệ thống plugin chính là iii. +**220 file source · ~52,000 LOC · 2,600+ test · 311 function · 60 KV scope**, tất cả trên ba primitive. Không có `agentmemory plugin install`. Hệ thống plugin chính là iii. --- @@ -1861,7 +1861,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 3ef47ba66d..ad18d7dcb1 100644 --- a/READMEs/README.zh-CN.md +++ b/READMEs/README.zh-CN.md @@ -71,7 +71,7 @@ 54 个 MCP 工具 12 个自动 hooks 0 个外部数据库 - 2,500+ 项测试通过 + 2,600+ 项测试通过

@@ -1444,7 +1444,7 @@ fi | Prometheus / Grafana | iii OTEL + 健康监控 | | Custom plugin systems | `iii worker add ` | -**219 个源文件 · ~52,000 行代码 · 2,500+ 个测试 · 311 个函数 · 60 个 KV 作用域**,全部基于三种原语。没有 `agentmemory plugin install`。插件系统就是 iii 本身。 +**220 个源文件 · ~52,000 行代码 · 2,600+ 个测试 · 311 个函数 · 60 个 KV 作用域**,全部基于三种原语。没有 `agentmemory plugin install`。插件系统就是 iii 本身。 --- @@ -1868,7 +1868,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 3c9250fb8d..84e7d66a88 100644 --- a/READMEs/README.zh-TW.md +++ b/READMEs/README.zh-TW.md @@ -71,7 +71,7 @@ 54 個 MCP 工具 12 個自動 hooks 0 個外部資料庫 - 2,500+ 測試通過 + 2,600+ 測試通過

@@ -1430,7 +1430,7 @@ fi | Prometheus / Grafana | iii OTEL + 健康監控 | | 自訂外掛系統 | `iii worker add ` | -**219 個原始檔 · ~52,000 行程式碼 · 2,500+ 測試 · 311 個函式 · 60 個 KV 範圍**,全部基於三種原語。沒有 `agentmemory plugin install`。外掛系統就是 iii 本身。 +**220 個原始檔 · ~52,000 行程式碼 · 2,600+ 測試 · 311 個函式 · 60 個 KV 範圍**,全部基於三種原語。沒有 `agentmemory plugin install`。外掛系統就是 iii 本身。 --- @@ -1854,7 +1854,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 2,500+ tests +npm test # 2,600+ 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 1bb69e34ce..4dfe9de336 100644 --- a/assets/tags/light/stat-tests.svg +++ b/assets/tags/light/stat-tests.svg @@ -1,5 +1,5 @@ - + - 2500+ + 2600+ TESTS PASSING diff --git a/assets/tags/stat-tests.svg b/assets/tags/stat-tests.svg index 44c9fc27f9..b704fbe706 100644 --- a/assets/tags/stat-tests.svg +++ b/assets/tags/stat-tests.svg @@ -1,5 +1,5 @@ - + - 2500+ + 2600+ TESTS PASSING diff --git a/scripts/docs-sync.state.json b/scripts/docs-sync.state.json index 4fab8b8840..8f8f22fa50 100644 --- a/scripts/docs-sync.state.json +++ b/scripts/docs-sync.state.json @@ -20,13 +20,13 @@ "12" ], "tests": [ - "2500+" + "2600+" ], "functions": [ "311" ], "sourceFiles": [ - "219" + "220" ], "loc": [ "52000" From c31cfffcc663dfdb77296f8f127d3f653e3560fc Mon Sep 17 00:00:00 2001 From: Rex57 <203883624+Rex57@users.noreply.github.com> Date: Thu, 8 Oct 2026 15:07:30 +0800 Subject: [PATCH 4/5] fix(status): show a small nonzero LLM cost as <$0.0001, not $0.0000 Signed-off-by: Rex57 <203883624+Rex57@users.noreply.github.com> --- src/functions/status.ts | 7 ++++++- test/status.test.ts | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/functions/status.ts b/src/functions/status.ts index b39d512f3a..9ab6aa7926 100644 --- a/src/functions/status.ts +++ b/src/functions/status.ts @@ -632,7 +632,12 @@ function processHealth(report: StatusReport): string { 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.toFixed(4)}`; + 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}`; } diff --git a/test/status.test.ts b/test/status.test.ts index 639688dee1..6336d50ec4 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -364,6 +364,11 @@ describe("renderStatusHtml", () => { 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"); From 0c269811e9015d45ba2d973d9829a77958472f3e Mon Sep 17 00:00:00 2001 From: Rex57 <203883624+Rex57@users.noreply.github.com> Date: Tue, 20 Oct 2026 15:25:40 +0800 Subject: [PATCH 5/5] test(openai): cover truncated reasoning in the provider and the packaged gate Provider tests now cover a reply cut at max_tokens with null or empty content and only reasoning or reasoning_content, through both compress and summarize; replies that finished normally with reasoning only (the fallback stays); and nonempty content, which is still returned even when finish_reason is "length". The packaged summary-recovery gate gains a truncated-reasoning-is-rejected scenario. Its loopback model returns finish_reason "length", null content and partial reasoning that parses as valid XML. Against the installed archive, summarize returns success: false with the max_tokens error, the compression is stored as failed (compression_failed), and the reasoning marker appears nowhere in the export. With the provider change reverted, the scenario fails because the partial reasoning is stored as the session summary. Signed-off-by: Rex57 <203883624+Rex57@users.noreply.github.com> --- scripts/release-gate/summary-recovery.mjs | 44 ++++++++++++++++++++--- test/fetch-timeout.test.ts | 37 ++++++++++++------- 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/scripts/release-gate/summary-recovery.mjs b/scripts/release-gate/summary-recovery.mjs index 42072a1814..9e74bca4da 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; @@ -221,14 +235,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 () => { @@ -294,6 +308,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/test/fetch-timeout.test.ts b/test/fetch-timeout.test.ts index f2be990c81..2f92013b23 100644 --- a/test/fetch-timeout.test.ts +++ b/test/fetch-timeout.test.ts @@ -552,26 +552,37 @@ describe("OpenAIProvider thinking-model fallback", () => { expect(out).toBe("older shape"); }); - it("throws instead of returning partial reasoning when the reply hit max_tokens", async () => { + 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: null, reasoning: "The user is asking me to reply with" }, - }, - ], + 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.compress("system", "user")).rejects.toThrow(/max_tokens \(16\)/); + await expect(provider[method]("system", "user")).rejects.toThrow(/max_tokens \(16\)/); }); - it("keeps the reasoning fallback when the reply finished normally", async () => { + 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: "stop", message: { content: "", reasoning_content: "complete answer" } }], + choices: [{ finish_reason: "length", message: { content: "partial but real", reasoning: "ignore" } }], }); - const provider = new OpenAIProvider("test-key", "gpt-5.6-luna", 1024); - const out = await provider.compress("system", "user"); - expect(out).toBe("complete answer"); + 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 () => {