Commit Graph
329 Commits
Author SHA1 Message Date
redshift 280bc06dc4 bumped sdk 2026-07-23 13:54:00 +01:00
redshift eb2d217c24 feat: auto-stop legacy cocod on daemon start
When upgrading from an older routstrd that ran cocod as a separate
process, the new in-process coco wallet refused to start because cocod
still held coco.db. Users had to manually 'cocod stop' (which ironically
could respawn the daemon) or kill the PID.

- coco-client.ts: add stopLegacyCocod() — reads cocod's PID file, sends
  SIGTERM, polls until the process exits and the PID file is removed.
  Refuses (no SIGKILL) on timeout to avoid corrupting coco.db mid-recovery.
- cli.ts: call stopLegacyCocod() in the 'start' action before spawning
  the daemon, so the upgrade path is automatic.

assertLegacyCocodNotRunning stays as a safety net for any caller that
bypasses the CLI.
2026-07-23 13:00:05 +01:00
redshift e46c3fa37f fix: surface real daemon error on startup failure and hint kill PID
The CLI spawned the daemon detached with stdout/stderr redirected to
debug.log, so when the daemon exited early the user only saw a useless
'Check logs in ~/.routstrd/logs' message while the actual error sat
silently in the log file.

- daemon/index.ts: print fatal startup error to stderr (captured by the
  spawn redirect) in addition to the dated logger.
- start-daemon.ts: record debug.log offset before spawning; on early exit
  read the newly appended output and include it in the thrown error.
- coco-client.ts: add 'kill <PID>' alternative to the legacy-cocod guard
  error message alongside 'cocod stop'.
2026-07-23 12:25:56 +01:00
redshift a583aaa482 fix logging 2026-07-20 20:31:55 +01:00
redshiftandGitHub 55e8615cde Merge pull request #54 from Routstr/feat/history-command
feat: add history command and /wallet/history endpoint
2026-07-19 13:41:13 +00:00
redshift 4694804a40 feat: add history command and /wallet/history endpoint
- Add 'history' CLI command with --limit, --offset, --verbose, --json options
- Add GET /wallet/history daemon endpoint
- Implement getHistory() in coco-client using coco.history.getPaginatedHistory()
- Add getHistory stub (returns []) to cocod-client interface
2026-07-16 01:08:47 +08:00
redshift aaafe91a4a fix(wallet): let coco recover failed operations 2026-07-13 20:32:02 +08:00
redshift 2d7c7e9b24 test(wallet): verify legacy cocod database migration 2026-07-13 20:17:14 +08:00
redshift 0b63ad31bf fix(wallet): protect mnemonic file permissions 2026-07-13 19:57:54 +08:00
redshift 52e5d9b1d6 fix(wallet): retain legacy cocod PID lock 2026-07-13 19:35:04 +08:00
redshift 19ae28c382 fix(wallet): block coco-core while legacy cocod is running
Check the legacy cocod PID file and Unix socket before opening coco.db. Refuse startup when cocod is active or its state cannot be verified, while permitting confirmed stale socket files. Add focused coverage for PID, live socket, stale socket, and fail-closed behavior.
2026-07-13 17:16:15 +08:00
redshift ca2c53f8cd fix(cli): remove cocod restart/update from update command after coco-core migration
After rebasing onto main, the update command and restartDaemonsAfterUpdate
still referenced resolveCocodExecutable and @routstr/cocod. Since cocod is
no longer a separate process, remove all cocod daemon management from the
update flow.
2026-07-13 17:04:49 +08:00
Om Santoshwarandredshift 4afc50500d fix(wallet): add cancel on send/melt failure, use trusted mints for listMints, improve receiveBolt11 type safety 2026-07-13 17:02:22 +08:00
Om Santoshwarandredshift a2219e43a9 fix: revert cosmetic formatting and document coco-core wallet status 2026-07-13 17:02:22 +08:00
Om Santoshwarandredshift 9ca937d4ad feat(cli): remove cocod dependency from onboard and start commands 2026-07-13 17:02:22 +08:00
Om Santoshwarandredshift 11d9a2b1f7 feat(wallet): replace cocod IPC with coco-core library 2026-07-13 17:02:22 +08:00
redshift 2a31fef10b chore: bump version to 0.3.10 v0.3.10 2026-07-12 08:26:44 +05:30
redshiftandGitHub e405e685b8 Merge pull request #52 from Routstr/fix-overriding-agent-config
fix breaking hermes config
2026-07-12 02:54:35 +00:00
9qeklajc f90e65aa09 fix breaking hermes config 2026-07-11 16:33:28 +02:00
redshift a7de201330 chore: bump version to 0.3.9 v0.3.9 2026-07-10 12:57:30 +05:30
redshift 9e8f8178a9 chore: bump version to 0.3.8 v0.3.8 2026-07-09 12:27:30 +05:30
redshift 60bc8b4cb2 fix: capture daemon crash logs and prevent silent crashes
- Redirect detached daemon stdout/stderr to ~/.routstrd/debug.log
  instead of ignoring them, so uncaught exception stack traces are
  no longer lost
- Add process-level uncaughtException/unhandledRejection handlers
  that log to the file logger before the process dies
- Wrap setInterval async callbacks (model refresh + refund jobs) in
  IIFE catch chains so rejected promises can't escape and kill the
  process silently
2026-07-09 00:07:13 +08:00
redshiftandGitHub 44cda2577d Merge pull request #50 from Routstr/feat/update-restart
feat(update): restart daemons after update
v0.3.7
2026-07-08 08:52:13 +00:00
redshift cf1ca5941a feat(update): restart daemons after update
The update command previously only downloaded and installed new
binaries for routstrd and cocod without restarting the running
daemons, so updates would not take effect until a manual restart.

- Add restartDaemonsAfterUpdate() helper that gracefully stops and
  restarts both daemons after a successful update
- routstrd: uses POST /stop (drains active connections), polls for
    shutdown, then calls startDaemon() with configured port/provider
- cocod: runs 'cocod stop', then spawns 'cocod daemon' detached,
    polls 'cocod ping' until it comes back up
- Skips restart for daemons that weren't running
- Skips routstrd daemon restart when using a remote daemon
- Collects and reports failures without rolling back the update
- Bump @routstr/sdk to 0.3.15
- Bump routstrd version to 0.3.7

Closes nostr task: update-restart
2026-07-08 16:39:31 +08:00
redshift f58e807807 Add 'update' command to upgrade routstrd and cocod globally v0.3.6 2026-07-06 18:27:00 +08:00
redshift 1a06093b96 bump version to 0.3.5, update @routstr/sdk to 0.3.14 v0.3.5 2026-07-06 11:37:34 +05:30
redshiftandGitHub f77bcf6d00 Merge pull request #47 from Routstr/syncing-sdk
Sync daemon with SDK discovery adapter API
2026-07-05 16:00:51 +00:00
redshift 1ff3b9a4e1 Fix renderToday definite-assignment and usage-summary stale fixtures
renderToday declared todayStats/recentDays/hourlyMap with let but only
assigned inside if (stats.summary); TypeScript flagged them as used
before assignment (TS2454). Initialize with sensible defaults so the
function degrades gracefully when summary is missing.

The usage-summary tz-bucketing test used hardcoded May 2026 timestamps
with a comment dated 2026-06-02. Those entries aged out of
getUsageSummary's 30-day rolling window, so days came back empty.
Recompute timestamps relative to now and assert on dynamically-derived
local-day date strings.
2026-07-05 21:27:20 +05:30
redshift b2738109e3 Sync daemon with SDK discovery adapter API 2026-07-04 21:11:56 +05:30
redshift 3c6161d9bf fix: add periodic Nostr event refresh to daemon
Calls refreshNostrEvents() after initial bootstrap and in the 21-minute
recurring job, covering provider discovery (38421) and lgtm reviews
(38425) which were previously only refreshed on manual trigger.
2026-06-28 10:33:52 +08:00
redshift a5be3b06e9 bump version to 0.3.4 and @routstr/sdk to 0.3.12 v0.3.4 2026-06-22 20:09:31 +08:00
redshift 9cc3b76483 refactor(tui): separate async fetching from sync rendering
Split the monolithic render() into two distinct functions:
- fetchData(): async background fetch that updates state and triggers
  a repaint, guarded against overlapping calls
- render(): synchronous paint that reads current state and writes to
  stdout, safe to call from key handlers without blocking

Run all four daemon calls concurrently via Promise.all to cut the
blocked window. Remove redundant isDaemonRunning() checks from each
fetch function in data.ts — the single check now lives in fetchData().

Key handlers now call the sync render() directly instead of
void render(false), so scrolling and tab switching feel instant.
2026-06-22 16:39:58 +08:00
redshiftandGitHub 8a13d23b2e Merge pull request #46 from Routstr/feat/request-response-logging-config
feat: configure raw request/response logging
v0.3.3
2026-06-20 09:41:32 +00:00
redshift d8385d5c2e verson bump 2026-06-20 17:40:16 +08:00
redshift f15e18cf05 Adapt request response logging to SDK sink 2026-06-20 17:00:52 +08:00
redshift 1735d97a9e feat: configure raw request response logging 2026-06-20 10:10:21 +08:00
redshiftandGitHub eacb75da30 Merge pull request #45 from Routstr/pr-43
feat: server-side /usage/summary endpoint with npub filtering
2026-06-11 02:02:35 +00:00
redshift 8c52c90f94 addeed npub filtering for /usage as well 2026-06-11 09:31:32 +08:00
redshift 61acc0b5fb added npub based filter! 2026-06-11 09:17:13 +08:00
redshift 764d2dd826 removed old functions with benchmark which is clearly not needed 2026-06-11 08:49:15 +08:00
redshift 829681ffca removed legacy usage support 2026-06-11 08:33:15 +08:00
redshift ae91c46f01 fix(usage-summary): compute size buckets in JS after SDK removed token-range filters
The SDK dropped minTotalTokens/maxTotalTokens from AggregateUsageOptions
(routstr-sdk c98de6b), so replace the five aggregate() calls with a single
list() and bucket entries in-process.
2026-06-10 17:29:19 +08:00
redshift 6536333224 Merge remote-tracking branch 'origin/main' into pr-43
# Conflicts:
#	package.json
#	src/daemon/index.ts
2026-06-10 17:14:24 +08:00
redshift 0ab608bf88 fixed provider disabling not working while running 2026-06-08 09:43:15 +08:00
redshift d87a911241 viisble lgos 2026-06-07 11:25:02 +08:00
redshift 4a66af87da feat(providers): add --refresh flag to providers list
routstrd providers list --refresh now:
- Re-fetches Nostr kind 38421 provider discovery events
- Re-fetches Nostr kind 38423 routstr21 model list
- Re-fetches Nostr kind 38425 review events (applies LGTM-based disable)
- Fetches models from all discovered providers
- Syncs fresh provider list and disabled status into the store

Usage: routstrd providers list --refresh
2026-06-07 11:13:39 +08:00
redshift 27b13c30b0 made relays configurable 2026-06-07 10:56:06 +08:00
redshift 70230d9030 cached otkens now appear on the TUI 2026-06-07 09:06:53 +08:00
redshift d86a231ed3 fix: use Bun-safe SDK entrypoints for ModelManager and storage
- Import ModelManager from @routstr/sdk/bun instead of @routstr/sdk
- Import storage helpers from @routstr/sdk/storage/bun instead of @routstr/sdk/storage
- Fix createBunSqliteUsageTrackingDriver call: async and no longer needs
  manual bun:sqlite import (now handled internally by the sdk entrypoint)
- Verified sharded discovery adapter setup matches SDK pattern in
  scripts/routstr-daemon.ts at 6077aa7
2026-06-06 18:13:06 +08:00
redshiftandGitHub 2e8bbc9aa0 Merge pull request #42 from bilthon/fix/monitor-time
Display usage timestamps in local time instead of UTC
2026-06-04 13:45:39 +00:00