Commit Graph
164 Commits
Author SHA1 Message Date
thePR0M3TH3AN f5d52bd13c Merge pull request #360 from PR0M3TH3AN/add-dashboard-home-button-16801596229675926990
Add Home button to dashboard linking to landing page
2026-02-19 23:11:21 -05:00
thePR0M3TH3AN 2b706f6085 Merge pull request #359 from PR0M3TH3AN/fix/torch-init-gitignore-13639849350884611583
Ensure torch init adds .gitignore with node_modules
2026-02-19 23:10:56 -05:00
google-labs-jules[bot]andPR0M3TH3AN babdd4af5d Add Home button to dashboard linking to landing page
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-20 04:04:28 +00:00
google-labs-jules[bot]andPR0M3TH3AN c36735dbde fix: ensure torch init adds .gitignore with node_modules
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-20 04:01:39 +00:00
thePR0M3TH3AN a35286f17d Merge pull request #355 from PR0M3TH3AN/refactor-governance-target-validation-5425533680072569362
🧹 refactor(governance): extract duplicated target validation logic
2026-02-19 22:51:13 -05:00
google-labs-jules[bot]andPR0M3TH3AN cd744982a1 refactor(governance): extract duplicated target validation logic
Extracted duplicated target path resolution and allowlist validation logic
into a shared `resolveAndValidateTarget` helper function in
`src/services/governance/index.js`.

Updated `createProposal`, `validateProposal`, `applyProposal`, and
`rollbackPrompt` to use the new helper, ensuring consistent validation
and path handling across the service.

Added `test/governance-health.test.mjs` to verify validation logic.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-20 03:50:36 +00:00
google-labs-jules[bot]andPR0M3TH3AN 8d4ae0d616 feat(testing): add unit tests for ExitError and improve class definition
- Added `test/errors.test.mjs` with comprehensive tests for the `ExitError` class.
- Updated `src/errors.mjs` to set `this.name = 'ExitError'` in the constructor for better error reporting.
- Verified that all new tests pass and no regressions were introduced to the existing test suite.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-20 03:49:34 +00:00
thePR0M3TH3AN 1a534fc746 Merge pull request #351 from PR0M3TH3AN/add-qwen-coder-landing-4500751862979356017
Add Qwen Coder to landing page and platform detection
2026-02-19 22:13:20 -05:00
google-labs-jules[bot]andPR0M3TH3AN a61079b505 Add Qwen Coder to landing page and platform detection
- Added Qwen Coder CLI to `landing/index.html` agent selector.
- Updated `src/utils.mjs` to detect `QWEN_API_KEY` or `QWEN_SESSION_ID` as 'qwen' platform.
- Updated `dashboard/app.js` to render Qwen tasks with appropriate badge styling.
- Added tests for Qwen platform detection in `test/utils.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-20 02:42:08 +00:00
Claude be5ec21d5c feat(governance): add prompt versioning, rollback --list, and state backup
- governance/index.js: archive filenames now include ISO timestamp for
  deterministic sorting (<base>_<ts>_<hash>.md); write .meta.json sidecar
  on every archive with proposalId, author, reason, and archivedAt
- governance/index.js: add listPromptVersions(target) — returns archived
  versions for a prompt sorted newest-first with sidecar metadata surfaced
- cmd-rollback.mjs: add --list flag to list available versions without
  restoring (delegates to listPromptVersions)
- cli-parser.mjs: add --list and --output flags
- lib.mjs: pass list flag to cmdRollback; add backup command dispatch
- cmd-backup.mjs: new torch-lock backup command — snapshots
  .scheduler-memory/memory-store.json and scheduler run state to
  .torch/backups/<timestamp>/; supports --output override and --list
- docs/prompt-versioning.md: comprehensive guide to the full
  proposal → apply → list-versions → rollback workflow, state backup
  and restore procedure, and storage location reference
- test/governance.test.mjs: 7 scenario-based tests (SCN-proposal-create,
  SCN-proposal-list, SCN-proposal-reject, SCN-archive-naming,
  SCN-version-list, SCN-rollback-latest, SCN-rollback-hash)

https://claude.ai/code/session_01Ndq2D72Kp77BYo4owD63uY
2026-02-20 02:27:57 +00:00
thePR0M3TH3AN 158026bdb4 Merge pull request #346 from PR0M3TH3AN/claude/add-torch-removal-command-keFx5
Add cmdRemove command to completely uninstall TORCH from projects
2026-02-19 21:09:54 -05:00
Claude 7984c7de66 feat: add torch-lock remove command for complete TORCH uninstallation
Users who installed TORCH via `npm install <tarball> && npx torch-lock init`
had no built-in way to cleanly remove it. This adds a `remove` command that
detects and removes all TORCH artifacts: the torch/ directory, config files,
runtime directories (.torch/, .scheduler-memory/, task-logs/), governance
proposals, host package.json scripts, and the npm package itself.

- Add cmdRemove() in src/ops.mjs with detection, preview, confirmation, and cleanup
- Wire up `remove` command in CLI dispatcher (src/lib.mjs)
- Add TORCH_HOST_SCRIPTS constant in constants.mjs for shared script key list
- Add docs/removal.md with full manual removal instructions
- Add removal section to README.md
- Add 7 scenario tests in test/ops-remove.test.mjs

https://claude.ai/code/session_011Snrxu3iZGLtJ9pnFSajpM
2026-02-20 01:59:30 +00:00
thePR0M3TH3AN 86bfec6319 update 2026-02-19 17:05:13 -05:00
thePR0M3TH3AN 6bce64be3b Merge pull request #339 from PR0M3TH3AN/feature/init-dashboard-file-config-hashtag-4189892407545080483
Generate TORCH_DASHBOARD.md and expose hashtag in config during init
2026-02-19 16:45:39 -05:00
google-labs-jules[bot]andPR0M3TH3AN 016f3e34e2 feat: generate dashboard file and config hashtag during init
This change updates the `torch init` command to:
1.  Prompt the user for a Nostr hashtag (defaulting to `${namespace}-agent-lock`).
2.  Explicitly save the `hashtag` to `torch-config.json` under `dashboard.hashtag` for easier editing.
3.  Generate a `TORCH_DASHBOARD.md` file in the installation directory containing a link to the TORCH dashboard with the correct `hashtag`, `namespace`, and `relays` pre-filled.

This improves the onboarding experience by making it easier to find and monitor the agent locks immediately after initialization.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-19 21:45:19 +00:00
thePR0M3TH3AN f1d4e0534c Merge pull request #338 from PR0M3TH3AN/jules-detect-active-agent-platforms-2907459520034809113
Add dashboard support for Goose, Gemini, and Antigravity platforms
2026-02-19 16:40:27 -05:00
google-labs-jules[bot]andPR0M3TH3AN abb4cc4361 feat(dashboard): add support for Goose, Gemini, and Antigravity platforms
- Update `src/utils.mjs` to detect `gemini` and `antigravity` platforms via environment variables.
- Update `dashboard/styles.css` with new color utilities for purple and pink themes.
- Update `dashboard/app.js` to map Goose, Gemini, and Antigravity platforms to distinct badge colors.
- Update `test/utils.test.mjs` to include unit tests for the new platform detection logic.

This ensures all active agent platforms are correctly identified and labeled in the TORCH dashboard.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-19 21:39:32 +00:00
google-labs-jules[bot]andPR0M3TH3AN b457025a8a [constants] Fix CI failure in test/scheduler-preflight-lock.e2e.test.mjs
- Added missing copy of `src/constants.mjs` to test fixture in `test/scheduler-preflight-lock.e2e.test.mjs`
- Verified fix with `npm run test:integration:e2e`

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-19 21:37:57 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2174e8bc4d [constants] Refactor 1000 to MS_PER_SECOND
- Extracted MS_PER_SECOND to src/constants.mjs
- Replaced literal 1000 in src/relay-health.mjs, src/utils.mjs, src/lib.mjs, src/lock-ops.mjs
- Updated test/scheduler-lock-failure-schema.contract.test.mjs to copy constants.mjs
- Added task log and artifacts

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-19 21:34:50 +00:00
Claude 639ad6877d chore: code quality, CI/CD, and DX improvements
Phase 3 — Code Quality:
- Deduplicate nowUnix() in lock-ops.mjs (import from utils.mjs)
- Promote ESLint no-unused-vars to error, fix all 46 violations
- Remove dead code: unused imports, variables, and catch bindings
- Add /* global marked */ for CDN-loaded library in dashboard

Phase 4 — CI/CD:
- Add Node.js version matrix (22, 23) to CI workflow
- Add npm audit security scan step to CI
- Add innerHTML usage check to CI pipeline
- Enable Dependabot for npm and GitHub Actions dependencies
- Create PR template

Phase 5 — Developer Experience:
- Create .env.example documenting all environment variables
- Expand CONTRIBUTING.md with commit conventions, agent/prompt
  creation guide, architecture overview, and test integrity
- Add system architecture diagram with Mermaid (docs/architecture/)

https://claude.ai/code/session_01GfwUNbgeMgXreFDbsNQMsS
2026-02-19 21:03:30 +00:00
Claude c9b23874f2 fix(tests): improve test reliability and remove unused deps
- Add --test-timeout=30000 to prevent test suite hanging
- Skip build_verification.test.mjs when dist/ is absent
- Replace setTimeout with mocked Date.now in memory-cache expiry test
- Replace wait(30) with setImmediate flush in scheduler smoke test
- Remove unused @playwright/test devDependency

https://claude.ai/code/session_01GfwUNbgeMgXreFDbsNQMsS
2026-02-19 20:55:17 +00:00
Claude e7ecd2617e fix(security): harden dashboard auth timing, XSS, and CSP
- Fix timingSafeCompare to pad buffers to equal length before comparing,
  closing the content timing side-channel on length mismatch
- Replace innerHTML with textContent for error messages to prevent XSS
- Extract inline script from dashboard/index.html into dashboard/app.js
- Remove 'unsafe-inline' from script-src CSP directive
- Update security test to match new CSP policy

https://claude.ai/code/session_01GfwUNbgeMgXreFDbsNQMsS
2026-02-19 20:53:15 +00:00
thePR0M3TH3AN fa59d658d6 Merge branch 'main' into agents/daily/protocol-research-agent-run-9833362316977900264 2026-02-19 08:38:47 -05:00
google-labs-jules[bot]andPR0M3TH3AN cc9a3fe69e Fix CI failure: copy missing deps & symlink node_modules in memory policy test
- Updates `test/run-scheduler-cycle-memory-policy.test.mjs` to copy `src/utils.mjs`, `src/torch-config.mjs`, `src/constants.mjs`, `src/relay-health.mjs`, and `src/lock-ops.mjs` to the temporary test environment.
- Symlinks `node_modules` into the test environment to resolve external dependencies (e.g., `nostr-tools`).
- Resolves `ERR_MODULE_NOT_FOUND` errors during CI.
- Includes Protocol Research Agent daily run artifacts (Protocol Inventory update and Report).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-19 13:29:58 +00:00
thePR0M3TH3AN 19f73142cf Merge pull request #316 from PR0M3TH3AN/agents/daily/perf-agent-run-16751979136899284510
Execute daily perf-agent run
2026-02-18 21:46:35 -05:00
google-labs-jules[bot]andPR0M3TH3AN bf41f181ee fix(test): inject AGENT_PLATFORM=codex in scheduler cycle tests
- Explicitly sets `AGENT_PLATFORM: 'codex'` in `test/run-scheduler-cycle-memory-policy.test.mjs` for tests that assert platform-specific output.
- Resolves CI failures where `detectPlatform` was falling back to `'unknown'` or the host environment's platform, causing assertion mismatches.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-19 01:09:14 +00:00
google-labs-jules[bot]andPR0M3TH3AN e4fecf631b fix(test): copy src/utils.mjs to temp dir in scheduler cycle test
- Addresses `ERR_MODULE_NOT_FOUND` in `test/run-scheduler-cycle-memory-policy.test.mjs` caused by missing dependency in the temporary test environment.
- Ensures `src/utils.mjs` is available for `scripts/agent/run-scheduler-cycle.mjs` during test execution.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-19 01:04:59 +00:00
google-labs-jules[bot]andPR0M3TH3AN afefda9281 fix(test): copy src/utils.mjs to temp env in scheduler tests
Resolves `ERR_MODULE_NOT_FOUND` in `run-scheduler-cycle-memory-policy.test.mjs` by explicitly copying `src/utils.mjs` to the temporary test directory structure, satisfying the import dependency of `scripts/agent/run-scheduler-cycle.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-19 00:58:25 +00:00
google-labs-jules[bot]andPR0M3TH3AN 23bb42a20c Fix: Update e2e test to allow 'unknown' platform
- Updated `test/scheduler-preflight-lock.e2e.test.mjs` to expect `detectPlatform() || 'unknown'` instead of hardcoding `'codex'`.
- This ensures the test passes in CI environments where `detectPlatform()` returns `null`, causing the script to default to `'unknown'`, as well as in local environments where it detects a platform like `'jules'`. This aligns with the updated default logic in `run-scheduler-cycle.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 21:55:00 +00:00
google-labs-jules[bot]andPR0M3TH3AN f003970195 Fix: Update e2e test to match detected platform
- Updated `test/scheduler-preflight-lock.e2e.test.mjs` to expect `detectPlatform() || 'codex'` instead of hardcoding `'codex'`.
- This ensures the test passes when running in environments where the platform is correctly detected (e.g., 'jules'), aligning with the changes made in the previous commit.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 21:51:11 +00:00
google-labs-jules[bot]andPR0M3TH3AN c1a4499499 Fix: Correctly detect agent platform and fix test fixture
- Updated `src/utils.mjs` to detect 'claude' platform via `CLAUDE_API_KEY`, `ANTHROPIC_API_KEY`, or `CLAUDE_SESSION_ID`.
- Updated `scripts/agent/scheduler-utils.mjs` `getSafeEnv` to preserve `JULES_`, `CODEX_`, `CLAUDE_`, `ANTHROPIC_`, and `GOOSE_` environment variables when spawning child processes.
- Updated `scripts/agent/run-scheduler-cycle.mjs` to use `detectPlatform()` as a fallback for `AGENT_PLATFORM` instead of hardcoding `'codex'`, ensuring the correct platform is used for lock creation.
- Added unit tests for `detectPlatform` in `test/utils.test.mjs`.
- Fixed `test/scheduler-lock-failure-schema.contract.test.mjs` to include `src/utils.mjs` in the temporary test environment, resolving `ERR_MODULE_NOT_FOUND`.

This resolves the issue where lock cards displayed "Unknown" or incorrect platforms and fixes the resulting CI failure.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 21:46:40 +00:00
google-labs-jules[bot]andPR0M3TH3AN ae2e382bfd Fix: Correctly detect agent platform for locks
- Updated `src/utils.mjs` to detect 'claude' platform via `CLAUDE_API_KEY`, `ANTHROPIC_API_KEY`, or `CLAUDE_SESSION_ID`.
- Updated `scripts/agent/scheduler-utils.mjs` `getSafeEnv` to preserve `JULES_`, `CODEX_`, `CLAUDE_`, `ANTHROPIC_`, and `GOOSE_` environment variables when spawning child processes.
- Updated `scripts/agent/run-scheduler-cycle.mjs` to use `detectPlatform()` as a fallback for `AGENT_PLATFORM` instead of hardcoding `'codex'`, ensuring the correct platform is used for lock creation.
- Added unit tests for `detectPlatform` in `test/utils.test.mjs`.

This resolves the issue where lock cards displayed "Unknown" or incorrect platforms.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 21:42:56 +00:00
google-labs-jules[bot]andPR0M3TH3AN 12625bc41b Cleanup repo structure and consolidate tests
- Consolidated `tests/` into `test/`
- Moved `test-audit/` scripts to `scripts/test-audit/`
- Updated audit scripts to support configurable output directory
- Removed root clutter (`test_output.txt`)
- Updated documentation and agent prompts

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 20:49:19 +00:00
google-labs-jules[bot]andPR0M3TH3AN 9d0d7d274e chore: test integrity enforcement and dashboard security fix
- Refactored `test/memory-scheduler.test.mjs` to use `mock.timers` for deterministic execution, replacing flaky `wait` logic.
- Strengthened `test/lock-ops.test.mjs` with edge case tests for `parseLockEvent` handling invalid JSON and missing fields.
- Fixed a security vulnerability in `src/dashboard.mjs` where sensitive configuration (e.g., rosters, auth) was exposed in `/torch-config.json`.
- Updated `src/prompts/daily/test-audit-agent.md` to comply with the canonical prompt contract.
- Added `reports/test-audit/test-integrity-note-2025-02-14.yaml` detailing test changes and anti-cheat measures.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 19:33:29 +00:00
google-labs-jules[bot]andPR0M3TH3AN 57f6675c64 Weekly fuzz-agent run: fixes and execution
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 15:22:04 +00:00
thePR0M3TH3AN 1d30b2f28d Merge branch 'main' into jules-test-roster-improvement-7422741331242836925 2026-02-18 09:50:23 -05:00
thePR0M3TH3AN 90fdaae6a5 Merge pull request #284 from PR0M3TH3AN/perf/optimize-roster-check-4709742538455928107
⚡ Optimize roster check in cmd-list using Set
2026-02-18 09:49:16 -05:00
thePR0M3TH3AN 845333e980 Merge branch 'main' into dashboard-security-headers-10540095592303062285 2026-02-18 09:47:42 -05:00
thePR0M3TH3AN 30212a6213 Merge pull request #275 from PR0M3TH3AN/fix-install-dir-command-injection-4005485668731201594
🔒 Fix command injection via install directory name
2026-02-18 09:47:23 -05:00
thePR0M3TH3AN 76c1513cfd Merge branch 'main' into jules-tests-utils-9764403852439497661 2026-02-18 09:46:52 -05:00
thePR0M3TH3AN 0c4650e92a Merge pull request #271 from PR0M3TH3AN/jules-3313039613758629393-8f27954c
Enhance test coverage for relay alert thresholds
2026-02-18 09:46:23 -05:00
thePR0M3TH3AN f5dee21b74 Merge branch 'main' into chore/remove-dead-code-cmd-check-6250725036284174249 2026-02-18 09:45:58 -05:00
thePR0M3TH3AN a231ea0784 Merge branch 'main' into jules/testing-relay-health-12520607155456440581 2026-02-18 09:44:14 -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 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 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 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