From b6c75d802fe96a7cc43a2031cc39bbc419627138 Mon Sep 17 00:00:00 2001 From: mnemonik-dev Date: Tue, 28 Jul 2026 00:15:05 +0300 Subject: [PATCH] feat(exports): expose runThink synthesis via gbrain/think subpath (#3427) * feat(exports): expose runThink synthesis via gbrain/think subpath The think synthesis pipeline (runThink, stripGapsSection, persistSynthesis, maxOutputTokensFor + the ThinkResult/ParsedCitation types) lives in src/core/think/index.ts but is not reachable through the public exports map. Downstream consumers importing `gbrain/think` fail to resolve it, and no other exported entrypoint re-exports runThink. Add `./think` to package.json exports and extend the public-exports contract test (count 20 -> 21; new EXPECTED_EXPORTS row with runtime canaries runThink + stripGapsSection). Test passes 38/38. Left the VERSION / package.json version / CHANGELOG / llms bumps to the maintainer /ship flow to avoid colliding with the version-queue allocator. * fix(ci): bump public-exports guard baseline to 21 for gbrain/think The new ./think subpath grows the exports map to 21 entries; scripts/check-exports-count.sh still pinned EXPECTED_COUNT=20 and exits 1 on growth, failing CI. Co-authored-by: mnemonik-dev Co-Authored-By: Claude Fable 5 --------- Co-authored-by: Garry Tan Co-authored-by: Claude Fable 5 --- package.json | 1 + scripts/check-exports-count.sh | 2 +- test/public-exports.test.ts | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 62002a4df..da62212c3 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "./backoff": "./src/core/backoff.ts", "./search/hybrid": "./src/core/search/hybrid.ts", "./search/expansion": "./src/core/search/expansion.ts", + "./think": "./src/core/think/index.ts", "./ai/gateway": "./src/core/ai/gateway.ts", "./extract": "./src/commands/extract.ts", "./ingestion": "./src/core/ingestion/index.ts", diff --git a/scripts/check-exports-count.sh b/scripts/check-exports-count.sh index a02d1a015..45cc056ac 100755 --- a/scripts/check-exports-count.sh +++ b/scripts/check-exports-count.sh @@ -19,7 +19,7 @@ set -euo pipefail -EXPECTED_COUNT=20 +EXPECTED_COUNT=21 # Count top-level keys in the exports object. `node -e` parses JSON # reliably without needing jq (which isn't in every CI environment). diff --git a/test/public-exports.test.ts b/test/public-exports.test.ts index c911de1f7..a7e701980 100644 --- a/test/public-exports.test.ts +++ b/test/public-exports.test.ts @@ -49,6 +49,7 @@ const EXPECTED_EXPORTS: ExpectedExport[] = [ { subpath: 'gbrain/backoff', canary: [] }, { subpath: 'gbrain/search/hybrid', canary: ['hybridSearch', 'rrfFusion'] }, { subpath: 'gbrain/search/expansion', canary: ['expandQuery'] }, + { subpath: 'gbrain/think', canary: ['runThink', 'stripGapsSection'] }, { subpath: 'gbrain/ai/gateway', canary: ['configureGateway', 'embed'] }, { subpath: 'gbrain/extract', canary: [] }, { subpath: 'gbrain/ingestion', canary: ['INGESTION_SOURCE_API_VERSION', 'validateIngestionEvent', 'computeContentHash'] }, @@ -68,7 +69,7 @@ describe('public exports — package.json exports map', () => { // Adding new exports: increment this + add to EXPECTED_EXPORTS below. // Removing exports: see CLAUDE.md "Removing any of these is a // breaking change going forward" — bump minor and update this count. - expect(count).toBe(20); + expect(count).toBe(21); }); test('EXPECTED_EXPORTS list matches the exports map exactly (no drift)', () => {