@theihtisham/agent-shadow-brain 6.3.0 → 7.0.0
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/CHANGELOG.md +411 -391
- package/LICENSE +21 -21
- package/README.md +428 -438
- package/dist/adapters/aider.js +13 -13
- package/dist/adapters/base-adapter.js +14 -14
- package/dist/adapters/codex.js +8 -8
- package/dist/adapters/roo-code.js +18 -18
- package/dist/brain/adr-engine.js +11 -11
- package/dist/brain/analyzer.js +30 -30
- package/dist/brain/auto-update.js +1 -1
- package/dist/brain/global-brain.d.ts +52 -63
- package/dist/brain/global-brain.d.ts.map +1 -1
- package/dist/brain/global-brain.js +577 -339
- package/dist/brain/global-brain.js.map +1 -1
- package/dist/brain/health-score.js +19 -19
- package/dist/brain/learning-engine.js +59 -59
- package/dist/brain/mcp-server.d.ts +1 -0
- package/dist/brain/mcp-server.d.ts.map +1 -1
- package/dist/brain/mcp-server.js +16 -6
- package/dist/brain/mcp-server.js.map +1 -1
- package/dist/brain/plugin-system.js +23 -23
- package/dist/brain/pr-generator.js +19 -19
- package/dist/brain/project-context.js +1 -1
- package/dist/brain/project-context.js.map +1 -1
- package/dist/brain/report-generator.js +270 -270
- package/dist/cli.js +105 -34
- package/dist/cli.js.map +1 -1
- package/dist/dashboard/v6-dashboard-html.d.ts +1 -1
- package/dist/dashboard/v6-dashboard-html.d.ts.map +1 -1
- package/dist/dashboard/v6-dashboard-html.js +5 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +28 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/watchers/git-watcher.d.ts.map +1 -1
- package/dist/watchers/git-watcher.js +1 -1
- package/dist/watchers/git-watcher.js.map +1 -1
- package/docs/launch/RELEASE_CHECKLIST_v7.0.0.md +24 -0
- package/docs/launch/RELEASE_NOTES_v7.0.0.md +44 -0
- package/package.json +17 -14
- package/docs/launch/README.md +0 -61
package/dist/adapters/aider.js
CHANGED
|
@@ -98,14 +98,14 @@ export class AiderAdapter extends BaseAdapter {
|
|
|
98
98
|
medium: 'SUGGESTION',
|
|
99
99
|
low: 'INFO',
|
|
100
100
|
};
|
|
101
|
-
const insightSection = `
|
|
102
|
-
## Shadow Brain — ${priorityLabel[insight.priority] ?? insight.priority}
|
|
103
|
-
|
|
104
|
-
> Type: ${insight.type} | Priority: ${insight.priority} | ${insight.timestamp.toISOString()}
|
|
105
|
-
|
|
106
|
-
${insight.content}
|
|
107
|
-
|
|
108
|
-
${insight.files?.length ? `### Affected Files\n${insight.files.map(f => `- \`${f}\``).join('\n')}` : ''}
|
|
101
|
+
const insightSection = `
|
|
102
|
+
## Shadow Brain — ${priorityLabel[insight.priority] ?? insight.priority}
|
|
103
|
+
|
|
104
|
+
> Type: ${insight.type} | Priority: ${insight.priority} | ${insight.timestamp.toISOString()}
|
|
105
|
+
|
|
106
|
+
${insight.content}
|
|
107
|
+
|
|
108
|
+
${insight.files?.length ? `### Affected Files\n${insight.files.map(f => `- \`${f}\``).join('\n')}` : ''}
|
|
109
109
|
`;
|
|
110
110
|
try {
|
|
111
111
|
if (fs.existsSync(conventionsFile)) {
|
|
@@ -131,11 +131,11 @@ ${insight.files?.length ? `### Affected Files\n${insight.files.map(f => `- \`${f
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
|
-
const header = `# Project Conventions
|
|
135
|
-
|
|
136
|
-
<!-- Auto-generated by Agent Shadow Brain -->
|
|
137
|
-
<!-- Aider reads this file to understand project conventions -->
|
|
138
|
-
|
|
134
|
+
const header = `# Project Conventions
|
|
135
|
+
|
|
136
|
+
<!-- Auto-generated by Agent Shadow Brain -->
|
|
137
|
+
<!-- Aider reads this file to understand project conventions -->
|
|
138
|
+
|
|
139
139
|
`;
|
|
140
140
|
fs.writeFileSync(conventionsFile, header + insightSection, 'utf-8');
|
|
141
141
|
}
|
|
@@ -69,15 +69,15 @@ export class BaseAdapter {
|
|
|
69
69
|
medium: '💡',
|
|
70
70
|
low: 'ℹ️',
|
|
71
71
|
};
|
|
72
|
-
return `# ${priorityEmoji[insight.priority]} ${insight.title}
|
|
73
|
-
|
|
74
|
-
**Type:** ${insight.type} | **Priority:** ${insight.priority}
|
|
75
|
-
**Time:** ${insight.timestamp.toISOString()}
|
|
76
|
-
${insight.files?.length ? `**Files:** ${insight.files.join(', ')}` : ''}
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
${insight.content}
|
|
72
|
+
return `# ${priorityEmoji[insight.priority]} ${insight.title}
|
|
73
|
+
|
|
74
|
+
**Type:** ${insight.type} | **Priority:** ${insight.priority}
|
|
75
|
+
**Time:** ${insight.timestamp.toISOString()}
|
|
76
|
+
${insight.files?.length ? `**Files:** ${insight.files.join(', ')}` : ''}
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
${insight.content}
|
|
81
81
|
`;
|
|
82
82
|
}
|
|
83
83
|
appendToBrainFile(existing, insight) {
|
|
@@ -87,11 +87,11 @@ ${insight.content}
|
|
|
87
87
|
// Keep last 20 insights max
|
|
88
88
|
const sections = existing.split('\n---\n').filter(s => s.trim());
|
|
89
89
|
const insights = sections.slice(1).slice(-19); // keep 19 + new one = 20
|
|
90
|
-
const newEntry = `
|
|
91
|
-
## ${insight.priority === 'critical' ? '🚨' : insight.priority === 'high' ? '⚠️' : '💡'} [${insight.type.toUpperCase()}] ${insight.title}
|
|
92
|
-
_${insight.timestamp.toISOString()}_
|
|
93
|
-
|
|
94
|
-
${insight.content}
|
|
90
|
+
const newEntry = `
|
|
91
|
+
## ${insight.priority === 'critical' ? '🚨' : insight.priority === 'high' ? '⚠️' : '💡'} [${insight.type.toUpperCase()}] ${insight.title}
|
|
92
|
+
_${insight.timestamp.toISOString()}_
|
|
93
|
+
|
|
94
|
+
${insight.content}
|
|
95
95
|
${insight.files?.length ? `\nFiles: \`${insight.files.join('`, `')}\`` : ''}`;
|
|
96
96
|
return header + '\n---\n' + [...insights, newEntry].join('\n---\n') + '\n';
|
|
97
97
|
}
|
package/dist/adapters/codex.js
CHANGED
|
@@ -41,14 +41,14 @@ export class CodexAdapter extends BaseAdapter {
|
|
|
41
41
|
async injectContext(insight) {
|
|
42
42
|
// Codex reads AGENTS.md from project root
|
|
43
43
|
const agentsFile = path.join(this.projectDir, 'AGENTS.md');
|
|
44
|
-
const brainSection = `
|
|
45
|
-
## 🧠 Shadow Brain — ${insight.type.toUpperCase()}
|
|
46
|
-
|
|
47
|
-
**Priority:** ${insight.priority}
|
|
48
|
-
**Time:** ${insight.timestamp.toISOString()}
|
|
49
|
-
|
|
50
|
-
${insight.content}
|
|
51
|
-
${insight.files?.length ? `\nRelevant files: ${insight.files.map(f => `\`${f}\``).join(', ')}` : ''}
|
|
44
|
+
const brainSection = `
|
|
45
|
+
## 🧠 Shadow Brain — ${insight.type.toUpperCase()}
|
|
46
|
+
|
|
47
|
+
**Priority:** ${insight.priority}
|
|
48
|
+
**Time:** ${insight.timestamp.toISOString()}
|
|
49
|
+
|
|
50
|
+
${insight.content}
|
|
51
|
+
${insight.files?.length ? `\nRelevant files: ${insight.files.map(f => `\`${f}\``).join(', ')}` : ''}
|
|
52
52
|
`;
|
|
53
53
|
const existing = this.readFile(agentsFile) || '# Agent Instructions\n';
|
|
54
54
|
// Replace or append brain section
|
|
@@ -129,24 +129,24 @@ export class RooCodeAdapter extends BaseAdapter {
|
|
|
129
129
|
medium: 'SUGGESTION',
|
|
130
130
|
low: 'INFO',
|
|
131
131
|
};
|
|
132
|
-
const ruleContent = `---
|
|
133
|
-
description: Shadow Brain insights for Roo Code
|
|
134
|
-
globs:
|
|
135
|
-
alwaysApply: true
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
# Shadow Brain — ${priorityLabel[insight.priority] ?? insight.priority}
|
|
139
|
-
|
|
140
|
-
**Type:** ${insight.type}
|
|
141
|
-
**Priority:** ${insight.priority}
|
|
142
|
-
**Time:** ${insight.timestamp.toISOString()}
|
|
143
|
-
${insight.files?.length ? `**Files:** ${insight.files.join(', ')}` : ''}
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
${insight.content}
|
|
148
|
-
|
|
149
|
-
${insight.files?.length ? `## Affected Files\n${insight.files.map(f => `- \`${f}\``).join('\n')}` : ''}
|
|
132
|
+
const ruleContent = `---
|
|
133
|
+
description: Shadow Brain insights for Roo Code
|
|
134
|
+
globs:
|
|
135
|
+
alwaysApply: true
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
# Shadow Brain — ${priorityLabel[insight.priority] ?? insight.priority}
|
|
139
|
+
|
|
140
|
+
**Type:** ${insight.type}
|
|
141
|
+
**Priority:** ${insight.priority}
|
|
142
|
+
**Time:** ${insight.timestamp.toISOString()}
|
|
143
|
+
${insight.files?.length ? `**Files:** ${insight.files.join(', ')}` : ''}
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
${insight.content}
|
|
148
|
+
|
|
149
|
+
${insight.files?.length ? `## Affected Files\n${insight.files.map(f => `- \`${f}\``).join('\n')}` : ''}
|
|
150
150
|
`;
|
|
151
151
|
// If file exists, append section; otherwise create new file
|
|
152
152
|
if (fs.existsSync(rulesFile)) {
|
package/dist/brain/adr-engine.js
CHANGED
|
@@ -351,17 +351,17 @@ export class ADREngine {
|
|
|
351
351
|
if (!this.llmClient)
|
|
352
352
|
return [];
|
|
353
353
|
const combined = diffs.join('\n\n').slice(0, 8000); // truncate to reasonable size
|
|
354
|
-
const prompt = `Analyse the following code diffs and identify any architectural decisions that should be documented as ADRs (Architecture Decision Records).
|
|
355
|
-
For each decision, provide:
|
|
356
|
-
- title: short descriptive title
|
|
357
|
-
- context: what is the situation that necessitates this decision
|
|
358
|
-
- decision: what was decided
|
|
359
|
-
- consequences: what are the resulting consequences
|
|
360
|
-
|
|
361
|
-
Respond with a JSON array of objects with keys: title, context, decision, consequences.
|
|
362
|
-
If no architectural decisions are detected, respond with an empty array: []
|
|
363
|
-
|
|
364
|
-
Diffs:
|
|
354
|
+
const prompt = `Analyse the following code diffs and identify any architectural decisions that should be documented as ADRs (Architecture Decision Records).
|
|
355
|
+
For each decision, provide:
|
|
356
|
+
- title: short descriptive title
|
|
357
|
+
- context: what is the situation that necessitates this decision
|
|
358
|
+
- decision: what was decided
|
|
359
|
+
- consequences: what are the resulting consequences
|
|
360
|
+
|
|
361
|
+
Respond with a JSON array of objects with keys: title, context, decision, consequences.
|
|
362
|
+
If no architectural decisions are detected, respond with an empty array: []
|
|
363
|
+
|
|
364
|
+
Diffs:
|
|
365
365
|
${combined}`;
|
|
366
366
|
const response = await this.llmClient.complete(prompt, 'You are a senior software architect. Analyse code changes and identify architectural decisions. Respond with valid JSON only.');
|
|
367
367
|
try {
|
package/dist/brain/analyzer.js
CHANGED
|
@@ -329,37 +329,37 @@ export class Analyzer {
|
|
|
329
329
|
}
|
|
330
330
|
export class PromptBuilder {
|
|
331
331
|
static buildSystemPrompt(personality) {
|
|
332
|
-
const base = `You are the Shadow Brain, an AI that watches agentic coding tools and provides real-time insights.
|
|
333
|
-
You review file changes, git activity, and agent behavior, then generate actionable insights.
|
|
334
|
-
You respond in JSON only — an array of 1-5 insight objects.
|
|
332
|
+
const base = `You are the Shadow Brain, an AI that watches agentic coding tools and provides real-time insights.
|
|
333
|
+
You review file changes, git activity, and agent behavior, then generate actionable insights.
|
|
334
|
+
You respond in JSON only — an array of 1-5 insight objects.
|
|
335
335
|
Each insight has: type (review|suggestion|warning|context|pattern|instruction), priority (critical|high|medium|low), title (max 100 chars), content (max 2000 chars), files (array of relevant file paths).`;
|
|
336
336
|
const personalities = {
|
|
337
|
-
mentor: `\nYour personality is MENTOR — you teach and guide.
|
|
338
|
-
- Explain WHY something might be a problem, not just that it is.
|
|
339
|
-
- Suggest better approaches with brief explanations.
|
|
340
|
-
- Acknowledge good patterns when you see them.
|
|
341
|
-
- Be encouraging but honest.
|
|
337
|
+
mentor: `\nYour personality is MENTOR — you teach and guide.
|
|
338
|
+
- Explain WHY something might be a problem, not just that it is.
|
|
339
|
+
- Suggest better approaches with brief explanations.
|
|
340
|
+
- Acknowledge good patterns when you see them.
|
|
341
|
+
- Be encouraging but honest.
|
|
342
342
|
- Focus on: code quality, best practices, learning opportunities.`,
|
|
343
|
-
critic: `\nYour personality is CRITIC — you give thorough, no-nonsense code reviews.
|
|
344
|
-
- Be direct and specific about issues.
|
|
345
|
-
- Cite specific lines/patterns that concern you.
|
|
346
|
-
- Rate the overall quality of changes.
|
|
343
|
+
critic: `\nYour personality is CRITIC — you give thorough, no-nonsense code reviews.
|
|
344
|
+
- Be direct and specific about issues.
|
|
345
|
+
- Cite specific lines/patterns that concern you.
|
|
346
|
+
- Rate the overall quality of changes.
|
|
347
347
|
- Focus on: bugs, logic errors, missing edge cases, poor naming.`,
|
|
348
|
-
architect: `\nYour personality is ARCHITECT — you think about the big picture.
|
|
349
|
-
- Consider how changes affect the overall system design.
|
|
350
|
-
- Look for coupling, cohesion, and separation of concerns.
|
|
351
|
-
- Suggest structural improvements and patterns.
|
|
348
|
+
architect: `\nYour personality is ARCHITECT — you think about the big picture.
|
|
349
|
+
- Consider how changes affect the overall system design.
|
|
350
|
+
- Look for coupling, cohesion, and separation of concerns.
|
|
351
|
+
- Suggest structural improvements and patterns.
|
|
352
352
|
- Focus on: modularity, scalability, maintainability, design patterns.`,
|
|
353
|
-
security: `\nYour personality is SECURITY — you are paranoid about vulnerabilities.
|
|
354
|
-
- Flag anything that could be a security risk.
|
|
355
|
-
- Check for: SQL injection, XSS, CSRF, insecure deserialization, hardcoded secrets, weak crypto, missing input validation, exposed endpoints.
|
|
353
|
+
security: `\nYour personality is SECURITY — you are paranoid about vulnerabilities.
|
|
354
|
+
- Flag anything that could be a security risk.
|
|
355
|
+
- Check for: SQL injection, XSS, CSRF, insecure deserialization, hardcoded secrets, weak crypto, missing input validation, exposed endpoints.
|
|
356
356
|
- Be explicit about attack vectors and mitigations.`,
|
|
357
|
-
performance: `\nYour personality is PERFORMANCE — you optimize everything.
|
|
358
|
-
- Look for: N+1 queries, unnecessary re-renders, memory leaks, blocking I/O, large bundle sizes, unoptimized loops, missing caching.
|
|
357
|
+
performance: `\nYour personality is PERFORMANCE — you optimize everything.
|
|
358
|
+
- Look for: N+1 queries, unnecessary re-renders, memory leaks, blocking I/O, large bundle sizes, unoptimized loops, missing caching.
|
|
359
359
|
- Suggest specific optimizations with expected impact.`,
|
|
360
|
-
balanced: `\nYour personality is BALANCED — you combine all perspectives.
|
|
361
|
-
- Mix mentorship, critique, architecture, security, and performance insights.
|
|
362
|
-
- Prioritize by severity: security > bugs > architecture > performance > style.
|
|
360
|
+
balanced: `\nYour personality is BALANCED — you combine all perspectives.
|
|
361
|
+
- Mix mentorship, critique, architecture, security, and performance insights.
|
|
362
|
+
- Prioritize by severity: security > bugs > architecture > performance > style.
|
|
363
363
|
- Provide 2-3 insights per analysis covering different aspects.`,
|
|
364
364
|
};
|
|
365
365
|
return base + personalities[personality];
|
|
@@ -368,12 +368,12 @@ Each insight has: type (review|suggestion|warning|context|pattern|instruction),
|
|
|
368
368
|
const { changes, context, activity, agentMemory } = params;
|
|
369
369
|
const sections = [];
|
|
370
370
|
// Project context
|
|
371
|
-
sections.push(`## Project Context
|
|
372
|
-
- Name: ${context.name}
|
|
373
|
-
- Languages: ${context.language.join(', ') || 'Unknown'}
|
|
374
|
-
- Framework: ${context.framework || 'Unknown'}
|
|
375
|
-
- Package Manager: ${context.packageManager || 'Unknown'}
|
|
376
|
-
- Branch: ${context.gitBranch || 'N/A'}
|
|
371
|
+
sections.push(`## Project Context
|
|
372
|
+
- Name: ${context.name}
|
|
373
|
+
- Languages: ${context.language.join(', ') || 'Unknown'}
|
|
374
|
+
- Framework: ${context.framework || 'Unknown'}
|
|
375
|
+
- Package Manager: ${context.packageManager || 'Unknown'}
|
|
376
|
+
- Branch: ${context.gitBranch || 'N/A'}
|
|
377
377
|
- Git Status: ${context.gitStatus || 'N/A'}`);
|
|
378
378
|
// File changes
|
|
379
379
|
if (changes.length > 0) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/brain/auto-update.ts — Check for Shadow Brain updates
|
|
2
2
|
import * as https from 'https';
|
|
3
|
-
const CURRENT_VERSION = '
|
|
3
|
+
const CURRENT_VERSION = '7.0.0';
|
|
4
4
|
const PACKAGE_NAME = '@theihtisham/agent-shadow-brain';
|
|
5
5
|
export async function checkForUpdate() {
|
|
6
6
|
return new Promise((resolve) => {
|
|
@@ -1,87 +1,76 @@
|
|
|
1
|
-
import { AgentTool, GlobalBrainConfig, GlobalBrainStats,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { AgentTool, BrainTimelineEvent, GlobalBrainConfig, GlobalBrainStats, GlobalBrainStorageHealth, GlobalEntry, ScoredGlobalEntry } from '../types.js';
|
|
2
|
+
type EntryInput = Omit<GlobalEntry, 'id' | 'createdAt' | 'lastAccessed' | 'accessCount'>;
|
|
3
|
+
interface RecallOptions {
|
|
4
|
+
projectId?: string;
|
|
5
|
+
agentTool?: AgentTool;
|
|
6
|
+
category?: string;
|
|
7
|
+
keywords?: string[];
|
|
8
|
+
limit?: number;
|
|
9
|
+
minImportance?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Local JSON store shared by cooperating Global Brain processes. */
|
|
8
12
|
export declare class GlobalBrain {
|
|
9
13
|
private static instance;
|
|
10
|
-
private config;
|
|
14
|
+
private readonly config;
|
|
11
15
|
private entries;
|
|
12
|
-
private
|
|
13
|
-
private agents;
|
|
14
|
-
private writeQueue;
|
|
16
|
+
private readonly pendingOperations;
|
|
15
17
|
private syncTimer;
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
+
private syncInFlight;
|
|
19
|
+
private readonly stats;
|
|
20
|
+
private readonly startedAt;
|
|
18
21
|
private initialized;
|
|
19
|
-
private
|
|
22
|
+
private shuttingDown;
|
|
23
|
+
private lastSuccessfulSync;
|
|
24
|
+
private lastError;
|
|
20
25
|
private constructor();
|
|
21
26
|
static getInstance(config?: Partial<GlobalBrainConfig>): GlobalBrain;
|
|
22
27
|
init(): Promise<void>;
|
|
23
|
-
|
|
28
|
+
private initialize;
|
|
29
|
+
/** Generate a stable project ID from absolute path. */
|
|
24
30
|
static projectIdFor(rootDir: string): string;
|
|
25
31
|
registerProject(rootDir: string, name?: string): string;
|
|
26
32
|
registerAgent(agent: AgentTool): void;
|
|
27
|
-
/** Queue a write
|
|
28
|
-
write(entry:
|
|
29
|
-
/**
|
|
30
|
-
writeSync(entry:
|
|
31
|
-
|
|
33
|
+
/** Queue a write. A failed attempt resolves false and retains the entry for a later sync. */
|
|
34
|
+
write(entry: EntryInput): Promise<boolean>;
|
|
35
|
+
/** Stage an entry for later sync and return its ID immediately. */
|
|
36
|
+
writeSync(entry: EntryInput): string;
|
|
37
|
+
private requireWritable;
|
|
38
|
+
private prepareEntry;
|
|
32
39
|
private publishWrite;
|
|
33
|
-
/** Recall entries
|
|
34
|
-
recall(opts?:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
category?: string;
|
|
38
|
-
keywords?: string[];
|
|
39
|
-
limit?: number;
|
|
40
|
-
minImportance?: number;
|
|
41
|
-
}): GlobalEntry[];
|
|
42
|
-
/**
|
|
43
|
-
* Recall entries with a per-entry confidence score (v6.3.0).
|
|
44
|
-
*
|
|
45
|
-
* Same matching as recall(), but each result carries a RecallConfidence so
|
|
46
|
-
* the consuming agent can weight memories by recency, author importance,
|
|
47
|
-
* cross-agent corroboration, prior usage, and keyword relevance rather than
|
|
48
|
-
* trusting every hit equally. Ordering switches from raw keyword score to
|
|
49
|
-
* blended confidence so the most trustworthy memories surface first.
|
|
50
|
-
*/
|
|
51
|
-
recallScored(opts?: {
|
|
52
|
-
projectId?: string;
|
|
53
|
-
agentTool?: AgentTool;
|
|
54
|
-
category?: string;
|
|
55
|
-
keywords?: string[];
|
|
56
|
-
limit?: number;
|
|
57
|
-
minImportance?: number;
|
|
40
|
+
/** Recall matching entries across projects and agents. */
|
|
41
|
+
recall(opts?: RecallOptions): GlobalEntry[];
|
|
42
|
+
/** Recall entries with heuristic ranking signals and an explanation of the match. */
|
|
43
|
+
recallScored(opts?: RecallOptions & {
|
|
58
44
|
minConfidence?: number;
|
|
59
45
|
}): ScoredGlobalEntry[];
|
|
60
|
-
|
|
46
|
+
private findMatches;
|
|
47
|
+
private compareEntries;
|
|
48
|
+
private recordRecall;
|
|
61
49
|
private computeConfidence;
|
|
62
|
-
/** Bump access count
|
|
50
|
+
/** Bump an entry's access count without replacing its persisted snapshot. */
|
|
63
51
|
touch(id: string): void;
|
|
64
52
|
recallByIds(ids: string[]): GlobalEntry[];
|
|
65
|
-
/** Chronological
|
|
66
|
-
timeline(opts?:
|
|
67
|
-
projectId?: string;
|
|
68
|
-
agentTool?: AgentTool;
|
|
69
|
-
category?: string;
|
|
70
|
-
limit?: number;
|
|
71
|
-
}): BrainTimelineEvent[];
|
|
53
|
+
/** Chronological memory stream for dashboards and handoffs. */
|
|
54
|
+
timeline(opts?: Pick<RecallOptions, 'projectId' | 'agentTool' | 'category' | 'limit'>): BrainTimelineEvent[];
|
|
72
55
|
getStats(): GlobalBrainStats;
|
|
73
|
-
|
|
56
|
+
private pendingWriteCount;
|
|
57
|
+
/** Absolute path to the on-disk brain store. */
|
|
74
58
|
get dbPath(): string;
|
|
75
|
-
|
|
59
|
+
getStorageHealth(): GlobalBrainStorageHealth;
|
|
60
|
+
/** Flush pending operations as one atomic commit against the latest snapshot. */
|
|
76
61
|
sync(): Promise<void>;
|
|
77
|
-
private
|
|
78
|
-
|
|
79
|
-
private
|
|
80
|
-
private
|
|
81
|
-
private
|
|
82
|
-
private
|
|
83
|
-
private
|
|
62
|
+
private commitPending;
|
|
63
|
+
private recordError;
|
|
64
|
+
private readLatestSnapshot;
|
|
65
|
+
private hydrateEntries;
|
|
66
|
+
private adoptSnapshot;
|
|
67
|
+
private refreshSnapshot;
|
|
68
|
+
private mergeOperations;
|
|
69
|
+
private serializeSnapshot;
|
|
70
|
+
private acquireLock;
|
|
71
|
+
private replaceSnapshot;
|
|
84
72
|
shutdown(): Promise<void>;
|
|
85
73
|
}
|
|
86
74
|
export declare function getGlobalBrain(config?: Partial<GlobalBrainConfig>): GlobalBrain;
|
|
75
|
+
export {};
|
|
87
76
|
//# sourceMappingURL=global-brain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-brain.d.ts","sourceRoot":"","sources":["../../src/brain/global-brain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"global-brain.d.ts","sourceRoot":"","sources":["../../src/brain/global-brain.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EAEX,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAsBrB,KAAK,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CAAC,CAAC;AAiDzF,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgHD,qEAAqE;AACrE,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA0B;IAC5D,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,QAAQ,C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