brainy/src/types
David Snelling ed75f250ec refactor(8.0): SubtypeRegistry hook + drop multi-hop subtype throw (scaffold steps 11-12)
Two small additions per BRAINY-8.0-SUBTYPE-CONTRACT § C-3 + § C-4.

STEP 11 — SubtypeRegistry declaration-merging hook (§ C-3)

src/types/brainy.types.ts
- New empty `SubtypeRegistry` interface. Consumers extend via TypeScript
  module augmentation to declare per-`(NounType, subtype)` metadata
  shapes. Brainy ships no entries; every entry is a consumer concern.
- Usage pattern documented inline:
    declare module '@soulcraft/brainy' {
      interface SubtypeRegistry {
        'person:employee': { employeeId: string; department: string }
        'document:invoice': { invoiceNumber: string; amount: number }
      }
    }
- Consumers with no entries see no type-level change (metadata stays T = any).

src/index.ts
- Public export of `SubtypeRegistry` as a type so consumers can declare-merge it.

The typed `add<NounType.Person, 'employee'>()` overloads + `brain.fillSubtypes()`
migration helper are NOT in this commit — they require the C-1 runtime
flip to land first (per step 10 deferral). The interface stub ships now
so external consumers can start the declare-merging pattern in their own
code immediately.

STEP 12 — drop the multi-hop subtype throw (§ C-4)

src/brainy.ts
- Deleted the `find({ connected: { subtype, depth > 1 } })` throw that
  7.30.x emitted ("Use depth: 1, or wait for Cortex native traversal").
- Replaced the throw block with an explanatory comment: cortex's D.3
  `findConnectedSubtype` handles the multi-hop case natively;
  open-core JS falls back to per-hop edge enumeration (correct but slow
  past ~10 K reachable edges per source).

Per BRAINY-8.0-RENAME-COORDINATION § G.3.b (cortex-confirmed): the native
graph index is ready for unbounded `depth` from brainy with no rebuild
required, and BFS-with-cycle-guard semantics hold at any depth.

VERIFICATION

- npx tsc --noEmit: clean
- npm test: 1408 / 1409 (same pre-existing race-condition outstanding)
2026-06-09 14:29:09 -07:00
..
apiTypes.ts feat: Brainy 3.0 - Production-ready Triple Intelligence database 2025-09-11 16:23:32 -07:00
brainy.types.ts refactor(8.0): SubtypeRegistry hook + drop multi-hop subtype throw (scaffold steps 11-12) 2026-06-09 14:29:09 -07:00
brainyInterface.ts feat: add aggregation engine with incremental SUM/COUNT/AVG/MIN/MAX, GROUP BY, and time windows 2026-02-16 16:57:53 -08:00
distributedTypes.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
fileSystemTypes.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
graphTypes.ts feat: enforce data/metadata separation, numeric range queries, improved docs 2026-02-09 12:07:54 -08:00
mcpTypes.ts feat: add infinite agent memory with MCP integration 2025-09-29 15:37:11 -07:00
optional-deps.d.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
paginationTypes.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
progress.types.ts feat: add progress tracking, entity caching, and relationship confidence 2025-10-01 15:12:54 -07:00
typeMigration.ts fix: exclude __words__ keyword index from corruption detection and getStats() 2026-01-27 15:38:21 -08:00