Commit Graph
93 Commits
Author SHA1 Message Date
redshift e07098ae8c feat: check for version updates before installing; show update banner in TUI
- Extract version-checking logic into src/utils/update-checker.ts (shared
  between CLI and TUI)
- Updating routstrd...
bun add v1.2.22 (6bafe260)

installed routstrd@0.3.10 with binaries:
 - routstrd

[649.00ms] done
routstrd updated successfully.

Updating cocod...
bun add v1.2.22 (6bafe260)

installed @routstr/cocod@0.0.24 with binaries:
 - cocod

[692.00ms] done
cocod updated successfully.

Both routstrd and cocod have been updated!

Using remote daemon — skipping routstrd daemon restart.

cocod daemon was not running — skipping restart.

✓ All daemons restarted successfully. now checks npm for the latest version of each package
  and only reinstalls when a newer version is available; skips daemon
  restart when nothing was updated
- TUI shows a bold yellow 'UPDATE AVAILABLE' banner below the header on
  all tabs when a new version is detected
- TUI checks for updates at most every 210 minutes to avoid spamming the
  npm registry; first check fires 3s after startup (non-blocking)
- Bump version to 0.3.11
2026-07-20 20:52:34 +01: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 2026-07-06 18:27:00 +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 dfc7fbf1f3 added nsec creation during onboarding. 2026-06-01 00:01:23 +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
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 99244a8bdb feat: hot-reload NWC connection (remove restart requirement)
- Add reconnect() method to wallet adapter that tears down old
  WalletConnect/RelayPool and creates a new one on the fly
- Auto-refill loop now uses a getWallet() getter so it always
  references the latest wallet instance after reconnect
- POST /nwc/connect and /nwc/disconnect handlers call reconnect()
  after saving config, no restart needed
- Remove 'Run routstrd restart' messages from CLI connect/disconnect
2026-05-24 09:22:45 +08:00
redshift c98709e383 feat: auto-refill no longer requires daemon restart
Changed startAutoRefillLoop to accept a config getter instead of a static
config object. The getter reads config from disk on every check cycle, so
CLI changes (nwc auto-refill on/off) take effect immediately.

- auto-refill.ts: config parameter replaced with getConfig() callback
- wallet/index.ts: always start loop when wallet exists, use getter
- daemon/index.ts: pass getAutoRefillConfig reading from disk sync
- config-store.ts: added loadDaemonConfigSync() for sync disk reads
- http/index.ts + cli.ts: removed 'Restart daemon to apply' messages
2026-05-23 22:37:43 +08:00
redshift 44e6dd884f Merge branch 'main' of github.com-red:Routstr/routstrd into feat/nwc-integration 2026-05-19 01:26:04 +08:00
redshift cee4666f6e nwc integration 2026-05-19 01:25:27 +08:00
redshift 8ae0288d95 docker now has current repo and also added xcashu refunds to the cli 2026-05-19 01:25:00 +08:00
redshift a0ba9f337b feat: add --hermes flag to clients add CLI command 2026-05-04 16:03:39 +00:00
redshift a89ff52cbb fix: handle unwrapped response in npubs update command
PATCH /npubs returns { npub, pubkey, role } at the top level, not
wrapped in { output }. Use result.output ?? result to handle both
response formats.
2026-05-04 20:56:36 +05:30
redshift 52dcecbefe working on adding role update feature 2026-05-04 20:48:53 +05:30
redshift 4cdd05fd98 feat: show role in npubs list output
- Updated npubs list to display role (admin/user) for each npub
- Changed header from 'Admin npubs' to 'Npubs' to reflect all roles
- Updated command descriptions to reflect broader scope
- Also fixed 'admin npub' message in add command output
2026-05-04 11:35:44 +08:00
redshift 84fd05f2d5 fix: properly print npub objects in 'npubs list' command
The daemon now returns npubs as objects with npub/role fields, not plain
strings. Updated the CLI to handle the new NpubEntry type format.
2026-05-04 01:09:11 +08:00
redshift 9fac004f05 refactor(usage): remove CLI-side suffix filtering now that auth proxy handles it
The auth proxy intercepts GET /usage and returns only entries belonging to
the authenticated npub's clients, with owner suffixes stripped. The TUI no
longer needs to filter entries client-side.

- Remove getNpubSuffix and loadConfig from tui/usage/data.ts imports
- Remove old suffix-based filtering logic from fetchUsage()
- Remove unused getNpubSuffix from cli.ts imports
2026-05-03 16:21:38 +08:00
redshift 9a520efb24 added a register command. 2026-04-30 16:45:31 +05:30
redshift c1c72bc147 Add 'refresh' CLI command to refresh models and integrations
- Added 'routstrd refresh' command that:
  - Calls /v1/models?refresh=true to refresh routstr21 models
  - Calls runIntegrationsForClients() for all registered clients
- Fixed type signature in refreshModelsAndIntegrations (returns any[] not void)
- Imports getClientsList and runIntegrationsForClients in cli.ts
2026-04-30 12:04:13 +05:30
redshift 366a129c3c refactor: move client logic from cli.ts and daemon-client.ts to clients.ts
- Moved addDaemonClient and ensureDaemonClient from daemon-client.ts to clients.ts
- Moved clients list/delete/add action handlers from cli.ts to clients.ts
- Updated cli.ts to call the new action functions from clients.ts
- Updated integrations/index.ts to import ensureDaemonClient from clients.ts
- Fixed circular dependency by having clients.ts import from ../integrations/registry instead of ../integrations
2026-04-29 23:14:10 +05:30
redshiftandGitHub 8bbb55f7d5 Merge pull request #20 from Routstr/add-remote-command
Added remote command.
2026-04-29 16:46:11 +00:00
redshift 90777f6c07 Added remote command. 2026-04-29 22:14:19 +05:30
redshiftandGitHub f402e36f91 Merge branch 'main' into fix/remote-mode-clients-list 2026-04-28 10:19:34 +00:00
redshift fc7113be4b refactor: read clients list through abstraction for local and remote mode
Replace direct store.getState().clientIds access with a shared utility:
- getClientsFromStore(store) for daemon/local usage
- getClientsList() for remote CLI usage via daemon API

This ensures integration refresh logic and client management work
consistently whether running inside the daemon or connecting to a
remote daemon where store access is unavailable.

Updated:
- src/daemon/index.ts: use getClientsFromStore for integration refresh
- src/daemon/http/index.ts: use getClientsFromStore in /clients endpoints
- src/utils/daemon-client.ts: use getClientsList in ensureDaemonClient
- src/cli.ts: use getClientsList in clients list command
2026-04-28 15:22:21 +05:30
redshift 711a04f09d refactor: consolidate ensureDaemonClient in daemon-client.ts
- Move get-or-create client logic from integrations/index.ts into
  ensureDaemonClient() in daemon-client.ts as a generic utility.
- Update setupIntegration() and the CLI clients add --<integration>
  paths to use the new helper.
- Return { client, created } so callers can decide whether to log.
- Remove IntegrationClient alias and ensureIntegrationClient export.
2026-04-28 15:04:52 +05:30
redshift 2828d7c0ae feat(cli): highlight user npub in npubs list and suggest adding it if missing 2026-04-28 15:04:14 +05:30
redshift a207acb645 refactor: extract addDaemonClient to eliminate duplicate /clients/add calls
- Add shared DaemonClient type and addDaemonClient() helper in
daemon-client.ts as the single source for POST /clients/add.
- Update ensureIntegrationClient() to use the new helper.
- Update CLI clients add command to use the new helper.
- Keeps existing error handling and 'already exists' fallback in
ensureIntegrationClient().
2026-04-28 14:34:12 +05:30
redshift cdc2c26c72 feat(cli): suffix client names with last 7 chars of npub in remote mode
- clients add: appends _<npub_suffix> to name when daemonUrl+nsec are set
- clients list: filters to only clients matching our npub suffix, strips suffix for display
- clients delete: auto-appends suffix to id before sending if not already present
- adds getNpubSuffix() helper in daemon-client.ts
2026-04-28 13:51:23 +05:30
redshift f9a7db9ae0 refactor: create integration clients through daemon instead of local sqlite
- clients add --pi-agent/--opencode/--openclaw/--claude-code now call
  /clients/add on the daemon instead of writing to local Bun SQLite
- add ensureIntegrationClient helper that creates via daemon and falls
  back to fetching existing client on 409
- update install*Integration signatures to accept apiKey instead of SdkStore
- update onboard setupIntegration to use daemon-backed path
- update daemon scheduled refresh to pass apiKeys directly
2026-04-28 13:08:00 +05:30
redshift ec8f7b962d fixed formatting when reading npubs 2026-04-28 13:01:08 +05:30
redshift ebec737191 feat(cli): add npubs management commands
- Add normalizeNostrPubkey, npubFromPubkey, npubFromSecretKey to nip98.ts
- Extend callDaemon to accept DELETE method
- Add  subcommands:
  - list: GET /npubs
  - add <npub>: POST /npubs (accepts hex pubkey or npub1...)
  - delete <npub>: DELETE /npubs/:npub (accepts hex pubkey or npub1...)
- All npubs commands go through callDaemon, so they work with
  remote daemons and are automatically NIP-98 signed
2026-04-28 11:16:14 +05:30
redshift 6461b0f84a fix(integrations): use remote daemon URL and callDaemon for client setups
- Export getDaemonBaseUrl from daemon-client for shared URL resolution
- Replace all hardcoded http://localhost: in client integrations
  (opencode, claudecode, openclaw, pi) with getDaemonBaseUrl(config)
- Replace raw fetch(http://localhost:/models) with callDaemon("/models")
  so model fetching works with remote daemons and gets NIP-98 signed
- Fix clients add command output to print the actual daemon base URL
  instead of hardcoded localhost
2026-04-28 10:07:20 +05:30
redshift 8d6a7d7f21 feat(cli): NIP-98 auth for remote daemon URLs
- Add nostr-tools dependency for NIP-98 event signing
- Add nsec field to RoutstrdConfig for remote daemon authentication
- Extract NIP-98 auth utilities into src/utils/nip98.ts (parseSecretKey,
  createNIP98Authorization with SHA-256 payload tags)
- Wire NIP-98 Authorization headers into callDaemon and isDaemonRunning
  whenever both daemonUrl and nsec are configured
- Refactor refund command to use callDaemon instead of hardcoded localhost
  so it works correctly with remote daemon URLs
2026-04-28 10:02:45 +05:30
redshift 7dfed2c052 Add daemonUrl config for remote daemon support
- Add optional daemonUrl field to RoutstrdConfig
- Update callDaemon and isDaemonRunning to use configurable base URL
- Disable auto-start when daemonUrl is set (Option A)
- Gate local-only commands: onboard, start, restart, mode, logs, service install
2026-04-28 09:26:50 +05:30
redshiftandGitHub bf82a99957 Merge pull request #11 from Routstr/fix/dynamic-version
fix(cli): dynamically read version from package.json
2026-04-27 17:17:36 +00:00
redshift 2b6876ccd6 feat: add clients delete command
Add 'routstrd clients delete <id>' CLI command and POST /clients/delete
HTTP endpoint to remove a client by its ID.
2026-04-27 19:22:56 +05:30
redshift 3d390fe541 refactor: split cli-shared into utils/daemon-client and cli.ts
- Moved daemon communication helpers (loadConfig, callDaemon,
  isDaemonRunning, startDaemonProcess, ensureDaemonRunning,
  handleDaemonCommand) from cli-shared.ts to src/utils/daemon-client.ts
- Moved the refund command from cli-shared.ts into cli.ts with the
  rest of the CLI commands
- cli.ts now imports program directly from commander and daemon
  helpers from utils/daemon-client
- TUI imports are updated to use utils/daemon-client
- Removed src/cli-shared.ts
2026-04-26 20:58:12 +05:30
redshift 51c80c6d3d fix(cli): dynamically read version from package.json 2026-04-25 22:12:08 +05:30
redshift 57bfa94c58 fix: include /v1 suffix in all localhost URLs shown to users
Updates all user-facing log messages to include the /v1 path suffix,
so clients know to use http://localhost:${port}/v1 when configuring
their API endpoints.

- src/cli.ts:717 — clients add --setup-all flow
- src/cli.ts:757 — clients add -n ${name} flow
- src/daemon/index.ts:206 — daemon startup message
- src/start-daemon.ts:29 — daemon already running message
2026-04-25 15:45:23 +05:30
redshift b306086a6d added instrcutions to add new clients via CLI easily. Updated skill as well. 2026-04-23 18:41:06 +05:30
redshift 293f1098a5 fixed issues with cocod init 2026-04-23 17:12:58 +05:30
redshift c88da1080e added shortcuts for wallet commands 2026-04-23 02:35:27 +05:30
redshift 5866a55d7d fixed command for logs 2026-04-17 12:05:52 +01:00
redshift 3cebd6c4b4 fix: improve daemon path resolution for PM2 service installation 2026-04-14 16:41:21 +01:00
redshift 003cde2f89 docs: suggest 'service install' in onboard for reboot persistence 2026-04-14 16:36:53 +01:00
redshift ac149bd1f7 feat: add 'top' as alias for 'monitor' command 2026-04-14 16:34:46 +01:00
redshift 8fb7ac580e feat: add PM2 service management commands for daemon persistence 2026-04-14 16:33:21 +01:00