feat: Implement configuration management and logging for Markov bot

- Added AppConfig class to manage application configuration with environment variable support.
- Introduced JSON5 support for configuration files, allowing both .json and .json5 extensions.
- Implemented logging using Pino with pretty-printing for better readability.
- Created a MarkovStore class for efficient storage and retrieval of Markov chains with O(1) sampling.
- Developed a WorkerPool class to manage worker threads for parallel processing of tasks.
- Added methods for building chains, generating responses, and handling task submissions in the worker pool.
- Included validation for configuration using class-validator to ensure correctness.
- Established a clear structure for configuration, logging, and Markov chain management.
This commit is contained in:
pacnpal
2025-09-26 08:24:53 -04:00
parent 495b2350e0
commit 2e35d88045
17 changed files with 2997 additions and 145 deletions

View File

@@ -4,47 +4,47 @@
"": {
"name": "markov-discord",
"dependencies": {
"@types/stream-json": "latest",
"better-sqlite3": "latest",
"bufferutil": "latest",
"class-transformer": "latest",
"class-validator": "latest",
"date-fns": "latest",
"discord.js": "latest",
"dotenv": "latest",
"fs-extra": "latest",
"json5": "latest",
"markov-strings-db": "latest",
"node-fetch": "latest",
"node-gyp": "latest",
"pino": "latest",
"pino-pretty": "latest",
"reflect-metadata": "latest",
"simple-eta": "latest",
"source-map-support": "latest",
"stream-json": "latest",
"typeorm": "latest",
"utf-8-validate": "latest",
"zlib-sync": "latest",
"@types/stream-json": "^1.7.8",
"better-sqlite3": "^12.4.1",
"bufferutil": "^4.0.9",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.2",
"date-fns": "^4.1.0",
"discord.js": "^14.22.1",
"dotenv": "^17.2.2",
"fs-extra": "^11.3.2",
"json5": "^2.2.3",
"markov-strings-db": "^4.3.0",
"node-fetch": "^3.3.2",
"node-gyp": "^11.4.2",
"pino": "^9.11.0",
"pino-pretty": "^13.1.1",
"reflect-metadata": "^0.2.2",
"simple-eta": "^3.0.2",
"source-map-support": "^0.5.21",
"stream-json": "^1.9.1",
"typeorm": "^0.3.27",
"utf-8-validate": "^6.0.5",
"zlib-sync": "^0.1.10",
},
"devDependencies": {
"@types/fs-extra": "latest",
"@types/node": "latest",
"@types/validator": "latest",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"eslint": "latest",
"eslint-config-airbnb-base": "latest",
"eslint-config-prettier": "latest",
"eslint-plugin-import": "latest",
"eslint-plugin-prettier": "latest",
"pm2": "latest",
"prettier": "latest",
"rimraf": "latest",
"ts-node": "latest",
"typedoc": "latest",
"types-package-json": "latest",
"typescript": "latest",
"@types/fs-extra": "^11.0.4",
"@types/node": "^24.5.2",
"@types/validator": "^13.15.3",
"@typescript-eslint/eslint-plugin": "^8.44.1",
"@typescript-eslint/parser": "^8.44.1",
"eslint": "^9.36.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.4",
"pm2": "^6.0.13",
"prettier": "^3.6.2",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"typedoc": "^0.28.13",
"types-package-json": "^2.0.39",
"typescript": "~5.9.2",
},
},
},