Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 384f4b6b9c | |||
| a58372f03f | |||
| a99b1e83c4 | |||
| 9f248b2495 |
76 changed files with 264 additions and 288 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## What Is Brainy
|
## What Is Brainy
|
||||||
|
|
||||||
@soulcraft/brainy (v7.17.0) is a Universal Knowledge Protocol -- a Triple Intelligence database combining vector search, graph traversal, and metadata filtering in a single library. Published to npm as a public MIT-licensed package.
|
@soulcraftlabs/brainy (v7.17.0) is a Universal Knowledge Protocol -- a Triple Intelligence database combining vector search, graph traversal, and metadata filtering in a single library. Published to npm as a public MIT-licensed package.
|
||||||
|
|
||||||
## Core Architecture
|
## Core Architecture
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
SOURCE_NPM_REG="https://source.soulcraft.com/api/packages/soulcraft/npm/"
|
SOURCE_NPM_REG="https://source.soulcraft.com/api/packages/soulcraftlabs/npm/"
|
||||||
VERSION="$(node -p "require('./package.json').version")"
|
VERSION="$(node -p "require('./package.json').version")"
|
||||||
# The dist-tag follows the version: a prerelease (any hyphen —
|
# The dist-tag follows the version: a prerelease (any hyphen —
|
||||||
# 10.4.0-rc.1) publishes under 'rc' and must NEVER move 'latest' —
|
# 10.4.0-rc.1) publishes under 'rc' and must NEVER move 'latest' —
|
||||||
|
|
@ -43,13 +43,13 @@ jobs:
|
||||||
case "$VERSION" in
|
case "$VERSION" in
|
||||||
*-*) NPM_TAG="rc" ;;
|
*-*) NPM_TAG="rc" ;;
|
||||||
esac
|
esac
|
||||||
echo "Publishing @soulcraft/brainy@${VERSION} to The Source registry (dist-tag: ${NPM_TAG})..."
|
echo "Publishing @soulcraftlabs/brainy@${VERSION} to The Source registry (dist-tag: ${NPM_TAG})..."
|
||||||
|
|
||||||
TMPRC="$(mktemp)"
|
TMPRC="$(mktemp)"
|
||||||
chmod 600 "$TMPRC"
|
chmod 600 "$TMPRC"
|
||||||
{
|
{
|
||||||
echo "@soulcraft:registry=${SOURCE_NPM_REG}"
|
echo "@soulcraftlabs:registry=${SOURCE_NPM_REG}"
|
||||||
echo "//source.soulcraft.com/api/packages/soulcraft/npm/:_authToken=${FORGE_NPM_TOKEN}"
|
echo "//source.soulcraft.com/api/packages/soulcraftlabs/npm/:_authToken=${FORGE_NPM_TOKEN}"
|
||||||
} > "$TMPRC"
|
} > "$TMPRC"
|
||||||
|
|
||||||
# The release script bumps package.json's version before it tags, so
|
# The release script bumps package.json's version before it tags, so
|
||||||
|
|
@ -64,7 +64,7 @@ jobs:
|
||||||
# exit code: a benign duplicate publish (a prior run, or a mirror, already
|
# exit code: a benign duplicate publish (a prior run, or a mirror, already
|
||||||
# landed this exact version) reports failure even though the registry
|
# landed this exact version) reports failure even though the registry
|
||||||
# already holds the right content.
|
# already holds the right content.
|
||||||
LANDED_VERSION="$(npm view "@soulcraft/brainy@${VERSION}" version --userconfig "$TMPRC" 2>/dev/null || echo "")"
|
LANDED_VERSION="$(npm view "@soulcraftlabs/brainy@${VERSION}" version --userconfig "$TMPRC" 2>/dev/null || echo "")"
|
||||||
rm -f "$TMPRC"
|
rm -f "$TMPRC"
|
||||||
|
|
||||||
if [ "$LANDED_VERSION" != "$VERSION" ]; then
|
if [ "$LANDED_VERSION" != "$VERSION" ]; then
|
||||||
|
|
@ -73,7 +73,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PUBLISH_OK" = true ]; then
|
if [ "$PUBLISH_OK" = true ]; then
|
||||||
echo "Published and verified @soulcraft/brainy@${VERSION} on The Source registry."
|
echo "Published and verified @soulcraftlabs/brainy@${VERSION} on The Source registry."
|
||||||
else
|
else
|
||||||
echo "::warning::npm publish reported failure, but readback confirms @soulcraft/brainy@${VERSION} is already live on The Source (a prior run or mirror landed it) — treating this run as successful, since the registry content is correct. Any OTHER failure mode would have failed the readback check above instead."
|
echo "::warning::npm publish reported failure, but readback confirms @soulcraftlabs/brainy@${VERSION} is already live on The Source (a prior run or mirror landed it) — treating this run as successful, since the registry content is correct. Any OTHER failure mode would have failed the readback check above instead."
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [10.4.3](https://source.soulcraft.com/soulcraft/brainy/compare/v10.4.2...v10.4.3) (2026-08-27)
|
||||||
|
|
||||||
|
- Merge branch 'next/open-brainy-rename' (a58372f0)
|
||||||
|
- chore: rename to @soulcraftlabs/brainy for Open Brainy on The Source (a99b1e83)
|
||||||
|
- docs(releases): 10.4.3 — Open Brainy's first release under the new name, same engine as 10.4.2; The Source is the one registry (9f248b24)
|
||||||
|
|
||||||
|
|
||||||
### [10.4.2](https://source.soulcraft.com/soulcraft/brainy/compare/v10.4.2-rc.1...v10.4.2) (2026-08-27)
|
### [10.4.2](https://source.soulcraft.com/soulcraft/brainy/compare/v10.4.2-rc.1...v10.4.2) (2026-08-27)
|
||||||
|
|
||||||
- docs(releases): 10.4.1 and 10.4.2 consumer notes; 10.4.2 is the last MIT release under this name, Open Brainy continues at @soulcraftlabs/brainy (a082e0ef)
|
- docs(releases): 10.4.1 and 10.4.2 consumer notes; 10.4.2 is the last MIT release under this name, Open Brainy continues at @soulcraftlabs/brainy (a082e0ef)
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,13 @@ Handoff file: `/home/dpsifr/.strategy/PLATFORM-HANDOFF.md`
|
||||||
|
|
||||||
**Brainy's current open actions:** None. MIT open-source — no platform-specific actions.
|
**Brainy's current open actions:** None. MIT open-source — no platform-specific actions.
|
||||||
|
|
||||||
**Current version:** run `npm view @soulcraft/brainy version` (never trust a hardcoded number here — this line went stale for months); consumer-facing changes tracked in `RELEASES.md`
|
**Current version:** run `npm view @soulcraftlabs/brainy version --registry https://source.soulcraft.com/api/packages/soulcraftlabs/npm/` (never trust a hardcoded number here — this line went stale for months); consumer-facing changes tracked in `RELEASES.md`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
Brainy is a Universal Knowledge Protocol -- a Triple Intelligence database that combines vector similarity search, graph traversal, and metadata filtering into a single TypeScript library. Published as `@soulcraft/brainy` on npm under the MIT license.
|
Brainy is a Universal Knowledge Protocol -- a Triple Intelligence database that combines vector similarity search, graph traversal, and metadata filtering into a single TypeScript library. Published as `@soulcraftlabs/brainy` on The Source (source.soulcraft.com registry) under the MIT license.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
|
|
||||||
16
README.md
16
README.md
|
|
@ -1,5 +1,5 @@
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://source.soulcraft.com/soulcraft/brainy/raw/branch/main/brainy.png" alt="Brainy" width="180">
|
<img src="https://source.soulcraft.com/soulcraftlabs/open-brainy/raw/branch/main/brainy.png" alt="Brainy" width="180">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h1 align="center">Brainy</h1>
|
<h1 align="center">Brainy</h1>
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.npmjs.com/package/@soulcraft/brainy"><img src="https://img.shields.io/npm/v/@soulcraft/brainy.svg" alt="npm version"></a>
|
<a href="https://source.soulcraft.com/soulcraftlabs/-/packages/npm/brainy"><img src="https://img.shields.io/badge/package-The%20Source-2c3e50.svg" alt="Package on The Source"></a>
|
||||||
<a href="https://www.npmjs.com/package/@soulcraft/brainy"><img src="https://img.shields.io/npm/dm/@soulcraft/brainy.svg" alt="npm downloads"></a>
|
<a href="https://source.soulcraft.com/soulcraftlabs/open-brainy"><img src="https://img.shields.io/badge/repo-open--brainy-2c3e50.svg" alt="Repository"></a>
|
||||||
<a href="https://source.soulcraft.com/soulcraft/brainy/actions"><img src="https://source.soulcraft.com/soulcraft/brainy/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
|
<a href="https://source.soulcraft.com/soulcraft/brainy/actions"><img src="https://source.soulcraft.com/soulcraft/brainy/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
|
||||||
<a href="https://soulcraft.com/docs"><img src="https://img.shields.io/badge/docs-soulcraft.com-blue.svg" alt="Documentation"></a>
|
<a href="https://soulcraft.com/docs"><img src="https://img.shields.io/badge/docs-soulcraft.com-blue.svg" alt="Documentation"></a>
|
||||||
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"></a>
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"></a>
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Open Brainy** is the MIT engine — the open API, client library, types, and protocol; an openly specified canonical on-disk format; and this TypeScript reference engine, scoped as a single-node engine for stores up to roughly one million rows. `@soulcraft/brainy` 10.4.2 was the last release under the old package name — the name passes to the native engine, **Brainy**, at 11.0.0: the same API over the same open format at production scale, and it requires a license.
|
||||||
|
|
||||||
Built because we were tired of stitching a vector store to a graph database to a document store — and spending weeks on plumbing before writing a line of business logic. Brainy indexes every fact **three ways at once** and lets one call query them together:
|
Built because we were tired of stitching a vector store to a graph database to a document store — and spending weeks on plumbing before writing a line of business logic. Brainy indexes every fact **three ways at once** and lets one call query them together:
|
||||||
|
|
||||||
| You write | Brainy indexes it as | You query it with |
|
| You write | Brainy indexes it as | You query it with |
|
||||||
|
|
@ -45,12 +47,14 @@ It runs **inside your process** — no server, no Docker, nothing to operate —
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bun add @soulcraft/brainy # Bun ≥ 1.1 — recommended
|
bun add @soulcraftlabs/brainy # Bun ≥ 1.1 — recommended
|
||||||
npm install @soulcraft/brainy # Node.js ≥ 22
|
npm install @soulcraftlabs/brainy # Node.js ≥ 22
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Registry**: add `@soulcraftlabs:registry=https://source.soulcraft.com/api/packages/soulcraftlabs/npm/` to your `.npmrc` (anonymous read).
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy() // in-memory; one line swaps to disk
|
const brain = new Brainy() // in-memory; one line swaps to disk
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
|
||||||
25
RELEASES.md
25
RELEASES.md
|
|
@ -31,7 +31,30 @@ is sometimes cited as a 7.x removal — those methods never existed on 7.x; the
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## v10.4.2 — 2026-08-28 (a zero-norm vector is not a vector)
|
## v10.4.3 — 2026-08-27 (Open Brainy's first release)
|
||||||
|
|
||||||
|
**`@soulcraftlabs/brainy` 10.4.3 is the same engine as `@soulcraft/brainy` 10.4.2, byte for
|
||||||
|
byte — only the name, the registry, and the pointers changed.** Install:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @soulcraftlabs/brainy
|
||||||
|
```
|
||||||
|
|
||||||
|
with the registry line in your `.npmrc` (anonymous read):
|
||||||
|
|
||||||
|
```
|
||||||
|
@soulcraftlabs:registry=https://source.soulcraft.com/api/packages/soulcraftlabs/npm/
|
||||||
|
```
|
||||||
|
|
||||||
|
- **The Source is the one registry.** Open Brainy publishes to source.soulcraft.com only; the
|
||||||
|
npmjs republish step is retired from the release rail. Existing npmjs versions of
|
||||||
|
`@soulcraft/brainy` stay as they are and receive no new versions.
|
||||||
|
- **The repository moved** to `soulcraftlabs/open-brainy` on The Source; the old path redirects.
|
||||||
|
- **No engine change.** Everything in the 10.4.2 notes applies unchanged; adoption is one
|
||||||
|
install-line change (`@soulcraft/brainy` → `@soulcraftlabs/brainy`), which downstream
|
||||||
|
applications make together with their native-engine bump.
|
||||||
|
|
||||||
|
## v10.4.2 — 2026-08-27 (a zero-norm vector is not a vector)
|
||||||
|
|
||||||
**This is the last release of the MIT engine under the `@soulcraft/brainy` name.**
|
**This is the last release of the MIT engine under the `@soulcraft/brainy` name.**
|
||||||
The MIT package continues as **Open Brainy** — `@soulcraftlabs/brainy`: the open API,
|
The MIT package continues as **Open Brainy** — `@soulcraftlabs/brainy`: the open API,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ commit to backporting fixes to unsupported lines.
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
This policy covers the `@soulcraft/brainy` package itself — the code in
|
This policy covers the `@soulcraftlabs/brainy` package itself — the code in
|
||||||
this repository. If you're evaluating a deployment that also uses
|
this repository. If you're evaluating a deployment that also uses
|
||||||
`@soulcraft/cor`, report issues in that package the same way, to the same
|
`@soulcraft/cor`, report issues in that package the same way, to the same
|
||||||
address; we'll route internally.
|
address; we'll route internally.
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/**
|
/**
|
||||||
* Modern TypeScript CLI Runner
|
* Modern TypeScript CLI Runner
|
||||||
*
|
*
|
||||||
* This is the entry point after npm install @soulcraft/brainy
|
* This is the entry point after npm install @soulcraftlabs/brainy
|
||||||
* It runs the compiled TypeScript CLI code
|
* It runs the compiled TypeScript CLI code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
2
bun.lock
2
bun.lock
|
|
@ -3,7 +3,7 @@
|
||||||
"configVersion": 0,
|
"configVersion": 0,
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraftlabs/brainy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.540.0",
|
"@aws-sdk/client-s3": "^3.540.0",
|
||||||
"@azure/identity": "^4.0.0",
|
"@azure/identity": "^4.0.0",
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy
|
npm install @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
### Your First Neural Database
|
### Your First Neural Database
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType } from '@soulcraft/brainy'
|
import { Brainy, NounType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Step 1: Create and initialize Brainy
|
// Step 1: Create and initialize Brainy
|
||||||
const brain = new Brainy({
|
const brain = new Brainy({
|
||||||
|
|
@ -143,7 +143,7 @@ Once you're comfortable with basic operations, move to **Level 2** to learn abou
|
||||||
### Building a Knowledge Graph
|
### Building a Knowledge Graph
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ storage: { type: 'memory' } })
|
const brain = new Brainy({ storage: { type: 'memory' } })
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -314,7 +314,7 @@ Ready for AI-powered search and clustering? Move to **Level 3**.
|
||||||
### Triple Intelligence in Action
|
### Triple Intelligence in Action
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ storage: { type: 'memory' } })
|
const brain = new Brainy({ storage: { type: 'memory' } })
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -529,7 +529,7 @@ Want to treat files as intelligent entities? Learn the **Virtual Filesystem** in
|
||||||
### Files as Intelligent Entities
|
### Files as Intelligent Entities
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ storage: { type: 'memory' } })
|
const brain = new Brainy({ storage: { type: 'memory' } })
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -832,7 +832,7 @@ Ready for production deployment? Level 5 covers **planet-scale architecture**.
|
||||||
### Production-Ready Deployment
|
### Production-Ready Deployment
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType } from '@soulcraft/brainy'
|
import { Brainy, NounType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// 1. PRODUCTION STORAGE - Filesystem with off-site snapshots
|
// 1. PRODUCTION STORAGE - Filesystem with off-site snapshots
|
||||||
console.log('Initializing production storage...\n')
|
console.log('Initializing production storage...\n')
|
||||||
|
|
|
||||||
|
|
@ -1217,7 +1217,7 @@ where: {
|
||||||
await brain.find({ type: 'Document' })
|
await brain.find({ type: 'Document' })
|
||||||
|
|
||||||
// ✅ Correct: Use NounType enum
|
// ✅ Correct: Use NounType enum
|
||||||
import { NounType } from '@soulcraft/brainy'
|
import { NounType } from '@soulcraftlabs/brainy'
|
||||||
await brain.find({ type: NounType.Document })
|
await brain.find({ type: NounType.Document })
|
||||||
|
|
||||||
// ❌ Error: Operator not recognized
|
// ❌ Error: Operator not recognized
|
||||||
|
|
|
||||||
|
|
@ -153,13 +153,13 @@ brainy-data/
|
||||||
### Step 1: Update Brainy Package
|
### Step 1: Update Brainy Package
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy@latest
|
npm install @soulcraftlabs/brainy@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
**Check your version:**
|
**Check your version:**
|
||||||
```bash
|
```bash
|
||||||
npm list @soulcraft/brainy
|
npm list @soulcraftlabs/brainy
|
||||||
# Should show: @soulcraft/brainy@4.0.0
|
# Should show: @soulcraftlabs/brainy@4.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: No Code Changes Required! ✅
|
### Step 2: No Code Changes Required! ✅
|
||||||
|
|
@ -374,7 +374,7 @@ If you encounter issues, you can rollback:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Reinstall v3
|
# Reinstall v3
|
||||||
npm install @soulcraft/brainy@^3.50.0
|
npm install @soulcraftlabs/brainy@^3.50.0
|
||||||
|
|
||||||
# Restart application
|
# Restart application
|
||||||
```
|
```
|
||||||
|
|
@ -389,7 +389,7 @@ rm -rf ./data
|
||||||
cp -r ./data-backup ./data
|
cp -r ./data-backup ./data
|
||||||
|
|
||||||
# Reinstall v3
|
# Reinstall v3
|
||||||
npm install @soulcraft/brainy@^3.50.0
|
npm install @soulcraftlabs/brainy@^3.50.0
|
||||||
```
|
```
|
||||||
|
|
||||||
## Common Migration Scenarios
|
## Common Migration Scenarios
|
||||||
|
|
@ -539,7 +539,7 @@ console.log('Storage type:', status.type)
|
||||||
|
|
||||||
**Migration Checklist:**
|
**Migration Checklist:**
|
||||||
- ✅ Backup data
|
- ✅ Backup data
|
||||||
- ✅ Update npm package (`npm install @soulcraft/brainy@latest`)
|
- ✅ Update npm package (`npm install @soulcraftlabs/brainy@latest`)
|
||||||
- ✅ Restart application (automatic migration)
|
- ✅ Restart application (automatic migration)
|
||||||
- ✅ Verify data integrity
|
- ✅ Verify data integrity
|
||||||
- ✅ Enable lifecycle policies
|
- ✅ Enable lifecycle policies
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ If no plugin provides a given key, brainy uses its built-in JavaScript implement
|
||||||
### 1. Implement the `BrainyPlugin` interface
|
### 1. Implement the `BrainyPlugin` interface
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import type { BrainyPlugin, BrainyPluginContext } from '@soulcraft/brainy/plugin'
|
import type { BrainyPlugin, BrainyPluginContext } from '@soulcraftlabs/brainy/plugin'
|
||||||
|
|
||||||
const myPlugin: BrainyPlugin = {
|
const myPlugin: BrainyPlugin = {
|
||||||
name: 'my-brainy-plugin', // Must be unique (typically your npm package name)
|
name: 'my-brainy-plugin', // Must be unique (typically your npm package name)
|
||||||
|
|
@ -90,7 +90,7 @@ await brain.init()
|
||||||
**Programmatic registration:** For plugins not installed as npm packages, use `brain.use()`:
|
**Programmatic registration:** For plugins not installed as npm packages, use `brain.use()`:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
import myPlugin from './my-plugin.js'
|
import myPlugin from './my-plugin.js'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
|
|
@ -272,10 +272,10 @@ When provided by an optional native acceleration plugin (such as `@soulcraft/cor
|
||||||
#### `cache`
|
#### `cache`
|
||||||
**Type:** `UnifiedCache`
|
**Type:** `UnifiedCache`
|
||||||
|
|
||||||
Replaces the global `UnifiedCache` singleton used for VFS path resolution, semantic caching, and vector index caching. Must implement the `UnifiedCache` interface (available from `@soulcraft/brainy/internals`).
|
Replaces the global `UnifiedCache` singleton used for VFS path resolution, semantic caching, and vector index caching. Must implement the `UnifiedCache` interface (available from `@soulcraftlabs/brainy/internals`).
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import type { UnifiedCache } from '@soulcraft/brainy/internals'
|
import type { UnifiedCache } from '@soulcraftlabs/brainy/internals'
|
||||||
|
|
||||||
context.registerProvider('cache', myNativeCache)
|
context.registerProvider('cache', myNativeCache)
|
||||||
```
|
```
|
||||||
|
|
@ -325,8 +325,8 @@ Plugins can register custom storage backends that users reference by name.
|
||||||
### Implementing a Storage Adapter
|
### Implementing a Storage Adapter
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import type { StorageAdapterFactory } from '@soulcraft/brainy/plugin'
|
import type { StorageAdapterFactory } from '@soulcraftlabs/brainy/plugin'
|
||||||
import type { StorageAdapter } from '@soulcraft/brainy'
|
import type { StorageAdapter } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
class MyStorageAdapter implements StorageAdapter {
|
class MyStorageAdapter implements StorageAdapter {
|
||||||
async init(): Promise<void> { /* ... */ }
|
async init(): Promise<void> { /* ... */ }
|
||||||
|
|
@ -360,9 +360,9 @@ Brainy provides three entry points for plugin developers:
|
||||||
|
|
||||||
| Import Path | Contents | Stability |
|
| Import Path | Contents | Stability |
|
||||||
|-------------|----------|-----------|
|
|-------------|----------|-----------|
|
||||||
| `@soulcraft/brainy` | Public API, types, StorageAdapter | Stable (semver) |
|
| `@soulcraftlabs/brainy` | Public API, types, StorageAdapter | Stable (semver) |
|
||||||
| `@soulcraft/brainy/plugin` | BrainyPlugin, BrainyPluginContext, StorageAdapterFactory | Stable (semver) |
|
| `@soulcraftlabs/brainy/plugin` | BrainyPlugin, BrainyPluginContext, StorageAdapterFactory | Stable (semver) |
|
||||||
| `@soulcraft/brainy/internals` | UnifiedCache, EntityIdMapper, logger utilities | Internal (may change between minor versions) |
|
| `@soulcraftlabs/brainy/internals` | UnifiedCache, EntityIdMapper, logger utilities | Internal (may change between minor versions) |
|
||||||
|
|
||||||
## Diagnostics
|
## Diagnostics
|
||||||
|
|
||||||
|
|
@ -440,7 +440,7 @@ A minimal but useful plugin that provides SIMD-accelerated distance calculations
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// simd-distance-plugin/src/plugin.ts
|
// simd-distance-plugin/src/plugin.ts
|
||||||
import type { BrainyPlugin, BrainyPluginContext } from '@soulcraft/brainy/plugin'
|
import type { BrainyPlugin, BrainyPluginContext } from '@soulcraftlabs/brainy/plugin'
|
||||||
|
|
||||||
// Hypothetical native module
|
// Hypothetical native module
|
||||||
import { simdCosineDistance } from './native.js'
|
import { simdCosineDistance } from './native.js'
|
||||||
|
|
@ -470,7 +470,7 @@ export default simdDistancePlugin
|
||||||
"main": "./dist/plugin.js",
|
"main": "./dist/plugin.js",
|
||||||
"types": "./dist/plugin.d.ts",
|
"types": "./dist/plugin.d.ts",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@soulcraft/brainy": ">=7.0.0"
|
"@soulcraftlabs/brainy": ">=7.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -478,7 +478,7 @@ export default simdDistancePlugin
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ plugins: ['brainy-simd-distance'] })
|
const brain = new Brainy({ plugins: ['brainy-simd-distance'] })
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ After 40 API calls:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// server.ts
|
// server.ts
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// SINGLETON INSTANCE
|
// SINGLETON INSTANCE
|
||||||
let brainInstance: Brainy | null = null
|
let brainInstance: Brainy | null = null
|
||||||
|
|
@ -174,7 +174,7 @@ process.on('SIGTERM', async () => {
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// server.ts - Clean Bun implementation
|
// server.ts - Clean Bun implementation
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brain: Brainy | null = null
|
let brain: Brainy | null = null
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ Examples:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Deprecate wrong version on npm
|
# 1. Deprecate wrong version on npm
|
||||||
npm deprecate @soulcraft/brainy@X.X.X "Incorrect version - use Y.Y.Y"
|
npm deprecate @soulcraftlabs/brainy@X.X.X "Incorrect version - use Y.Y.Y"
|
||||||
|
|
||||||
# 2. Fix version in package.json
|
# 2. Fix version in package.json
|
||||||
# 3. Republish correct version
|
# 3. Republish correct version
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
### In-Memory
|
### In-Memory
|
||||||
```typescript
|
```typescript
|
||||||
import Brainy from '@soulcraft/brainy'
|
import Brainy from '@soulcraftlabs/brainy'
|
||||||
const brain = new Brainy({ storage: { type: 'memory' } })
|
const brain = new Brainy({ storage: { type: 'memory' } })
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ The native vector provider (via the optional `@soulcraft/cor` package) extends t
|
||||||
|
|
||||||
Numbers below are **measured** by `tests/benchmarks/find-composition-scale.js` (a single
|
Numbers below are **measured** by `tests/benchmarks/find-composition-scale.js` (a single
|
||||||
Node 22 process, in-memory storage, 384-dim vectors, `balanced` recall). They are the
|
Node 22 process, in-memory storage, 384-dim vectors, `balanced` recall). They are the
|
||||||
open-core (pure-TypeScript) path — what you get from `@soulcraft/brainy` with no native
|
open-core (pure-TypeScript) path — what you get from `@soulcraftlabs/brainy` with no native
|
||||||
provider installed. Run it yourself: `node --max-old-space-size=8192 tests/benchmarks/find-composition-scale.js 100000`.
|
provider installed. Run it yourself: `node --max-old-space-size=8192 tests/benchmarks/find-composition-scale.js 100000`.
|
||||||
|
|
||||||
`find()` query latency, p50 / p95 (200 queries each):
|
`find()` query latency, p50 / p95 (200 queries each):
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ next:
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy() // Zero config!
|
const brain = new Brainy() // Zero config!
|
||||||
await brain.init() // VFS auto-initialized!
|
await brain.init() // VFS auto-initialized!
|
||||||
|
|
@ -1010,7 +1010,7 @@ await db.release() // unpin + free cached materialization
|
||||||
|
|
||||||
### Db API errors
|
### Db API errors
|
||||||
|
|
||||||
All exported from `@soulcraft/brainy`:
|
All exported from `@soulcraftlabs/brainy`:
|
||||||
|
|
||||||
| Error | Thrown by | Meaning |
|
| Error | Thrown by | Meaning |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|
|
@ -1918,11 +1918,11 @@ isn't serving throws instead of rebuilding mid-query:
|
||||||
| `MetadataIndexNotReadyError` | `find({ where })` | Metadata/field index isn't serving |
|
| `MetadataIndexNotReadyError` | `find({ where })` | Metadata/field index isn't serving |
|
||||||
| `VectorIndexNotReadyError` | `find({ query })`, `similar()` | Vector index isn't serving |
|
| `VectorIndexNotReadyError` | `find({ query })`, `similar()` | Vector index isn't serving |
|
||||||
|
|
||||||
All three are exported from `@soulcraft/brainy`. Catch them to distinguish
|
All three are exported from `@soulcraftlabs/brainy`. Catch them to distinguish
|
||||||
"index not ready" from a genuine empty result:
|
"index not ready" from a genuine empty result:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { MetadataIndexNotReadyError } from '@soulcraft/brainy'
|
import { MetadataIndexNotReadyError } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const rows = await brain.find({ where: { status: 'active' } })
|
const rows = await brain.find({ where: { status: 'active' } })
|
||||||
|
|
@ -2208,7 +2208,7 @@ For the full taxonomy with all 169 types and their descriptions, see:
|
||||||
- **📖 Documentation:** [Full Documentation](../)
|
- **📖 Documentation:** [Full Documentation](../)
|
||||||
- **🐛 Issues:** [GitHub Issues](https://github.com/soulcraftlabs/brainy/issues)
|
- **🐛 Issues:** [GitHub Issues](https://github.com/soulcraftlabs/brainy/issues)
|
||||||
- **💬 Discussions:** [GitHub Discussions](https://github.com/soulcraftlabs/brainy/discussions)
|
- **💬 Discussions:** [GitHub Discussions](https://github.com/soulcraftlabs/brainy/discussions)
|
||||||
- **📦 NPM:** [@soulcraft/brainy](https://www.npmjs.com/package/@soulcraft/brainy)
|
- **📦 NPM:** [@soulcraftlabs/brainy](https://www.npmjs.com/package/@soulcraftlabs/brainy)
|
||||||
- **⭐ GitHub:** [Star us](https://github.com/soulcraftlabs/brainy)
|
- **⭐ GitHub:** [Star us](https://github.com/soulcraftlabs/brainy)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ locks/_flush_responses/ # writer answers with <uuid>.ack
|
||||||
| **Counts/statistics** | Per-type and per-subtype maps | `_system/{type,subtype,verb-subtype}-statistics.json.gz`, `counts.json` | Recomputable by scanning entities (`brainy inspect repair`) |
|
| **Counts/statistics** | Per-type and per-subtype maps | `_system/{type,subtype,verb-subtype}-statistics.json.gz`, `counts.json` | Recomputable by scanning entities (`brainy inspect repair`) |
|
||||||
|
|
||||||
A pluggable index provider (the 8.0 plugin contract in
|
A pluggable index provider (the 8.0 plugin contract in
|
||||||
`@soulcraft/brainy/plugin`) may replace any of the JS implementations; the
|
`@soulcraftlabs/brainy/plugin`) may replace any of the JS implementations; the
|
||||||
persisted formats above are contract-bound so JS and native implementations
|
persisted formats above are contract-bound so JS and native implementations
|
||||||
can interleave on the same directory.
|
can interleave on the same directory.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ class TypeAwareMetadataIndex {
|
||||||
**The Design**: Specify types clearly in your API calls:
|
**The Design**: Specify types clearly in your API calls:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Add entity with explicit type
|
// Add entity with explicit type
|
||||||
await brain.add({
|
await brain.add({
|
||||||
|
|
@ -231,7 +231,7 @@ class OrgEnrichmentAugmentation {
|
||||||
**Brainy's Approach**: Extract **typed** concepts:
|
**Brainy's Approach**: Extract **typed** concepts:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { NaturalLanguageProcessor } from '@soulcraft/brainy'
|
import { NaturalLanguageProcessor } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const nlp = new NaturalLanguageProcessor()
|
const nlp = new NaturalLanguageProcessor()
|
||||||
const concepts = await nlp.extractConcepts("Alice works at Google in San Francisco")
|
const concepts = await nlp.extractConcepts("Alice works at Google in San Francisco")
|
||||||
|
|
@ -382,7 +382,7 @@ import {
|
||||||
getVerbTypes,
|
getVerbTypes,
|
||||||
BrainyTypes,
|
BrainyTypes,
|
||||||
suggestType
|
suggestType
|
||||||
} from '@soulcraft/brainy'
|
} from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Get all available noun types
|
// Get all available noun types
|
||||||
const nounTypes = getNounTypes()
|
const nounTypes = getNounTypes()
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ For reference, a clean migration path:
|
||||||
`isMultiProcessSafe` type-guard. Keep `hasStorageMethod` for
|
`isMultiProcessSafe` type-guard. Keep `hasStorageMethod` for
|
||||||
build/install artifact protection.
|
build/install artifact protection.
|
||||||
5. Document the new contract in `concepts/storage-adapters.md`.
|
5. Document the new contract in `concepts/storage-adapters.md`.
|
||||||
6. Major-version-bump the `@soulcraft/brainy` peerDep range expected by
|
6. Major-version-bump the `@soulcraftlabs/brainy` peerDep range expected by
|
||||||
plugins.
|
plugins.
|
||||||
|
|
||||||
Estimated work: ~half a day of code, ~2 hours of doc/example updates,
|
Estimated work: ~half a day of code, ~2 hours of doc/example updates,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ next:
|
||||||
Every example on this page is written against the real Brainy 8.0 API. The setup is always the same:
|
Every example on this page is written against the real Brainy 8.0 API. The setup is always the same:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -40,7 +40,7 @@ Brainy's **Noun-Verb Taxonomy** achieves broad coverage of human knowledge throu
|
||||||
- **Multi-hop Graph Traversals = Relationship Complexity**
|
- **Multi-hop Graph Traversals = Relationship Complexity**
|
||||||
- **Result: Model data across virtually any industry**
|
- **Result: Model data across virtually any industry**
|
||||||
|
|
||||||
Every piece of information can be represented as entities (nouns) connected by relationships (verbs) carrying properties (metadata). The standardized type system from `@soulcraft/brainy` (`NounType`, `VerbType`) gives those nouns and verbs a stable, shared name.
|
Every piece of information can be represented as entities (nouns) connected by relationships (verbs) carrying properties (metadata). The standardized type system from `@soulcraftlabs/brainy` (`NounType`, `VerbType`) gives those nouns and verbs a stable, shared name.
|
||||||
|
|
||||||
## The Power of Standardization: Universal Interoperability
|
## The Power of Standardization: Universal Interoperability
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ constructor and `init()`.
|
||||||
## Instant Start
|
## Instant Start
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// That's it. No config needed.
|
// That's it. No config needed.
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ await brain.find({ orderBy: 'createdAt' })
|
||||||
`UnresolvableFieldError` is exported from the package root:
|
`UnresolvableFieldError` is exported from the package root:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { UnresolvableFieldError } from '@soulcraft/brainy'
|
import { UnresolvableFieldError } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await brain.find({ orderBy: 'createdAt' })
|
await brain.find({ orderBy: 'createdAt' })
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ catchable error naming the reason:
|
||||||
| `MetadataIndexNotReadyError` | `find({ where })` | The metadata/field index isn't serving — a filtered read would otherwise return `[]` indistinguishable from "no matches" |
|
| `MetadataIndexNotReadyError` | `find({ where })` | The metadata/field index isn't serving — a filtered read would otherwise return `[]` indistinguishable from "no matches" |
|
||||||
| `VectorIndexNotReadyError` | `find({ query })`, `similar()` | The vector index isn't serving — a semantic search would otherwise return `[]` indistinguishable from "nothing similar" |
|
| `VectorIndexNotReadyError` | `find({ query })`, `similar()` | The vector index isn't serving — a semantic search would otherwise return `[]` indistinguishable from "nothing similar" |
|
||||||
|
|
||||||
All three are exported from `@soulcraft/brainy`. Catch them where your application
|
All three are exported from `@soulcraftlabs/brainy`. Catch them where your application
|
||||||
needs to distinguish "this index isn't ready yet" from "there's genuinely nothing
|
needs to distinguish "this index isn't ready yet" from "there's genuinely nothing
|
||||||
here" — a health dashboard, a retry policy, an operator alert. The fix is always
|
here" — a health dashboard, a retry policy, an operator alert. The fix is always
|
||||||
the same: reconcile the index, either by reopening the brain (which brings every
|
the same: reconcile the index, either by reopening the brain (which brings every
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ The only required override is the capability flag. Returning `true` from
|
||||||
to call `acquireWriterLock()` at init.
|
to call `acquireWriterLock()` at init.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { FileSystemStorage } from '@soulcraft/brainy'
|
import { FileSystemStorage } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
export class MmapFileSystemStorage extends FileSystemStorage {
|
export class MmapFileSystemStorage extends FileSystemStorage {
|
||||||
public supportsMultiProcessLocking(): boolean {
|
public supportsMultiProcessLocking(): boolean {
|
||||||
|
|
@ -79,7 +79,7 @@ If your storage is **not filesystem-backed** (a custom
|
||||||
network backend), extend `BaseStorage` directly:
|
network backend), extend `BaseStorage` directly:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { BaseStorage } from '@soulcraft/brainy'
|
import { BaseStorage } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
export class MyCloudStorage extends BaseStorage {
|
export class MyCloudStorage extends BaseStorage {
|
||||||
// BaseStorage's default no-op implementations of the multi-process
|
// BaseStorage's default no-op implementations of the multi-process
|
||||||
|
|
@ -101,7 +101,7 @@ The defensive check at every new-storage-method call site (`brainy.ts`,
|
||||||
`hasStorageMethod(name)`) does **not** exist to handle "plugin bundles a
|
`hasStorageMethod(name)`) does **not** exist to handle "plugin bundles a
|
||||||
stale BaseStorage." Plugins ship a dist that preserves the dynamic ESM
|
stale BaseStorage." Plugins ship a dist that preserves the dynamic ESM
|
||||||
import (verify in your plugin's `dist/`: `import { FileSystemStorage } from
|
import (verify in your plugin's `dist/`: `import { FileSystemStorage } from
|
||||||
'@soulcraft/brainy'` is not rewritten to a vendored copy). The prototype
|
'@soulcraftlabs/brainy'` is not rewritten to a vendored copy). The prototype
|
||||||
chain at runtime resolves to whatever Brainy version your consumer has
|
chain at runtime resolves to whatever Brainy version your consumer has
|
||||||
installed.
|
installed.
|
||||||
|
|
||||||
|
|
@ -109,8 +109,8 @@ installed.
|
||||||
the prototype chain at the consumer-app level:
|
the prototype chain at the consumer-app level:
|
||||||
|
|
||||||
- **Stale `node_modules`** — a lingering install from before the consumer
|
- **Stale `node_modules`** — a lingering install from before the consumer
|
||||||
upgraded Brainy. The package.json says `@soulcraft/brainy@7.22.0` but
|
upgraded Brainy. The package.json says `@soulcraftlabs/brainy@7.22.0` but
|
||||||
`node_modules/@soulcraft/brainy` is still 7.20.x.
|
`node_modules/@soulcraftlabs/brainy` is still 7.20.x.
|
||||||
- **Lockfile drift** — `bun.lockb` / `package-lock.json` pins a brainy
|
- **Lockfile drift** — `bun.lockb` / `package-lock.json` pins a brainy
|
||||||
version older than the package.json range, and `bun install` honors the
|
version older than the package.json range, and `bun install` honors the
|
||||||
lockfile.
|
lockfile.
|
||||||
|
|
@ -131,7 +131,7 @@ and the warning names the adapter class plus a remediation hint:
|
||||||
methods on its prototype chain. Writer locking and the flush-request RPC are
|
methods on its prototype chain. Writer locking and the flush-request RPC are
|
||||||
disabled for this directory. Likely fix: clean install (`rm -rf node_modules
|
disabled for this directory. Likely fix: clean install (`rm -rf node_modules
|
||||||
bun.lockb && bun install`) or rebuild your container image to refresh
|
bun.lockb && bun install`) or rebuild your container image to refresh
|
||||||
`@soulcraft/brainy` to ≥7.21. See docs/concepts/storage-adapters.md.
|
`@soulcraftlabs/brainy` to ≥7.21. See docs/concepts/storage-adapters.md.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Authoring a new storage adapter — minimum checklist
|
## Authoring a new storage adapter — minimum checklist
|
||||||
|
|
@ -168,7 +168,7 @@ bun.lockb && bun install`) or rebuild your container image to refresh
|
||||||
install time — fix install, not your plugin.
|
install time — fix install, not your plugin.
|
||||||
|
|
||||||
6. **Pin your peer dep generously.** `"peerDependencies": {
|
6. **Pin your peer dep generously.** `"peerDependencies": {
|
||||||
"@soulcraft/brainy": "^7.21.0" }` accepts any compatible 7.x. Don't pin
|
"@soulcraftlabs/brainy": "^7.21.0" }` accepts any compatible 7.x. Don't pin
|
||||||
to an exact patch unless you're tracking a known regression.
|
to an exact patch unless you're tracking a known regression.
|
||||||
|
|
||||||
## Future direction
|
## Future direction
|
||||||
|
|
@ -185,5 +185,5 @@ follow-up; consumers don't need to anticipate the change.
|
||||||
heartbeat semantics, what the lock protects.
|
heartbeat semantics, what the lock protects.
|
||||||
- [`guides/inspection`](../guides/inspection.md) — `brainy inspect` and the
|
- [`guides/inspection`](../guides/inspection.md) — `brainy inspect` and the
|
||||||
read-only mode.
|
read-only mode.
|
||||||
- `node_modules/@soulcraft/brainy/dist/storage/baseStorage.d.ts` — the
|
- `node_modules/@soulcraftlabs/brainy/dist/storage/baseStorage.d.ts` — the
|
||||||
authoritative type signatures for every method this page references.
|
authoritative type signatures for every method this page references.
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ they share a single scan.
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType } from '@soulcraft/brainy'
|
import { Brainy, NounType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ Brainy is **framework-friendly** - designed to drop into the server side of any
|
||||||
|
|
||||||
Brainy embeds an HNSW vector index, a graph engine, and a filesystem-backed persistence layer. These belong on the server:
|
Brainy embeds an HNSW vector index, a graph engine, and a filesystem-backed persistence layer. These belong on the server:
|
||||||
|
|
||||||
- **Zero configuration**: Just `import { Brainy } from '@soulcraft/brainy'`
|
- **Zero configuration**: Just `import { Brainy } from '@soulcraftlabs/brainy'`
|
||||||
- **Auto storage detection**: `new Brainy()` auto-selects filesystem persistence on Node
|
- **Auto storage detection**: `new Brainy()` auto-selects filesystem persistence on Node
|
||||||
- **Cleaner code**: No browser polyfills, no conditional client/server imports
|
- **Cleaner code**: No browser polyfills, no conditional client/server imports
|
||||||
- **Better DX**: One instance shared across your server routes
|
- **Better DX**: One instance shared across your server routes
|
||||||
|
|
@ -18,13 +18,13 @@ Brainy embeds an HNSW vector index, a graph engine, and a filesystem-backed pers
|
||||||
### Install Brainy
|
### Install Brainy
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy
|
npm install @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
### Basic Integration
|
### Basic Integration
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Run on the server (API route, server component, backend service)
|
// Run on the server (API route, server component, backend service)
|
||||||
// new Brainy() auto-detects filesystem persistence on Node
|
// new Brainy() auto-detects filesystem persistence on Node
|
||||||
|
|
@ -105,7 +105,7 @@ On the server, create one Brainy instance and reuse it across requests. This mod
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// lib/brain.server.js
|
// lib/brain.server.js
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brainPromise
|
let brainPromise
|
||||||
|
|
||||||
|
|
@ -163,7 +163,7 @@ On the server, create one Brainy instance and reuse it across requests:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// server/brain.js (server-only module)
|
// server/brain.js (server-only module)
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brainPromise
|
let brainPromise
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ The matching backend endpoint uses Brainy directly (Node/Bun):
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// server: api/search
|
// server: api/search
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy() // auto-detects filesystem persistence on Node
|
const brain = new Brainy() // auto-detects filesystem persistence on Node
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -266,7 +266,7 @@ In Next.js, Brainy lives in server code only: API routes, server components, or
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// lib/brain.server.js (imported only by server code)
|
// lib/brain.server.js (imported only by server code)
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brainPromise
|
let brainPromise
|
||||||
|
|
||||||
|
|
@ -318,7 +318,7 @@ Brainy runs in a server-only module (`*.server.js`); the component fetches resul
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// src/lib/server/brain.js (server-only — note the .server suffix)
|
// src/lib/server/brain.js (server-only — note the .server suffix)
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brainPromise
|
let brainPromise
|
||||||
|
|
||||||
|
|
@ -432,7 +432,7 @@ import { defineConfig } from 'vite'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
ssr: {
|
ssr: {
|
||||||
external: ['@soulcraft/brainy']
|
external: ['@soulcraftlabs/brainy']
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
@ -440,7 +440,7 @@ export default defineConfig({
|
||||||
```javascript
|
```javascript
|
||||||
// rollup.config.js (server bundle)
|
// rollup.config.js (server bundle)
|
||||||
export default {
|
export default {
|
||||||
external: ['@soulcraft/brainy', 'node:fs', 'node:path', 'node:crypto']
|
external: ['@soulcraftlabs/brainy', 'node:fs', 'node:path', 'node:crypto']
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -466,7 +466,7 @@ export async function load({ url }) {
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// For build-time usage (runs in Node during the build)
|
// For build-time usage (runs in Node during the build)
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
export async function generateStaticProps() {
|
export async function generateStaticProps() {
|
||||||
const brain = new Brainy({
|
const brain = new Brainy({
|
||||||
|
|
@ -513,7 +513,7 @@ export async function generateStaticProps() {
|
||||||
|
|
||||||
### Issue: Large client bundle size
|
### Issue: Large client bundle size
|
||||||
**Cause**: A client module is pulling in Brainy.
|
**Cause**: A client module is pulling in Brainy.
|
||||||
**Solution**: Move the `import { Brainy } from '@soulcraft/brainy'` into a server-only module so it never reaches the browser bundle.
|
**Solution**: Move the `import { Brainy } from '@soulcraftlabs/brainy'` into a server-only module so it never reaches the browser bundle.
|
||||||
|
|
||||||
### Issue: SSR hydration mismatch
|
### Issue: SSR hydration mismatch
|
||||||
**Solution**: Run the search on the server (loader / server action / API route) and pass the results down as props, so server and client render the same markup.
|
**Solution**: Run the search on the server (loader / server action / API route) and pass the results down as props, so server and client render the same markup.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Brainy's import is **ONE magical method** that understands EVERYTHING:
|
||||||
## The Ultimate Simplicity
|
## The Ultimate Simplicity
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ Brainy provides real-time progress tracking for **all 7 supported file formats**
|
||||||
### Basic Progress Tracking
|
### Basic Progress Tracking
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
|
||||||
const brain = await Brainy.create()
|
const brain = await Brainy.create()
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
## Basic Import
|
## Basic Import
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -187,7 +187,7 @@ await brain.import(file, {
|
||||||
## Complete Example
|
## Complete Example
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
|
||||||
async function importCatalog() {
|
async function importCatalog() {
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ check fails — useful for piping into monitoring or CI.
|
||||||
## Programmatic inspection
|
## Programmatic inspection
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const reader = await Brainy.openReadOnly({
|
const reader = await Brainy.openReadOnly({
|
||||||
storage: { type: 'filesystem', path: '/data/brain' }
|
storage: { type: 'filesystem', path: '/data/brain' }
|
||||||
|
|
|
||||||
|
|
@ -21,21 +21,21 @@ next:
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy
|
npm install @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
Or with your preferred package manager:
|
Or with your preferred package manager:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bun add @soulcraft/brainy
|
bun add @soulcraftlabs/brainy
|
||||||
yarn add @soulcraft/brainy
|
yarn add @soulcraftlabs/brainy
|
||||||
pnpm add @soulcraft/brainy
|
pnpm add @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
## Verify
|
## Verify
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -52,7 +52,7 @@ npm install @soulcraft/cor
|
||||||
```
|
```
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ plugins: ['@soulcraft/cor'] })
|
const brain = new Brainy({ plugins: ['@soulcraft/cor'] })
|
||||||
await brain.init() // native providers registered during init
|
await brain.init() // native providers registered during init
|
||||||
|
|
@ -71,7 +71,7 @@ remains available on npm if you need it.
|
||||||
Brainy ships with full TypeScript types. No `@types/` package needed:
|
Brainy ships with full TypeScript types. No `@types/` package needed:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ const results = await brain.search("query")
|
||||||
**New diagnostics for capacity planning and performance tuning.**
|
**New diagnostics for capacity planning and performance tuning.**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -112,7 +112,7 @@ Recommendations: ${stats.recommendations.join(', ')}
|
||||||
### Step 1: Update Package
|
### Step 1: Update Package
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy@latest
|
npm install @soulcraftlabs/brainy@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: Restart Your Application
|
### Step 2: Restart Your Application
|
||||||
|
|
@ -134,7 +134,7 @@ npm run start
|
||||||
### Check Adaptive Sizing is Working
|
### Check Adaptive Sizing is Working
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -218,7 +218,7 @@ For debugging or compatibility testing:
|
||||||
If you need to rollback to v3.35.0:
|
If you need to rollback to v3.35.0:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy@3.35.0
|
npm install @soulcraftlabs/brainy@3.35.0
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** We don't anticipate any issues, but rollback is straightforward if needed.
|
**Note:** We don't anticipate any issues, but rollback is straightforward if needed.
|
||||||
|
|
@ -367,7 +367,7 @@ if (stats.fairness.fairnessViolation) {
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
1. ✅ **Upgrade:** `npm install @soulcraft/brainy@latest`
|
1. ✅ **Upgrade:** `npm install @soulcraftlabs/brainy@latest`
|
||||||
2. 📊 **Monitor:** Use `getCacheStats()` to verify performance improvements
|
2. 📊 **Monitor:** Use `getCacheStats()` to verify performance improvements
|
||||||
3. 🎯 **Tune:** Adjust based on recommendations (if needed)
|
3. 🎯 **Tune:** Adjust based on recommendations (if needed)
|
||||||
4. 📖 **Read:** [Operations Guide](../operations/capacity-planning.md) for capacity planning
|
4. 📖 **Read:** [Operations Guide](../operations/capacity-planning.md) for capacity planning
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ This single WASM file contains everything needed for sentence embeddings.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Bun as a runtime — supported and recommended
|
# Bun as a runtime — supported and recommended
|
||||||
bun add @soulcraft/brainy
|
bun add @soulcraftlabs/brainy
|
||||||
bun run server.ts
|
bun run server.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ If you read raw stored records (fact-log scanners, export tooling), use
|
||||||
the exported shape-aware splitters — they handle both record eras:
|
the exported shape-aware splitters — they handle both record eras:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { splitNounMetadataRecord } from '@soulcraft/brainy'
|
import { splitNounMetadataRecord } from '@soulcraftlabs/brainy'
|
||||||
const { reserved, custom } = splitNounMetadataRecord(rawRecord)
|
const { reserved, custom } = splitNounMetadataRecord(rawRecord)
|
||||||
// reserved = engine fields · custom = the user's bag, ANY names
|
// reserved = engine fields · custom = the user's bag, ANY names
|
||||||
```
|
```
|
||||||
|
|
@ -88,7 +88,7 @@ const { reserved, custom } = splitNounMetadataRecord(rawRecord)
|
||||||
Feature detection (never version-sniff):
|
Feature detection (never version-sniff):
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import * as brainy from '@soulcraft/brainy'
|
import * as brainy from '@soulcraftlabs/brainy'
|
||||||
const lawActive = 'FIELD_ADDRESSING_CAPABILITY' in brainy // 'field-addressing/v1'
|
const lawActive = 'FIELD_ADDRESSING_CAPABILITY' in brainy // 'field-addressing/v1'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Complete guide to integrating Brainy with Next.js applications, covering App Rou
|
||||||
```bash
|
```bash
|
||||||
npx create-next-app@latest my-brainy-app
|
npx create-next-app@latest my-brainy-app
|
||||||
cd my-brainy-app
|
cd my-brainy-app
|
||||||
npm install @soulcraft/brainy
|
npm install @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
### Basic Setup
|
### Basic Setup
|
||||||
|
|
@ -18,7 +18,7 @@ npm install @soulcraft/brainy
|
||||||
// app/components/BrainyProvider.jsx
|
// app/components/BrainyProvider.jsx
|
||||||
'use client'
|
'use client'
|
||||||
import { createContext, useContext, useEffect, useState } from 'react'
|
import { createContext, useContext, useEffect, useState } from 'react'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const BrainyContext = createContext()
|
const BrainyContext = createContext()
|
||||||
|
|
||||||
|
|
@ -271,7 +271,7 @@ export default function SearchPage() {
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// app/api/search/route.js (App Router)
|
// app/api/search/route.js (App Router)
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brain = null
|
let brain = null
|
||||||
|
|
||||||
|
|
@ -332,7 +332,7 @@ export async function GET() {
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// pages/api/search.js (Pages Router)
|
// pages/api/search.js (Pages Router)
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brain = null
|
let brain = null
|
||||||
|
|
||||||
|
|
@ -374,7 +374,7 @@ export default async function handler(req, res) {
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// app/api/data/route.js
|
// app/api/data/route.js
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brain = null
|
let brain = null
|
||||||
|
|
||||||
|
|
@ -418,7 +418,7 @@ export async function POST(request) {
|
||||||
```jsx
|
```jsx
|
||||||
// app/actions/brainy.js
|
// app/actions/brainy.js
|
||||||
'use server'
|
'use server'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brain = null
|
let brain = null
|
||||||
|
|
||||||
|
|
@ -630,7 +630,7 @@ CMD ["npm", "start"]
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
experimental: {
|
experimental: {
|
||||||
serverComponentsExternalPackages: ['@soulcraft/brainy']
|
serverComponentsExternalPackages: ['@soulcraftlabs/brainy']
|
||||||
},
|
},
|
||||||
webpack: (config, { isServer }) => {
|
webpack: (config, { isServer }) => {
|
||||||
if (!isServer) {
|
if (!isServer) {
|
||||||
|
|
@ -797,7 +797,7 @@ export function rateLimit(req, limit = 100, window = 60000) {
|
||||||
// app/contexts/BrainyContext.jsx
|
// app/contexts/BrainyContext.jsx
|
||||||
'use client'
|
'use client'
|
||||||
import { createContext, useContext, useReducer, useEffect } from 'react'
|
import { createContext, useContext, useReducer, useEffect } from 'react'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const BrainyContext = createContext()
|
const BrainyContext = createContext()
|
||||||
|
|
||||||
|
|
@ -873,7 +873,7 @@ import { BrainyProvider } from '../app/components/BrainyProvider'
|
||||||
import { Search } from '../app/components/Search'
|
import { Search } from '../app/components/Search'
|
||||||
|
|
||||||
// Mock Brainy
|
// Mock Brainy
|
||||||
jest.mock('@soulcraft/brainy', () => ({
|
jest.mock('@soulcraftlabs/brainy', () => ({
|
||||||
Brainy: jest.fn().mockImplementation(() => ({
|
Brainy: jest.fn().mockImplementation(() => ({
|
||||||
init: jest.fn().mockResolvedValue(undefined),
|
init: jest.fn().mockResolvedValue(undefined),
|
||||||
find: jest.fn().mockResolvedValue([
|
find: jest.fn().mockResolvedValue([
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ Brainy 7.31.0 adds a per-entity revision counter so multiple writers can coordin
|
||||||
Every distributed-job scheduler eventually wants this exact loop:
|
Every distributed-job scheduler eventually wants this exact loop:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { Brainy, RevisionConflictError } from '@soulcraft/brainy'
|
import { Brainy, RevisionConflictError } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const LOCK_ID = '...uuid for this job slot...'
|
const LOCK_ID = '...uuid for this job slot...'
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ await brain.addIfMissing({ // ← not a real API
|
||||||
It's race-prone as a plain read-then-write: two concurrent imports both see "not found," both insert, you get duplicates. Without a unique-index primitive (which Brainy doesn't have today), close the race with whole-store CAS — read at a pinned generation, then commit only if nothing moved:
|
It's race-prone as a plain read-then-write: two concurrent imports both see "not found," both insert, you get duplicates. Without a unique-index primitive (which Brainy doesn't have today), close the race with whole-store CAS — read at a pinned generation, then commit only if nothing moved:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { GenerationConflictError } from '@soulcraft/brainy'
|
import { GenerationConflictError } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
async function addIfMissingByEmail(email: string, data: string) {
|
async function addIfMissingByEmail(email: string, data: string) {
|
||||||
for (let attempt = 0; attempt < 5; attempt++) {
|
for (let attempt = 0; attempt < 5; attempt++) {
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@ Get Brainy running in under a minute.
|
||||||
## 1. Install
|
## 1. Install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy
|
npm install @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. Initialize
|
## 2. Initialize
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
import { Brainy, NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -67,7 +67,7 @@ await brain.relate({
|
||||||
## 5. Query with Triple Intelligence
|
## 5. Query with Triple Intelligence
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import type { Result } from '@soulcraft/brainy'
|
import type { Result } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// All three search paradigms in one call
|
// All three search paradigms in one call
|
||||||
const results: Result[] = await brain.find({
|
const results: Result[] = await brain.find({
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
### One Interface for Everything
|
### One Interface for Everything
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = await Brainy.create()
|
const brain = await Brainy.create()
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ interface ImportProgress {
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
function UniversalImportProgress({ file }: { file: File }) {
|
function UniversalImportProgress({ file }: { file: File }) {
|
||||||
const [progress, setProgress] = useState({
|
const [progress, setProgress] = useState({
|
||||||
|
|
@ -177,7 +177,7 @@ function UniversalImportProgress({ file }: { file: File }) {
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import ora from 'ora'
|
import ora from 'ora'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
async function importWithProgress(filePath: string) {
|
async function importWithProgress(filePath: string) {
|
||||||
const spinner = ora('Starting import...').start()
|
const spinner = ora('Starting import...').start()
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ on-disk layout (memory's "disk" is a JS Map).
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Filesystem (recommended for any persistent workload):
|
// Filesystem (recommended for any persistent workload):
|
||||||
const brain = new Brainy({
|
const brain = new Brainy({
|
||||||
|
|
@ -134,7 +134,7 @@ config; the `type` is optional.
|
||||||
If you want to skip the factory:
|
If you want to skip the factory:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { FileSystemStorage, MemoryStorage } from '@soulcraft/brainy'
|
import { FileSystemStorage, MemoryStorage } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const fsStorage = new FileSystemStorage('./brainy-data')
|
const fsStorage = new FileSystemStorage('./brainy-data')
|
||||||
const memStorage = new MemoryStorage()
|
const memStorage = new MemoryStorage()
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Three layers solve this:
|
||||||
### Write
|
### Write
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType } from '@soulcraft/brainy'
|
import { Brainy, NounType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -240,7 +240,7 @@ await brain.migrateField({
|
||||||
A realistic adoption sequence for a brain that started without these primitives:
|
A realistic adoption sequence for a brain that started without these primitives:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType } from '@soulcraft/brainy'
|
import { Brainy, NounType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ storage: { type: 'filesystem', path: './brain-data' } })
|
const brain = new Brainy({ storage: { type: 'filesystem', path: './brain-data' } })
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ content — and how 8.0 recovers it for you.
|
||||||
|
|
||||||
## TL;DR
|
## TL;DR
|
||||||
|
|
||||||
- **Just upgrade to `@soulcraft/brainy@8.0.12` (or later) and open the store.**
|
- **Just upgrade to `@soulcraftlabs/brainy@8.0.12` (or later) and open the store.**
|
||||||
If a previous upgrade left VFS content stranded, 8.0.12 **heals it on open**,
|
If a previous upgrade left VFS content stranded, 8.0.12 **heals it on open**,
|
||||||
with no operator action.
|
with no operator action.
|
||||||
- Want to force or script it? Call **`await brain.vfs.adoptOrphanedBlobs()`**.
|
- Want to force or script it? Call **`await brain.vfs.adoptOrphanedBlobs()`**.
|
||||||
|
|
@ -90,7 +90,7 @@ So the operator action for a stranded store is simply: **upgrade to 8.0.12 and
|
||||||
open it.**
|
open it.**
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Opening the store is all that is required — recovery runs during init().
|
// Opening the store is all that is required — recovery runs during init().
|
||||||
const brain = new Brainy({ storage: { type: 'filesystem', path: '/data/my-store' } })
|
const brain = new Brainy({ storage: { type: 'filesystem', path: '/data/my-store' } })
|
||||||
|
|
@ -182,5 +182,5 @@ and opening each store is sufficient.
|
||||||
The recovery is copy-only, so no rollback of the recovery itself is ever needed.
|
The recovery is copy-only, so no rollback of the recovery itself is ever needed.
|
||||||
If you need to roll back the **whole** 7→8 upgrade, restore the directory from
|
If you need to roll back the **whole** 7→8 upgrade, restore the directory from
|
||||||
your pre-upgrade backup (retained automatically while recovery is incomplete, or
|
your pre-upgrade backup (retained automatically while recovery is incomplete, or
|
||||||
your own snapshot) and pin `@soulcraft/brainy@7.x`. 8.0 does not keep the old
|
your own snapshot) and pin `@soulcraftlabs/brainy@7.x`. 8.0 does not keep the old
|
||||||
branch layout in place, so a directory-level restore is the rollback path.
|
branch layout in place, so a directory-level restore is the rollback path.
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Complete guide to integrating Brainy with Vue.js applications, covering Vue 3, N
|
||||||
npm create vue@latest my-brainy-app
|
npm create vue@latest my-brainy-app
|
||||||
cd my-brainy-app
|
cd my-brainy-app
|
||||||
npm install
|
npm install
|
||||||
npm install @soulcraft/brainy
|
npm install @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
### Basic Setup
|
### Basic Setup
|
||||||
|
|
@ -574,7 +574,7 @@ Nuxt's server engine (Nitro) is the natural home for Brainy: it runs on Node/Bun
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// server/utils/brain.js (server-only — Nitro never bundles this into the client)
|
// server/utils/brain.js (server-only — Nitro never bundles this into the client)
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
let brainPromise
|
let brainPromise
|
||||||
|
|
||||||
|
|
@ -1201,7 +1201,7 @@ import vue from '@vitejs/plugin-vue'
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()],
|
plugins: [vue()],
|
||||||
ssr: {
|
ssr: {
|
||||||
external: ['@soulcraft/brainy']
|
external: ['@soulcraftlabs/brainy']
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ Brainy's neural extraction system uses a **4-signal ensemble architecture** to c
|
||||||
### Method 1: Brain Instance (Recommended)
|
### Method 1: Brain Instance (Recommended)
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, NounType } from '@soulcraft/brainy'
|
import { Brainy, NounType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -62,9 +62,9 @@ const people = await brain.extractEntities('...', {
|
||||||
import {
|
import {
|
||||||
SmartExtractor,
|
SmartExtractor,
|
||||||
SmartRelationshipExtractor
|
SmartRelationshipExtractor
|
||||||
} from '@soulcraft/brainy'
|
} from '@soulcraftlabs/brainy'
|
||||||
// Or use subpath imports:
|
// Or use subpath imports:
|
||||||
import { SmartExtractor } from '@soulcraft/brainy/neural/SmartExtractor'
|
import { SmartExtractor } from '@soulcraftlabs/brainy/neural/SmartExtractor'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -176,7 +176,7 @@ const withVectors = await brain.extractEntities(text, {
|
||||||
**Direct entity type classifier.** Use when you have pre-detected candidates or need custom configuration.
|
**Direct entity type classifier.** Use when you have pre-detected candidates or need custom configuration.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { SmartExtractor, FormatContext } from '@soulcraft/brainy'
|
import { SmartExtractor, FormatContext } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const extractor = new SmartExtractor(brain, {
|
const extractor = new SmartExtractor(brain, {
|
||||||
minConfidence: 0.7, // Threshold
|
minConfidence: 0.7, // Threshold
|
||||||
|
|
@ -229,7 +229,7 @@ interface ExtractionResult {
|
||||||
**Relationship type classifier.** Determines verb/relationship types between entities.
|
**Relationship type classifier.** Determines verb/relationship types between entities.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { SmartRelationshipExtractor } from '@soulcraft/brainy'
|
import { SmartRelationshipExtractor } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const relExtractor = new SmartRelationshipExtractor(brain, {
|
const relExtractor = new SmartRelationshipExtractor(brain, {
|
||||||
minConfidence: 0.6,
|
minConfidence: 0.6,
|
||||||
|
|
@ -286,7 +286,7 @@ const rel = await relExtractor.infer(
|
||||||
**Full extraction orchestrator.** Handles candidate detection, classification, and deduplication.
|
**Full extraction orchestrator.** Handles candidate detection, classification, and deduplication.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { NeuralEntityExtractor } from '@soulcraft/brainy'
|
import { NeuralEntityExtractor } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const extractor = new NeuralEntityExtractor(brain)
|
const extractor = new NeuralEntityExtractor(brain)
|
||||||
|
|
||||||
|
|
@ -607,7 +607,7 @@ const locations = entities.filter(e => e.type === NounType.Location)
|
||||||
### Example 2: Excel Data Classification
|
### Example 2: Excel Data Classification
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { SmartExtractor } from '@soulcraft/brainy'
|
import { SmartExtractor } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const extractor = new SmartExtractor(brain)
|
const extractor = new SmartExtractor(brain)
|
||||||
|
|
||||||
|
|
@ -629,7 +629,7 @@ for (let i = 0; i < cells.length; i++) {
|
||||||
### Example 3: Relationship Extraction
|
### Example 3: Relationship Extraction
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { SmartRelationshipExtractor } from '@soulcraft/brainy'
|
import { SmartRelationshipExtractor } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const relExtractor = new SmartRelationshipExtractor(brain)
|
const relExtractor = new SmartRelationshipExtractor(brain)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,8 +204,8 @@ await brain.add({ data: { name: 'Entity' }, type: NounType.Thing })
|
||||||
### Basic Add Operation
|
### Basic Add Operation
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
import { NounType } from '@soulcraft/brainy/types'
|
import { NounType } from '@soulcraftlabs/brainy/types'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -428,7 +428,7 @@ await brain.relate({ ... }) // a crash here leaves the entity unlinked
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { describe, it, expect } from 'vitest'
|
import { describe, it, expect } from 'vitest'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
describe('Transaction Tests', () => {
|
describe('Transaction Tests', () => {
|
||||||
it('should rollback on failure', async () => {
|
it('should rollback on failure', async () => {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ The Universal Display Augmentation is a powerful AI-powered system that automati
|
||||||
### Basic Usage
|
### Basic Usage
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brainy = new Brainy()
|
const brainy = new Brainy()
|
||||||
await brainy.init()
|
await brainy.init()
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,9 @@ Let's build a projection that organizes files by priority (high, medium, low):
|
||||||
### Step 1: Create the Strategy Class
|
### Step 1: Create the Strategy Class
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { BaseProjectionStrategy } from '@soulcraft/brainy/vfs/semantic'
|
import { BaseProjectionStrategy } from '@soulcraftlabs/brainy/vfs/semantic'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
import { VirtualFileSystem, VFSEntity } from '@soulcraft/brainy/vfs'
|
import { VirtualFileSystem, VFSEntity } from '@soulcraftlabs/brainy/vfs'
|
||||||
|
|
||||||
export class PriorityProjection extends BaseProjectionStrategy {
|
export class PriorityProjection extends BaseProjectionStrategy {
|
||||||
readonly name = 'priority'
|
readonly name = 'priority'
|
||||||
|
|
@ -141,7 +141,7 @@ export class PriorityProjection extends BaseProjectionStrategy {
|
||||||
### Step 2: Register the Strategy
|
### Step 2: Register the Strategy
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
import { PriorityProjection } from './PriorityProjection'
|
import { PriorityProjection } from './PriorityProjection'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
|
|
@ -537,7 +537,7 @@ Use the projection's resolve cache:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { describe, it, expect, beforeAll } from 'vitest'
|
import { describe, it, expect, beforeAll } from 'vitest'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
import { PriorityProjection } from './PriorityProjection'
|
import { PriorityProjection } from './PriorityProjection'
|
||||||
|
|
||||||
describe('PriorityProjection', () => {
|
describe('PriorityProjection', () => {
|
||||||
|
|
@ -714,7 +714,7 @@ async resolve(brain, vfs, value: string) {
|
||||||
3. Use appropriate limits: Don't fetch more than needed
|
3. Use appropriate limits: Don't fetch more than needed
|
||||||
|
|
||||||
### Type errors
|
### Type errors
|
||||||
1. Import correct types: `import { Brainy, VirtualFileSystem } from '@soulcraft/brainy'`
|
1. Import correct types: `import { Brainy, VirtualFileSystem } from '@soulcraftlabs/brainy'`
|
||||||
2. Use `as VFSEntity` when mapping results
|
2. Use `as VFSEntity` when mapping results
|
||||||
3. Check BaseProjectionStrategy import
|
3. Check BaseProjectionStrategy import
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@ A file explorer that:
|
||||||
## ⚡ Step 1: Basic Setup (1 minute)
|
## ⚡ Step 1: Basic Setup (1 minute)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy
|
npm install @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// ✅ CORRECT: Use filesystem storage for production
|
// ✅ CORRECT: Use filesystem storage for production
|
||||||
const brain = new Brainy({
|
const brain = new Brainy({
|
||||||
|
|
@ -115,7 +115,7 @@ Here's a complete React component using the correct patterns:
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
export function FileExplorer() {
|
export function FileExplorer() {
|
||||||
const [brain, setBrain] = useState(null)
|
const [brain, setBrain] = useState(null)
|
||||||
|
|
@ -288,8 +288,8 @@ Your file explorer is now working! Here's what to explore next:
|
||||||
### "Module not found" errors
|
### "Module not found" errors
|
||||||
```bash
|
```bash
|
||||||
# Make sure you're using the right import
|
# Make sure you're using the right import
|
||||||
npm ls @soulcraft/brainy # Check version
|
npm ls @soulcraftlabs/brainy # Check version
|
||||||
npm install @soulcraft/brainy@latest # Update if needed
|
npm install @soulcraftlabs/brainy@latest # Update if needed
|
||||||
```
|
```
|
||||||
|
|
||||||
### "VFS not initialized" errors
|
### "VFS not initialized" errors
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ Brainy VFS is a revolutionary virtual filesystem that runs on top of Brainy's ne
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { VirtualFileSystem } from '@soulcraft/brainy/vfs'
|
import { VirtualFileSystem } from '@soulcraftlabs/brainy/vfs'
|
||||||
|
|
||||||
// Initialize the VFS
|
// Initialize the VFS
|
||||||
const vfs = new VirtualFileSystem({
|
const vfs = new VirtualFileSystem({
|
||||||
|
|
@ -381,7 +381,7 @@ Brainy VFS fully leverages Brainy's revolutionary Triple Intelligence system:
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @soulcraft/brainy
|
npm install @soulcraftlabs/brainy
|
||||||
```
|
```
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ Mount VFS as a native filesystem on Linux/Mac/Windows.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// Planned (research phase)
|
// Planned (research phase)
|
||||||
import { mountVFS } from '@soulcraft/brainy/vfs/fuse'
|
import { mountVFS } from '@soulcraftlabs/brainy/vfs/fuse'
|
||||||
|
|
||||||
await mountVFS(vfs, {
|
await mountVFS(vfs, {
|
||||||
mountPoint: '/mnt/brainy',
|
mountPoint: '/mnt/brainy',
|
||||||
|
|
@ -160,7 +160,7 @@ These features would benefit from community contributions. If you're interested
|
||||||
### Express.js Static Middleware
|
### Express.js Static Middleware
|
||||||
```typescript
|
```typescript
|
||||||
// Wanted: Community contribution
|
// Wanted: Community contribution
|
||||||
import { createStaticMiddleware } from '@soulcraft/brainy/vfs/express'
|
import { createStaticMiddleware } from '@soulcraftlabs/brainy/vfs/express'
|
||||||
|
|
||||||
app.use('/files', createStaticMiddleware(vfs, {
|
app.use('/files', createStaticMiddleware(vfs, {
|
||||||
index: ['index.html', 'index.md'],
|
index: ['index.html', 'index.md'],
|
||||||
|
|
@ -172,7 +172,7 @@ app.use('/files', createStaticMiddleware(vfs, {
|
||||||
### VSCode Extension
|
### VSCode Extension
|
||||||
```typescript
|
```typescript
|
||||||
// Wanted: Community contribution
|
// Wanted: Community contribution
|
||||||
import { VFSProvider } from '@soulcraft/brainy/vfs/vscode'
|
import { VFSProvider } from '@soulcraftlabs/brainy/vfs/vscode'
|
||||||
|
|
||||||
const provider = new VFSProvider(vfs)
|
const provider = new VFSProvider(vfs)
|
||||||
vscode.workspace.registerFileSystemProvider('brainy', provider)
|
vscode.workspace.registerFileSystemProvider('brainy', provider)
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ console.log(id1 === id2 && id2 === id3) // true
|
||||||
Create your own semantic dimensions:
|
Create your own semantic dimensions:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { BaseProjectionStrategy } from '@soulcraft/brainy/vfs/semantic'
|
import { BaseProjectionStrategy } from '@soulcraftlabs/brainy/vfs/semantic'
|
||||||
|
|
||||||
class PriorityProjection extends BaseProjectionStrategy {
|
class PriorityProjection extends BaseProjectionStrategy {
|
||||||
readonly name = 'priority'
|
readonly name = 'priority'
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ Brainy's Virtual Filesystem (VFS) provides a POSIX-like filesystem interface tha
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Initialize Brainy
|
// Initialize Brainy
|
||||||
const brain = new Brainy({
|
const brain = new Brainy({
|
||||||
|
|
@ -598,7 +598,7 @@ const user = await store.findById('users', 'user123')
|
||||||
VFS uses standard POSIX-style errors:
|
VFS uses standard POSIX-style errors:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { VFSError, VFSErrorCode } from '@soulcraft/brainy'
|
import { VFSError, VFSErrorCode } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await vfs.readFile('/nonexistent.txt')
|
await vfs.readFile('/nonexistent.txt')
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ GitBridge provides Git import/export capabilities:
|
||||||
#### GitBridge Usage
|
#### GitBridge Usage
|
||||||
```javascript
|
```javascript
|
||||||
// Import and instantiate GitBridge
|
// Import and instantiate GitBridge
|
||||||
import { GitBridge } from '@soulcraft/brainy'
|
import { GitBridge } from '@soulcraftlabs/brainy'
|
||||||
const gitBridge = new GitBridge(vfs, brain)
|
const gitBridge = new GitBridge(vfs, brain)
|
||||||
|
|
||||||
// Export VFS to Git repository structure
|
// Export VFS to Git repository structure
|
||||||
|
|
@ -452,7 +452,7 @@ This ordering prevents race conditions where file writes might fail because pare
|
||||||
## Complete Example
|
## Complete Example
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
async function vfsExample() {
|
async function vfsExample() {
|
||||||
// Initialize
|
// Initialize
|
||||||
|
|
|
||||||
|
|
@ -196,5 +196,5 @@ await brain.relate({
|
||||||
Always import and use the type enums:
|
Always import and use the type enums:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { NounType, VerbType } from '@soulcraft/brainy'
|
import { NounType, VerbType } from '@soulcraftlabs/brainy'
|
||||||
```
|
```
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
The Brainy VFS is automatically initialized during `brain.init()`. No separate initialization needed!
|
The Brainy VFS is automatically initialized during `brain.init()`. No separate initialization needed!
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Create and initialize Brainy
|
// Create and initialize Brainy
|
||||||
const brain = new Brainy({
|
const brain = new Brainy({
|
||||||
|
|
@ -71,7 +71,7 @@ VFS stores files as entities and relationships in the same graph as everything e
|
||||||
## Complete Example
|
## Complete Example
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
async function useVFS() {
|
async function useVFS() {
|
||||||
// Initialize Brainy
|
// Initialize Brainy
|
||||||
|
|
@ -100,7 +100,7 @@ useVFS().catch(console.error)
|
||||||
## TypeScript Usage
|
## TypeScript Usage
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, VirtualFileSystem } from '@soulcraft/brainy'
|
import { Brainy, VirtualFileSystem } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
class FileManager {
|
class FileManager {
|
||||||
private brain: Brainy
|
private brain: Brainy
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Brainy VFS provides safe, tree-aware methods that prevent these issues:
|
||||||
### Method 1: Use `getDirectChildren()` (Recommended)
|
### Method 1: Use `getDirectChildren()` (Recommended)
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, VirtualFileSystem } from '@soulcraft/brainy'
|
import { Brainy, VirtualFileSystem } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy()
|
const brain = new Brainy()
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -97,7 +97,7 @@ Here's a complete example using React:
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { VirtualFileSystem } from '@soulcraft/brainy'
|
import { VirtualFileSystem } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
interface FileNode {
|
interface FileNode {
|
||||||
name: string
|
name: string
|
||||||
|
|
@ -177,7 +177,7 @@ function TreeView({ node, onToggle, expanded }) {
|
||||||
If you must build trees manually from flat lists, use the `VFSTreeUtils`:
|
If you must build trees manually from flat lists, use the `VFSTreeUtils`:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { VFSTreeUtils } from '@soulcraft/brainy/vfs'
|
import { VFSTreeUtils } from '@soulcraftlabs/brainy/vfs'
|
||||||
|
|
||||||
// Get all entities somehow
|
// Get all entities somehow
|
||||||
const allEntities = await vfs.getDescendants('/root')
|
const allEntities = await vfs.getDescendants('/root')
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
* the Bluesky firehose with Brainy's distributed architecture
|
* the Bluesky firehose with Brainy's distributed architecture
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
import { WebSocket } from 'ws'
|
import { WebSocket } from 'ws'
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* ts-node examples/monitor-cache-performance.ts
|
* ts-node examples/monitor-cache-performance.ts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Brainy, NounType } from '@soulcraft/brainy'
|
import { Brainy, NounType } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// ANSI color codes for pretty output
|
// ANSI color codes for pretty output
|
||||||
const colors = {
|
const colors = {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ Connect Brainy to spreadsheets, BI tools, and external systems with zero configu
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ integrations: true })
|
const brain = new Brainy({ integrations: true })
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -178,7 +178,7 @@ Webhooks include `X-Brainy-Signature` header with HMAC-SHA256 signature.
|
||||||
### Minimal (in-memory):
|
### Minimal (in-memory):
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ integrations: true })
|
const brain = new Brainy({ integrations: true })
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -194,7 +194,7 @@ console.log(brain.hub.getInstructions())
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
const brain = new Brainy({
|
const brain = new Brainy({
|
||||||
|
|
@ -232,7 +232,7 @@ app.listen(3000, () => {
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Hono } from 'hono'
|
import { Hono } from 'hono'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const app = new Hono()
|
const app = new Hono()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ Add the `BRAINY_URL` script property in Apps Script settings.
|
||||||
The simplest way to enable all integrations:
|
The simplest way to enable all integrations:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const brain = new Brainy({ integrations: true })
|
const brain = new Brainy({ integrations: true })
|
||||||
await brain.init()
|
await brain.init()
|
||||||
|
|
@ -112,7 +112,7 @@ With Express:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { Brainy } from '@soulcraft/brainy'
|
import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
const brain = new Brainy({ integrations: true })
|
const brain = new Brainy({ integrations: true })
|
||||||
|
|
|
||||||
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraftlabs/brainy",
|
||||||
"version": "10.4.2",
|
"version": "10.4.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraftlabs/brainy",
|
||||||
"version": "10.4.2",
|
"version": "10.4.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@msgpack/msgpack": "^3.1.2",
|
"@msgpack/msgpack": "^3.1.2",
|
||||||
|
|
|
||||||
13
package.json
13
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraftlabs/brainy",
|
||||||
"version": "10.4.2",
|
"version": "10.4.3",
|
||||||
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. Stage 3 CANONICAL: 42 nouns × 127 verbs covering 96-97% of all human knowledge.",
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. Stage 3 CANONICAL: 42 nouns × 127 verbs covering 96-97% of all human knowledge.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
|
|
@ -126,15 +126,16 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
"private": false,
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public",
|
||||||
|
"registry": "https://source.soulcraft.com/api/packages/soulcraftlabs/npm/"
|
||||||
},
|
},
|
||||||
"homepage": "https://source.soulcraft.com/soulcraft/brainy",
|
"homepage": "https://source.soulcraft.com/soulcraftlabs/open-brainy",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://source.soulcraft.com/soulcraft/brainy/issues"
|
"url": "https://source.soulcraft.com/soulcraftlabs/open-brainy/issues"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://source.soulcraft.com/soulcraft/brainy.git"
|
"url": "git+https://source.soulcraft.com/soulcraftlabs/open-brainy.git"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist/**/*.js",
|
"dist/**/*.js",
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ NC='\033[0m' # No Color
|
||||||
RELEASE_TYPE="${1:-patch}" # patch, minor, or major
|
RELEASE_TYPE="${1:-patch}" # patch, minor, or major
|
||||||
SKIP_TESTS=false
|
SKIP_TESTS=false
|
||||||
DRY_RUN=false
|
DRY_RUN=false
|
||||||
# --source-only: the HOME leg only — tag, CI's publish to The Source, and the
|
# --source-only is now a no-op: The Source is the one registry, so every
|
||||||
# release page; NO storefront (npmjs) publish, NO pair verification, NO docs
|
# release already ships Source-only — tag, CI's publish to The Source, the
|
||||||
# push. The pair-gate shape: a prerelease the fleet's other engine devDeps
|
# release page, and the docs push, with no separate storefront leg to skip.
|
||||||
# from our own registry while the pair is proven, never a public artifact.
|
# The flag is still accepted (for backward-compatible invocations) and just
|
||||||
# Refused for a non-prerelease version — a public floor is always a pair.
|
# prints a notice; it no longer changes behavior.
|
||||||
SOURCE_ONLY=false
|
SOURCE_ONLY=false
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
|
|
@ -109,7 +109,7 @@ else
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "${RED}❌ Invalid release type: ${RELEASE_TYPE}${NC}"
|
echo -e "${RED}❌ Invalid release type: ${RELEASE_TYPE}${NC}"
|
||||||
echo "Usage: ./scripts/release.sh [patch|minor|major|<explicit-version>] [--dry-run] [--source-only (prereleases only)]"
|
echo "Usage: ./scripts/release.sh [patch|minor|major|<explicit-version>] [--dry-run] [--source-only (no-op; The Source is the one registry)]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -129,11 +129,7 @@ if [ "$PRERELEASE" = true ]; then
|
||||||
echo -e "${YELLOW}⚠️ Prerelease → npm dist-tag '${NPM_TAG}', GitHub prerelease${NC}"
|
echo -e "${YELLOW}⚠️ Prerelease → npm dist-tag '${NPM_TAG}', GitHub prerelease${NC}"
|
||||||
fi
|
fi
|
||||||
if [ "$SOURCE_ONLY" = true ]; then
|
if [ "$SOURCE_ONLY" = true ]; then
|
||||||
if [ "$PRERELEASE" != true ]; then
|
echo -e "${YELLOW}⚠️ The Source is the one registry; --source-only is implied${NC}"
|
||||||
echo -e "${RED}❌ --source-only is for prereleases only: a non-prerelease version is a public floor and always ships as the byte-identical pair.${NC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo -e "${YELLOW}⚠️ --source-only → The Source (home) ONLY: no npmjs publish, no pair verification, no docs push${NC}"
|
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
@ -209,9 +205,9 @@ echo -e "${GREEN}✅ Pushed to origin${NC}\n"
|
||||||
# .forgejo/workflows/publish-source.yml, which builds and publishes on The
|
# .forgejo/workflows/publish-source.yml, which builds and publishes on The
|
||||||
# Source's own runner (datacenter-side: seconds, not the laptop's WAN timing
|
# Source's own runner (datacenter-side: seconds, not the laptop's WAN timing
|
||||||
# out on an 87MB tarball PUT). The laptop holds no home-registry publish
|
# out on an 87MB tarball PUT). The laptop holds no home-registry publish
|
||||||
# credential anymore; it only waits for CI's result before trusting the
|
# credential anymore; it only waits for CI's result before continuing on to
|
||||||
# home/npmjs pair enough to publish the storefront leg.
|
# the release page and the docs push.
|
||||||
SOURCE_NPM_REG="https://source.soulcraft.com/api/packages/soulcraft/npm/"
|
SOURCE_NPM_REG="https://source.soulcraft.com/api/packages/soulcraftlabs/npm/"
|
||||||
SOURCE_POLL_INTERVAL_S=15
|
SOURCE_POLL_INTERVAL_S=15
|
||||||
SOURCE_POLL_MAX_ATTEMPTS=200 # 200 × 15s = 50 minutes — the runner is sequential and a busy day's ci.yml
|
SOURCE_POLL_MAX_ATTEMPTS=200 # 200 × 15s = 50 minutes — the runner is sequential and a busy day's ci.yml
|
||||||
# backlog has twice exceeded the old 20-minute window (8.10.3, 9.0.0);
|
# backlog has twice exceeded the old 20-minute window (8.10.3, 9.0.0);
|
||||||
|
|
@ -219,7 +215,7 @@ SOURCE_POLL_MAX_ATTEMPTS=200 # 200 × 15s = 50 minutes — the runner is sequen
|
||||||
echo -e "${BLUE}9️⃣ Waiting for CI to publish v${NEW_VERSION} to The Source registry (home)...${NC}"
|
echo -e "${BLUE}9️⃣ Waiting for CI to publish v${NEW_VERSION} to The Source registry (home)...${NC}"
|
||||||
SOURCE_LANDED=false
|
SOURCE_LANDED=false
|
||||||
for ((attempt = 1; attempt <= SOURCE_POLL_MAX_ATTEMPTS; attempt++)); do
|
for ((attempt = 1; attempt <= SOURCE_POLL_MAX_ATTEMPTS; attempt++)); do
|
||||||
LANDED_VERSION=$(npm view "@soulcraft/brainy@${NEW_VERSION}" version "--@soulcraft:registry=${SOURCE_NPM_REG}" 2>/dev/null || echo "")
|
LANDED_VERSION=$(npm view "@soulcraftlabs/brainy@${NEW_VERSION}" version "--@soulcraftlabs:registry=${SOURCE_NPM_REG}" 2>/dev/null || echo "")
|
||||||
if [ "$LANDED_VERSION" = "$NEW_VERSION" ]; then
|
if [ "$LANDED_VERSION" = "$NEW_VERSION" ]; then
|
||||||
SOURCE_LANDED=true
|
SOURCE_LANDED=true
|
||||||
break
|
break
|
||||||
|
|
@ -232,57 +228,11 @@ if [ "$SOURCE_LANDED" = true ]; then
|
||||||
echo -e "${GREEN}✅ CI published v${NEW_VERSION} to The Source${NC}\n"
|
echo -e "${GREEN}✅ CI published v${NEW_VERSION} to The Source${NC}\n"
|
||||||
else
|
else
|
||||||
echo -e "${RED}❌ CI's home publish did not land — check the workflow run on The Source; the pair must not diverge.${NC}"
|
echo -e "${RED}❌ CI's home publish did not land — check the workflow run on The Source; the pair must not diverge.${NC}"
|
||||||
echo -e "${RED} v${NEW_VERSION} was tagged and pushed, but @soulcraft/brainy@${NEW_VERSION} never became visible on the${NC}"
|
echo -e "${RED} v${NEW_VERSION} was tagged and pushed, but @soulcraftlabs/brainy@${NEW_VERSION} never became visible on the${NC}"
|
||||||
echo -e "${RED} Source registry after ${SOURCE_POLL_MAX_ATTEMPTS} attempts, ${SOURCE_POLL_INTERVAL_S}s apart. Aborting before npmjs.${NC}"
|
echo -e "${RED} Source registry after ${SOURCE_POLL_MAX_ATTEMPTS} attempts, ${SOURCE_POLL_INTERVAL_S}s apart. Aborting.${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SOURCE_ONLY" = true ]; then
|
|
||||||
echo -e "${YELLOW}9️⃣½ Storefront (npmjs) leg SKIPPED — --source-only: v${NEW_VERSION} lives on The Source under dist-tag '${NPM_TAG}' only${NC}\n"
|
|
||||||
else
|
|
||||||
echo -e "${BLUE}9️⃣½ Publishing to npmjs (storefront, dist-tag: ${NPM_TAG})...${NC}"
|
|
||||||
# BYTE-IDENTITY LAW: the storefront republishes CI's EXACT artifact — download
|
|
||||||
# the tarball The Source serves and publish that file, never a fresh local pack
|
|
||||||
# (a local rebuild can differ byte-wise, and the fleet verifies the pair by
|
|
||||||
# shasum across registries).
|
|
||||||
STOREFRONT_TMP="$(mktemp -d)"
|
|
||||||
(cd "$STOREFRONT_TMP" && npm pack "@soulcraft/brainy@${NEW_VERSION}" "--@soulcraft:registry=${SOURCE_NPM_REG}" >/dev/null)
|
|
||||||
SOURCE_TARBALL="$(ls "$STOREFRONT_TMP"/soulcraft-brainy-*.tgz)"
|
|
||||||
echo -e "${BLUE} home artifact: $(sha256sum "$SOURCE_TARBALL" | cut -d' ' -f1)${NC}"
|
|
||||||
npm publish "$SOURCE_TARBALL" --tag "$NPM_TAG" "--@soulcraft:registry=https://registry.npmjs.org/"
|
|
||||||
rm -rf "$STOREFRONT_TMP"
|
|
||||||
# Brainy is the only PUBLIC @soulcraft package — verify visibility after every publish.
|
|
||||||
npm access get status @soulcraft/brainy "--@soulcraft:registry=https://registry.npmjs.org/" || true
|
|
||||||
# Verify the pair is byte-identical by registry-reported shasum — divergence
|
|
||||||
# here means the storefront leg must be treated as failed, loudly. RETRIED
|
|
||||||
# with raw curl: npmjs metadata propagates with a lag measured in minutes,
|
|
||||||
# and a one-shot npm-view probe fired a false DIVERGENCE on 10.0.0 while a
|
|
||||||
# raw curl of the registry document already confirmed byte-identity. The
|
|
||||||
# probe now reads the registry JSON directly (no npm cache in the path) and
|
|
||||||
# gives propagation up to 5 minutes before calling the pair divergent.
|
|
||||||
NPMJS_VERIFY_ATTEMPTS=20
|
|
||||||
NPMJS_VERIFY_INTERVAL_S=15 # 20 × 15s = 5 minutes of propagation grace
|
|
||||||
SOURCE_SHA=$(npm view "@soulcraft/brainy@${NEW_VERSION}" dist.shasum "--@soulcraft:registry=${SOURCE_NPM_REG}" 2>/dev/null || echo "source-unavailable")
|
|
||||||
PAIR_IDENTICAL=false
|
|
||||||
for ((attempt = 1; attempt <= NPMJS_VERIFY_ATTEMPTS; attempt++)); do
|
|
||||||
NPMJS_SHA=$(curl -fsSL "https://registry.npmjs.org/@soulcraft%2Fbrainy" 2>/dev/null \
|
|
||||||
| node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{try{const v=JSON.parse(d).versions[process.argv[1]];console.log(v?v.dist.shasum:'')}catch{console.log('')}})" "${NEW_VERSION}" \
|
|
||||||
|| echo "")
|
|
||||||
if [ -n "$NPMJS_SHA" ] && [ "$SOURCE_SHA" = "$NPMJS_SHA" ]; then
|
|
||||||
PAIR_IDENTICAL=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo -e "${YELLOW} … npmjs metadata not settled (attempt ${attempt}/${NPMJS_VERIFY_ATTEMPTS}: '${NPMJS_SHA:-absent}' vs '${SOURCE_SHA}'); retrying in ${NPMJS_VERIFY_INTERVAL_S}s${NC}"
|
|
||||||
sleep "$NPMJS_VERIFY_INTERVAL_S"
|
|
||||||
done
|
|
||||||
if [ "$PAIR_IDENTICAL" = true ]; then
|
|
||||||
echo -e "${GREEN}✅ Published to npmjs — byte-identical pair (shasum ${NPMJS_SHA})${NC}\n"
|
|
||||||
else
|
|
||||||
echo -e "${RED}❌ REGISTRY DIVERGENCE: The Source shasum ${SOURCE_SHA} != npmjs shasum ${NPMJS_SHA} after ${NPMJS_VERIFY_ATTEMPTS} attempts — investigate before announcing${NC}\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 11: Release object on The Source (presentational — the tag, CHANGELOG,
|
# Step 11: Release object on The Source (presentational — the tag, CHANGELOG,
|
||||||
# and RELEASES.md are the record; this just gives The Source's UI a release page).
|
# and RELEASES.md are the record; this just gives The Source's UI a release page).
|
||||||
echo -e "${BLUE}🔟 Creating release page on The Source...${NC}"
|
echo -e "${BLUE}🔟 Creating release page on The Source...${NC}"
|
||||||
|
|
@ -303,24 +253,15 @@ fi
|
||||||
# DOCS_INGEST_SECRET is unset; fails loudly (without undoing the publish —
|
# DOCS_INGEST_SECRET is unset; fails loudly (without undoing the publish —
|
||||||
# that already happened) when a push errors, so the docs site never
|
# that already happened) when a push errors, so the docs site never
|
||||||
# silently trails npm.
|
# silently trails npm.
|
||||||
if [ "$SOURCE_ONLY" = true ]; then
|
echo -e "${BLUE}1️⃣2️⃣ Pushing public docs to soulcraft.com/docs...${NC}"
|
||||||
echo -e "${YELLOW}1️⃣2️⃣ Docs push SKIPPED — --source-only (a home-only prerelease publishes no public docs)${NC}\n"
|
if node scripts/push-docs.js; then
|
||||||
|
echo -e "${GREEN}✅ Docs push step done${NC}\n"
|
||||||
else
|
else
|
||||||
echo -e "${BLUE}1️⃣2️⃣ Pushing public docs to soulcraft.com/docs...${NC}"
|
echo -e "${RED}❌ Docs push FAILED — soulcraft.com/docs trails npm until re-run or interim sync${NC}\n"
|
||||||
if node scripts/push-docs.js; then
|
|
||||||
echo -e "${GREEN}✅ Docs push step done${NC}\n"
|
|
||||||
else
|
|
||||||
echo -e "${RED}❌ Docs push FAILED — soulcraft.com/docs trails npm until re-run or interim sync${NC}\n"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||||
echo -e "${GREEN}🎉 Release ${NEW_VERSION} complete!${NC}"
|
echo -e "${GREEN}🎉 Release ${NEW_VERSION} complete!${NC}"
|
||||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
if [ "$SOURCE_ONLY" = true ]; then
|
|
||||||
echo -e "📦 npmjs: ${YELLOW}not published (--source-only)${NC}"
|
|
||||||
else
|
|
||||||
echo -e "📦 npm: ${BLUE}https://www.npmjs.com/package/@soulcraft/brainy/v/${NEW_VERSION}${NC}"
|
|
||||||
fi
|
|
||||||
echo -e "🏠 The Source: ${BLUE}https://source.soulcraft.com/soulcraft/brainy/releases/tag/v${NEW_VERSION}${NC}"
|
echo -e "🏠 The Source: ${BLUE}https://source.soulcraft.com/soulcraft/brainy/releases/tag/v${NEW_VERSION}${NC}"
|
||||||
|
|
|
||||||
|
|
@ -952,14 +952,14 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
||||||
* extends FileSystemStorage`) inherit new methods Brainy adds to
|
* extends FileSystemStorage`) inherit new methods Brainy adds to
|
||||||
* `FileSystemStorage` / `BaseStorage` automatically — `typeof` walks the
|
* `FileSystemStorage` / `BaseStorage` automatically — `typeof` walks the
|
||||||
* prototype chain, so there's no in-package version skew to worry about as
|
* prototype chain, so there's no in-package version skew to worry about as
|
||||||
* long as the plugin's own dist resolves `@soulcraft/brainy` dynamically
|
* long as the plugin's own dist resolves `@soulcraftlabs/brainy` dynamically
|
||||||
* (which Cortex 2.2.x onward does — see
|
* (which Cortex 2.2.x onward does — see
|
||||||
* `node_modules/@soulcraft/cor/dist/storage/mmapFileSystemStorage.js`).
|
* `node_modules/@soulcraft/cor/dist/storage/mmapFileSystemStorage.js`).
|
||||||
*
|
*
|
||||||
* This helper exists for the **build/install** failure modes the import
|
* This helper exists for the **build/install** failure modes the import
|
||||||
* resolution can't catch:
|
* resolution can't catch:
|
||||||
* - Stale `node_modules` left over from a prior `bun install` against
|
* - Stale `node_modules` left over from a prior `bun install` against
|
||||||
* `@soulcraft/brainy ≤7.20.x`.
|
* `@soulcraftlabs/brainy ≤7.20.x`.
|
||||||
* - Lockfile drift pinning brainy below the version that introduced the
|
* - Lockfile drift pinning brainy below the version that introduced the
|
||||||
* method.
|
* method.
|
||||||
* - Docker layer caches that reuse a `node_modules` from an earlier image.
|
* - Docker layer caches that reuse a `node_modules` from an earlier image.
|
||||||
|
|
@ -1175,7 +1175,7 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
||||||
`and the flush-request RPC are disabled for this directory. ` +
|
`and the flush-request RPC are disabled for this directory. ` +
|
||||||
`Likely fix: clean install (\`rm -rf node_modules bun.lockb && ` +
|
`Likely fix: clean install (\`rm -rf node_modules bun.lockb && ` +
|
||||||
`bun install\`) or rebuild your container image to refresh ` +
|
`bun install\`) or rebuild your container image to refresh ` +
|
||||||
`\`@soulcraft/brainy\` to ≥7.21. See docs/concepts/storage-adapters.md.`
|
`\`@soulcraftlabs/brainy\` to ≥7.21. See docs/concepts/storage-adapters.md.`
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
console.warn(
|
console.warn(
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
* speculative `with()` overlay; the canonical storage walk only ever answers
|
* speculative `with()` overlay; the canonical storage walk only ever answers
|
||||||
* "what is live right now."
|
* "what is live right now."
|
||||||
*
|
*
|
||||||
* All are exported from the package root (`@soulcraft/brainy`).
|
* All are exported from the package root (`@soulcraftlabs/brainy`).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ async function loadBunAssets(): Promise<ModelAssets> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strategy 2: node_modules path relative to CWD (for installed packages)
|
// Strategy 2: node_modules path relative to CWD (for installed packages)
|
||||||
const nmPath = './node_modules/@soulcraft/brainy/assets/models/all-MiniLM-L6-v2'
|
const nmPath = './node_modules/@soulcraftlabs/brainy/assets/models/all-MiniLM-L6-v2'
|
||||||
pathsToTry.push([
|
pathsToTry.push([
|
||||||
`${nmPath}/model.safetensors`,
|
`${nmPath}/model.safetensors`,
|
||||||
`${nmPath}/tokenizer.json`,
|
`${nmPath}/tokenizer.json`,
|
||||||
|
|
@ -168,9 +168,9 @@ async function loadBunAssets(): Promise<ModelAssets> {
|
||||||
// If all strategies fail, provide helpful error message
|
// If all strategies fail, provide helpful error message
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Could not load model assets. For bun --compile, ensure model files are accessible:\n' +
|
'Could not load model assets. For bun --compile, ensure model files are accessible:\n' +
|
||||||
' Option 1: Keep node_modules/@soulcraft/brainy/assets/ alongside your binary\n' +
|
' Option 1: Keep node_modules/@soulcraftlabs/brainy/assets/ alongside your binary\n' +
|
||||||
' Option 2: Copy assets/ folder to your working directory\n' +
|
' Option 2: Copy assets/ folder to your working directory\n' +
|
||||||
' Option 3: Use --asset flag: bun build --compile --asset="./node_modules/@soulcraft/brainy/assets/**/*"'
|
' Option 3: Use --asset flag: bun build --compile --asset="./node_modules/@soulcraftlabs/brainy/assets/**/*"'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ async function loadNodeAssets(): Promise<ModelAssets> {
|
||||||
if (!fs.existsSync(assetsDir)) {
|
if (!fs.existsSync(assetsDir)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Model assets not found: ${assetsDir}\n` +
|
`Model assets not found: ${assetsDir}\n` +
|
||||||
`Ensure @soulcraft/brainy is installed correctly.`
|
`Ensure @soulcraftlabs/brainy is installed correctly.`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* - {@link RelationNotFoundError} — a referenced relationship (verb) does
|
* - {@link RelationNotFoundError} — a referenced relationship (verb) does
|
||||||
* not exist.
|
* not exist.
|
||||||
*
|
*
|
||||||
* Both are exported from the package root (`@soulcraft/brainy`).
|
* Both are exported from the package root (`@soulcraftlabs/brainy`).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* @example Enable integrations (recommended)
|
* @example Enable integrations (recommended)
|
||||||
* ```typescript
|
* ```typescript
|
||||||
* import { Brainy } from '@soulcraft/brainy'
|
* import { Brainy } from '@soulcraftlabs/brainy'
|
||||||
*
|
*
|
||||||
* const brain = new Brainy({ integrations: true })
|
* const brain = new Brainy({ integrations: true })
|
||||||
* await brain.init()
|
* await brain.init()
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ The `BrainyMCPService` has been refactored to separate the core functionality fr
|
||||||
### In Any Environment (Browser, Node.js, Server)
|
### In Any Environment (Browser, Node.js, Server)
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, BrainyMCPAdapter, MCPAugmentationToolset } from '@soulcraft/brainy'
|
import { Brainy, BrainyMCPAdapter, MCPAugmentationToolset } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Create a Brainy instance
|
// Create a Brainy instance
|
||||||
const brainyData = new Brainy()
|
const brainyData = new Brainy()
|
||||||
|
|
@ -81,7 +81,7 @@ const toolResponse = await toolset.handleRequest({
|
||||||
### In Browser Environment (Core Functionality Only)
|
### In Browser Environment (Core Functionality Only)
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Brainy, BrainyMCPService } from '@soulcraft/brainy'
|
import { Brainy, BrainyMCPService } from '@soulcraftlabs/brainy'
|
||||||
|
|
||||||
// Create a Brainy instance
|
// Create a Brainy instance
|
||||||
const brainyData = new Brainy()
|
const brainyData = new Brainy()
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import type { GraphIndexStats } from './graph/graphAdjacencyIndex.js'
|
||||||
|
|
||||||
// Re-export the provider contracts that already live closer to their
|
// Re-export the provider contracts that already live closer to their
|
||||||
// implementations so a plugin author (Cor) can import the *entire*
|
// implementations so a plugin author (Cor) can import the *entire*
|
||||||
// provider surface from one stable entrypoint: `@soulcraft/brainy/plugin`.
|
// provider surface from one stable entrypoint: `@soulcraftlabs/brainy/plugin`.
|
||||||
export type { ColumnStoreProvider } from './indexes/columnStore/types.js'
|
export type { ColumnStoreProvider } from './indexes/columnStore/types.js'
|
||||||
export type {
|
export type {
|
||||||
AggregationProvider,
|
AggregationProvider,
|
||||||
|
|
@ -41,7 +41,7 @@ export interface BrainyPlugin {
|
||||||
name: string
|
name: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional semver range of `@soulcraft/brainy` this plugin supports
|
* Optional semver range of `@soulcraftlabs/brainy` this plugin supports
|
||||||
* (e.g. `'>=8.0.0 <9.0.0'` or `'^8.0.0'`). When set and the running brainy is
|
* (e.g. `'>=8.0.0 <9.0.0'` or `'^8.0.0'`). When set and the running brainy is
|
||||||
* OUTSIDE the range, `init()` THROWS rather than silently falling back to the
|
* OUTSIDE the range, `init()` THROWS rather than silently falling back to the
|
||||||
* default JS engine. This is the version-coupling guard for the native
|
* default JS engine. This is the version-coupling guard for the native
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ export interface ScoreExplanation {
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* declare module '@soulcraft/brainy' {
|
* declare module '@soulcraftlabs/brainy' {
|
||||||
* interface SubtypeRegistry {
|
* interface SubtypeRegistry {
|
||||||
* // For NounType.Person, subtype 'employee':
|
* // For NounType.Person, subtype 'employee':
|
||||||
* 'person:employee': { employeeId: string; department: string }
|
* 'person:employee': { employeeId: string; department: string }
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
* | `_rev` | system-managed revision counter — pass `ifRev` to `update()` for CAS |
|
* | `_rev` | system-managed revision counter — pass `ifRev` to `update()` for CAS |
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* import { RESERVED_ENTITY_FIELDS } from '@soulcraft/brainy'
|
* import { RESERVED_ENTITY_FIELDS } from '@soulcraftlabs/brainy'
|
||||||
* const isReserved = (key: string) =>
|
* const isReserved = (key: string) =>
|
||||||
* (RESERVED_ENTITY_FIELDS as readonly string[]).includes(key)
|
* (RESERVED_ENTITY_FIELDS as readonly string[]).includes(key)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```typescript
|
* ```typescript
|
||||||
* import { BrainyTypes } from '@soulcraft/brainy'
|
* import { BrainyTypes } from '@soulcraftlabs/brainy'
|
||||||
*
|
*
|
||||||
* // Get all available types
|
* // Get all available types
|
||||||
* const nounTypes = BrainyTypes.nouns // ['Person', 'Organization', ...]
|
* const nounTypes = BrainyTypes.nouns // ['Person', 'Organization', ...]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* @module utils/version
|
* @module utils/version
|
||||||
* @description Resolves the running `@soulcraft/brainy` package version. Brainy 8.0
|
* @description Resolves the running `@soulcraftlabs/brainy` package version. Brainy 8.0
|
||||||
* targets Node-like runtimes only (Node.js, Bun, Deno — all expose `node:fs`), so the
|
* targets Node-like runtimes only (Node.js, Bun, Deno — all expose `node:fs`), so the
|
||||||
* version is read **synchronously** from `package.json` on first call and cached.
|
* version is read **synchronously** from `package.json` on first call and cached.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* - Hook 2: the public `brain.stampBrainFormat()` the provider calls once its
|
* - Hook 2: the public `brain.stampBrainFormat()` the provider calls once its
|
||||||
* background migration has verified-and-swapped, authoring the shared
|
* background migration has verified-and-swapped, authoring the shared
|
||||||
* `_system/brain-format.json` marker.
|
* `_system/brain-format.json` marker.
|
||||||
* - Hook 3: the marker module is re-exported at `@soulcraft/brainy/brain-format`
|
* - Hook 3: the marker module is re-exported at `@soulcraftlabs/brainy/brain-format`
|
||||||
* so cor reads the SAME `EXPECTED_INDEX_EPOCH` / `CURRENT_DATA_FORMAT` constants
|
* so cor reads the SAME `EXPECTED_INDEX_EPOCH` / `CURRENT_DATA_FORMAT` constants
|
||||||
* (single source of truth, no duplicated value).
|
* (single source of truth, no duplicated value).
|
||||||
*
|
*
|
||||||
|
|
@ -242,7 +242,7 @@ describe('rc.8 no-freeze migration deference (isMigrating / stampBrainFormat / b
|
||||||
// --- Hook 3: marker module export ----------------------------------------
|
// --- Hook 3: marker module export ----------------------------------------
|
||||||
|
|
||||||
it('the brain-format marker module exports the compiled epoch + data-format constants', () => {
|
it('the brain-format marker module exports the compiled epoch + data-format constants', () => {
|
||||||
// cor imports these from '@soulcraft/brainy/brain-format' (Hook 3) so both
|
// cor imports these from '@soulcraftlabs/brainy/brain-format' (Hook 3) so both
|
||||||
// sides share ONE source of truth — no duplicated constant to drift.
|
// sides share ONE source of truth — no duplicated constant to drift.
|
||||||
// Epoch 3: the namespace-law key split (bare user keys · literal
|
// Epoch 3: the namespace-law key split (bare user keys · literal
|
||||||
// 'system.<field>' scalars, 2026-08-03) — every brain rebuilds onto the
|
// 'system.<field>' scalars, 2026-08-03) — every brain rebuilds onto the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue