routstrd 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SKILL.md CHANGED
@@ -49,10 +49,6 @@ Restart the daemon (stops if running, then starts).
49
49
 
50
50
  Check daemon and wallet status. Returns JSON with current state.
51
51
 
52
- ### `routstrd ping`
53
-
54
- Test connection to the daemon.
55
-
56
52
  ### `routstrd balance`
57
53
 
58
54
  Get wallet and API key balances. Shows per-mint wallet balances, per-key API balances, and a grand total (all in sats).
@@ -41534,9 +41534,26 @@ Installing routstr configuration in ${configPath}...`);
41534
41534
  }
41535
41535
  settings.env["ANTHROPIC_AUTH_TOKEN"] = apiKey;
41536
41536
  settings.env["ANTHROPIC_BASE_URL"] = `http://localhost:${port}`;
41537
- settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = "gpt-5.4";
41538
- settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = "claude-opus-4.7";
41539
- settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = "minimax-m2.7";
41537
+ try {
41538
+ const response = await fetch(`http://localhost:${port}/models`);
41539
+ const data = await response.json();
41540
+ const models = data.output?.models || [];
41541
+ if (models.length >= 3) {
41542
+ settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = models[0].id;
41543
+ settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = models[1].id;
41544
+ settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = models[2].id;
41545
+ logger3.log(`Set Claude models: Opus=${models[0].id}, Sonnet=${models[1].id}, Haiku=${models[2].id}`);
41546
+ } else if (models.length > 0) {
41547
+ logger3.log(`Only ${models.length} models available, falling back to defaults.`);
41548
+ settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = models[0].id;
41549
+ settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = models[0].id;
41550
+ settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = models[0].id;
41551
+ } else {
41552
+ logger3.log("No models available from routstr daemon.");
41553
+ }
41554
+ } catch (error) {
41555
+ logger3.error("Failed to fetch models for Claude Code integration:", error);
41556
+ }
41540
41557
  try {
41541
41558
  mkdirSync3(dirname3(configPath), { recursive: true });
41542
41559
  await writeFile3(configPath, JSON.stringify(settings, null, 2));
package/dist/index.js CHANGED
@@ -29002,9 +29002,26 @@ Installing routstr configuration in ${configPath}...`);
29002
29002
  }
29003
29003
  settings.env["ANTHROPIC_AUTH_TOKEN"] = apiKey;
29004
29004
  settings.env["ANTHROPIC_BASE_URL"] = `http://localhost:${port}`;
29005
- settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = "gpt-5.4";
29006
- settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = "claude-opus-4.7";
29007
- settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = "minimax-m2.7";
29005
+ try {
29006
+ const response = await fetch(`http://localhost:${port}/models`);
29007
+ const data = await response.json();
29008
+ const models = data.output?.models || [];
29009
+ if (models.length >= 3) {
29010
+ settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = models[0].id;
29011
+ settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = models[1].id;
29012
+ settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = models[2].id;
29013
+ logger.log(`Set Claude models: Opus=${models[0].id}, Sonnet=${models[1].id}, Haiku=${models[2].id}`);
29014
+ } else if (models.length > 0) {
29015
+ logger.log(`Only ${models.length} models available, falling back to defaults.`);
29016
+ settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = models[0].id;
29017
+ settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = models[0].id;
29018
+ settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = models[0].id;
29019
+ } else {
29020
+ logger.log("No models available from routstr daemon.");
29021
+ }
29022
+ } catch (error) {
29023
+ logger.error("Failed to fetch models for Claude Code integration:", error);
29024
+ }
29008
29025
  try {
29009
29026
  mkdirSync3(dirname3(configPath), { recursive: true });
29010
29027
  await writeFile3(configPath, JSON.stringify(settings, null, 2));
@@ -36927,21 +36944,21 @@ async function printLightningInvoice(invoice) {
36927
36944
  Invoice:
36928
36945
  ${invoice}`);
36929
36946
  }
36947
+ async function installCocodOrExit() {
36948
+ logger.log("cocod not found. Installing globally with bun...");
36949
+ const installProc = Bun.spawn(["bun", "install", "--global", "@routstr/cocod"], {
36950
+ stdout: "inherit",
36951
+ stderr: "inherit"
36952
+ });
36953
+ const installCode = await installProc.exited;
36954
+ if (installCode !== 0 || !await isCocodInstalled()) {
36955
+ logger.error("Failed to install cocod. Please run 'bun install --global @routstr/cocod' manually.");
36956
+ throw new Error("cocod installation failed");
36957
+ }
36958
+ logger.log("cocod installed successfully.");
36959
+ }
36930
36960
  async function initDaemon() {
36931
36961
  logger.log("Initializing routstrd...");
36932
- if (!await checkCocodInstalled()) {
36933
- logger.log("cocod not found. Installing globally with bun...");
36934
- const installProc = Bun.spawn(["bun", "install", "--global", "cocod"], {
36935
- stdout: "inherit",
36936
- stderr: "inherit"
36937
- });
36938
- const installCode = await installProc.exited;
36939
- if (installCode !== 0 || !await checkCocodInstalled()) {
36940
- logger.error("Failed to install cocod. Please run 'bun install --global cocod' manually.");
36941
- return;
36942
- }
36943
- logger.log("cocod installed successfully.");
36944
- }
36945
36962
  if (!existsSync9(CONFIG_DIR)) {
36946
36963
  mkdirSync5(CONFIG_DIR, { recursive: true });
36947
36964
  logger.log(`Created config directory: ${CONFIG_DIR}`);
@@ -36955,24 +36972,14 @@ async function initDaemon() {
36955
36972
  logger.log(`Created config file: ${CONFIG_FILE}`);
36956
36973
  }
36957
36974
  const config = await loadConfig();
36958
- const cocodExecutable = resolveCocodExecutable(config.cocodPath);
36959
36975
  if (!await isCocodInstalled(config.cocodPath)) {
36960
36976
  if (config.cocodPath) {
36961
36977
  logger.error(`Configured cocod executable was not found: ${config.cocodPath}`);
36962
36978
  return;
36963
36979
  }
36964
- logger.log("cocod not found. Installing globally with bun...");
36965
- const installProc = Bun.spawn(["bun", "install", "--global", "cocod"], {
36966
- stdout: "inherit",
36967
- stderr: "inherit"
36968
- });
36969
- const installCode = await installProc.exited;
36970
- if (installCode !== 0 || !await isCocodInstalled(config.cocodPath)) {
36971
- logger.error("Failed to install cocod. Please run 'bun install --global cocod' manually.");
36972
- return;
36973
- }
36974
- logger.log("cocod installed successfully.");
36980
+ await installCocodOrExit();
36975
36981
  }
36982
+ const cocodExecutable = resolveCocodExecutable(config.cocodPath);
36976
36983
  console.log(`Database will be stored at: ${DB_PATH}`);
36977
36984
  console.log(`
36978
36985
  Initializing cocod...`);
@@ -37026,18 +37033,6 @@ Initialization complete!`);
37026
37033
  logger.log(`
37027
37034
  To ensure routstrd persists across system restarts, run: 'routstrd service install'`);
37028
37035
  }
37029
- async function checkCocodInstalled() {
37030
- try {
37031
- const proc = Bun.spawn({
37032
- cmd: ["which", "cocod"],
37033
- stdout: "pipe"
37034
- });
37035
- const code = await proc.exited;
37036
- return code === 0;
37037
- } catch {
37038
- return false;
37039
- }
37040
- }
37041
37036
  program.name("routstrd").description("Routstr daemon - Manage routstr processes").version(cliVersion, "--version", "output the version number");
37042
37037
  program.command("onboard").description("Initialize routstrd (creates config directory and initializes cocod)").action(async () => {
37043
37038
  await initDaemon();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "routstrd",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "private": false,
package/src/cli.ts CHANGED
@@ -73,27 +73,27 @@ async function printLightningInvoice(invoice: string): Promise<void> {
73
73
  console.log(`${qr}\nInvoice:\n${invoice}`);
74
74
  }
75
75
 
76
- async function initDaemon(): Promise<void> {
77
- logger.log("Initializing routstrd...");
76
+ async function installCocodOrExit(): Promise<void> {
77
+ logger.log("cocod not found. Installing globally with bun...");
78
78
 
79
- if (!(await checkCocodInstalled())) {
80
- logger.log("cocod not found. Installing globally with bun...");
79
+ const installProc = Bun.spawn(["bun", "install", "--global", "@routstr/cocod"], {
80
+ stdout: "inherit",
81
+ stderr: "inherit",
82
+ });
81
83
 
82
- const installProc = Bun.spawn(["bun", "install", "--global", "cocod"], {
83
- stdout: "inherit",
84
- stderr: "inherit",
85
- });
84
+ const installCode = await installProc.exited;
85
+ if (installCode !== 0 || !(await isCocodInstalled())) {
86
+ logger.error(
87
+ "Failed to install cocod. Please run 'bun install --global @routstr/cocod' manually.",
88
+ );
89
+ throw new Error("cocod installation failed");
90
+ }
86
91
 
87
- const installCode = await installProc.exited;
88
- if (installCode !== 0 || !(await checkCocodInstalled())) {
89
- logger.error(
90
- "Failed to install cocod. Please run 'bun install --global cocod' manually.",
91
- );
92
- return;
93
- }
92
+ logger.log("cocod installed successfully.");
93
+ }
94
94
 
95
- logger.log("cocod installed successfully.");
96
- }
95
+ async function initDaemon(): Promise<void> {
96
+ logger.log("Initializing routstrd...");
97
97
 
98
98
  // Create config directory
99
99
  if (!existsSync(CONFIG_DIR)) {
@@ -112,7 +112,6 @@ async function initDaemon(): Promise<void> {
112
112
  }
113
113
 
114
114
  const config = await loadConfig();
115
- const cocodExecutable = resolveCocodExecutable(config.cocodPath);
116
115
 
117
116
  if (!(await isCocodInstalled(config.cocodPath))) {
118
117
  if (config.cocodPath) {
@@ -122,24 +121,11 @@ async function initDaemon(): Promise<void> {
122
121
  return;
123
122
  }
124
123
 
125
- logger.log("cocod not found. Installing globally with bun...");
126
-
127
- const installProc = Bun.spawn(["bun", "install", "--global", "cocod"], {
128
- stdout: "inherit",
129
- stderr: "inherit",
130
- });
131
-
132
- const installCode = await installProc.exited;
133
- if (installCode !== 0 || !(await isCocodInstalled(config.cocodPath))) {
134
- logger.error(
135
- "Failed to install cocod. Please run 'bun install --global cocod' manually.",
136
- );
137
- return;
138
- }
139
-
140
- logger.log("cocod installed successfully.");
124
+ await installCocodOrExit();
141
125
  }
142
126
 
127
+ const cocodExecutable = resolveCocodExecutable(config.cocodPath);
128
+
143
129
  console.log(`Database will be stored at: ${DB_PATH}`);
144
130
  console.log("\nInitializing cocod...");
145
131
 
@@ -216,19 +202,6 @@ async function initDaemon(): Promise<void> {
216
202
  );
217
203
  }
218
204
 
219
- async function checkCocodInstalled(): Promise<boolean> {
220
- try {
221
- const proc = Bun.spawn({
222
- cmd: ["which", "cocod"],
223
- stdout: "pipe",
224
- });
225
- const code = await proc.exited;
226
- return code === 0;
227
- } catch {
228
- return false;
229
- }
230
- }
231
-
232
205
  program
233
206
  .name("routstrd")
234
207
  .description("Routstr daemon - Manage routstr processes")
@@ -4,7 +4,7 @@ import { dirname } from "path";
4
4
  import type { RoutstrdConfig } from "../utils/config";
5
5
  import { logger } from "../utils/logger";
6
6
  import type { SdkStore } from "@routstr/sdk";
7
- import type { IntegrationConfig } from "./registry";
7
+ import type { IntegrationConfig, RoutstrModel } from "./registry";
8
8
  import { generateApiKey } from "./registry";
9
9
 
10
10
  export async function installClaudeCodeIntegration(
@@ -61,11 +61,28 @@ export async function installClaudeCodeIntegration(
61
61
 
62
62
  settings.env["ANTHROPIC_AUTH_TOKEN"] = apiKey;
63
63
  settings.env["ANTHROPIC_BASE_URL"] = `http://localhost:${port}`;
64
-
65
- // Default models as requested
66
- settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = "gpt-5.4";
67
- settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = "claude-opus-4.7";
68
- settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = "minimax-m2.7";
64
+
65
+ try {
66
+ const response = await fetch(`http://localhost:${port}/models`);
67
+ const data = await response.json() as { output?: { models: RoutstrModel[] } };
68
+ const models = data.output?.models || [];
69
+
70
+ if (models.length >= 3) {
71
+ settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = models[0].id;
72
+ settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = models[1].id;
73
+ settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = models[2].id;
74
+ logger.log(`Set Claude models: Opus=${models[0].id}, Sonnet=${models[1].id}, Haiku=${models[2].id}`);
75
+ } else if (models.length > 0) {
76
+ logger.log(`Only ${models.length} models available, falling back to defaults.`);
77
+ settings.env["ANTHROPIC_DEFAULT_OPUS_MODEL"] = models[0].id;
78
+ settings.env["ANTHROPIC_DEFAULT_SONNET_MODEL"] = models[0].id;
79
+ settings.env["ANTHROPIC_DEFAULT_HAIKU_MODEL"] = models[0].id;
80
+ } else {
81
+ logger.log("No models available from routstr daemon.");
82
+ }
83
+ } catch (error) {
84
+ logger.error("Failed to fetch models for Claude Code integration:", error);
85
+ }
69
86
 
70
87
  try {
71
88
  mkdirSync(dirname(configPath), { recursive: true });