@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 +3 -1
- package/dist/lib/budget.js +4 -0
- package/dist/lib/cache.js +5 -1
- package/dist/lib/wallet.js +1 -1
- package/dist/tools/budget.js +1 -2
- package/dist/tools/dex-candles.js +1 -2
- package/dist/tools/dex-orderbook.js +1 -2
- package/dist/tools/dex-trades.js +1 -2
- package/dist/tools/research.js +1 -2
- package/dist/tools/search.js +1 -2
- package/dist/tools/stellar-pools.js +1 -2
- package/package.json +1 -1
- package/src/lib/wallet.ts +1 -1
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",
|
|
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
|
];
|
package/dist/lib/budget.js
CHANGED
|
@@ -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${
|
|
25
|
+
text: `[cached — no charge]\n\n${stripped}`,
|
|
22
26
|
},
|
|
23
27
|
],
|
|
24
28
|
};
|
package/dist/lib/wallet.js
CHANGED
|
@@ -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.
|
|
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 });
|
package/dist/tools/budget.js
CHANGED
|
@@ -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')"),
|
package/dist/tools/dex-trades.js
CHANGED
package/dist/tools/research.js
CHANGED
|
@@ -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)
|
package/dist/tools/search.js
CHANGED
|
@@ -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)
|
package/package.json
CHANGED
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.
|
|
97
|
+
apiUrl: process.env.XLMTOOLS_API_URL ?? "https://api.xlmtools.com",
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
mkdirSync(CONFIG_DIR, { recursive: true });
|