claude-brain 0.17.3 → 0.17.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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.3
1
+ 0.17.4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-brain",
3
- "version": "0.17.3",
3
+ "version": "0.17.4",
4
4
  "description": "Local development assistant bridging Obsidian vaults with Claude Code via MCP",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -3,7 +3,7 @@ import type { PartialConfig } from './schema'
3
3
  /** Default configuration values for Claude Brain */
4
4
  export const defaultConfig: PartialConfig = {
5
5
  serverName: 'claude-brain',
6
- serverVersion: '0.17.3',
6
+ serverVersion: '0.17.4',
7
7
  logLevel: 'info',
8
8
  logFilePath: './logs/claude-brain.log',
9
9
  dbPath: './data/memory.db',
@@ -284,7 +284,7 @@ export const ConfigSchema = z.object({
284
284
  serverName: z.string().default('claude-brain'),
285
285
 
286
286
  /** Server version in semver format */
287
- serverVersion: z.string().regex(/^\d+\.\d+\.\d+$/, 'Version must be semver format').default('0.17.3'),
287
+ serverVersion: z.string().regex(/^\d+\.\d+\.\d+$/, 'Version must be semver format').default('0.17.4'),
288
288
 
289
289
  /** Logging level */
290
290
  logLevel: LogLevelSchema.default('info'),
@@ -8,6 +8,7 @@ export class ChromaClientManager {
8
8
  private config: ChromaConfig
9
9
  private isConnected: boolean = false
10
10
  private collections: Map<string, Collection> = new Map()
11
+ private pendingCollections: Map<string, Promise<Collection>> = new Map()
11
12
 
12
13
  constructor(logger: Logger, config: ChromaConfig) {
13
14
  this.logger = logger.child({ component: 'chroma-client' })
@@ -106,8 +107,25 @@ export class ChromaClientManager {
106
107
  return this.collections.get(name)!
107
108
  }
108
109
 
110
+ // Deduplicate concurrent calls: if a getOrCreateCollection is already
111
+ // in-flight for this name, reuse the same promise instead of racing.
112
+ if (this.pendingCollections.has(name)) {
113
+ return this.pendingCollections.get(name)!
114
+ }
115
+
116
+ const pending = this.fetchAndCacheCollection(name)
117
+ this.pendingCollections.set(name, pending)
118
+
119
+ try {
120
+ return await pending
121
+ } finally {
122
+ this.pendingCollections.delete(name)
123
+ }
124
+ }
125
+
126
+ private async fetchAndCacheCollection(name: string): Promise<Collection> {
109
127
  try {
110
- const collection = await this.client.getOrCreateCollection({
128
+ const collection = await this.client!.getOrCreateCollection({
111
129
  name,
112
130
  metadata: {
113
131
  'hnsw:space': 'cosine',