claude-brain 0.28.2 → 0.28.3
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 +1 -1
- package/package.json +1 -1
- package/src/cli/commands/serve.ts +7 -0
- package/src/config/loader.ts +9 -4
- package/src/config/schema.ts +1 -1
- package/src/server/services.ts +6 -2
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.28.
|
|
1
|
+
0.28.3
|
package/package.json
CHANGED
|
@@ -27,6 +27,13 @@ export async function runServe() {
|
|
|
27
27
|
// - otherwise → secondary if primary is already running (Claude Code MCP session)
|
|
28
28
|
const pidManager = new ServerPidManager()
|
|
29
29
|
const existingPid = pidManager.getRunningPid()
|
|
30
|
+
|
|
31
|
+
// Prevent duplicate --http-only processes
|
|
32
|
+
if (httpOnly && existingPid) {
|
|
33
|
+
console.error(`[claude-brain] Primary instance already running (PID ${existingPid}). Exiting.`)
|
|
34
|
+
process.exit(0)
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
const isSecondaryInstance = !httpOnly && !!existingPid
|
|
31
38
|
|
|
32
39
|
if (!isSecondaryInstance) {
|
package/src/config/loader.ts
CHANGED
|
@@ -148,7 +148,7 @@ export async function loadConfig(basePath: string = process.cwd()): Promise<Conf
|
|
|
148
148
|
const fileConfig = loadFromFile(basePath)
|
|
149
149
|
const envConfig = loadFromEnv()
|
|
150
150
|
|
|
151
|
-
const merged = mergeConfigs(defaultConfig as Partial<Config>,
|
|
151
|
+
const merged = mergeConfigs(defaultConfig as Partial<Config>, envConfig, fileConfig)
|
|
152
152
|
|
|
153
153
|
const result = ConfigSchema.safeParse(merged)
|
|
154
154
|
|
|
@@ -163,9 +163,14 @@ export async function loadConfig(basePath: string = process.cwd()): Promise<Conf
|
|
|
163
163
|
const data = result.data
|
|
164
164
|
data.logFilePath = resolveHomePath(data.logFilePath)
|
|
165
165
|
data.dbPath = resolveHomePath(data.dbPath)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
166
|
+
|
|
167
|
+
// Always resolve knowledge graph path to absolute
|
|
168
|
+
// Zod .default({}) on nested objects means graph/persistPath may not exist
|
|
169
|
+
if (!data.knowledge) data.knowledge = {} as any
|
|
170
|
+
if (!data.knowledge.graph) data.knowledge.graph = {} as any
|
|
171
|
+
data.knowledge.graph.persistPath = resolveHomePath(
|
|
172
|
+
data.knowledge.graph.persistPath || './data/knowledge-graph.json'
|
|
173
|
+
)
|
|
169
174
|
|
|
170
175
|
// Phase 30: Auto-detect vaultPath if not configured
|
|
171
176
|
if (!data.vaultPath) {
|
package/src/config/schema.ts
CHANGED
|
@@ -290,7 +290,7 @@ export const ConfigSchema = z.object({
|
|
|
290
290
|
serverVersion: z.string().regex(/^\d+\.\d+\.\d+$/, 'Version must be semver format').default(pkg.version),
|
|
291
291
|
|
|
292
292
|
/** Logging level */
|
|
293
|
-
logLevel: LogLevelSchema.default('
|
|
293
|
+
logLevel: LogLevelSchema.default('warn'),
|
|
294
294
|
|
|
295
295
|
/** Path to log file */
|
|
296
296
|
logFilePath: z.string().default('./logs/claude-brain.log'),
|
package/src/server/services.ts
CHANGED
|
@@ -178,7 +178,9 @@ export async function initializeServices(config: Config, logger: Logger): Promis
|
|
|
178
178
|
if (config.knowledge?.graph?.enabled !== false) {
|
|
179
179
|
try {
|
|
180
180
|
const graph = new InMemoryKnowledgeGraph(logger)
|
|
181
|
-
|
|
181
|
+
// Use absolute path from getHomePaths() if persistPath not configured
|
|
182
|
+
const { getHomePaths: getHomePathsKG } = await import('@/config/home')
|
|
183
|
+
const graphPersistPath = config.knowledge?.graph?.persistPath || getHomePathsKG().knowledgeGraph
|
|
182
184
|
|
|
183
185
|
// Load existing graph from disk
|
|
184
186
|
await graph.load(graphPersistPath)
|
|
@@ -656,7 +658,9 @@ export async function shutdownServices(): Promise<void> {
|
|
|
656
658
|
// Save and stop knowledge graph
|
|
657
659
|
if (services.knowledgeGraph) {
|
|
658
660
|
services.knowledgeGraph.graph.stopAutoSave()
|
|
659
|
-
|
|
661
|
+
// Use absolute path from getHomePaths() if persistPath not configured
|
|
662
|
+
const { getHomePaths } = await import('@/config/home')
|
|
663
|
+
const persistPath = services.config.knowledge?.graph?.persistPath || getHomePaths().knowledgeGraph
|
|
660
664
|
try {
|
|
661
665
|
await services.knowledgeGraph.graph.save(persistPath)
|
|
662
666
|
serviceLogger.info('Knowledge graph saved on shutdown')
|