Commit Graph
66 Commits
Author SHA1 Message Date
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 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
redshift f60afed4c3 fix: display prompt/completion pricing as sats per million tokens 2026-04-09 16:48:51 +01:00
redshift 7d439967ce feat(models): add model provider lookup with pricing info
Add -m/--model option to models serving a
specific model with their pricing details (prompt, completion, request,
max_cost in sats). Providers are sorted by max_cost (cheapest first).

New endpoint: GET /models/:id/providers
New function: getModelProviders() in model service
2026-04-09 16:45:32 +01:00
redshift 633f555e09 disabled xcashu agian since its not battle tested 2026-04-06 19:04:58 +01:00
redshift cbaf26bda0 allowing xcashu mode right now and removed logs. 2026-04-02 22:45:52 +02:00
redshift ae80f94afe logging changed to date based 2026-04-02 14:17:04 +02:00
redshift f7fadaefd2 fix: handle daemon /usage endpoint returning array directly
The daemon's /usage endpoint returns { output: [...] } where output IS
the entries array directly, not an object with entries/totalEntries/etc.
Both the CLI usage command and TUI monitor expected the wrong shape,
causing entries.reduce to fail with 'is not a function'.

- Fix fetchUsage() to parse the array response correctly
- Fix CLI usage command to handle the array response
- Add defensive check in getTotals() for undefined/non-array input
2026-04-01 18:12:48 +02:00
redshift dca3ca992f Merge branch 'wallet-integration' of github.com-red:Routstr/routstrd 2026-04-01 15:55:35 +02:00
redshift 4917ff2f91 mode chagnes 2026-03-30 21:20:29 +01:00
redshift 07adab2265 added a way to add clients 2026-03-30 21:06:30 +01:00
redshift e8dfb2b05b formatting 2026-03-29 15:11:59 +01:00
redshift cb699a3882 added a way to disable providers 2026-03-28 18:17:39 +00:00
redshift f1b388ef43 removed lazyrefund completely 2026-03-28 14:02:19 +00:00
redshift 3c7e0c25ab bun driver to sdk 2026-03-27 21:57:32 +00:00
redshift 66678f96ba removed unnecessary file 2026-03-24 20:58:55 +00:00
Evan Yang 10a6c5c131 Merge origin/main into wallet-integration 2026-03-23 10:43:48 +08:00
redshift dffd8ef3f2 updated desciptns 2026-03-21 22:59:06 +00:00
redshift 310e7076c3 Add mode parameter to routeRequests and CLI command
- Add mode config option (xcashu, lazyrefund, apikeys) to RoutstrdConfig
- Pass mode parameter to routeRequests in daemon HTTP handler
- Add 'routstrd mode' CLI command to set mode interactively
- Mode command shows current mode, prompts for selection, updates config,
  and restarts the daemon
2026-03-21 22:07:28 +00:00
redshift a02a0dcad3 added restart 2026-03-21 21:10:03 +00:00
redshift b3fc02b1cc feat(cli): show client ID in usage command output
- Add client field to UsageEntry type
- Display client ID when present in usage entries
2026-03-21 16:52:42 +00:00
redshift 5aadad1d34 Merge branch 'main' of github.com-red:Routstr/routstrd 2026-03-21 13:22:39 +00:00
redshift cb793be8de integrations with unique api keys 2026-03-21 13:22:30 +00:00
redshift 0e1b97dcaf draft for the TUI 2026-03-21 12:44:13 +00:00
Evan Yang 76ce27d518 Add cocod-backed wallet integration 2026-03-21 12:40:47 +08:00
redshift dee1b9e84e merge 2026-03-19 16:27:13 +00:00
redshift e299c80d5b refactored the daemon 2026-03-19 16:25:57 +00:00
redshift 8c3bf7ecf1 force refresh mdoels 2026-03-19 16:24:22 +00:00
redshift edf5b95bb5 added usage command 2026-03-13 12:49:14 +00:00