chore(8.0)!: drop browser support, cloud SDKs, legacy pipeline, dead threading

Brainy 8.0 is server-only. This commit takes the consequences seriously and
removes everything that was only there to keep browser/cloud/threading
surfaces alive.

Browser support drop (per the @deprecated notes in environment.ts):
  - isBrowser, isWebWorker, areWebWorkersAvailable, navigator.deviceMemory
    paths, window/document/self.onmessage code.
  - browser console.log in unified.ts, the 'browser' branch in
    autoConfiguration.ts (env enum + scaleUp cases), 'browser-cache' model
    path, MCP service environment value.
  - package.json browser field.
  - src/worker.ts (Web Worker entrypoint) deleted.

Cloud SDK removal (the four adapters were dropped in Phase 7; the SDKs
were the lingering tax):
  - @aws-sdk/client-s3, @azure/identity, @azure/storage-blob, and
    @google-cloud/storage removed from package.json. Lockfile drops the
    entire @aws/@azure/@google-cloud/@smithy transitive tree.
  - EnhancedS3Clear class deleted from enhancedClearOperations.ts (the
    only @aws-sdk/client-s3 consumer; the dynamic import sites went with
    it). EnhancedFileSystemClear stays.
  - src/utils/adaptiveSocketManager.ts deleted entirely (474 LOC of HTTPS
    socket-pool management for the dropped cloud HTTP handler).
    performanceMonitor.ts no longer reports a socketConfig; socket
    utilization is fixed at 0.

Dead threading subsystem:
  - executeInThread was imported by distance.ts and hnswIndex.ts but
    never called. It was scaffolding for a future "off-main-thread
    distance batch" optimization that never shipped.
  - src/utils/workerUtils.ts deleted (Web Worker code path + an
    unreachable Node Worker Threads code path).
  - environment.ts loses isThreadingAvailable, isThreadingAvailableAsync,
    areWorkerThreadsAvailable, areWorkerThreadsAvailableSync. All exports
    purged from index.ts and unified.ts.
  - autoConfiguration.ts drops AutoConfigResult.threadingAvailable.

Legacy plugin/augmentation pipeline:
  - src/pipeline.ts deleted. The whole file was a no-op stub for
    backwards compat — Pipeline class had no methods, no lifecycle hooks,
    no before/after callbacks. AugmentationPipeline, augmentationPipeline,
    createPipeline, createStreamingPipeline, StreamlinedPipelineOptions,
    StreamlinedPipelineResult, StreamlinedExecutionMode were all aliases
    for the same stub.
  - src/mcp/mcpAugmentationToolset.ts deleted. executePipeline always
    threw "deprecated", isValidAugmentationType always returned false,
    getAvailableTools always returned []. Dead surface.
  - BrainyMCPService no longer instantiates a toolset. TOOL_EXECUTION
    requests now return the standard UNSUPPORTED_REQUEST_TYPE error.
    'availableTools' system-info returns [] (was the same in practice).

Net: 22 files changed, ~6400 LOC deleted (including legacy code +
mechanical lockfile churn). Build clean, 1409/1409 tests pass.
This commit is contained in:
David Snelling 2026-06-09 16:38:30 -07:00
parent adda1570f3
commit 266715aeee
22 changed files with 134 additions and 4648 deletions

View file

@ -18,7 +18,6 @@
import type { StorageAdapter } from '../coreTypes.js'
import { MemoryStorage } from './adapters/memoryStorage.js'
import { isBrowser } from '../utils/environment.js'
import type { OperationConfig } from '../utils/operationUtils.js'
/**
@ -80,11 +79,10 @@ function configureCOW(storage: any, options?: StorageOptions): void {
/**
* Resolve `StorageOptions` to a concrete storage adapter.
*
* - `'auto'` (default) picks `FileSystemStorage` when the runtime exposes
* the Node `fs` API, otherwise falls back to `MemoryStorage`.
* - `'auto'` (default) picks `FileSystemStorage`, falling back to
* `MemoryStorage` only if filesystem init fails (e.g. no write permission).
* - `forceMemoryStorage: true` returns `MemoryStorage` regardless.
* - `forceFileSystemStorage: true` returns `FileSystemStorage` and throws in
* the browser.
* - `forceFileSystemStorage: true` returns `FileSystemStorage`.
*/
export async function createStorage(options: StorageOptions = {}): Promise<StorageAdapter> {
const storage = await pickAdapter(options)
@ -104,27 +102,15 @@ async function pickAdapter(options: StorageOptions): Promise<StorageAdapter> {
}
if (requestedType === 'filesystem' || options.forceFileSystemStorage) {
if (isBrowser()) {
throw new Error(
"Brainy: 'filesystem' storage is not available in browser environments. " +
"Use `type: 'memory'` for in-browser brains, or run on a Node-like runtime."
)
}
return await createFilesystemStorage(options)
}
// 'auto': filesystem if we have Node-like fs, otherwise memory.
if (!isBrowser()) {
try {
return await createFilesystemStorage(options)
} catch (err) {
// Fall back to memory if filesystem init fails for any reason
// (e.g. no write permission on rootDirectory).
return new MemoryStorage()
}
// 'auto': prefer filesystem, fall back to memory if init fails.
try {
return await createFilesystemStorage(options)
} catch {
return new MemoryStorage()
}
return new MemoryStorage()
}
async function createFilesystemStorage(options: StorageOptions): Promise<StorageAdapter> {