Commit Graph
258 Commits
Author SHA1 Message Date
thePR0M3TH3AN 30753d97be Merge branch 'main' into agents/daily/todo-triage-agent-3669620007397262659 2026-02-18 09:43:41 -05:00
thePR0M3TH3AN b6775cda28 Merge pull request #289 from PR0M3TH3AN/optimize-relay-ranking-1239301882622685923
⚡ Optimize relay ranking with caching
2026-02-17 22:45:08 -05:00
thePR0M3TH3AN ae45ddd20c Merge pull request #280 from PR0M3TH3AN/refactor/extract-lock-ops-error-constants-665695259531782224
🧹 Extract hardcoded error classification strings in lock-ops.mjs
2026-02-17 22:44:53 -05:00
thePR0M3TH3AN 34c20fadd8 Merge pull request #285 from PR0M3TH3AN/fix-dashboard-path-traversal-vulnerability-5749294800748882365
Fix path traversal vulnerability in dashboard.mjs
2026-02-17 22:43:20 -05:00
thePR0M3TH3AN ae85044021 Merge pull request #281 from PR0M3TH3AN/perf/optimize-pruner-lifecycle-3710831960416065931
⚡ Optimize createLifecyclePlan with Promise.all
2026-02-17 22:42:24 -05:00
thePR0M3TH3AN fabe54ca50 Merge pull request #286 from PR0M3TH3AN/perf-optimize-text-match-similarity-10778846404637796189
⚡ Optimize memory text similarity check
2026-02-17 22:42:05 -05:00
thePR0M3TH3AN 11c7510b95 Merge pull request #287 from PR0M3TH3AN/perf/optimize-pruner-lifecycle-15735036455677538666
⚡ Parallelize memory lifecycle actions in pruner
2026-02-17 22:41:48 -05:00
thePR0M3TH3AN 84e1da5825 Merge pull request #279 from PR0M3TH3AN/perf-pruner-optimization-6586476437632671797
⚡ Optimize memory pruner groupNearDuplicates
2026-02-17 22:41:07 -05:00
thePR0M3TH3AN 5cb3e32b8a Merge pull request #273 from PR0M3TH3AN/remove-dead-code-cmd-lock-18301432139913694771
🧹 Remove dead code src/cmd-lock.mjs
2026-02-17 22:40:51 -05:00
thePR0M3TH3AN 0d7f5a250c Merge pull request #278 from PR0M3TH3AN/fix-dashboard-config-exposure-6646545441224592886
fix(dashboard): prevent information disclosure via /torch-config.json
2026-02-17 22:40:08 -05:00
thePR0M3TH3AN ea127b9b2d Merge pull request #274 from PR0M3TH3AN/code-health-ensure-dir-13440231316649260412
Refactor: Centralize `ensureDir` utility
2026-02-17 22:39:11 -05:00
google-labs-jules[bot]andPR0M3TH3AN a9f30f13f9 feat(perf): cache relay ranking in RelayHealthManager
- Implement caching for `rankRelays` to avoid redundant sorting and computations.
- Cache is invalidated on new outcomes or when quarantine status changes.
- Add `_metricsVersion` to track metrics updates.
- Benchmarks show ~3x performance improvement (0.06ms -> 0.02ms per call for 100 relays).
- Add unit tests for caching behavior and invalidation.
- Add `perf/benchmark-lock-ops.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:33:59 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0f29e9126e perf: parallelize applyLifecycleActions for faster pruning
- Use Promise.all to execute memory lifecycle actions concurrently.
- Maintain intra-item dependency order (merged_into before action).
- Update tests to support non-deterministic execution order of independent items.
- Benchmark shows ~65x improvement for 100 items with 10ms latency.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:32:03 +00:00
google-labs-jules[bot]andPR0M3TH3AN 850be9c37d perf: Optimize textMatchSimilarity in memory retriever
Avoids redundant string concatenation and lowercasing in the inner loop of `buildSimilarityIndex`.
Pre-computes query terms and regexes once per query.
Uses RegExp.test for case-insensitive matching without allocation.
Benchmark shows ~2x speedup (99ms vs 191ms for 10k memories).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:31:22 +00:00
google-labs-jules[bot]andPR0M3TH3AN 5fe9e8a1f9 Fix: Strengthen path traversal protection in dashboard.mjs
- Replaced brittle regex-based sanitization with `path.resolve` relative to `packageRoot`.
- Added `test/dashboard-path-traversal-fix.test.mjs` to verify robust protection against traversal attacks.
- Verified that legitimate access to allowed paths is maintained.
- Verified that access to restricted files (like package.json) is blocked.
- Updated path handling to correctly handle absolute paths and URL-encoded characters.

This change addresses a potential security vulnerability where the previous sanitization logic could be bypassed in certain environments or with specific edge cases. By using standard path resolution and explicitly checking against a canonical root, the implementation is more secure and maintainable.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:31:18 +00:00
google-labs-jules[bot]andPR0M3TH3AN cc932d31de refactor: extract hardcoded error classification strings in lock-ops.mjs
- Introduced `PUBLISH_ERROR_CODES` constant for publish error classification.
- Introduced `PUBLISH_FAILURE_CATEGORIES` constant for failure categorization.
- Replaced hardcoded strings in `classifyPublishError`, `isTransientPublishCategory`, `LockPublisher.publish`, and `determineFailureCategory` with these constants.
- Verified changes with existing tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:30:29 +00:00
google-labs-jules[bot]andPR0M3TH3AN 7305dd964d Optimize createLifecyclePlan with Promise.all
Replaced sequential `await condenseGroup` calls with `Promise.all` to run condensation tasks concurrently.
Added `scripts/benchmark-pruner.mjs` to measure performance improvement.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:30:28 +00:00
google-labs-jules[bot]andPR0M3TH3AN ace069cc19 perf(pruner): optimize groupNearDuplicates to O(N log N) from O(N^2)
Sorts memories by created_at and uses an early exit condition in the inner loop to avoid checking all pairs. This reduces complexity from O(N^2) to roughly O(N * k) where k is the number of items within the duplicate window.

Measured improvement for 30k items: ~2.1s -> ~0.25s (8x speedup).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:30:11 +00:00
google-labs-jules[bot]andPR0M3TH3AN aad5e46b31 fix(dashboard): whitelist exposed torch-config.json fields
Restrict the /torch-config.json endpoint to only return fields required by the dashboard frontend (dashboard config excluding auth, and nostrLock namespace/relays). This prevents exposure of sensitive internal configuration such as rosters, scheduler settings, and full relay lists.

- Modify src/dashboard.mjs to sanitize config using an allowlist approach.
- Add test/dashboard-config-exposure.test.mjs to verify sensitive fields are stripped.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:29:23 +00:00
google-labs-jules[bot]andPR0M3TH3AN e12c415f28 feat(test): add unit tests for roster loading logic with dependency injection
- Refactor `src/roster.mjs` to support dependency injection for `fs` and `loadTorchConfig`.
- Add `test/roster.test.mjs` to test roster loading scenarios including file precedence, caching, fallback, and configuration overrides.
- Export `_resetRosterCache` in `src/roster.mjs` for testing purposes.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:29:09 +00:00
google-labs-jules[bot]andPR0M3TH3AN ba5d86142c Refactor: Move ensureDir to src/utils.mjs
Moved the `ensureDir` utility function from `src/ops.mjs` to `src/utils.mjs` to promote code reuse and centralization.
Updated `src/ops.mjs` and `src/services/memory/index.js` to use the shared utility.
Added unit tests for `ensureDir` in `test/utils.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:28:09 +00:00
google-labs-jules[bot]andPR0M3TH3AN 74993c1d47 I've removed the dead code in src/cmd-lock.mjs. This file contained duplicated logic that is now handled in src/lib.mjs and is not imported by any other module in the codebase.
Verified by:
- Searching the codebase to confirm no imports.
- Running the tests to ensure no regressions.
- Running the build to ensure the process is unaffected.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:28:01 +00:00
google-labs-jules[bot]andPR0M3TH3AN f436beab9b docs(agent): audit and improve documentation (docs-agent)
- Created `CONTRIBUTING.md` with development instructions.
- Updated `README.md` to include a Development section.
- Added daily scheduler run artifacts.
- Completed scheduler cycle for `docs-agent`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 01:16:10 +00:00
thePR0M3TH3AN f343af246f Merge pull request #266 from PR0M3TH3AN/agents/daily/deps-security-agent-2026-02-17-6568228938484904642
Daily Scheduler: deps-security-agent
2026-02-17 18:40:25 -05:00
google-labs-jules[bot]andPR0M3TH3AN da4d360af1 chore(scheduler): execute deps-security-agent
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 23:27:49 +00:00
google-labs-jules[bot]andPR0M3TH3AN 9e993800fa [scheduler] daily/decompose-agent: Decompose scripts/agent/run-scheduler-cycle.mjs
- Executed daily scheduler cycle.
- Selected `decompose-agent` (next in roster).
- Decomposed `scripts/agent/run-scheduler-cycle.mjs` (1127 lines) into `scripts/agent/scheduler-utils.mjs` (195 lines) and `scripts/agent/scheduler-lock.mjs` (173 lines).
- Resulting main file size: 788 lines (339 lines reduction).
- Fixed lint warnings.
- Updated `test/scheduler-preflight-lock.e2e.test.mjs`, `test/run-scheduler-cycle-memory-policy.test.mjs`, `test/scheduler-lock-failure-schema.contract.test.mjs` to copy new modules into test fixtures.
- Updated `test/scheduler-ratchet.test.mjs` to verify moved functions in `scheduler-lock.mjs`.
- Note: `scripts/check-file-size.mjs` was not updated as it lacks the baseline feature referenced in the prompt.
- Created artifacts: `src/context/CONTEXT_...`, `src/decisions/DECISIONS_...`, `src/test_logs/TEST_LOG_...`, `src/todo/TODO_...`.
- Created scheduler log: `task-logs/daily/2026-02-17T22-29-00Z__decompose-agent__completed.md`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 22:41:37 +00:00
google-labs-jules[bot]andPR0M3TH3AN ed56a72f69 Daily Agent: content-audit-agent run (missing content directory) + fix lock-ops
- Audited `/content` directory: Not found.
- Updated `KNOWN_ISSUES.md`.
- Fixed a bug in `src/lock-ops.mjs` where `deps` was undefined in `LockPublisher`.
- Created run artifacts and task logs.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 21:39:10 +00:00
thePR0M3TH3AN 8fb2a2ab99 Merge branch 'main' into agents/daily/ci-health-agent-2026-02-17-8365488986185039286 2026-02-17 15:09:34 -05:00
google-labs-jules[bot]andPR0M3TH3AN 5e99e81f2d chore(scheduler): Execute ci-health-agent and fix critical bugs
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 19:58:43 +00:00
thePR0M3TH3AN 010fea88e3 Merge branch 'main' into agents/weekly/frontend-console-debug-agent-3080226125712323863 2026-02-17 14:53:27 -05:00
google-labs-jules[bot]andPR0M3TH3AN 2466c80af9 fix(dashboard): Allow access to src/constants.mjs and fix lock-ops
`frontend-console-debug-agent` run:
- Fixed a 403 Forbidden error in `src/dashboard.mjs` preventing `src/constants.mjs` from loading by adding it to the `allowedPaths` whitelist.
- Refactored `src/lock-ops.mjs` to fix a critical syntax error in `LockPublisher` class.
- Fixed a typo in `src/cmd-check.mjs` (`queryLocksFn` -> `queryLocks`).
- Added `@playwright/test` for frontend debugging.
- Added `scripts/agent/debug_frontend.mjs` for reproduction.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 19:52:10 +00:00
google-labs-jules[bot]andPR0M3TH3AN 03ccb232ee Refactor lock backend constants and fix scheduler syntax error
- Extracted hardcoded retry/health constants from `src/lock-ops.mjs` to `src/constants.mjs`.
- Refactored `src/lock-ops.mjs` to use `LockPublisher` class pattern and shared constants.
- Fixed `SyntaxError` in `src/lock-ops.mjs` (function inside function).
- Fixed `ReferenceError` in `src/cmd-check.mjs` (`queryLocksFn` -> `queryLocks`).
- Verified with unit tests (`test:unit:lock-backend`) and linting.
- Completed daily scheduler cycle for `const-refactor-agent`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 19:50:48 +00:00
thePR0M3TH3AN 058011089d Merge branch 'main' into fix-insecure-random-backoff-15480292305985131336 2026-02-17 14:30:13 -05:00
thePR0M3TH3AN 59c286e247 Merge branch 'main' into refactor-cmdinit-ops-5287196156995262612 2026-02-17 14:29:31 -05:00
thePR0M3TH3AN 0c41456db6 Merge pull request #254 from PR0M3TH3AN/refactor-cmd-init-10842756279574756855
🧹 Refactor cmdInit in src/ops.mjs
2026-02-17 14:29:07 -05:00
thePR0M3TH3AN 2c51424b6d Merge branch 'main' into refactor-lock-ops-publish-lock-16349393256066370386 2026-02-17 14:28:12 -05:00
thePR0M3TH3AN db38fb0e91 Merge pull request #256 from PR0M3TH3AN/refactor-lock-ops-state-3445549076565547288
Refactor lock-ops to encapsulate global state
2026-02-17 14:27:22 -05:00
thePR0M3TH3AN fb558b0b4d Merge branch 'main' into test-improvement-get-relevant-memories-15158310533650216935 2026-02-17 14:26:54 -05:00
thePR0M3TH3AN 3502d38431 Merge branch 'main' into jules-perf-async-config-1969443791138192182 2026-02-17 14:26:06 -05:00
google-labs-jules[bot]andPR0M3TH3AN 50b0cf5a07 perf: Refactor config loading to be non-blocking async
Replaces synchronous `fs.readFileSync` with `fs.promises.readFile` in `loadTorchConfig` to prevent event loop blocking.
Updates all dependent configuration getters and consumers to use async/await.
Includes benchmark proving non-blocking behavior.
Fixes dashboard tests to properly await server listening.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 19:02:46 +00:00
google-labs-jules[bot]andPR0M3TH3AN 68da87ac48 Refactor cmdInit in src/ops.mjs to improve modularity and maintainability
- Extracted logic into helper functions: `resolveConfiguration`, `ensureInstallDirectory`, `installAppAssets`, `installTorchAssets`, `configureTorch`, `injectHostScriptsIfNeeded`.
- Updated `cmdInit` to orchestrate these functions.
- Verified functionality with existing tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 19:01:15 +00:00
google-labs-jules[bot]andPR0M3TH3AN 59fbe1f4b8 Refactor lock-ops to encapsulate global state in RelayHealthManager class
- Replaces module-level mutable state (`metricsByRelay`, `lastSnapshotAt`) with `RelayHealthManager` class.
- Moves state-dependent functions (`ensureRelayMetrics`, `rankRelaysByHealth`, etc.) to class methods.
- Updates `queryLocks` and `publishLock` to support dependency injection for `healthManager`.
- Maintains backward compatibility via `defaultHealthManager` singleton.
- Adds `test/relay-health-manager.test.mjs` to verify state isolation and functionality.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:55:11 +00:00
google-labs-jules[bot]andPR0M3TH3AN 568d37a45c Fix insecure random number generator in backoff logic
Replaced `Math.random` with a cryptographically secure random number generator using `node:crypto.randomInt` in `src/lock-ops.mjs` to prevent potential timing attacks or predictability in backoff delays.

Added `test/secure-random.test.mjs` to verify the secure random generator.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:54:42 +00:00
google-labs-jules[bot]andPR0M3TH3AN bcc501e52f Refactor cmdInit in src/ops.mjs to improve modularity
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:54:33 +00:00
google-labs-jules[bot]andPR0M3TH3AN 321d5848ac Refactor publishLock into LockPublisher class in src/lock-ops.mjs
- Extracted complex retry logic from `publishLock` into `LockPublisher` class.
- Decomposed `publishLock` into `executePublishCycle`, `attemptPhase`, `analyzeFailures`, `determineFailureCategory`, and logging helpers.
- Preserved existing functionality and behavior including telemetry, health management, and error handling.
- Verified with existing tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:54:02 +00:00
google-labs-jules[bot]andPR0M3TH3AN 99bd4ba2a3 test: add unit tests for cmdCheck
Refactor `cmdCheck` in `src/cmd-check.mjs` to support dependency injection for better testability.
Add `test/cmd-check.test.mjs` with comprehensive unit tests for `cmdCheck`, covering happy paths and edge cases.
Verify tests pass with `node --test test/cmd-check.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:53:55 +00:00
google-labs-jules[bot]andPR0M3TH3AN 694afb1462 feat: make getRelevantMemories testable and add tests
- Modified `getRelevantMemories` in `src/services/memory/index.js` to accept optional `ranker` and `cache` parameters for dependency injection.
- Added `test/memory-index.test.mjs` with comprehensive unit tests for `getRelevantMemories` using `node:test` mocks.
- Verified that existing behavior is preserved via default parameters.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:53:52 +00:00
thePR0M3TH3AN 39b7783899 Merge pull request #241 from PR0M3TH3AN/refactor-usage-text-5134896285807665530
🧹 Refactor usage text to constants
2026-02-17 13:38:21 -05:00
thePR0M3TH3AN f0437a9647 Merge pull request #231 from PR0M3TH3AN/code-health/relay-health-comment-8690906014173608719
Sweep: Add comment to swallowed error in relay-health.mjs
2026-02-17 13:37:43 -05:00
google-labs-jules[bot]andPR0M3TH3AN 24f1853efc refactor(cli): move usage text to constants
Moved the large usage help text from `src/lib.mjs` to `src/constants.mjs` to improve readability and maintainability of the library file.

- Added `USAGE_TEXT` to `src/constants.mjs`.
- Updated `src/lib.mjs` to import and use `USAGE_TEXT`.
- Removed unused `DEFAULT_DASHBOARD_PORT` import from `src/lib.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:35:55 +00:00