brainbank 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  printResults,
15
15
  registerConfigCollections,
16
16
  stripFlags
17
- } from "./chunk-JRVYSTMP.js";
17
+ } from "./chunk-IB3X5D5Y.js";
18
18
  import {
19
19
  DEFAULT_PORT,
20
20
  isServerRunning,
package/dist/index.d.ts CHANGED
@@ -2167,6 +2167,12 @@ interface ProjectConfig {
2167
2167
  maxFileSize?: number;
2168
2168
  indexers?: Plugin[];
2169
2169
  brainbank?: Partial<BrainBankConfig>;
2170
+ /** Optional API keys — override env vars. Kept out of version control. */
2171
+ keys?: {
2172
+ anthropic?: string;
2173
+ perplexity?: string;
2174
+ openai?: string;
2175
+ };
2170
2176
  /** Context field defaults (e.g. { lines: true, callTree: true, symbols: false }). */
2171
2177
  context?: Record<string, unknown>;
2172
2178
  /** Per-plugin config sections (e.g. code, git, docs). */
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  sanitizeFTS,
50
50
  vecToBuffer,
51
51
  withLock
52
- } from "./chunk-JRVYSTMP.js";
52
+ } from "./chunk-IB3X5D5Y.js";
53
53
  import {
54
54
  DEFAULT_PORT,
55
55
  getServerUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainbank",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Pluggable semantic memory for AI agents — hybrid search (vector + BM25) in a single SQLite file. Built-in code, git, and docs indexers. Bring your own.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,6 @@
24
24
  "assets/"
25
25
  ],
26
26
  "scripts": {
27
-
28
27
  "start": "bin/brainbank",
29
28
  "build": "rm -rf dist && tsup && npm run build --workspaces --if-present",
30
29
  "build:core": "rm -rf dist && tsup",
@@ -70,6 +69,7 @@
70
69
  "@brainbank/code": "^0.1.1",
71
70
  "@brainbank/docs": "^0.1.1",
72
71
  "@brainbank/git": "^0.1.1",
72
+ "@brainbank/mcp": "^0.3.1",
73
73
  "@xenova/transformers": "^2.17.2",
74
74
  "node-llama-cpp": "^3.18.1"
75
75
  },
@@ -85,4 +85,4 @@
85
85
  "tsx": "^4.19.0",
86
86
  "typescript": "^5.7.0"
87
87
  }
88
- }
88
+ }
@@ -21,6 +21,12 @@ export interface ProjectConfig {
21
21
  maxFileSize?: number;
22
22
  indexers?: Plugin[];
23
23
  brainbank?: Partial<BrainBankConfig>;
24
+ /** Optional API keys — override env vars. Kept out of version control. */
25
+ keys?: {
26
+ anthropic?: string;
27
+ perplexity?: string;
28
+ openai?: string;
29
+ };
24
30
  /** Context field defaults (e.g. { lines: true, callTree: true, symbols: false }). */
25
31
  context?: Record<string, unknown>;
26
32
  /** Per-plugin config sections (e.g. code, git, docs). */
@@ -106,6 +106,17 @@ export async function setupProviders(
106
106
  flags?: Record<string, string | undefined>,
107
107
  env?: Record<string, string | undefined>,
108
108
  ): Promise<void> {
109
+ // Resolve API keys: config.keys > env vars
110
+ const keys = config?.keys ?? {};
111
+ const anthropicKey = keys.anthropic || process.env.ANTHROPIC_API_KEY;
112
+ const perplexityKey = keys.perplexity || process.env.PERPLEXITY_API_KEY;
113
+ const openaiKey = keys.openai || process.env.OPENAI_API_KEY;
114
+
115
+ // Inject resolved keys into process.env so downstream providers auto-detect them
116
+ if (anthropicKey) process.env.ANTHROPIC_API_KEY = anthropicKey;
117
+ if (perplexityKey) process.env.PERPLEXITY_API_KEY = perplexityKey;
118
+ if (openaiKey) process.env.OPENAI_API_KEY = openaiKey;
119
+
109
120
  const rerankerFlag = flags?.reranker ?? (config?.reranker as string | undefined);
110
121
  if (rerankerFlag === 'qwen3') {
111
122
  const { Qwen3Reranker } = await import('@/providers/rerankers/qwen3-reranker.ts');
@@ -115,7 +126,7 @@ export async function setupProviders(
115
126
  const prunerFlag = flags?.pruner ?? (config?.pruner as string | undefined);
116
127
  if (prunerFlag === 'haiku') {
117
128
  const { HaikuPruner } = await import('@/providers/pruners/haiku-pruner.ts');
118
- brainOpts.pruner = new HaikuPruner();
129
+ brainOpts.pruner = new HaikuPruner({ apiKey: anthropicKey });
119
130
  }
120
131
 
121
132
  // Expander: explicit opt-in only (config.json `expander: "haiku"` or --expander flag)
@@ -123,7 +134,7 @@ export async function setupProviders(
123
134
  if (expanderFlag === 'haiku') {
124
135
  try {
125
136
  const { HaikuExpander } = await import('@/providers/pruners/haiku-expander.ts');
126
- brainOpts.expander = new HaikuExpander();
137
+ brainOpts.expander = new HaikuExpander({ apiKey: anthropicKey });
127
138
  } catch {
128
139
  // Fail-open: if API key missing, skip expander silently
129
140
  }