devicely 2.3.3 → 2.3.5

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 (106) hide show
  1. package/README.md +168 -249
  2. package/bin/devicely.js +1 -1
  3. package/config/apps_presets.conf +19 -0
  4. package/lib/actionSchema.js +1 -0
  5. package/lib/advanced-logger.js +1 -1
  6. package/lib/aiProviders.js +1 -1
  7. package/lib/aiProvidersConfig.js +1 -1
  8. package/lib/androidDeviceDetection.js +1 -1
  9. package/lib/api/v1/auth.js +1 -0
  10. package/lib/api/v1/deviceResolver.js +1 -0
  11. package/lib/api/v1/index.js +1 -0
  12. package/lib/api/v1/operations.js +1 -0
  13. package/lib/api/v1/passcode.js +1 -0
  14. package/lib/api/v1/resultNormalizer.js +1 -0
  15. package/lib/api/v1/screenCapture.js +1 -0
  16. package/lib/api/v1/uiTree.js +1 -0
  17. package/lib/appListing.js +1 -0
  18. package/lib/appMappings.js +1 -1
  19. package/lib/cognitiveLocator.js +1 -1
  20. package/lib/commanderService.js +1 -1
  21. package/lib/deviceContextProvider.js +1 -0
  22. package/lib/deviceDetection.js +1 -1
  23. package/lib/deviceDriver.js +1 -0
  24. package/lib/deviceHealthMonitor.js +1 -0
  25. package/lib/devices.js +1 -1
  26. package/lib/doctor.js +1 -1
  27. package/lib/encryption.js +1 -1
  28. package/lib/executor.js +1 -1
  29. package/lib/frontend/asset-manifest.json +5 -7
  30. package/lib/frontend/index.html +1 -1
  31. package/lib/frontend/static/js/main.bd89f5ef.js +2 -0
  32. package/lib/hybridAI.js +1 -1
  33. package/lib/intelligentLocatorService.js +1 -1
  34. package/lib/lightweightAI.js +1 -1
  35. package/lib/localBuiltInAI.js +1 -1
  36. package/lib/localBuiltInAI_backup.js +1 -1
  37. package/lib/localBuiltInAI_simple.js +1 -1
  38. package/lib/locatorStrategy.js +1 -1
  39. package/lib/logger.js +1 -1
  40. package/lib/mcp/audit.js +1 -0
  41. package/lib/mcp/client.js +1 -0
  42. package/lib/mcp/clientConfigs.js +1 -0
  43. package/lib/mcp/format.js +1 -0
  44. package/lib/mcp/http.js +1 -0
  45. package/lib/mcp/index.js +1 -0
  46. package/lib/mcp/policy.js +1 -0
  47. package/lib/mcp/prompts.js +1 -0
  48. package/lib/mcp/resources.js +1 -0
  49. package/lib/mcp/schemas.js +1 -0
  50. package/lib/mcp/stdio.js +3 -0
  51. package/lib/mcp/tools/act.js +1 -0
  52. package/lib/mcp/tools/apps.js +1 -0
  53. package/lib/mcp/tools/devices.js +1 -0
  54. package/lib/mcp/tools/diagnostics.js +1 -0
  55. package/lib/mcp/tools/flow.js +1 -0
  56. package/lib/mcp/tools/multi.js +1 -0
  57. package/lib/mcp/tools/observe.js +1 -0
  58. package/lib/mcp/tools/recordings.js +1 -0
  59. package/lib/mjpegStream.js +1 -0
  60. package/lib/package.json +9 -1
  61. package/lib/quick-start-logger.js +1 -1
  62. package/lib/recordingSteps.js +1 -0
  63. package/lib/recordingStore.js +1 -0
  64. package/lib/replayEngine.js +1 -0
  65. package/lib/scriptLoader.js +1 -1
  66. package/lib/server.js +1 -1
  67. package/lib/tensorflowAI.js +1 -1
  68. package/lib/tinyAI.js +1 -1
  69. package/lib/universalSessionManager.js +1 -1
  70. package/lib/virtualDevices/androidEmulatorProvider.js +1 -0
  71. package/lib/virtualDevices/index.js +1 -0
  72. package/lib/virtualDevices/iosSimulatorCommands.js +1 -0
  73. package/lib/virtualDevices/iosSimulatorProvider.js +1 -0
  74. package/lib/virtualDevices/parsers.js +1 -0
  75. package/lib/virtualDevices/ports.js +1 -0
  76. package/lib/virtualDevices/toolchain.js +1 -0
  77. package/lib/virtualDevices/wdaSimulator.js +1 -0
  78. package/package.json +8 -14
  79. package/scripts/shell/android_device_control.enc +1 -1
  80. package/scripts/shell/connect_android_usb_multi_final.enc +1 -1
  81. package/scripts/shell/connect_ios_usb_multi_final.enc +1 -1
  82. package/scripts/shell/connect_ios_wireless_multi_final.enc +1 -1
  83. package/lib/.env.example +0 -20
  84. package/lib/aiProviders.js.strategic-backup +0 -657
  85. package/lib/devices.js.strategic-backup +0 -57
  86. package/lib/encryption.js.strategic-backup +0 -61
  87. package/lib/eslint.config.js +0 -1
  88. package/lib/executor.js.strategic-backup +0 -107
  89. package/lib/frontend/static/css/main.ed39ba12.css +0 -2
  90. package/lib/frontend/static/js/main.bb9425de.js +0 -3
  91. package/lib/jest.config.js +0 -1
  92. package/lib/logger-demo.js +0 -2
  93. package/lib/logger-integration-examples.js +0 -102
  94. package/lib/public/asset-manifest.json +0 -13
  95. package/lib/public/index.html +0 -1
  96. package/lib/public/static/css/main.ed39ba12.css +0 -2
  97. package/lib/public/voice-test.html +0 -156
  98. package/lib/server.js.strategic-backup +0 -6298
  99. package/lib/tensorflowAI.js.strategic-backup +0 -717
  100. package/lib/tests/__mocks__/logger.js +0 -12
  101. package/lib/tests/integration/deviceSync.test.js +0 -74
  102. package/lib/tests/setup/testSetup.js +0 -1
  103. package/lib/tests/unit/commanderService.test.js +0 -70
  104. package/lib/tsconfig.json +0 -18
  105. /package/lib/{public → frontend}/static/css/main.1bbcfef2.css +0 -0
  106. /package/lib/frontend/static/js/{main.bb9425de.js.LICENSE.txt → main.bd89f5ef.js.LICENSE.txt} +0 -0
@@ -1,12 +0,0 @@
1
- class MockLogger {
2
- constructor(module) {
3
- this.module = module;
4
- }
5
- info(msg) {}
6
- error(msg, err) {}
7
- warn(msg) {}
8
- debug(msg) {}
9
- verbose(msg) {}
10
- }
11
-
12
- module.exports = MockLogger;
@@ -1,74 +0,0 @@
1
- const axios = require('axios');
2
- const CommanderService = require('../../commanderService');
3
-
4
- // Need to mock default export properly for CommonJS
5
- jest.mock('axios', () => {
6
- return {
7
- post: jest.fn(),
8
- get: jest.fn(),
9
- delete: jest.fn()
10
- };
11
- });
12
- jest.mock('../../logger');
13
-
14
- describe('Device Sync Integration', () => {
15
- let commander;
16
- let mockWss;
17
- let mockConnectedDevices;
18
-
19
- beforeEach(() => {
20
- mockWss = {
21
- clients: new Set(),
22
- // mock broadcast implementation
23
- };
24
- mockConnectedDevices = [
25
- { name: 'LeaderDevice', udid: 'L1', platform: 'ios', port: 8100 },
26
- { name: 'Follower1', udid: 'F1', platform: 'ios', port: 8101 },
27
- { name: 'Follower2', udid: 'F2', platform: 'android', port: 8102 }
28
- ];
29
-
30
- global.sessionManager = {
31
- getByName: jest.fn((name) => {
32
- const dev = mockConnectedDevices.find(d => d.name === name);
33
- if (dev && dev.platform === 'ios') {
34
- return { sessionId: 'mock-session-id', port: dev.port };
35
- }
36
- return null;
37
- })
38
- };
39
-
40
- commander = new CommanderService(mockWss, mockConnectedDevices);
41
-
42
- // Silence some expected console errors during tests
43
- jest.spyOn(console, 'error').mockImplementation(() => {});
44
- jest.spyOn(console, 'log').mockImplementation(() => {});
45
- jest.spyOn(console, 'warn').mockImplementation(() => {});
46
- });
47
-
48
- afterEach(() => {
49
- jest.restoreAllMocks();
50
- });
51
-
52
- it('should recover from network drop using exponential backoff', async () => {
53
- commander.commanderDevice = mockConnectedDevices[0];
54
- const follower = mockConnectedDevices[1];
55
- // Erase global session to trigger /status lookup loop
56
- follower.sessionId = undefined;
57
- follower.wdaSessionId = undefined;
58
- commander.connectedDevices = [];
59
-
60
- let attempts = 0;
61
- require('axios').get.mockImplementation(async () => {
62
- attempts++;
63
- if (attempts < 3) throw new Error('ECONNREFUSED');
64
- return { data: { sessionId: 'mock-recovered-id' } };
65
- });
66
-
67
- await commander._executeOnFollowerWithLocators(follower, {}, 0, 0);
68
- expect(attempts).toBeGreaterThan(1);
69
-
70
- // Verify error catching allows graceful exit and won't crash process
71
- attempts = 0;
72
- await expect(commander._executeOnFollowerWithLocators(follower, {}, 0, 0)).resolves.not.toThrow();
73
- }, 20000);
74
- });
@@ -1 +0,0 @@
1
- jest.mock('../../logger', () => require('../__mocks__/logger'));
@@ -1,70 +0,0 @@
1
- const CommanderService = require('../../commanderService');
2
-
3
- // Mock out heavy dependencies
4
- jest.mock('child_process');
5
- jest.mock('axios');
6
- jest.mock('../../locatorStrategy');
7
- jest.mock('../../logger');
8
-
9
- describe('CommanderService', () => {
10
- let commander;
11
- let mockWss;
12
- let mockConnectedDevices;
13
-
14
- beforeEach(() => {
15
- mockWss = {
16
- clients: new Set(),
17
- removeListener: jest.fn(),
18
- removeAllListeners: jest.fn()
19
- };
20
- mockConnectedDevices = [];
21
-
22
- // Setup a clean instance for each test
23
- commander = new CommanderService(mockWss, mockConnectedDevices);
24
-
25
- // Add global session manager mock
26
- global.sessionManager = {
27
- getByName: jest.fn(),
28
- getSessionByDeviceName: jest.fn()
29
- };
30
- });
31
-
32
- afterEach(() => {
33
- jest.clearAllMocks();
34
- });
35
-
36
- describe('Connection Management', () => {
37
- it('should dispose resources cleanly via dispose()', () => {
38
- commander.isActive = true;
39
- commander.followerDevices.add({name: 'test_follower', platform: 'ios'});
40
- commander.eventQueue.push({ type: 'test' });
41
-
42
- // Setup fake intervals
43
- commander.screenStreamInterval = setInterval(() => {}, 1000);
44
- commander.touchMonitorInterval = setInterval(() => {}, 1000);
45
-
46
- commander.dispose();
47
-
48
- expect(commander.isActive).toBe(false);
49
- expect(commander.followerDevices.size).toBe(0);
50
- expect(commander.eventQueue.length).toBe(0);
51
- expect(commander.screenStreamInterval).toBeNull();
52
- expect(commander.touchMonitorInterval).toBeNull();
53
- });
54
-
55
- it('should reject invalid bounds for elements', () => {
56
- expect(commander.isElementInteractive('Button', { width: 0, height: 10, x: 10, y: 10 }, 'test')).toBe(false);
57
- expect(commander.isElementInteractive('Button', { width: 10, height: 10, x: -5, y: 10 }, 'test')).toBe(false);
58
- });
59
-
60
- it('should handle device drop gracefully clearing connected references', () => {
61
- commander.isActive = true;
62
- commander.commanderDevice = { name: 'Device1', platform: 'ios' };
63
- commander.followerDevices.add({name: 'Device2', platform: 'ios'});
64
-
65
- commander.removeFollower('Device2');
66
-
67
- expect(commander.followerDevices.size).toBe(0);
68
- });
69
- });
70
- });
package/lib/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2022",
4
- "module": "commonjs",
5
- "lib": ["es2022", "DOM"],
6
- "outDir": "./dist",
7
- "rootDir": "../../",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "noImplicitAny": true,
13
- "resolveJsonModule": true,
14
- "allowJs": true
15
- },
16
- "include": ["**/*.js"],
17
- "exclude": ["node_modules", "dist", "*.strategic-backup", "logger-integration-examples.js"]
18
- }