Commit Graph
303 Commits
Author SHA1 Message Date
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
Bilthon a637ecf804 bench: add in-process /usage/summary vs legacy benchmark 2026-06-04 00:46:52 -05:00
Bilthon bc7ac9ff01 fix(daemon): import bun ModelManager for event persistence 2026-06-03 11:39:16 -05:00
Bilthon 6b746debed fix(monitor): use all-time summary totals in overview and exclude today from recent days 2026-06-02 22:03:56 -05:00
Bilthon c47145137d fix(test): export reset hook and call it in beforeEach for cache isolation 2026-06-02 15:27:19 -05:00
Bilthon bc8611ba7f fix(daemon): include client identity in usage-summary cache key 2026-06-02 15:26:55 -05:00
Bilthon c08f64941e fix(monitor): align top-models-per-client across summary and legacy 2026-06-02 15:26:43 -05:00
Bilthon b60b810dc8 fix(monitor): match summary today bucket to local day 2026-06-02 15:26:14 -05:00
Bilthon f0978f22c1 test: cover /usage/summary builder 2026-06-02 14:53:38 -05:00
Bilthon 21eb887346 feat(monitor): consume /usage/summary with legacy fallback 2026-06-02 14:51:02 -05:00
Bilthon 8f77da3911 feat(daemon): add /usage/summary aggregated endpoint 2026-06-02 14:45:06 -05:00
Bilthon 1b99aa1660 chore(deps): require @routstr/sdk ^0.4.0 for usage aggregate 2026-06-02 14:43:42 -05:00
Bilthon 0c382209af refactor: import bun sqlite drivers from @routstr/sdk/storage/bun 2026-06-02 14:43:35 -05:00
Bilthon c6c4ed61e1 fix(monitor): display usage timestamps in local time instead of UTC 2026-06-01 18:10:14 -05:00
redshift fec0d99d72 fix: switch clients commands back to callDaemon
Clients management endpoints (/clients, /clients/add, /clients/delete)
should route through the daemon directly, not the auth proxy.
2026-06-01 16:07:44 +08:00
redshift dfc7fbf1f3 added nsec creation during onboarding. 2026-06-01 00:01:23 +08:00
redshift f9412af8b3 version bump and using the new adapters and a local eventsDb. 2026-05-30 18:25:18 +08:00
redshiftandGitHub 2dc2cf64ec Merge pull request #39 from Routstr/feat/auth-url-for-npubs-clients-usage
feat: add auth URL for npubs clients usage
2026-05-30 06:22:45 +00:00
redshiftandGitHub f9a85b3fc6 Merge pull request #38 from Routstr/feat/pi-integration-contexts
feat: add context window support to pi integration
2026-05-30 06:22:03 +00:00
redshiftandGitHub f52da6cffc Merge pull request #37 from jeroenubbink/fix/onboard-silent-output-and-blocked-postinstall
fix(onboard): show integration menu and progress in terminal
2026-05-30 06:21:30 +00:00
redshift 17529e762e feat: add context window support to pi integration
- Add optional contextWindow field to PiModelEntry type
- Map model.context_length to contextWindow when available
- Add context_length to RoutstrModel type in registry
2026-05-30 14:04:24 +08:00
redshift 94cd2ff15d feat: add authUrl config for routing management commands to auth proxy
Adds an authUrl field to RoutstrdConfig so CLI management commands
(npubs, clients, usage) can be directed to the routstrd-auth proxy
instead of the daemon. This fixes 'routstrd npubs list' failing with
'Only POST is supported' when the auth proxy and daemon run on
separate ports (e.g., Cloudron setup: proxy on 8008, daemon on 8009).

Changes:
- config.ts: add authUrl to RoutstrdConfig
- daemon-client.ts: add getAuthBaseUrl(), callAuth(), refactor callDaemon
- cli.ts: npubs/usage commands use callAuth, remote command accepts --auth-url
- clients.ts: clients commands use callAuth
2026-05-30 05:30:42 +00:00
Jeroen UbbinkandClaude Sonnet 4.6 739034b043 fix(onboard): show integration menu and progress in terminal
The logger utility in this project is a file-only logger — every call to
logger.log() / logger.error() writes to ~/.routstrd/logs/YYYY-MM-DD.log
and produces no terminal output whatsoever. This is intentional and correct
for the background daemon (daemon/, start-daemon.ts), which has no attached
terminal.

However, the onboarding and integration code was mistakenly using logger.log
instead of console.log for all of its user-facing output:

- setupIntegration() printed the 1-6 integration menu with logger.log, so
  the user only ever saw the bare prompt 'Select integration [1]: ' with no
  options above it. The selection appeared to be broken.

- Every install*Integration function (opencode, openclaw, claudecode, hermes,
  pi) reported all progress and results with logger.log, so after picking an
  integration nothing appeared to happen.

- initDaemon() used logger.log for 'Initialization complete!' and the
  follow-up wallet instructions, so those were also silently dropped.

- installCocodOrExit() used logger.log for the 'cocod not found, installing'
  message and the success/failure result.

Fix: replace logger.log/logger.error with console.log/console.error in all
CLI-facing code paths (cli.ts, integrations/index.ts, and all five
integration installers). Remove the now-unused logger import from the five
integration files. The logger import in integrations/index.ts is kept because
refreshModelsAndIntegrations() is called by the daemon's internal scheduler
and correctly logs to file there.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 09:02:36 +02:00
redshift 8db3b3cf8b lock v0.3.0 2026-05-25 08:57:57 +08:00
redshift ba52a3c52e bumped version 2026-05-25 08:26:56 +08:00
redshiftandGitHub db3d4809f2 Merge pull request #36 from Routstr/feat/nwc-integration
feat: NWC (Nostr Wallet Connect) integration with auto-refill
2026-05-24 02:39:23 +00:00
redshift e9775c10d4 Display cooldown in minutes instead of milliseconds
- Add cooldownMinutes field to /nwc/status and /nwc/auto-refill responses
- Change auto-refill log from ms to minutes display
- Keep cooldownMs internally for calculations
2026-05-24 10:23:29 +08:00