@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.
Files changed (87) hide show
  1. package/README.md +304 -1
  2. package/bin/boss-claude.js +1138 -0
  3. package/bin/commands/mode.js +250 -0
  4. package/bin/onyx-guard.js +259 -0
  5. package/bin/onyx-guard.sh +251 -0
  6. package/bin/prompts.js +284 -0
  7. package/bin/rollback.js +85 -0
  8. package/bin/setup-wizard.js +492 -0
  9. package/config/.env.example +17 -0
  10. package/lib/README.md +83 -0
  11. package/lib/agent-logger.js +61 -0
  12. package/lib/agents/memory-engineers/github-memory-engineer.js +251 -0
  13. package/lib/agents/memory-engineers/postgres-memory-engineer.js +633 -0
  14. package/lib/agents/memory-engineers/qdrant-memory-engineer.js +358 -0
  15. package/lib/agents/memory-engineers/redis-memory-engineer.js +383 -0
  16. package/lib/agents/memory-supervisor.js +526 -0
  17. package/lib/agents/registry.js +135 -0
  18. package/lib/auto-monitor.js +131 -0
  19. package/lib/checkpoint-hook.js +112 -0
  20. package/lib/checkpoint.js +319 -0
  21. package/lib/commentator.js +213 -0
  22. package/lib/context-scribe.js +120 -0
  23. package/lib/delegation-strategies.js +326 -0
  24. package/lib/hierarchy-validator.js +643 -0
  25. package/lib/index.js +15 -0
  26. package/lib/init-with-mode.js +261 -0
  27. package/lib/init.js +44 -6
  28. package/lib/memory-result-aggregator.js +252 -0
  29. package/lib/memory.js +35 -7
  30. package/lib/mode-enforcer.js +473 -0
  31. package/lib/onyx-banner.js +169 -0
  32. package/lib/onyx-identity.js +214 -0
  33. package/lib/onyx-monitor.js +381 -0
  34. package/lib/onyx-reminder.js +188 -0
  35. package/lib/onyx-tool-interceptor.js +341 -0
  36. package/lib/onyx-wrapper.js +315 -0
  37. package/lib/orchestrator-gate.js +334 -0
  38. package/lib/output-formatter.js +296 -0
  39. package/lib/postgres.js +1 -1
  40. package/lib/prompt-injector.js +220 -0
  41. package/lib/prompts.js +532 -0
  42. package/lib/session.js +153 -6
  43. package/lib/setup/README.md +187 -0
  44. package/lib/setup/env-manager.js +785 -0
  45. package/lib/setup/error-recovery.js +630 -0
  46. package/lib/setup/explain-scopes.js +385 -0
  47. package/lib/setup/github-instructions.js +333 -0
  48. package/lib/setup/github-repo.js +254 -0
  49. package/lib/setup/import-credentials.js +498 -0
  50. package/lib/setup/index.js +62 -0
  51. package/lib/setup/init-postgres.js +785 -0
  52. package/lib/setup/init-redis.js +456 -0
  53. package/lib/setup/integration-test.js +652 -0
  54. package/lib/setup/progress.js +357 -0
  55. package/lib/setup/rollback.js +670 -0
  56. package/lib/setup/rollback.test.js +452 -0
  57. package/lib/setup/setup-with-rollback.example.js +351 -0
  58. package/lib/setup/summary.js +400 -0
  59. package/lib/setup/test-github-setup.js +10 -0
  60. package/lib/setup/test-postgres-init.js +98 -0
  61. package/lib/setup/verify-setup.js +102 -0
  62. package/lib/task-agent-worker.js +235 -0
  63. package/lib/token-monitor.js +466 -0
  64. package/lib/tool-wrapper-integration.js +369 -0
  65. package/lib/tool-wrapper.js +387 -0
  66. package/lib/validators/README.md +497 -0
  67. package/lib/validators/config.js +583 -0
  68. package/lib/validators/config.test.js +175 -0
  69. package/lib/validators/github.js +310 -0
  70. package/lib/validators/github.test.js +61 -0
  71. package/lib/validators/index.js +15 -0
  72. package/lib/validators/postgres.js +525 -0
  73. package/package.json +98 -13
  74. package/scripts/benchmark-memory.js +433 -0
  75. package/scripts/check-secrets.sh +12 -0
  76. package/scripts/fetch-todos.mjs +148 -0
  77. package/scripts/graceful-shutdown.sh +156 -0
  78. package/scripts/install-onyx-hooks.js +373 -0
  79. package/scripts/install.js +119 -18
  80. package/scripts/redis-monitor.js +284 -0
  81. package/scripts/redis-setup.js +412 -0
  82. package/scripts/test-memory-retrieval.js +201 -0
  83. package/scripts/validate-exports.js +68 -0
  84. package/scripts/validate-package.js +120 -0
  85. package/scripts/verify-onyx-deployment.js +309 -0
  86. package/scripts/verify-redis-deployment.js +354 -0
  87. package/scripts/verify-redis-init.js +219 -0
@@ -0,0 +1,369 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * TOOL WRAPPER INTEGRATION
4
+ *
5
+ * Integration layer for Tool Wrapper system.
6
+ * Provides hooks and utilities for integrating auto-delegation
7
+ * into Boss Claude and ONYX agents.
8
+ */
9
+
10
+ import chalk from 'chalk';
11
+ import toolWrapper from './tool-wrapper.js';
12
+ import taskWorker from './task-agent-worker.js';
13
+
14
+ /**
15
+ * Initialize Tool Wrapper system
16
+ *
17
+ * @param {Object} config - Configuration options
18
+ * @returns {Object} Integration interface
19
+ */
20
+ export function initializeToolWrapper(config = {}) {
21
+ const {
22
+ agentName = 'ONYX',
23
+ taskExecutor = null,
24
+ enabled = true,
25
+ verbose = false
26
+ } = config;
27
+
28
+ // Configure tool wrapper
29
+ if (agentName) {
30
+ toolWrapper.agentName = agentName;
31
+ }
32
+
33
+ toolWrapper.setEnabled(enabled);
34
+
35
+ // Configure task executor
36
+ if (taskExecutor) {
37
+ toolWrapper.setTaskExecutor(taskExecutor);
38
+ }
39
+
40
+ if (verbose) {
41
+ console.log(chalk.blue('\nšŸ”§ Tool Wrapper Initialized'));
42
+ console.log(chalk.dim('─'.repeat(60)));
43
+ console.log(chalk.white(`Agent: ${chalk.bold(agentName)}`));
44
+ console.log(chalk.white(`Status: ${enabled ? chalk.green('ENABLED') : chalk.red('DISABLED')}`));
45
+ console.log(chalk.white(`Task Executor: ${taskExecutor ? chalk.green('CONFIGURED') : chalk.yellow('NOT CONFIGURED')}`));
46
+ console.log(chalk.dim('─'.repeat(60)));
47
+ }
48
+
49
+ return {
50
+ toolWrapper,
51
+ taskWorker,
52
+ executeTool: toolWrapper.executeTool.bind(toolWrapper),
53
+ setTaskExecutor: toolWrapper.setTaskExecutor.bind(toolWrapper),
54
+ getStats: toolWrapper.getStats.bind(toolWrapper),
55
+ printReport: toolWrapper.printReport.bind(toolWrapper),
56
+ reset: toolWrapper.reset.bind(toolWrapper)
57
+ };
58
+ }
59
+
60
+ /**
61
+ * Create tool execution wrapper for specific agent
62
+ *
63
+ * @param {string} agentName - Name of agent
64
+ * @param {Function} taskExecutor - Task tool executor function
65
+ * @returns {Function} Wrapped executeTool function
66
+ */
67
+ export function createAgentToolWrapper(agentName, taskExecutor = null) {
68
+ const wrapperConfig = {
69
+ agentName,
70
+ taskExecutor,
71
+ enabled: true
72
+ };
73
+
74
+ const wrapper = initializeToolWrapper(wrapperConfig);
75
+
76
+ // Return wrapped function with agent context
77
+ return async function executeToolWithDelegation(toolName, toolParams, options = {}) {
78
+ return await wrapper.executeTool(toolName, toolParams, {
79
+ ...options,
80
+ context: {
81
+ agentName,
82
+ ...options.context
83
+ }
84
+ });
85
+ };
86
+ }
87
+
88
+ /**
89
+ * Hook into Read tool
90
+ */
91
+ export function hookRead(originalReadFn, agentName = 'ONYX') {
92
+ return async function wrappedRead(params, options = {}) {
93
+ const result = await toolWrapper.executeTool('Read', params, {
94
+ executor: originalReadFn,
95
+ context: { agentName },
96
+ ...options
97
+ });
98
+
99
+ return result.success ? result.result : result;
100
+ };
101
+ }
102
+
103
+ /**
104
+ * Hook into Write tool
105
+ */
106
+ export function hookWrite(originalWriteFn, agentName = 'ONYX') {
107
+ return async function wrappedWrite(params, options = {}) {
108
+ const result = await toolWrapper.executeTool('Write', params, {
109
+ executor: originalWriteFn,
110
+ context: { agentName },
111
+ ...options
112
+ });
113
+
114
+ return result.success ? result.result : result;
115
+ };
116
+ }
117
+
118
+ /**
119
+ * Hook into Edit tool
120
+ */
121
+ export function hookEdit(originalEditFn, agentName = 'ONYX') {
122
+ return async function wrappedEdit(params, options = {}) {
123
+ const result = await toolWrapper.executeTool('Edit', params, {
124
+ executor: originalEditFn,
125
+ context: { agentName },
126
+ ...options
127
+ });
128
+
129
+ return result.success ? result.result : result;
130
+ };
131
+ }
132
+
133
+ /**
134
+ * Hook into Bash tool
135
+ */
136
+ export function hookBash(originalBashFn, agentName = 'ONYX') {
137
+ return async function wrappedBash(params, options = {}) {
138
+ const result = await toolWrapper.executeTool('Bash', params, {
139
+ executor: originalBashFn,
140
+ context: { agentName },
141
+ ...options
142
+ });
143
+
144
+ return result.success ? result.result : result;
145
+ };
146
+ }
147
+
148
+ /**
149
+ * Hook into Grep tool
150
+ */
151
+ export function hookGrep(originalGrepFn, agentName = 'ONYX') {
152
+ return async function wrappedGrep(params, options = {}) {
153
+ const result = await toolWrapper.executeTool('Grep', params, {
154
+ executor: originalGrepFn,
155
+ context: { agentName },
156
+ ...options
157
+ });
158
+
159
+ return result.success ? result.result : result;
160
+ };
161
+ }
162
+
163
+ /**
164
+ * Hook into Glob tool
165
+ */
166
+ export function hookGlob(originalGlobFn, agentName = 'ONYX') {
167
+ return async function wrappedGlob(params, options = {}) {
168
+ const result = await toolWrapper.executeTool('Glob', params, {
169
+ executor: originalGlobFn,
170
+ context: { agentName },
171
+ ...options
172
+ });
173
+
174
+ return result.success ? result.result : result;
175
+ };
176
+ }
177
+
178
+ /**
179
+ * Hook all tools at once
180
+ *
181
+ * @param {Object} tools - Object with original tool functions
182
+ * @param {string} agentName - Name of agent
183
+ * @returns {Object} Object with wrapped tool functions
184
+ */
185
+ export function hookAllTools(tools, agentName = 'ONYX') {
186
+ const wrapped = {};
187
+
188
+ if (tools.Read) {
189
+ wrapped.Read = hookRead(tools.Read, agentName);
190
+ }
191
+
192
+ if (tools.Write) {
193
+ wrapped.Write = hookWrite(tools.Write, agentName);
194
+ }
195
+
196
+ if (tools.Edit) {
197
+ wrapped.Edit = hookEdit(tools.Edit, agentName);
198
+ }
199
+
200
+ if (tools.Bash) {
201
+ wrapped.Bash = hookBash(tools.Bash, agentName);
202
+ }
203
+
204
+ if (tools.Grep) {
205
+ wrapped.Grep = hookGrep(tools.Grep, agentName);
206
+ }
207
+
208
+ if (tools.Glob) {
209
+ wrapped.Glob = hookGlob(tools.Glob, agentName);
210
+ }
211
+
212
+ return wrapped;
213
+ }
214
+
215
+ /**
216
+ * Verify wrapper is intercepting correctly
217
+ *
218
+ * @returns {Promise<Object>} Verification results
219
+ */
220
+ export async function verifyWrapper() {
221
+ console.log(chalk.blue('\nšŸ” Verifying Tool Wrapper Integration'));
222
+ console.log(chalk.dim('═'.repeat(60)));
223
+
224
+ const results = {
225
+ passed: [],
226
+ failed: [],
227
+ total: 0
228
+ };
229
+
230
+ const testTools = [
231
+ {
232
+ name: 'Read',
233
+ params: { file_path: '/test/path.js' },
234
+ shouldDelegate: true
235
+ },
236
+ {
237
+ name: 'Write',
238
+ params: { file_path: '/test/path.js', content: 'test' },
239
+ shouldDelegate: true
240
+ },
241
+ {
242
+ name: 'Edit',
243
+ params: { file_path: '/test/path.js', old_string: 'a', new_string: 'b' },
244
+ shouldDelegate: true
245
+ },
246
+ {
247
+ name: 'Bash',
248
+ params: { command: 'echo test' },
249
+ shouldDelegate: true
250
+ },
251
+ {
252
+ name: 'Grep',
253
+ params: { pattern: 'test', path: '/src' },
254
+ shouldDelegate: true
255
+ },
256
+ {
257
+ name: 'Glob',
258
+ params: { pattern: '**/*.js' },
259
+ shouldDelegate: true
260
+ },
261
+ {
262
+ name: 'Task',
263
+ params: { description: 'Test task' },
264
+ shouldDelegate: false
265
+ }
266
+ ];
267
+
268
+ for (const test of testTools) {
269
+ results.total++;
270
+
271
+ try {
272
+ const result = await toolWrapper.executeTool(test.name, test.params);
273
+
274
+ const delegated = result.delegated === true;
275
+ const expectedDelegation = test.shouldDelegate;
276
+
277
+ if (delegated === expectedDelegation) {
278
+ results.passed.push({
279
+ tool: test.name,
280
+ expected: expectedDelegation ? 'delegated' : 'direct',
281
+ actual: delegated ? 'delegated' : 'direct',
282
+ success: true
283
+ });
284
+ console.log(chalk.green(`āœ“ ${test.name}: ${delegated ? 'delegated' : 'direct'} (expected)`));
285
+ } else {
286
+ results.failed.push({
287
+ tool: test.name,
288
+ expected: expectedDelegation ? 'delegated' : 'direct',
289
+ actual: delegated ? 'delegated' : 'direct',
290
+ success: false
291
+ });
292
+ console.log(chalk.red(`āœ— ${test.name}: ${delegated ? 'delegated' : 'direct'} (expected ${expectedDelegation ? 'delegated' : 'direct'})`));
293
+ }
294
+
295
+ } catch (error) {
296
+ results.failed.push({
297
+ tool: test.name,
298
+ error: error.message,
299
+ success: false
300
+ });
301
+ console.log(chalk.red(`āœ— ${test.name}: ERROR - ${error.message}`));
302
+ }
303
+ }
304
+
305
+ console.log(chalk.dim('═'.repeat(60)));
306
+ console.log(chalk.white(`Results: ${chalk.green(results.passed.length)} passed, ${chalk.red(results.failed.length)} failed`));
307
+ console.log(chalk.dim('═'.repeat(60)));
308
+
309
+ // Reset after verification
310
+ toolWrapper.reset();
311
+
312
+ return results;
313
+ }
314
+
315
+ /**
316
+ * Get integration status
317
+ */
318
+ export function getIntegrationStatus() {
319
+ const stats = toolWrapper.getStats();
320
+ const taskStats = taskWorker.getStats();
321
+
322
+ return {
323
+ wrapper: {
324
+ agentName: toolWrapper.agentName,
325
+ enabled: toolWrapper.enabled,
326
+ stats
327
+ },
328
+ taskWorker: {
329
+ configured: taskWorker.taskExecutor !== null,
330
+ stats: taskStats
331
+ },
332
+ timestamp: new Date().toISOString()
333
+ };
334
+ }
335
+
336
+ /**
337
+ * Print integration status
338
+ */
339
+ export function printIntegrationStatus() {
340
+ const status = getIntegrationStatus();
341
+
342
+ console.log(chalk.blue('\nšŸ“Š TOOL WRAPPER INTEGRATION STATUS'));
343
+ console.log(chalk.dim('═'.repeat(60)));
344
+ console.log(chalk.white(`Agent: ${chalk.bold(status.wrapper.agentName)}`));
345
+ console.log(chalk.white(`Wrapper: ${status.wrapper.enabled ? chalk.green('ENABLED') : chalk.red('DISABLED')}`));
346
+ console.log(chalk.white(`Task Executor: ${status.taskWorker.configured ? chalk.green('CONFIGURED') : chalk.yellow('NOT CONFIGURED')}`));
347
+ console.log(chalk.dim('─'.repeat(60)));
348
+ console.log(chalk.white(`Total Calls: ${chalk.magenta(status.wrapper.stats.total)}`));
349
+ console.log(chalk.white(`Delegation Rate: ${chalk.cyan(status.wrapper.stats.delegationRate + '%')}`));
350
+ console.log(chalk.white(`Task Success Rate: ${status.taskWorker.configured ? chalk.green(status.taskWorker.stats.successRate + '%') : chalk.dim('N/A')}`));
351
+ console.log(chalk.dim('═'.repeat(60)));
352
+ }
353
+
354
+ export default {
355
+ initializeToolWrapper,
356
+ createAgentToolWrapper,
357
+ hookRead,
358
+ hookWrite,
359
+ hookEdit,
360
+ hookBash,
361
+ hookGrep,
362
+ hookGlob,
363
+ hookAllTools,
364
+ verifyWrapper,
365
+ getIntegrationStatus,
366
+ printIntegrationStatus,
367
+ toolWrapper,
368
+ taskWorker
369
+ };