- Moved `withTimeout` implementation to `src/lock-utils.mjs` and exported it correctly.
- Removed duplicate local definitions of `withTimeout`, `mergeRelayList`, and `secureRandom` in `src/lock-ops.mjs` and `src/lock-publisher.mjs`.
- Fixed imports in `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs` to use `src/lock-utils.mjs` consistently.
- Updated `test/utils.test.mjs` and `test/utils-async.test.mjs` to fix broken imports and test definitions.
- Verified `npm run lock:complete` and `npm run scheduler:daily` execute correctly.
- Updated `src/todo/TODO_2026-02-20T03-00-00Z.md` to mark verification task as completed.
- Verified `src/relay-health.mjs` does not use `MINUTE_MS` locally, despite mysterious CI error. Confirmed imports are correct.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Removes `PUBLISH_ERROR_CODES` from `src/lock-publisher.mjs` imports as it was unused and caused a lint failure in CI.
- Verified with `npm run lint` and relevant tests.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Remove unused `manifest` variable from destructuring in `test/cmd-backup.test.mjs` to resolve ESLint error.
- Verified fix with `npm run lint`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fixes CI failure in `test/install_dir_validation.test.mjs` where `assert.notMatch` was undefined.
- `assert.doesNotMatch` is the standard Node.js assertion method for negative regex matching.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Removed unused `getTtl` import from `src/torch-config.mjs` in `src/lib.mjs` to fix CI lint failure.
- Verified with `npm run lint` and `npm test test/lib.test.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Refactor `src/cmd-proposal.mjs` to use dependency injection for testability.
Add `test/cmd-proposal.test.mjs` to verify all subcommands (`create`, `list`, `apply`, `reject`, `show`) and error handling.
Fix indentation in `src/cmd-proposal.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Replaced manual promise management in `src/services/memory/index.js` with a `CoalescingWorker` class.
- Extracted `performSave` logic into `performSave` function used by the worker (worker function).
- Ensures concurrent calls to `saveMemoryStore` are coalesced into a single pending operation, maintaining data integrity and performance.
- Removed global state variables for promise management.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces aggressive `cache.clear()` with per-agent invalidation in `src/services/memory/index.js` to improve performance.
- Adds `prune(predicate)` to `createMemoryCache`.
- Updates `ingestEvents`, `runPruneCycle`, `pinMemory`, `unpinMemory`, and `markMemoryMerged` to invalidate only the affected agent's cache entries.
- Adds unit test for `prune` in `test/memory-cache.test.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces the unconditional global expiration scan in `setRuntimeEvent` with a scoped expiration check, significantly reducing overhead for cache writes. Global expiration is now only triggered when the cache reaches its capacity limit.
This change improves `setRuntimeEvent` performance by ~3.5x in benchmarks with 5000 active events.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Add rate limiting to prevent brute force attacks on dashboard authentication
- Block IPs for 5 minutes after 5 failed attempts
- Return 429 Too Many Requests when blocked
- Clean up state periodically to prevent memory leaks
Co-authored-by: PR0M3TH3AN <[email protected]>
- Refactor `cmdBackup` and `listBackups` in `src/cmd-backup.mjs` to accept `cwd` parameter for dependency injection.
- Add `test/cmd-backup.test.mjs` to test backup creation, missing files handling, output override, and listing functionality.
- Ensure tests run in isolated temporary directories using `fs.mkdtemp`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Extracted `LockPublisher` and `publishLock` to `src/lock-publisher.mjs` (already existed, but cleaned up).
- Refactored `src/lock-publisher.mjs` to import error constants and classification logic from `src/lock-error-classifier.mjs` instead of duplicating them.
- Refactored `src/lock-publisher.mjs` and `src/lock-utils.mjs` to use `mergeRelayList` from `src/utils.mjs`.
- Consolidated and moved publisher tests from `test/lock-ops.test.mjs` and `test/lock-ops-publish-retry.test.mjs` to `test/lock-publisher.test.mjs`.
- Cleaned up `src/lock-utils.mjs` to remove duplicate `mergeRelayList`.
- Verified changes with tests.
Co-authored-by: PR0M3TH3AN <[email protected]>
Verified that ajv (6.14.0) and minimatch (10.2.2) are at secure versions in the repository.
Ran npm audit to confirm 0 vulnerabilities.
Marked investigation tasks as completed in src/todo/TODO_2026-02-20T01-13-24Z.md.
Co-authored-by: PR0M3TH3AN <[email protected]>
`assert.notMatch` is not a valid function in Node.js `node:assert` module. The correct function is `assert.doesNotMatch`. This caused `test/install_dir_validation.test.mjs` to fail.
This commit replaces the incorrect usage to fix the test failure.
Co-authored-by: PR0M3TH3AN <[email protected]>
This change confirms the decomposition of `src/lock-ops.mjs` into `src/relay-health-manager.mjs` and `src/lock-publisher.mjs`.
- `RelayHealthManager` is now imported from `src/relay-health-manager.mjs`.
- `LockPublisher` is now imported from `src/lock-publisher.mjs`.
- `src/lock-ops.mjs` acts as an entry point re-exporting these classes.
- Tests in `test/lock-ops.test.mjs` pass.
- The TODO file `src/todo/TODO_2026-02-20T02-28-25Z.md` is deleted as all tasks are completed.
- A comment was added to `src/lock-ops.mjs` to document the refactoring.
Co-authored-by: PR0M3TH3AN <[email protected]>
The `perf-agent` prompt contained detailed instructions to audit `/content` upload documentation and features. Since no such features or documentation exist in the repository (as confirmed by `content-audit-agent`), these instructions were causing confusion and wasted effort.
This change removes:
- The "Docs audit" sub-workflow and its associated steps.
- References to `/content` and upload/contribution docs in the Mission, Focus, and Goals.
- The "docs: `/content` upload alignment" PR template.
This aligns the agent's instructions with the actual codebase capabilities.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implemented `verifyPassword` helper in `src/dashboard.mjs` to support hashed passwords.
- Added support for `scrypt:<salt>:<hash>` format for storing credentials.
- Maintained backward compatibility for plaintext passwords using `timingSafeCompare`.
- Updated `cmdDashboard` to use the new verification logic.
- Added comprehensive tests in `test/dashboard-auth.test.mjs` for hashed credential validation.
This change eliminates the need to store plaintext passwords in `torch-config.json` or environment variables, addressing a security vulnerability.
Co-authored-by: PR0M3TH3AN <[email protected]>
Upgraded `eslint` to `^10.0.1` which updated `minimatch` to `10.2.2` (resolving ReDoS vulnerability).
Ran `npm audit fix` which updated `ajv` to `6.14.0` (resolving ReDoS vulnerability).
Verified with `npm test` and `npm run lint`.
Marked tasks as completed in `src/todo/TODO_2026-02-20T01-13-24Z.md`.
Co-authored-by: PR0M3TH3AN <[email protected]>