onbuzz 3.6.1 → 3.6.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/package.json +1 -1
- package/src/__test-utils__/fixtures/malformedJson.js +31 -0
- package/src/__test-utils__/globalSetup.js +9 -0
- package/src/__test-utils__/globalTeardown.js +12 -0
- package/src/__test-utils__/mockFactories.js +101 -0
- package/src/analyzers/__tests__/CSSAnalyzer.test.js +41 -0
- package/src/analyzers/__tests__/ConfigValidator.test.js +362 -0
- package/src/analyzers/__tests__/ESLintAnalyzer.test.js +271 -0
- package/src/analyzers/__tests__/JavaScriptAnalyzer.test.js +40 -0
- package/src/analyzers/__tests__/PrettierFormatter.test.js +197 -0
- package/src/analyzers/__tests__/PythonAnalyzer.test.js +208 -0
- package/src/analyzers/__tests__/SecurityAnalyzer.test.js +303 -0
- package/src/analyzers/__tests__/SparrowAnalyzer.test.js +270 -0
- package/src/analyzers/__tests__/TypeScriptAnalyzer.test.js +187 -0
- package/src/core/__tests__/agentPool.test.js +601 -0
- package/src/core/__tests__/agentScheduler.test.js +576 -0
- package/src/core/__tests__/contextManager.test.js +252 -0
- package/src/core/__tests__/flowExecutor.test.js +262 -0
- package/src/core/__tests__/messageProcessor.test.js +627 -0
- package/src/core/__tests__/orchestrator.test.js +257 -0
- package/src/core/__tests__/stateManager.test.js +375 -0
- package/src/core/agentPool.js +11 -1
- package/src/index.js +25 -9
- package/src/interfaces/terminal/__tests__/smoke/imports.test.js +3 -5
- package/src/services/__tests__/agentActivityService.test.js +319 -0
- package/src/services/__tests__/apiKeyManager.test.js +206 -0
- package/src/services/__tests__/benchmarkService.test.js +184 -0
- package/src/services/__tests__/budgetService.test.js +211 -0
- package/src/services/__tests__/contextInjectionService.test.js +205 -0
- package/src/services/__tests__/conversationCompactionService.test.js +280 -0
- package/src/services/__tests__/credentialVault.test.js +469 -0
- package/src/services/__tests__/errorHandler.test.js +314 -0
- package/src/services/__tests__/fileAttachmentService.test.js +278 -0
- package/src/services/__tests__/flowContextService.test.js +199 -0
- package/src/services/__tests__/memoryService.test.js +450 -0
- package/src/services/__tests__/modelRouterService.test.js +388 -0
- package/src/services/__tests__/modelsService.test.js +261 -0
- package/src/services/__tests__/portRegistry.test.js +123 -0
- package/src/services/__tests__/projectDetector.test.js +34 -0
- package/src/services/__tests__/promptService.test.js +242 -0
- package/src/services/__tests__/qualityInspector.test.js +97 -0
- package/src/services/__tests__/scheduleService.test.js +308 -0
- package/src/services/__tests__/serviceRegistry.test.js +74 -0
- package/src/services/__tests__/skillsService.test.js +402 -0
- package/src/services/__tests__/tokenCountingService.test.js +48 -0
- package/src/tools/__tests__/agentCommunicationTool.test.js +500 -0
- package/src/tools/__tests__/agentDelayTool.test.js +342 -0
- package/src/tools/__tests__/asyncToolManager.test.js +344 -0
- package/src/tools/__tests__/baseTool.test.js +420 -0
- package/src/tools/__tests__/codeMapTool.test.js +348 -0
- package/src/tools/__tests__/fileContentReplaceTool.test.js +309 -0
- package/src/tools/__tests__/fileSystemTool.test.js +717 -0
- package/src/tools/__tests__/fileTreeTool.test.js +274 -0
- package/src/tools/__tests__/helpTool.test.js +204 -0
- package/src/tools/__tests__/jobDoneTool.test.js +296 -0
- package/src/tools/__tests__/memoryTool.test.js +297 -0
- package/src/tools/__tests__/seekTool.test.js +282 -0
- package/src/tools/__tests__/skillsTool.test.js +226 -0
- package/src/tools/__tests__/staticAnalysisTool.test.js +509 -0
- package/src/tools/__tests__/taskManagerTool.test.js +725 -0
- package/src/tools/__tests__/terminalTool.test.js +384 -0
- package/src/tools/__tests__/userPromptTool.test.js +297 -0
- package/src/tools/__tests__/webTool.e2e.test.js +25 -11
- package/src/tools/webTool.js +6 -12
- package/src/types/__tests__/agent.test.js +499 -0
- package/src/types/__tests__/contextReference.test.js +606 -0
- package/src/types/__tests__/conversation.test.js +555 -0
- package/src/types/__tests__/toolCommand.test.js +584 -0
- package/src/types/contextReference.js +1 -1
- package/src/utilities/__tests__/attachmentValidator.test.js +80 -0
- package/src/utilities/__tests__/configManager.test.js +397 -0
- package/src/utilities/__tests__/constants.test.js +49 -0
- package/src/utilities/__tests__/directoryAccessManager.test.js +388 -0
- package/src/utilities/__tests__/fileProcessor.test.js +104 -0
- package/src/utilities/__tests__/jsonRepair.test.js +104 -0
- package/src/utilities/__tests__/logger.test.js +129 -0
- package/src/utilities/__tests__/platformUtils.test.js +87 -0
- package/src/utilities/__tests__/structuredFileValidator.test.js +263 -0
- package/src/utilities/__tests__/tagParser.test.js +887 -0
- package/src/utilities/__tests__/toolConstants.test.js +94 -0
- package/src/utilities/tagParser.js +2 -2
- package/src/tools/browserTool.js +0 -897
- package/src/utilities/platformUtils.test.js +0 -98
- /package/src/tools/{filesystemTool.js → fileSystemTool.js} +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jest, describe, test, expect, beforeEach } from '@jest/globals';
|
|
2
|
+
import {
|
|
3
|
+
TOOL_IDS,
|
|
4
|
+
identifyJsonStructure,
|
|
5
|
+
getToolIdFromAction,
|
|
6
|
+
isValidToolId,
|
|
7
|
+
getToolActions,
|
|
8
|
+
TOOL_ACTION_MAP,
|
|
9
|
+
JSON_STRUCTURES,
|
|
10
|
+
COMMAND_FORMATS
|
|
11
|
+
} from '../toolConstants.js';
|
|
12
|
+
|
|
13
|
+
describe('toolConstants', () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('TOOL_IDS', () => {
|
|
19
|
+
test('contains expected tool IDs', () => {
|
|
20
|
+
expect(TOOL_IDS.TERMINAL).toBe('terminal');
|
|
21
|
+
expect(TOOL_IDS.FILESYSTEM).toBe('filesystem');
|
|
22
|
+
expect(TOOL_IDS.WEB).toBe('web');
|
|
23
|
+
expect(TOOL_IDS.JOB_DONE).toBe('jobdone');
|
|
24
|
+
expect(TOOL_IDS.TASK_MANAGER).toBe('taskmanager');
|
|
25
|
+
expect(TOOL_IDS.AGENT_COMMUNICATION).toBe('agentcommunication');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('isValidToolId', () => {
|
|
30
|
+
test('returns true for known tools, false for unknown', () => {
|
|
31
|
+
expect(isValidToolId('terminal')).toBe(true);
|
|
32
|
+
expect(isValidToolId('filesystem')).toBe(true);
|
|
33
|
+
expect(isValidToolId('web')).toBe(true);
|
|
34
|
+
expect(isValidToolId('nonexistent-tool')).toBe(false);
|
|
35
|
+
expect(isValidToolId('')).toBe(false);
|
|
36
|
+
expect(isValidToolId(null)).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('getToolIdFromAction', () => {
|
|
41
|
+
test('returns correct tool for known actions', () => {
|
|
42
|
+
expect(getToolIdFromAction('run-command')).toBe('terminal');
|
|
43
|
+
expect(getToolIdFromAction('write-file')).toBe('filesystem');
|
|
44
|
+
expect(getToolIdFromAction('move-file')).toBe('filesystem');
|
|
45
|
+
// Note: 'read-file' is overridden by skills tool in TOOL_ACTION_MAP
|
|
46
|
+
expect(getToolIdFromAction('read-file')).toBe('skills');
|
|
47
|
+
expect(getToolIdFromAction('delay')).toBe('agentdelay');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('returns null for unknown action', () => {
|
|
51
|
+
expect(getToolIdFromAction('totally-unknown-action')).toBeNull();
|
|
52
|
+
expect(getToolIdFromAction(null)).toBeNull();
|
|
53
|
+
expect(getToolIdFromAction('')).toBeNull();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('identifyJsonStructure', () => {
|
|
58
|
+
test('identifies standard format { toolId, parameters }', () => {
|
|
59
|
+
const data = { toolId: 'terminal', parameters: { command: 'ls' } };
|
|
60
|
+
expect(identifyJsonStructure(data)).toBe(JSON_STRUCTURES.STANDARD);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('identifies actions array format', () => {
|
|
64
|
+
const data = { actions: [{ type: 'run-command' }] };
|
|
65
|
+
expect(identifyJsonStructure(data)).toBe(JSON_STRUCTURES.ACTIONS_ARRAY);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('identifies direct action format', () => {
|
|
69
|
+
const data = { type: 'run-command', command: 'ls' };
|
|
70
|
+
expect(identifyJsonStructure(data)).toBe(JSON_STRUCTURES.DIRECT_ACTION);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('returns null for non-object or unrecognized input', () => {
|
|
74
|
+
expect(identifyJsonStructure(null)).toBeNull();
|
|
75
|
+
expect(identifyJsonStructure('string')).toBeNull();
|
|
76
|
+
expect(identifyJsonStructure({ random: 'data' })).toBeNull();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe('getToolActions', () => {
|
|
81
|
+
test('returns array of actions for a valid tool', () => {
|
|
82
|
+
const terminalActions = getToolActions('terminal');
|
|
83
|
+
expect(Array.isArray(terminalActions)).toBe(true);
|
|
84
|
+
expect(terminalActions).toContain('run-command');
|
|
85
|
+
expect(terminalActions).toContain('change-directory');
|
|
86
|
+
expect(terminalActions.length).toBeGreaterThan(0);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('returns empty array for unknown tool', () => {
|
|
90
|
+
const actions = getToolActions('nonexistent-tool');
|
|
91
|
+
expect(actions).toEqual([]);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -401,8 +401,8 @@ class TagParser {
|
|
|
401
401
|
const matches = this.matchAll(content, this.patterns.agentRedirect);
|
|
402
402
|
|
|
403
403
|
for (const match of matches) {
|
|
404
|
-
const attributeString = match.groups[
|
|
405
|
-
const messageContent = match.groups[
|
|
404
|
+
const attributeString = match.groups[0];
|
|
405
|
+
const messageContent = match.groups[1].trim();
|
|
406
406
|
|
|
407
407
|
const attributes = this.parseAttributes(attributeString);
|
|
408
408
|
|