process-watchdog 1.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.
Files changed (117) hide show
  1. package/config/default.json +16 -0
  2. package/dashboard/watchdog.html +856 -0
  3. package/dist/api/routes.d.ts +6 -0
  4. package/dist/api/routes.d.ts.map +1 -0
  5. package/dist/api/routes.js +105 -0
  6. package/dist/api/routes.js.map +1 -0
  7. package/dist/api/server.d.ts +10 -0
  8. package/dist/api/server.d.ts.map +1 -0
  9. package/dist/api/server.js +16 -0
  10. package/dist/api/server.js.map +1 -0
  11. package/dist/config.d.ts +27 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +45 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/daemon/processwatchdog.err.log +973 -0
  16. package/dist/daemon/processwatchdog.exe +0 -0
  17. package/dist/daemon/processwatchdog.exe.config +6 -0
  18. package/dist/daemon/processwatchdog.out.log +2 -0
  19. package/dist/daemon/processwatchdog.wrapper.log +18 -0
  20. package/dist/daemon/processwatchdog.xml +30 -0
  21. package/dist/index.d.ts +3 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +203 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/installer/service.d.ts +3 -0
  26. package/dist/installer/service.d.ts.map +1 -0
  27. package/dist/installer/service.js +41 -0
  28. package/dist/installer/service.js.map +1 -0
  29. package/dist/integrations/mah.d.ts +3 -0
  30. package/dist/integrations/mah.d.ts.map +1 -0
  31. package/dist/integrations/mah.js +22 -0
  32. package/dist/integrations/mah.js.map +1 -0
  33. package/dist/integrations/total-recall.d.ts +3 -0
  34. package/dist/integrations/total-recall.d.ts.map +1 -0
  35. package/dist/integrations/total-recall.js +22 -0
  36. package/dist/integrations/total-recall.js.map +1 -0
  37. package/dist/platform/index.d.ts +4 -0
  38. package/dist/platform/index.d.ts.map +1 -0
  39. package/dist/platform/index.js +10 -0
  40. package/dist/platform/index.js.map +1 -0
  41. package/dist/platform/platform.interface.d.ts +42 -0
  42. package/dist/platform/platform.interface.d.ts.map +1 -0
  43. package/dist/platform/platform.interface.js +2 -0
  44. package/dist/platform/platform.interface.js.map +1 -0
  45. package/dist/platform/windows.d.ts +14 -0
  46. package/dist/platform/windows.d.ts.map +1 -0
  47. package/dist/platform/windows.js +162 -0
  48. package/dist/platform/windows.js.map +1 -0
  49. package/dist/plugins/cpu-monitor.d.ts +11 -0
  50. package/dist/plugins/cpu-monitor.d.ts.map +1 -0
  51. package/dist/plugins/cpu-monitor.js +57 -0
  52. package/dist/plugins/cpu-monitor.js.map +1 -0
  53. package/dist/plugins/disk-health.d.ts +11 -0
  54. package/dist/plugins/disk-health.d.ts.map +1 -0
  55. package/dist/plugins/disk-health.js +111 -0
  56. package/dist/plugins/disk-health.js.map +1 -0
  57. package/dist/plugins/memory-monitor.d.ts +11 -0
  58. package/dist/plugins/memory-monitor.d.ts.map +1 -0
  59. package/dist/plugins/memory-monitor.js +61 -0
  60. package/dist/plugins/memory-monitor.js.map +1 -0
  61. package/dist/plugins/plugin-loader.d.ts +4 -0
  62. package/dist/plugins/plugin-loader.d.ts.map +1 -0
  63. package/dist/plugins/plugin-loader.js +25 -0
  64. package/dist/plugins/plugin-loader.js.map +1 -0
  65. package/dist/plugins/plugin.interface.d.ts +28 -0
  66. package/dist/plugins/plugin.interface.d.ts.map +1 -0
  67. package/dist/plugins/plugin.interface.js +2 -0
  68. package/dist/plugins/plugin.interface.js.map +1 -0
  69. package/dist/plugins/process-guard.d.ts +11 -0
  70. package/dist/plugins/process-guard.d.ts.map +1 -0
  71. package/dist/plugins/process-guard.js +139 -0
  72. package/dist/plugins/process-guard.js.map +1 -0
  73. package/dist/plugins/startup-optimizer.d.ts +11 -0
  74. package/dist/plugins/startup-optimizer.d.ts.map +1 -0
  75. package/dist/plugins/startup-optimizer.js +78 -0
  76. package/dist/plugins/startup-optimizer.js.map +1 -0
  77. package/dist/scheduler.d.ts +16 -0
  78. package/dist/scheduler.d.ts.map +1 -0
  79. package/dist/scheduler.js +46 -0
  80. package/dist/scheduler.js.map +1 -0
  81. package/dist/store/history.d.ts +20 -0
  82. package/dist/store/history.d.ts.map +1 -0
  83. package/dist/store/history.js +60 -0
  84. package/dist/store/history.js.map +1 -0
  85. package/package.json +35 -0
  86. package/src/api/routes.ts +123 -0
  87. package/src/api/server.ts +20 -0
  88. package/src/config.ts +78 -0
  89. package/src/index.ts +228 -0
  90. package/src/installer/service.ts +50 -0
  91. package/src/integrations/mah.ts +22 -0
  92. package/src/integrations/total-recall.ts +27 -0
  93. package/src/platform/index.ts +13 -0
  94. package/src/platform/platform.interface.ts +46 -0
  95. package/src/platform/windows.ts +242 -0
  96. package/src/plugins/cpu-monitor.ts +67 -0
  97. package/src/plugins/disk-health.ts +128 -0
  98. package/src/plugins/memory-monitor.ts +70 -0
  99. package/src/plugins/plugin-loader.ts +27 -0
  100. package/src/plugins/plugin.interface.ts +31 -0
  101. package/src/plugins/process-guard.ts +165 -0
  102. package/src/plugins/startup-optimizer.ts +103 -0
  103. package/src/scheduler.ts +53 -0
  104. package/src/store/history.ts +90 -0
  105. package/tests/api/routes.test.ts +113 -0
  106. package/tests/config.test.ts +24 -0
  107. package/tests/platform/windows.test.ts +59 -0
  108. package/tests/plugins/cpu-monitor.test.ts +69 -0
  109. package/tests/plugins/disk-health.test.ts +69 -0
  110. package/tests/plugins/memory-monitor.test.ts +57 -0
  111. package/tests/plugins/plugin-loader.test.ts +35 -0
  112. package/tests/plugins/process-guard.test.ts +40 -0
  113. package/tests/plugins/startup-optimizer.test.ts +50 -0
  114. package/tests/scheduler.test.ts +69 -0
  115. package/tests/store/history.test.ts +89 -0
  116. package/tsconfig.json +18 -0
  117. package/vitest.config.ts +10 -0
Binary file
@@ -0,0 +1,6 @@
1
+ <configuration>
2
+ <startup>
3
+ <supportedRuntime version="v2.0.50727" />
4
+ <supportedRuntime version="v4.0" />
5
+ </startup>
6
+ </configuration>
@@ -0,0 +1,2 @@
1
+ [watchdog] Started with 5 plugin(s). Press Ctrl+C to stop.
2
+ [watchdog] Started with 5 plugin(s). Press Ctrl+C to stop.
@@ -0,0 +1,18 @@
1
+ 2026-04-11 22:49:37 - Starting C:\Program Files\nodejs\node.exe C:\Dev\process-watchdog\node_modules\node-windows\lib\wrapper.js --file C:\Dev\process-watchdog\dist\index.js --scriptoptions=start --log "ProcessWatchdog wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined
2
+ 2026-04-11 22:49:37 - Started 82532
3
+ 2026-04-12 00:07:07 - Stopping processwatchdog.exe
4
+ 2026-04-12 00:07:07 - ProcessKill 82532
5
+ 2026-04-12 00:07:07 - Shutdown exception
6
+ Message:Class not registered
7
+
8
+ Stacktrace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
9
+ at System.Management.ManagementScope.InitializeGuts(Object o)
10
+ at System.Management.ManagementScope.Initialize()
11
+ at System.Management.ManagementObjectSearcher.Initialize()
12
+ at System.Management.ManagementObjectSearcher.Get()
13
+ at winsw.WrapperService.GetChildPids(Int32 pid)
14
+ at winsw.WrapperService.StopProcessAndChildren(Int32 pid)
15
+ at winsw.WrapperService.StopIt()
16
+ at winsw.WrapperService.OnShutdown()
17
+ 2026-04-12 00:07:45 - Starting C:\Program Files\nodejs\node.exe C:\Dev\process-watchdog\node_modules\node-windows\lib\wrapper.js --file C:\Dev\process-watchdog\dist\index.js --scriptoptions=start --log "ProcessWatchdog wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined
18
+ 2026-04-12 00:07:45 - Started 6352
@@ -0,0 +1,30 @@
1
+ <service>
2
+ <id>processwatchdog.exe</id>
3
+ <name>ProcessWatchdog</name>
4
+ <description>Process Watchdog — PC health monitoring agent</description>
5
+ <executable>C:\Program Files\nodejs\node.exe</executable>
6
+ <argument>C:\Dev\process-watchdog\node_modules\node-windows\lib\wrapper.js</argument>
7
+ <argument>--file</argument>
8
+ <argument>C:\Dev\process-watchdog\dist\index.js</argument>
9
+ <argument>--scriptoptions=start</argument>
10
+ <argument>--log</argument>
11
+ <argument>ProcessWatchdog wrapper</argument>
12
+ <argument>--grow</argument>
13
+ <argument>0.25</argument>
14
+ <argument>--wait</argument>
15
+ <argument>1</argument>
16
+ <argument>--maxrestarts</argument>
17
+ <argument>3</argument>
18
+ <argument>--abortonerror</argument>
19
+ <argument>n</argument>
20
+ <argument>--stopparentfirst</argument>
21
+ <argument>undefined</argument>
22
+ <logmode>rotate</logmode>
23
+ <stoptimeout>30sec</stoptimeout>
24
+ <serviceaccount>
25
+ <domain>SURFACEAVI</domain>
26
+ <user>LocalSystem</user>
27
+ <password></password>
28
+ </serviceaccount>
29
+ <workingdirectory>C:\Dev\process-watchdog</workingdirectory>
30
+ </service>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { mkdirSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ import { loadConfig } from './config.js';
6
+ import { loadPlugins } from './plugins/plugin-loader.js';
7
+ import { Scheduler } from './scheduler.js';
8
+ import { HistoryStore } from './store/history.js';
9
+ const program = new Command();
10
+ program
11
+ .name('watchdog')
12
+ .description('AI Dev process watchdog — monitor and auto-fix system health')
13
+ .version('1.0.0');
14
+ // ---------------------------------------------------------------------------
15
+ // watchdog start
16
+ // ---------------------------------------------------------------------------
17
+ program
18
+ .command('start')
19
+ .description('Load config, start scheduler, and watch continuously')
20
+ .action(async () => {
21
+ const config = await loadConfig();
22
+ const plugins = loadPlugins(config);
23
+ const home = process.env.HOME || process.env.USERPROFILE || '.';
24
+ const aidevDir = join(home, '.aidev');
25
+ mkdirSync(aidevDir, { recursive: true });
26
+ const dbPath = join(aidevDir, 'watchdog.db');
27
+ const store = new HistoryStore(dbPath);
28
+ const autoFix = {};
29
+ for (const [name, cfg] of Object.entries(config.plugins)) {
30
+ autoFix[name] = cfg.autoFix;
31
+ }
32
+ const scheduler = new Scheduler(plugins, { autoFix });
33
+ scheduler.start();
34
+ console.log(`[watchdog] Started with ${plugins.length} plugin(s). Press Ctrl+C to stop.`);
35
+ process.on('SIGINT', () => {
36
+ console.log('\n[watchdog] Stopping…');
37
+ scheduler.stop();
38
+ store.close();
39
+ process.exit(0);
40
+ });
41
+ });
42
+ // ---------------------------------------------------------------------------
43
+ // watchdog status
44
+ // ---------------------------------------------------------------------------
45
+ program
46
+ .command('status')
47
+ .description('Run check() on each plugin and print a summary line')
48
+ .action(async () => {
49
+ const config = await loadConfig();
50
+ const plugins = loadPlugins(config);
51
+ for (const plugin of plugins) {
52
+ try {
53
+ const result = await plugin.check();
54
+ const label = result.status === 'healthy'
55
+ ? 'OK'
56
+ : result.status === 'warning'
57
+ ? 'WARN'
58
+ : 'CRIT';
59
+ console.log(`[${label}] ${plugin.name}: ${result.message}`);
60
+ }
61
+ catch (err) {
62
+ console.error(`[ERR] ${plugin.name}: ${err.message}`);
63
+ }
64
+ }
65
+ });
66
+ // ---------------------------------------------------------------------------
67
+ // watchdog check [plugin]
68
+ // ---------------------------------------------------------------------------
69
+ program
70
+ .command('check [plugin]')
71
+ .description('Run check() for all or a specific plugin and print detailed metrics')
72
+ .action(async (pluginArg) => {
73
+ const config = await loadConfig();
74
+ const plugins = loadPlugins(config);
75
+ const targets = pluginArg
76
+ ? plugins.filter((p) => p.name === pluginArg)
77
+ : plugins;
78
+ if (pluginArg && targets.length === 0) {
79
+ console.error(`No plugin found with name "${pluginArg}"`);
80
+ process.exit(1);
81
+ }
82
+ for (const plugin of targets) {
83
+ try {
84
+ const result = await plugin.check();
85
+ console.log(`\n--- ${plugin.name} ---`);
86
+ console.log(`Status : ${result.status}`);
87
+ console.log(`Message: ${result.message}`);
88
+ console.log('Metrics:');
89
+ for (const [key, value] of Object.entries(result.metrics)) {
90
+ console.log(` ${key}: ${value}`);
91
+ }
92
+ if (result.suggestedActions.length > 0) {
93
+ console.log('Suggested actions:');
94
+ for (const action of result.suggestedActions) {
95
+ console.log(` - ${action}`);
96
+ }
97
+ }
98
+ }
99
+ catch (err) {
100
+ console.error(`[ERR] ${plugin.name}: ${err.message}`);
101
+ }
102
+ }
103
+ });
104
+ // ---------------------------------------------------------------------------
105
+ // watchdog fix [plugin]
106
+ // ---------------------------------------------------------------------------
107
+ program
108
+ .command('fix [plugin]')
109
+ .description('Run fix() for all or a specific plugin and print actions and resources freed')
110
+ .action(async (pluginArg) => {
111
+ const config = await loadConfig();
112
+ const plugins = loadPlugins(config);
113
+ const targets = pluginArg
114
+ ? plugins.filter((p) => p.name === pluginArg)
115
+ : plugins;
116
+ if (pluginArg && targets.length === 0) {
117
+ console.error(`No plugin found with name "${pluginArg}"`);
118
+ process.exit(1);
119
+ }
120
+ for (const plugin of targets) {
121
+ try {
122
+ const result = await plugin.fix();
123
+ console.log(`\n--- ${plugin.name} ---`);
124
+ console.log(`Resources freed: ${result.resourcesFreed}`);
125
+ if (result.actionsKept.length > 0) {
126
+ console.log('Actions taken:');
127
+ for (const action of result.actionsKept) {
128
+ console.log(` - ${action}`);
129
+ }
130
+ }
131
+ console.log('Before metrics:');
132
+ for (const [key, value] of Object.entries(result.beforeMetrics)) {
133
+ console.log(` ${key}: ${value}`);
134
+ }
135
+ console.log('After metrics:');
136
+ for (const [key, value] of Object.entries(result.afterMetrics)) {
137
+ console.log(` ${key}: ${value}`);
138
+ }
139
+ }
140
+ catch (err) {
141
+ console.error(`[ERR] ${plugin.name}: ${err.message}`);
142
+ }
143
+ }
144
+ });
145
+ // ---------------------------------------------------------------------------
146
+ // watchdog api start
147
+ // ---------------------------------------------------------------------------
148
+ const apiCmd = program.command('api').description('API server commands');
149
+ apiCmd
150
+ .command('start')
151
+ .description('Start the HTTP API server')
152
+ .action(async () => {
153
+ const config = await loadConfig();
154
+ const plugins = loadPlugins(config);
155
+ const home = process.env.HOME || process.env.USERPROFILE || '.';
156
+ const aidevDir = join(home, '.aidev');
157
+ mkdirSync(aidevDir, { recursive: true });
158
+ const dbPath = join(aidevDir, 'watchdog.db');
159
+ const store = new HistoryStore(dbPath);
160
+ // Dynamic import so that missing api/server.ts does not break the whole CLI at load time
161
+ const { startServer } = await import('./api/server.js');
162
+ startServer(store, plugins, config);
163
+ console.log(`[watchdog] API server started on port ${config.port}. Press Ctrl+C to stop.`);
164
+ process.on('SIGINT', () => {
165
+ console.log('\n[watchdog] Shutting down API server…');
166
+ store.close();
167
+ process.exit(0);
168
+ });
169
+ });
170
+ // ---------------------------------------------------------------------------
171
+ // watchdog install-service
172
+ // ---------------------------------------------------------------------------
173
+ program
174
+ .command('install-service')
175
+ .description('Install watchdog as a system service')
176
+ .action(async () => {
177
+ try {
178
+ const { installService } = await import('./installer/service.js');
179
+ await installService();
180
+ }
181
+ catch (err) {
182
+ console.error('[watchdog] install-service failed:', err.message);
183
+ process.exit(1);
184
+ }
185
+ });
186
+ // ---------------------------------------------------------------------------
187
+ // watchdog uninstall-service
188
+ // ---------------------------------------------------------------------------
189
+ program
190
+ .command('uninstall-service')
191
+ .description('Uninstall the watchdog system service')
192
+ .action(async () => {
193
+ try {
194
+ const { uninstallService } = await import('./installer/service.js');
195
+ await uninstallService();
196
+ }
197
+ catch (err) {
198
+ console.error('[watchdog] uninstall-service failed:', err.message);
199
+ process.exit(1);
200
+ }
201
+ });
202
+ program.parseAsync(process.argv);
203
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAA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CAAC;KAC1B,WAAW,CAAC,sCAAsC,CAAC;KACnD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;QAClE,MAAM,cAAc,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAC9E,OAAO;KACJ,OAAO,CAAC,mBAAmB,CAAC;KAC5B,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;QACpE,MAAM,gBAAgB,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;QAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function installService(): Promise<void>;
2
+ export declare function uninstallService(): Promise<void>;
3
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/installer/service.ts"],"names":[],"mappings":"AAKA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAyBpD;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAiBtD"}
@@ -0,0 +1,41 @@
1
+ import { join } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
4
+ export async function installService() {
5
+ if (process.platform !== 'win32') {
6
+ console.error('Service installation currently supports Windows only.');
7
+ process.exit(1);
8
+ }
9
+ const { Service } = await import('node-windows');
10
+ const svc = new Service({
11
+ name: 'ProcessWatchdog',
12
+ description: 'Process Watchdog — PC health monitoring agent',
13
+ script: join(__dirname, '..', 'index.js'),
14
+ nodeOptions: [],
15
+ scriptOptions: 'start',
16
+ });
17
+ svc.on('install', () => {
18
+ svc.start();
19
+ console.log('[watchdog] Service installed and started');
20
+ });
21
+ svc.on('alreadyinstalled', () => {
22
+ console.log('[watchdog] Service already installed');
23
+ });
24
+ svc.install();
25
+ }
26
+ export async function uninstallService() {
27
+ if (process.platform !== 'win32') {
28
+ console.error('Service uninstallation currently supports Windows only.');
29
+ process.exit(1);
30
+ }
31
+ const { Service } = await import('node-windows');
32
+ const svc = new Service({
33
+ name: 'ProcessWatchdog',
34
+ script: join(__dirname, '..', 'index.js'),
35
+ });
36
+ svc.on('uninstall', () => {
37
+ console.log('[watchdog] Service uninstalled');
38
+ });
39
+ svc.uninstall();
40
+ }
41
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/installer/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,CAAC,KAAK,CA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AAG,CAAC,gCAAgC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,SAAS,EAAE,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { WatchdogConfig } from '../config.js';
2
+ export declare function registerProduct(config: WatchdogConfig): Promise<boolean>;
3
+ //# sourceMappingURL=mah.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mah.d.ts","sourceRoot":"","sources":["../../src/integrations/mah.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,wBAAsB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAmB9E"}
@@ -0,0 +1,22 @@
1
+ export async function registerProduct(config) {
2
+ if (!config.integrations.mah.enabled)
3
+ return false;
4
+ try {
5
+ const response = await fetch(`${config.integrations.mah.url}/api/v1/products`, {
6
+ method: 'POST',
7
+ headers: { 'Content-Type': 'application/json' },
8
+ body: JSON.stringify({
9
+ name: 'Process Watchdog',
10
+ runtime: 'mah-native',
11
+ description: 'Modular PC health agent with plugin architecture',
12
+ port: config.port,
13
+ healthEndpoint: `http://localhost:${config.port}/api/v1/health`,
14
+ }),
15
+ });
16
+ return response.ok;
17
+ }
18
+ catch {
19
+ return false;
20
+ }
21
+ }
22
+ //# sourceMappingURL=mah.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mah.js","sourceRoot":"","sources":["../../src/integrations/mah.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAsB;IAC1D,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAEnD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,kBAAkB,EAAE;YAC7E,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,YAAY;gBACrB,WAAW,EAAE,kDAAkD;gBAC/D,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,cAAc,EAAE,oBAAoB,MAAM,CAAC,IAAI,gBAAgB;aAChE,CAAC;SACH,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { WatchdogConfig } from '../config.js';
2
+ export declare function pushAlert(config: WatchdogConfig, plugin: string, message: string, severity: 'info' | 'warning' | 'critical'): Promise<boolean>;
3
+ //# sourceMappingURL=total-recall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"total-recall.d.ts","sourceRoot":"","sources":["../../src/integrations/total-recall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,wBAAsB,SAAS,CAC7B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GACxC,OAAO,CAAC,OAAO,CAAC,CAmBlB"}
@@ -0,0 +1,22 @@
1
+ export async function pushAlert(config, plugin, message, severity) {
2
+ if (!config.integrations.totalRecall.enabled)
3
+ return false;
4
+ try {
5
+ const response = await fetch(`${config.integrations.totalRecall.url}/broadcast`, {
6
+ method: 'POST',
7
+ headers: { 'Content-Type': 'application/json' },
8
+ body: JSON.stringify({
9
+ source: 'process-watchdog',
10
+ plugin,
11
+ message,
12
+ severity,
13
+ timestamp: new Date().toISOString(),
14
+ }),
15
+ });
16
+ return response.ok;
17
+ }
18
+ catch {
19
+ return false;
20
+ }
21
+ }
22
+ //# sourceMappingURL=total-recall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"total-recall.js","sourceRoot":"","sources":["../../src/integrations/total-recall.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAsB,EACtB,MAAc,EACd,OAAe,EACf,QAAyC;IAEzC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAE3D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,YAAY,EAAE;YAC/E,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,MAAM,EAAE,kBAAkB;gBAC1B,MAAM;gBACN,OAAO;gBACP,QAAQ;gBACR,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACpC,CAAC;SACH,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PlatformAdapter } from './platform.interface.js';
2
+ export declare function getPlatform(): PlatformAdapter;
3
+ export type { PlatformAdapter, ProcessInfo, MemoryInfo, DiskInfo, CpuSample, StartupItem } from './platform.interface.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,wBAAgB,WAAW,IAAI,eAAe,CAO7C;AAED,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { WindowsPlatform } from './windows.js';
2
+ export function getPlatform() {
3
+ switch (process.platform) {
4
+ case 'win32':
5
+ return new WindowsPlatform();
6
+ default:
7
+ throw new Error(`Unsupported platform: ${process.platform}. Windows support only in v1.`);
8
+ }
9
+ }
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,UAAU,WAAW;IACzB,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,OAAO;YACV,OAAO,IAAI,eAAe,EAAE,CAAC;QAC/B;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,CAAC,QAAQ,+BAA+B,CAAC,CAAC;IAC9F,CAAC;AACH,CAAC"}
@@ -0,0 +1,42 @@
1
+ export interface ProcessInfo {
2
+ pid: number;
3
+ name: string;
4
+ memoryMB: number;
5
+ cpu: number;
6
+ responding: boolean;
7
+ }
8
+ export interface MemoryInfo {
9
+ totalMB: number;
10
+ freeMB: number;
11
+ usedPct: number;
12
+ pageFileUsageMB: number;
13
+ }
14
+ export interface DiskInfo {
15
+ drive: string;
16
+ totalGB: number;
17
+ freeGB: number;
18
+ usedPct: number;
19
+ }
20
+ export interface CpuSample {
21
+ usedPct: number;
22
+ timestamp: Date;
23
+ }
24
+ export interface StartupItem {
25
+ name: string;
26
+ command: string;
27
+ location: string;
28
+ enabled: boolean;
29
+ }
30
+ export interface PlatformAdapter {
31
+ getProcesses(): Promise<ProcessInfo[]>;
32
+ getProcessesByName(name: string): Promise<ProcessInfo[]>;
33
+ getListeningPids(): Promise<number[]>;
34
+ killProcess(pid: number): Promise<boolean>;
35
+ getMemoryInfo(): Promise<MemoryInfo>;
36
+ getDiskInfo(): Promise<DiskInfo[]>;
37
+ getCpuUsage(samples: number, intervalMs: number): Promise<CpuSample[]>;
38
+ getStartupItems(): Promise<StartupItem[]>;
39
+ disableStartupItem(name: string): Promise<boolean>;
40
+ getTempDirs(): string[];
41
+ }
42
+ //# sourceMappingURL=platform.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.interface.d.ts","sourceRoot":"","sources":["../../src/platform/platform.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACvC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACzD,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,WAAW,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACvE,eAAe,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1C,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,WAAW,IAAI,MAAM,EAAE,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=platform.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.interface.js","sourceRoot":"","sources":["../../src/platform/platform.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { PlatformAdapter, ProcessInfo, MemoryInfo, DiskInfo, CpuSample, StartupItem } from './platform.interface.js';
2
+ export declare class WindowsPlatform implements PlatformAdapter {
3
+ getProcesses(): Promise<ProcessInfo[]>;
4
+ getProcessesByName(name: string): Promise<ProcessInfo[]>;
5
+ getListeningPids(): Promise<number[]>;
6
+ killProcess(pid: number): Promise<boolean>;
7
+ getMemoryInfo(): Promise<MemoryInfo>;
8
+ getDiskInfo(): Promise<DiskInfo[]>;
9
+ getCpuUsage(samples: number, intervalMs: number): Promise<CpuSample[]>;
10
+ getStartupItems(): Promise<StartupItem[]>;
11
+ disableStartupItem(name: string): Promise<boolean>;
12
+ getTempDirs(): string[];
13
+ }
14
+ //# sourceMappingURL=windows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"windows.d.ts","sourceRoot":"","sources":["../../src/platform/windows.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAmBjC,qBAAa,eAAgB,YAAW,eAAe;IAC/C,YAAY,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAsBtC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAsBxD,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAUrC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS1C,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IA+BpC,WAAW,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAmBlC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IA8BtE,eAAe,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAsDzC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWxD,WAAW,IAAI,MAAM,EAAE;CAKxB"}