@xlmtools/cli 0.1.0 → 0.1.1

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/dist/cli.js CHANGED
@@ -106,8 +106,10 @@ function handleTools() {
106
106
  name,
107
107
  price: `$${price}`,
108
108
  }));
109
+ // Note: `budget` is MCP-only — the CLI is a fresh process per invocation
110
+ // so a session-scoped cap is meaningless. Excluded from the CLI's free list.
109
111
  const free = [
110
- "crypto", "weather", "domain", "wallet", "tools", "budget",
112
+ "crypto", "weather", "domain", "wallet", "tools",
111
113
  "dex-orderbook", "dex-candles", "dex-trades", "swap-quote",
112
114
  "stellar-asset", "stellar-account", "stellar-pools", "oracle-price",
113
115
  ];
@@ -6,6 +6,10 @@ let maxBudget = null;
6
6
  let totalSpent = 0;
7
7
  export function setBudget(max) {
8
8
  maxBudget = max;
9
+ // Reset spent counter so the new cap starts fresh. Users expect
10
+ // "I just set a $1.00 budget" to mean they have $1.00 to spend
11
+ // from now — not "$1.00 minus whatever I spent before setting it".
12
+ totalSpent = 0;
9
13
  logger.info({ max }, "session budget set");
10
14
  }
11
15
  export function clearBudget() {
package/dist/lib/cache.js CHANGED
@@ -13,12 +13,16 @@ export async function withCache(toolName, params, fn) {
13
13
  logger.debug({ toolName }, "cache hit");
14
14
  const original = cached.result;
15
15
  if (original.content[0]?.type === "text") {
16
+ // Strip the "---\nPayment: ..." footer from cached text — no
17
+ // payment happened on this call, so the original tx hash would
18
+ // contradict the [cached — no charge] prefix.
19
+ const stripped = original.content[0].text.replace(/\n---\nPayment: .*$/s, "");
16
20
  return {
17
21
  ...original,
18
22
  content: [
19
23
  {
20
24
  type: "text",
21
- text: `[cached — no charge]\n\n${original.content[0].text}`,
25
+ text: `[cached — no charge]\n\n${stripped}`,
22
26
  },
23
27
  ],
24
28
  };
@@ -70,7 +70,7 @@ export function loadOrCreateWallet() {
70
70
  const config = {
71
71
  stellarPrivateKey: keypair.secret(),
72
72
  stellarPublicKey: keypair.publicKey(),
73
- apiUrl: process.env.XLMTools_API_URL ?? "http://localhost:3000",
73
+ apiUrl: process.env.XLMTOOLS_API_URL ?? "https://api.xlmtools.com",
74
74
  };
75
75
  mkdirSync(CONFIG_DIR, { recursive: true });
76
76
  writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2), { mode: 0o600 });
@@ -12,8 +12,7 @@ export function registerBudgetTool(server) {
12
12
  action: z
13
13
  .enum(["set", "check", "clear"])
14
14
  .describe("Action: set a limit, check status, or clear limit"),
15
- amount: z
16
- .number()
15
+ amount: z.coerce.number()
17
16
  .positive()
18
17
  .optional()
19
18
  .describe("Budget amount in USD (required for 'set')"),
@@ -15,8 +15,7 @@ export function registerDexCandlesTool(server) {
15
15
  .enum(["1m", "5m", "15m", "1h", "1d", "1w"])
16
16
  .default("1h")
17
17
  .describe("Candle interval"),
18
- limit: z
19
- .number()
18
+ limit: z.coerce.number()
20
19
  .int()
21
20
  .min(1)
22
21
  .max(200)
@@ -11,8 +11,7 @@ export function registerDexOrderbookTool(server) {
11
11
  pair: z
12
12
  .string()
13
13
  .describe('Asset pair (e.g. "XLM/USDC", "USDC/EURC")'),
14
- limit: z
15
- .number()
14
+ limit: z.coerce.number()
16
15
  .int()
17
16
  .min(1)
18
17
  .max(200)
@@ -10,8 +10,7 @@ export function registerDexTradesTool(server) {
10
10
  pair: z
11
11
  .string()
12
12
  .describe('Asset pair (e.g. "XLM/USDC")'),
13
- limit: z
14
- .number()
13
+ limit: z.coerce.number()
15
14
  .int()
16
15
  .min(1)
17
16
  .max(200)
@@ -10,8 +10,7 @@ export function registerResearchTool(server) {
10
10
  title: "Deep Research",
11
11
  description: `Deep research on any topic — returns summarized, sourced results from multiple web pages.\nCost: $${TOOL_PRICES.research} USDC per query (paid via Stellar MPP).`, inputSchema: z.object({
12
12
  query: z.string().describe("Research query"),
13
- num_results: z
14
- .number()
13
+ num_results: z.coerce.number()
15
14
  .int()
16
15
  .min(1)
17
16
  .max(20)
@@ -10,8 +10,7 @@ export function registerSearchTool(server) {
10
10
  title: "Web Search",
11
11
  description: `Search the web and news in real-time. Returns results with source URLs.\nCost: $${TOOL_PRICES.search} USDC per search (paid via Stellar MPP).`, inputSchema: z.object({
12
12
  query: z.string().describe("Search query"),
13
- count: z
14
- .number()
13
+ count: z.coerce.number()
15
14
  .int()
16
15
  .min(1)
17
16
  .max(20)
@@ -11,8 +11,7 @@ export function registerStellarPoolsTool(server) {
11
11
  .string()
12
12
  .optional()
13
13
  .describe('Filter by asset (e.g. "XLM", "USDC"). Omit for all pools.'),
14
- limit: z
15
- .number()
14
+ limit: z.coerce.number()
16
15
  .int()
17
16
  .min(1)
18
17
  .max(200)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xlmtools/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "xlmtools": "dist/index.js",
package/src/lib/wallet.ts CHANGED
@@ -94,7 +94,7 @@ export function loadOrCreateWallet(): XLMToolsConfig {
94
94
  const config: XLMToolsConfig = {
95
95
  stellarPrivateKey: keypair.secret(),
96
96
  stellarPublicKey: keypair.publicKey(),
97
- apiUrl: process.env.XLMTools_API_URL ?? "http://localhost:3000",
97
+ apiUrl: process.env.XLMTOOLS_API_URL ?? "https://api.xlmtools.com",
98
98
  };
99
99
 
100
100
  mkdirSync(CONFIG_DIR, { recursive: true });