use-agently 0.33.0 → 0.35.0
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/build/bin.js +182 -6
- package/package.json +2 -2
package/build/bin.js
CHANGED
|
@@ -91835,7 +91835,7 @@ function PayTransaction(wallet) {
|
|
|
91835
91835
|
// ../use-agently-sdk/package.json
|
|
91836
91836
|
var package_default = {
|
|
91837
91837
|
name: "@use-agently/sdk",
|
|
91838
|
-
version: "0.
|
|
91838
|
+
version: "0.35.0",
|
|
91839
91839
|
description: "Core SDK for the Agently platform — wallet management, A2A, MCP, x402 payments",
|
|
91840
91840
|
homepage: "https://github.com/AgentlyHQ/use-agently/tree/main/packages/use-agently-sdk",
|
|
91841
91841
|
bugs: {
|
|
@@ -96617,9 +96617,16 @@ Examples:
|
|
|
96617
96617
|
const detected = await detectProviders(activeProvider);
|
|
96618
96618
|
const otherProviders = detected.filter((p) => p.installed && !p.active);
|
|
96619
96619
|
const format = getOutputFormat(command);
|
|
96620
|
+
const website = `https://use-agently.com/account/${wallet.address}`;
|
|
96620
96621
|
if (format === "json") {
|
|
96621
96622
|
outputJson({
|
|
96622
|
-
|
|
96623
|
+
website,
|
|
96624
|
+
address: result.address,
|
|
96625
|
+
balance: {
|
|
96626
|
+
value: result.balance,
|
|
96627
|
+
currency: result.currency,
|
|
96628
|
+
network: result.network
|
|
96629
|
+
},
|
|
96623
96630
|
provider: activeProvider,
|
|
96624
96631
|
otherProviders: otherProviders.map((p) => ({
|
|
96625
96632
|
type: p.type,
|
|
@@ -96629,7 +96636,12 @@ Examples:
|
|
|
96629
96636
|
}))
|
|
96630
96637
|
});
|
|
96631
96638
|
} else {
|
|
96632
|
-
outputTuiKeyValue({
|
|
96639
|
+
outputTuiKeyValue({
|
|
96640
|
+
website,
|
|
96641
|
+
balance: `${result.balance} USD (${result.currency} on ${result.network})`,
|
|
96642
|
+
address: result.address,
|
|
96643
|
+
provider: activeProvider
|
|
96644
|
+
});
|
|
96633
96645
|
if (otherProviders.length > 0) {
|
|
96634
96646
|
console.log("");
|
|
96635
96647
|
console.log("Other wallets detected:");
|
|
@@ -96645,7 +96657,7 @@ Switch provider: use-agently wallet set <provider>`);
|
|
|
96645
96657
|
// package.json
|
|
96646
96658
|
var package_default2 = {
|
|
96647
96659
|
name: "use-agently",
|
|
96648
|
-
version: "0.
|
|
96660
|
+
version: "0.35.0",
|
|
96649
96661
|
description: "Use Agently CLI",
|
|
96650
96662
|
homepage: "https://use-agently.com",
|
|
96651
96663
|
bugs: "https://github.com/AgentlyHQ/use-agently/issues",
|
|
@@ -96669,7 +96681,7 @@ var package_default2 = {
|
|
|
96669
96681
|
test: "bun test"
|
|
96670
96682
|
},
|
|
96671
96683
|
dependencies: {
|
|
96672
|
-
"@use-agently/sdk": "0.
|
|
96684
|
+
"@use-agently/sdk": "0.35.0",
|
|
96673
96685
|
boxen: "^8.0.1",
|
|
96674
96686
|
"cli-table3": "^0.6.5",
|
|
96675
96687
|
commander: "^14.0.3",
|
|
@@ -97049,6 +97061,13 @@ Expected a JSON object, e.g. --args '{"message":"hello"}'`);
|
|
|
97049
97061
|
throw err;
|
|
97050
97062
|
}
|
|
97051
97063
|
});
|
|
97064
|
+
function tryParseJson(text) {
|
|
97065
|
+
try {
|
|
97066
|
+
return JSON.parse(text);
|
|
97067
|
+
} catch {
|
|
97068
|
+
return text;
|
|
97069
|
+
}
|
|
97070
|
+
}
|
|
97052
97071
|
function outputMcpResult(result, command) {
|
|
97053
97072
|
const content = result.content;
|
|
97054
97073
|
if (result.isError) {
|
|
@@ -97097,7 +97116,8 @@ Run "use-agently balance" to check your wallet address and balance, then send US
|
|
|
97097
97116
|
}
|
|
97098
97117
|
if (content?.every((c) => c.type === "text" && c.text)) {
|
|
97099
97118
|
const texts = content.map((c) => c.text);
|
|
97100
|
-
|
|
97119
|
+
const parsed = texts.length === 1 ? tryParseJson(texts[0]) : texts.map(tryParseJson);
|
|
97120
|
+
output(command, parsed);
|
|
97101
97121
|
} else {
|
|
97102
97122
|
output(command, result);
|
|
97103
97123
|
}
|
|
@@ -97105,6 +97125,157 @@ Run "use-agently balance" to check your wallet address and balance, then send US
|
|
|
97105
97125
|
mcpCommand.addCommand(mcpToolsCommand);
|
|
97106
97126
|
mcpCommand.addCommand(mcpCallCommand);
|
|
97107
97127
|
|
|
97128
|
+
// src/commands/tools.ts
|
|
97129
|
+
function checkSpendLimit2(err, maxSpendPerCall) {
|
|
97130
|
+
const req = err.requirements[0];
|
|
97131
|
+
if (!req) {
|
|
97132
|
+
throw new SpendLimitExceeded(NaN, maxSpendPerCall);
|
|
97133
|
+
}
|
|
97134
|
+
let amountInDollars;
|
|
97135
|
+
try {
|
|
97136
|
+
const { usdcDecimals } = getChainConfigByNetwork(req.network);
|
|
97137
|
+
amountInDollars = Number(formatUnits(BigInt(req.amount), usdcDecimals));
|
|
97138
|
+
} catch {
|
|
97139
|
+
throw new SpendLimitExceeded(NaN, maxSpendPerCall);
|
|
97140
|
+
}
|
|
97141
|
+
if (amountInDollars > maxSpendPerCall) {
|
|
97142
|
+
throw new SpendLimitExceeded(amountInDollars, maxSpendPerCall);
|
|
97143
|
+
}
|
|
97144
|
+
}
|
|
97145
|
+
var toolsCommand = new Command("tools").description("List or call tools on an MCP server").requiredOption("-u, --uri <value>", "MCP server URL or CAIP-19 ID").showHelpAfterError(true).addHelpText("after", `
|
|
97146
|
+
Examples:
|
|
97147
|
+
use-agently tools --uri https://example.com/mcp
|
|
97148
|
+
use-agently tools --uri eip155:8453/erc8004:0x1234/1
|
|
97149
|
+
use-agently tools call --uri https://example.com/mcp --tool echo`).action(async (options, command) => {
|
|
97150
|
+
const tools = await listMcpTools(defaultClient, options.uri, {
|
|
97151
|
+
clientInfo: { name: "use-agently", version: package_default2.version },
|
|
97152
|
+
fetchImpl: clientFetch2
|
|
97153
|
+
});
|
|
97154
|
+
outputCollection(command, tools);
|
|
97155
|
+
});
|
|
97156
|
+
var toolsCallCommand = new Command("call").description("Call a specific tool on an MCP server").requiredOption("--tool <name>", "Tool name to call").option("--args <json>", "JSON arguments to pass to the tool").option("--pay", "Authorize payment if the tool requires it (default: dry-run, shows cost only)").showHelpAfterError(true).addHelpText("after", `
|
|
97157
|
+
Examples:
|
|
97158
|
+
use-agently tools call --uri https://example.com/mcp --tool echo --args '{"message":"hello"}'
|
|
97159
|
+
use-agently tools call --uri https://example.com/mcp --tool paid-tool --args '{"message":"hello"}' --pay`).action(async (options, command) => {
|
|
97160
|
+
const uri = command.optsWithGlobals().uri;
|
|
97161
|
+
const tool = options.tool;
|
|
97162
|
+
let args = {};
|
|
97163
|
+
if (options.args !== undefined) {
|
|
97164
|
+
try {
|
|
97165
|
+
args = JSON.parse(options.args);
|
|
97166
|
+
} catch {
|
|
97167
|
+
throw new Error(`Invalid JSON in --args: ${options.args}
|
|
97168
|
+
Expected a JSON object, e.g. --args '{"message":"hello"}'`);
|
|
97169
|
+
}
|
|
97170
|
+
}
|
|
97171
|
+
const mcpClientInfo = { name: "use-agently", version: package_default2.version };
|
|
97172
|
+
if (options.pay) {
|
|
97173
|
+
const config2 = await getConfigOrThrow();
|
|
97174
|
+
const wallet = loadWallet(config2.wallet);
|
|
97175
|
+
const maxSpend = getMaxSpendPerCall(config2);
|
|
97176
|
+
try {
|
|
97177
|
+
const result = await callMcpTool(defaultClient, uri, tool, args, {
|
|
97178
|
+
transaction: DryRunTransaction,
|
|
97179
|
+
clientInfo: mcpClientInfo,
|
|
97180
|
+
fetchImpl: clientFetch2
|
|
97181
|
+
});
|
|
97182
|
+
return outputMcpResult2(result, command);
|
|
97183
|
+
} catch (err) {
|
|
97184
|
+
if (err instanceof DryRunPaymentRequired) {
|
|
97185
|
+
checkSpendLimit2(err, maxSpend);
|
|
97186
|
+
} else {
|
|
97187
|
+
throw err;
|
|
97188
|
+
}
|
|
97189
|
+
}
|
|
97190
|
+
try {
|
|
97191
|
+
const result = await callMcpTool(defaultClient, uri, tool, args, {
|
|
97192
|
+
transaction: PayTransaction(wallet),
|
|
97193
|
+
clientInfo: mcpClientInfo,
|
|
97194
|
+
fetchImpl: clientFetch2
|
|
97195
|
+
});
|
|
97196
|
+
return outputMcpResult2(result, command);
|
|
97197
|
+
} catch (err) {
|
|
97198
|
+
if (err instanceof SpendLimitExceeded)
|
|
97199
|
+
handleSpendLimitError(err);
|
|
97200
|
+
throw err;
|
|
97201
|
+
}
|
|
97202
|
+
}
|
|
97203
|
+
try {
|
|
97204
|
+
const result = await callMcpTool(defaultClient, uri, tool, args, {
|
|
97205
|
+
transaction: DryRunTransaction,
|
|
97206
|
+
clientInfo: mcpClientInfo,
|
|
97207
|
+
fetchImpl: clientFetch2
|
|
97208
|
+
});
|
|
97209
|
+
return outputMcpResult2(result, command);
|
|
97210
|
+
} catch (err) {
|
|
97211
|
+
if (err instanceof DryRunPaymentRequired)
|
|
97212
|
+
handleDryRunError(err);
|
|
97213
|
+
throw err;
|
|
97214
|
+
}
|
|
97215
|
+
});
|
|
97216
|
+
function tryParseJson2(text) {
|
|
97217
|
+
try {
|
|
97218
|
+
return JSON.parse(text);
|
|
97219
|
+
} catch {
|
|
97220
|
+
return text;
|
|
97221
|
+
}
|
|
97222
|
+
}
|
|
97223
|
+
function outputMcpResult2(result, command) {
|
|
97224
|
+
const content = result.content;
|
|
97225
|
+
if (result.isError) {
|
|
97226
|
+
const text = content?.find((c) => c.type === "text")?.text;
|
|
97227
|
+
if (text) {
|
|
97228
|
+
try {
|
|
97229
|
+
const parsed = JSON.parse(text);
|
|
97230
|
+
if (parsed?.error && Array.isArray(parsed?.accepts) && parsed.accepts.length > 0) {
|
|
97231
|
+
let message;
|
|
97232
|
+
if (parsed.error === "insufficient_funds") {
|
|
97233
|
+
const req = parsed.accepts[0];
|
|
97234
|
+
let amountStr = "unknown amount";
|
|
97235
|
+
try {
|
|
97236
|
+
const { usdcDecimals } = getChainConfigByNetwork(req.network);
|
|
97237
|
+
const raw = formatUnits(BigInt(req.amount), usdcDecimals);
|
|
97238
|
+
const formatted = raw.includes(".") ? raw.replace(/\.?0+$/, "") : raw;
|
|
97239
|
+
amountStr = `$${formatted} USDC on ${req.network}`;
|
|
97240
|
+
} catch {
|
|
97241
|
+
amountStr = `${req.amount} (raw units)`;
|
|
97242
|
+
}
|
|
97243
|
+
message = `Insufficient funds to pay for this tool.
|
|
97244
|
+
Required: ${amountStr}
|
|
97245
|
+
Run "use-agently balance" to check your wallet address and balance, then send USDC on Base to fund it.`;
|
|
97246
|
+
} else {
|
|
97247
|
+
message = `Payment error: ${parsed.error}`;
|
|
97248
|
+
}
|
|
97249
|
+
if (process.stderr.isTTY) {
|
|
97250
|
+
console.error(boxen(message, {
|
|
97251
|
+
title: parsed.error === "insufficient_funds" ? "Insufficient Funds" : "Payment Error",
|
|
97252
|
+
titleAlignment: "center",
|
|
97253
|
+
borderColor: "red",
|
|
97254
|
+
padding: 1
|
|
97255
|
+
}));
|
|
97256
|
+
} else {
|
|
97257
|
+
const title = parsed.error === "insufficient_funds" ? "Insufficient Funds" : "Payment Error";
|
|
97258
|
+
console.error(`${title}: ${message}`);
|
|
97259
|
+
}
|
|
97260
|
+
process.exit(1);
|
|
97261
|
+
}
|
|
97262
|
+
} catch {}
|
|
97263
|
+
console.error(text);
|
|
97264
|
+
} else {
|
|
97265
|
+
console.error("Tool call returned an error with no text content.");
|
|
97266
|
+
}
|
|
97267
|
+
process.exit(1);
|
|
97268
|
+
}
|
|
97269
|
+
if (content?.every((c) => c.type === "text" && c.text)) {
|
|
97270
|
+
const texts = content.map((c) => c.text);
|
|
97271
|
+
const parsed = texts.length === 1 ? tryParseJson2(texts[0]) : texts.map(tryParseJson2);
|
|
97272
|
+
output(command, parsed);
|
|
97273
|
+
} else {
|
|
97274
|
+
output(command, result);
|
|
97275
|
+
}
|
|
97276
|
+
}
|
|
97277
|
+
toolsCommand.addCommand(toolsCallCommand);
|
|
97278
|
+
|
|
97108
97279
|
// src/commands/web.ts
|
|
97109
97280
|
function collect(value, previous) {
|
|
97110
97281
|
return previous.concat([value]);
|
|
@@ -97582,6 +97753,7 @@ cli.addCommand(balanceCommand.helpGroup("Diagnostics"));
|
|
|
97582
97753
|
cli.addCommand(searchCommand.helpGroup("Discovery"));
|
|
97583
97754
|
cli.addCommand(viewCommand.helpGroup("Discovery"));
|
|
97584
97755
|
cli.addCommand(a2aCommand.helpGroup("Protocols"));
|
|
97756
|
+
cli.addCommand(toolsCommand.helpGroup("Protocols"));
|
|
97585
97757
|
cli.addCommand(mcpCommand.helpGroup("Protocols"));
|
|
97586
97758
|
cli.addCommand(webCommand.helpGroup("Protocols"));
|
|
97587
97759
|
cli.addCommand(initCommand.helpGroup("Lifecycle"));
|
|
@@ -97597,6 +97769,10 @@ Quick Reference:
|
|
|
97597
97769
|
a2a card -u <uri>
|
|
97598
97770
|
|
|
97599
97771
|
List or call tools on an MCP server:
|
|
97772
|
+
tools -u <uri>
|
|
97773
|
+
tools call -u <uri> --tool <name> [--args <json>] [--pay]
|
|
97774
|
+
|
|
97775
|
+
(Legacy) List or call tools via the MCP command:
|
|
97600
97776
|
mcp tools -u <uri>
|
|
97601
97777
|
mcp call -u <uri> --tool <name> [--args <json>] [--pay]
|
|
97602
97778
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-agently",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Use Agently CLI",
|
|
5
5
|
"homepage": "https://use-agently.com",
|
|
6
6
|
"bugs": "https://github.com/AgentlyHQ/use-agently/issues",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test": "bun test"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@use-agently/sdk": "0.
|
|
27
|
+
"@use-agently/sdk": "0.35.0",
|
|
28
28
|
"boxen": "^8.0.1",
|
|
29
29
|
"cli-table3": "^0.6.5",
|
|
30
30
|
"commander": "^14.0.3",
|