@cpretzinger/boss-claude 1.0.0 → 1.0.2
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/README.md +304 -1
- package/bin/boss-claude.js +1138 -0
- package/bin/commands/mode.js +250 -0
- package/bin/onyx-guard.js +259 -0
- package/bin/onyx-guard.sh +251 -0
- package/bin/prompts.js +284 -0
- package/bin/rollback.js +85 -0
- package/bin/setup-wizard.js +492 -0
- package/config/.env.example +17 -0
- package/lib/README.md +83 -0
- package/lib/agent-logger.js +61 -0
- package/lib/agents/memory-engineers/github-memory-engineer.js +251 -0
- package/lib/agents/memory-engineers/postgres-memory-engineer.js +633 -0
- package/lib/agents/memory-engineers/qdrant-memory-engineer.js +358 -0
- package/lib/agents/memory-engineers/redis-memory-engineer.js +383 -0
- package/lib/agents/memory-supervisor.js +526 -0
- package/lib/agents/registry.js +135 -0
- package/lib/auto-monitor.js +131 -0
- package/lib/checkpoint-hook.js +112 -0
- package/lib/checkpoint.js +319 -0
- package/lib/commentator.js +213 -0
- package/lib/context-scribe.js +120 -0
- package/lib/delegation-strategies.js +326 -0
- package/lib/hierarchy-validator.js +643 -0
- package/lib/index.js +15 -0
- package/lib/init-with-mode.js +261 -0
- package/lib/init.js +44 -6
- package/lib/memory-result-aggregator.js +252 -0
- package/lib/memory.js +35 -7
- package/lib/mode-enforcer.js +473 -0
- package/lib/onyx-banner.js +169 -0
- package/lib/onyx-identity.js +214 -0
- package/lib/onyx-monitor.js +381 -0
- package/lib/onyx-reminder.js +188 -0
- package/lib/onyx-tool-interceptor.js +341 -0
- package/lib/onyx-wrapper.js +315 -0
- package/lib/orchestrator-gate.js +334 -0
- package/lib/output-formatter.js +296 -0
- package/lib/postgres.js +1 -1
- package/lib/prompt-injector.js +220 -0
- package/lib/prompts.js +532 -0
- package/lib/session.js +153 -6
- package/lib/setup/README.md +187 -0
- package/lib/setup/env-manager.js +785 -0
- package/lib/setup/error-recovery.js +630 -0
- package/lib/setup/explain-scopes.js +385 -0
- package/lib/setup/github-instructions.js +333 -0
- package/lib/setup/github-repo.js +254 -0
- package/lib/setup/import-credentials.js +498 -0
- package/lib/setup/index.js +62 -0
- package/lib/setup/init-postgres.js +785 -0
- package/lib/setup/init-redis.js +456 -0
- package/lib/setup/integration-test.js +652 -0
- package/lib/setup/progress.js +357 -0
- package/lib/setup/rollback.js +670 -0
- package/lib/setup/rollback.test.js +452 -0
- package/lib/setup/setup-with-rollback.example.js +351 -0
- package/lib/setup/summary.js +400 -0
- package/lib/setup/test-github-setup.js +10 -0
- package/lib/setup/test-postgres-init.js +98 -0
- package/lib/setup/verify-setup.js +102 -0
- package/lib/task-agent-worker.js +235 -0
- package/lib/token-monitor.js +466 -0
- package/lib/tool-wrapper-integration.js +369 -0
- package/lib/tool-wrapper.js +387 -0
- package/lib/validators/README.md +497 -0
- package/lib/validators/config.js +583 -0
- package/lib/validators/config.test.js +175 -0
- package/lib/validators/github.js +310 -0
- package/lib/validators/github.test.js +61 -0
- package/lib/validators/index.js +15 -0
- package/lib/validators/postgres.js +525 -0
- package/package.json +98 -13
- package/scripts/benchmark-memory.js +433 -0
- package/scripts/check-secrets.sh +12 -0
- package/scripts/fetch-todos.mjs +148 -0
- package/scripts/graceful-shutdown.sh +156 -0
- package/scripts/install-onyx-hooks.js +373 -0
- package/scripts/install.js +119 -18
- package/scripts/redis-monitor.js +284 -0
- package/scripts/redis-setup.js +412 -0
- package/scripts/test-memory-retrieval.js +201 -0
- package/scripts/validate-exports.js +68 -0
- package/scripts/validate-package.js +120 -0
- package/scripts/verify-onyx-deployment.js +309 -0
- package/scripts/verify-redis-deployment.js +354 -0
- package/scripts/verify-redis-init.js +219 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Memory Engineer
|
|
3
|
+
*
|
|
4
|
+
* Long-term memory archive using GitHub Issues API
|
|
5
|
+
* - Async search with timeout handling (5s max)
|
|
6
|
+
* - Retry logic for failed requests
|
|
7
|
+
* - Integration with lib/memory.js functions
|
|
8
|
+
*
|
|
9
|
+
* @module lib/agents/memory-engineers/github-memory-engineer
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { saveMemory, searchMemory, getMemoryByIssue } from '../../memory.js';
|
|
13
|
+
|
|
14
|
+
const DEFAULT_TIMEOUT = 5000; // 5 seconds
|
|
15
|
+
const MAX_RETRIES = 3;
|
|
16
|
+
const RETRY_DELAY = 1000; // 1 second
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Sleep utility for retry delays
|
|
20
|
+
*/
|
|
21
|
+
function sleep(ms) {
|
|
22
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Wraps a promise with timeout
|
|
27
|
+
* FIX: Clear timeout to prevent race condition and memory leak
|
|
28
|
+
*/
|
|
29
|
+
function withTimeout(promise, timeoutMs = DEFAULT_TIMEOUT) {
|
|
30
|
+
let timeoutHandle;
|
|
31
|
+
|
|
32
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
33
|
+
timeoutHandle = setTimeout(() => reject(new Error(`Operation timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return Promise.race([
|
|
37
|
+
promise.then(result => {
|
|
38
|
+
clearTimeout(timeoutHandle);
|
|
39
|
+
return result;
|
|
40
|
+
}).catch(error => {
|
|
41
|
+
clearTimeout(timeoutHandle);
|
|
42
|
+
throw error;
|
|
43
|
+
}),
|
|
44
|
+
timeoutPromise
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Executes function with retry logic
|
|
50
|
+
*/
|
|
51
|
+
async function withRetry(fn, retries = MAX_RETRIES, delay = RETRY_DELAY) {
|
|
52
|
+
let lastError;
|
|
53
|
+
|
|
54
|
+
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
55
|
+
try {
|
|
56
|
+
return await fn();
|
|
57
|
+
} catch (error) {
|
|
58
|
+
lastError = error;
|
|
59
|
+
|
|
60
|
+
if (attempt < retries) {
|
|
61
|
+
console.warn(`Attempt ${attempt} failed: ${error.message}. Retrying in ${delay}ms...`);
|
|
62
|
+
await sleep(delay);
|
|
63
|
+
// FIX: Add jitter to prevent thundering herd
|
|
64
|
+
// Exponential backoff with +/- 25% jitter
|
|
65
|
+
const jitter = delay * 0.25 * (Math.random() * 2 - 1);
|
|
66
|
+
delay = (delay * 2) + jitter;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
throw new Error(`Failed after ${retries} attempts: ${lastError.message}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* GitHub Memory Engineer Class
|
|
76
|
+
*/
|
|
77
|
+
export class GitHubMemoryEngineer {
|
|
78
|
+
constructor(options = {}) {
|
|
79
|
+
this.timeout = options.timeout || DEFAULT_TIMEOUT;
|
|
80
|
+
this.maxRetries = options.maxRetries || MAX_RETRIES;
|
|
81
|
+
this.retryDelay = options.retryDelay || RETRY_DELAY;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Archive a session to GitHub Issues
|
|
86
|
+
*
|
|
87
|
+
* @param {Object} sessionData - Session data to archive
|
|
88
|
+
* @param {string} sessionData.repo_name - Repository/project name
|
|
89
|
+
* @param {string} sessionData.summary - Brief summary of session
|
|
90
|
+
* @param {string} sessionData.content - Full session content (JSON string)
|
|
91
|
+
* @param {string[]} sessionData.tags - Optional tags for categorization
|
|
92
|
+
* @returns {Promise<Object>} Created issue details
|
|
93
|
+
*/
|
|
94
|
+
async archiveSession(sessionData) {
|
|
95
|
+
const operation = () => saveMemory(sessionData);
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
const result = await withTimeout(
|
|
99
|
+
withRetry(operation, this.maxRetries, this.retryDelay),
|
|
100
|
+
this.timeout
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
success: true,
|
|
105
|
+
...result
|
|
106
|
+
};
|
|
107
|
+
} catch (error) {
|
|
108
|
+
return {
|
|
109
|
+
success: false,
|
|
110
|
+
error: error.message,
|
|
111
|
+
operation: 'archiveSession'
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Search GitHub Issues for relevant memories
|
|
118
|
+
*
|
|
119
|
+
* @param {string} query - Search query
|
|
120
|
+
* @param {number} limit - Maximum number of results (default: 5)
|
|
121
|
+
* @returns {Promise<Object>} Search results with memories
|
|
122
|
+
*/
|
|
123
|
+
async searchArchive(query, limit = 5) {
|
|
124
|
+
const operation = () => searchMemory(query, limit);
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
const results = await withTimeout(
|
|
128
|
+
withRetry(operation, this.maxRetries, this.retryDelay),
|
|
129
|
+
this.timeout
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
success: true,
|
|
134
|
+
query,
|
|
135
|
+
count: results.length,
|
|
136
|
+
memories: results
|
|
137
|
+
};
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
error: error.message,
|
|
142
|
+
query,
|
|
143
|
+
operation: 'searchArchive'
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Retrieve specific memory by issue number
|
|
150
|
+
*
|
|
151
|
+
* @param {number} issueNumber - GitHub issue number
|
|
152
|
+
* @returns {Promise<Object>} Memory details
|
|
153
|
+
*/
|
|
154
|
+
async retrieveMemory(issueNumber) {
|
|
155
|
+
const operation = () => getMemoryByIssue(issueNumber);
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
const memory = await withTimeout(
|
|
159
|
+
withRetry(operation, this.maxRetries, this.retryDelay),
|
|
160
|
+
this.timeout
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
success: true,
|
|
165
|
+
memory
|
|
166
|
+
};
|
|
167
|
+
} catch (error) {
|
|
168
|
+
return {
|
|
169
|
+
success: false,
|
|
170
|
+
error: error.message,
|
|
171
|
+
issueNumber,
|
|
172
|
+
operation: 'retrieveMemory'
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Health check - verifies GitHub API connectivity
|
|
179
|
+
*
|
|
180
|
+
* @returns {Promise<Object>} Health status
|
|
181
|
+
*/
|
|
182
|
+
async healthCheck() {
|
|
183
|
+
try {
|
|
184
|
+
// Quick search with minimal timeout
|
|
185
|
+
const result = await withTimeout(
|
|
186
|
+
searchMemory('test', 1),
|
|
187
|
+
2000 // 2 second timeout for health check
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
success: true,
|
|
192
|
+
status: 'healthy',
|
|
193
|
+
message: 'GitHub API connection successful'
|
|
194
|
+
};
|
|
195
|
+
} catch (error) {
|
|
196
|
+
return {
|
|
197
|
+
success: false,
|
|
198
|
+
status: 'unhealthy',
|
|
199
|
+
error: error.message
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Batch archive multiple sessions
|
|
206
|
+
*
|
|
207
|
+
* @param {Object[]} sessions - Array of session data objects
|
|
208
|
+
* @returns {Promise<Object>} Batch operation results
|
|
209
|
+
*/
|
|
210
|
+
async batchArchive(sessions) {
|
|
211
|
+
const results = {
|
|
212
|
+
success: [],
|
|
213
|
+
failed: [],
|
|
214
|
+
total: sessions.length
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
for (const session of sessions) {
|
|
218
|
+
const result = await this.archiveSession(session);
|
|
219
|
+
|
|
220
|
+
if (result.success) {
|
|
221
|
+
results.success.push({
|
|
222
|
+
repo_name: session.repo_name,
|
|
223
|
+
issue_number: result.issue_number,
|
|
224
|
+
url: result.url
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
results.failed.push({
|
|
228
|
+
repo_name: session.repo_name,
|
|
229
|
+
error: result.error
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return {
|
|
235
|
+
success: results.failed.length === 0,
|
|
236
|
+
...results
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Factory function to create GitHub Memory Engineer instance
|
|
243
|
+
*/
|
|
244
|
+
export function createGitHubMemoryEngineer(options) {
|
|
245
|
+
return new GitHubMemoryEngineer(options);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Default export
|
|
250
|
+
*/
|
|
251
|
+
export default GitHubMemoryEngineer;
|