14 Commits
Author SHA1 Message Date
thePR0M3TH3AN 1fa4d4560e Fix host-repo scheduler config resolution and handoff defaults 2026-02-25 14:48:11 -05:00
google-labs-jules[bot]andPR0M3TH3AN 003e18b93b Fix CI lint error in lock-publisher.mjs
- Ensure `src/lock-publisher.mjs` does not import `randomInt`.
- Clean up test output artifacts.
- Re-verify tests pass locally.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-21 20:48:15 +00:00
thePR0M3TH3AN 9fef4c4f46 update 2026-02-21 15:16:45 -05:00
google-labs-jules[bot]andPR0M3TH3AN 4e01a33cc2 fix(lock): fix potential duplicate imports in lock-publisher
- Rewrote `src/lock-publisher.mjs` to ensure clean imports and no duplicate declarations of `withTimeout`.
- This addresses the lint error `Identifier 'withTimeout' has already been declared` seen in CI.
- Verified lint passes locally.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-21 19:54:06 +00:00
google-labs-jules[bot]andPR0M3TH3AN ef22045a61 fix(scheduler): Resolve CI module export error in lock-utils
- Fix `SyntaxError: The requested module './lock-utils.mjs' does not provide an export named 'withTimeout'` by refactoring exports in `src/lock-utils.mjs`.
- Explicitly import `relayListLabel` and `mergeRelayList` from `src/utils.mjs` before exporting them to avoid ambiguous export behavior in some environments.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-21 19:46:26 +00:00
google-labs-jules[bot]andPR0M3TH3AN eefab43fdf fix(lock-utils): consolidate function declarations and fix CI failures
- Imported `randomInt` from `node:crypto` in `src/lock-publisher.mjs` to fix CI failure.
- Centralized `withTimeout` and `mergeRelayList` in `src/utils.mjs`.
- Updated `src/lock-utils.mjs` to re-export them.
- Removed local redefinitions in `src/lock-ops.mjs` and `src/lock-publisher.mjs`.
- Fixed `test/utils.test.mjs` imports.
- Verified all tests pass.

This resolves the N/A documentation task by ensuring the codebase is in a valid state.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-21 19:32:26 +00:00
google-labs-jules[bot]andPR0M3TH3AN 3648b0da40 fix(security): remove default credentials from example config
Removes the hardcoded `auth: "admin:password"` from `torch-config.example.json` to prevent users from accidentally deploying with insecure defaults.

Adds a regression test `test/verify-example-config-security.test.mjs` to ensure the example config does not contain default credentials in the future.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-20 21:50:55 +00:00
google-labs-jules[bot]andPR0M3TH3AN 7c41e040bd docs: align package config and documentation paths
- Update `package.json` to include `TORCH.md` and `scripts/memory/` in distribution.
- Update `README.md` to reference `TORCH.md` correctly.
- Update `src/ops.mjs` to robustly handle memory policy paths in `torch-config.json` generation.
- Update `.gitignore` to exclude `.scheduler-memory/`.
- Update `torch-config.example.json` to include memory policy with standard defaults.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 16:51:35 +00:00
google-labs-jules[bot]andPR0M3TH3AN 456bc2df18 feat(security): add authentication and host binding to dashboard
This commit addresses the missing authentication vulnerability in the
dashboard server.

Changes:
- Added Basic Authentication support via TORCH_DASHBOARD_AUTH env var
  or dashboard.auth config field.
- Defaulted dashboard host binding to 127.0.0.1 for better security.
- Added --host CLI argument to allow overriding the bind address.
- Used crypto.timingSafeEqual for secure credential comparison.
- Fixed a potential crash when parsing malformed Authorization headers.
- Added comprehensive unit tests for dashboard authentication.
- Updated documentation in README.md and torch-config.example.json.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 17:24:33 +00:00
google-labs-jules[bot]andPR0M3TH3AN d23e6ff0b3 Refactor memory scripts and fix configuration for new installs
- Replaced fragile inline Node.js scripts in `torch-config.json` with dedicated modules: `scripts/memory/retrieve.mjs` and `scripts/memory/store.mjs`.
- Updated `src/ops.mjs` initialization logic to dynamically configure `scheduler.memoryPolicyByCadence` with correct paths based on the installation directory.
- Added default memory policy configuration to `torch-config.example.json` to guide users.
- Injected `torch:memory:list` and `torch:memory:inspect` convenience scripts into the host `package.json` during `init`.
- Removed legacy shell scripts (`run-memory-retrieval.sh`, `run-memory-store.sh`).
- Verified memory scripts function correctly and pass linting.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 17:19:55 +00:00
google-labs-jules[bot]andPR0M3TH3AN 487081f319 Improve torch init experience with interactive prompts and script injection
- Modified `init` to be interactive, asking for install directory, namespace, and relays.
- Added automatic injection of convenience scripts (`torch:check`, `torch:lock`, etc.) into the host `package.json`.
- Increased default network timeouts (30s query, 15s publish) to reduce failure rate.
- Added visual feedback (logs) during relay connection and querying.
- Refactored `src/ops.mjs` to support flexible installation paths.
- Updated `src/torch-config.mjs` to support config resolution from parent directories (e.g., when running via `npm run --prefix`).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 02:44:48 +00:00
thePR0M3TH3AN 57ba0fe4f4 Improve lock relay health ranking and quarantine handling 2026-02-14 19:15:31 -05:00
thePR0M3TH3AN 84d3e7eded Harden lock backend config validation and fallback behavior 2026-02-14 18:48:21 -05:00
google-labs-jules[bot]andPR0M3TH3AN 35092b3d5a Refactor torch-lock into an installable NPM library and CLI
- Rename `src/nostr-lock.mjs` to `src/lib.mjs` and export core functions.
- Create `bin/torch-lock.mjs` as the CLI entry point.
- Implement `dashboard` command in `src/lib.mjs` to serve the dashboard using Node.js.
- Update `package.json` to configure `bin`, `main`, and `files` for NPM packaging.
- Create `torch-config.example.json` as a template for consumers.
- Update tests and README.md to reflect the new structure.
- Exclude task-specific artifacts (logs, context) from the package while retaining prompts and docs.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-14 06:41:49 +00:00