@conto_finance/create-conto-agent 0.1.2 → 0.3.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/{chunk-6TRDZ4JG.js → chunk-K4LBO234.js} +1 -1
- package/dist/chunk-QN5FG53Q.js +1223 -0
- package/dist/chunk-WMVGNUSL.js +127 -0
- package/dist/cli.js +371 -110
- package/dist/{config-CFVDT6M4.js → config-RZBPNEBZ.js} +9 -1
- package/dist/index.js +75 -26
- package/dist/{output-VT23PY74.js → output-IN47X4NU.js} +1 -1
- package/package.json +10 -6
- package/dist/chunk-AWKUQSTP.js +0 -777
- package/dist/chunk-NK52PCTE.js +0 -78
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CLI_PACKAGE_VERSION,
|
|
2
3
|
browserAuth,
|
|
3
4
|
createApiClient,
|
|
4
5
|
fetchChains,
|
|
5
6
|
getChain,
|
|
6
7
|
runInit
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QN5FG53Q.js";
|
|
8
9
|
import {
|
|
9
10
|
isJsonMode,
|
|
10
11
|
printAmount,
|
|
@@ -18,12 +19,15 @@ import {
|
|
|
18
19
|
printTable,
|
|
19
20
|
setJsonMode,
|
|
20
21
|
truncateAddress
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-K4LBO234.js";
|
|
22
23
|
import {
|
|
24
|
+
isSensitiveConfigKey,
|
|
23
25
|
loadConfig,
|
|
24
26
|
loadGlobalConfig,
|
|
27
|
+
maskSecret,
|
|
28
|
+
missingSdkKeyMessage,
|
|
25
29
|
saveGlobalConfig
|
|
26
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WMVGNUSL.js";
|
|
27
31
|
|
|
28
32
|
// src/cli.ts
|
|
29
33
|
import { Command } from "commander";
|
|
@@ -32,7 +36,7 @@ import { Command } from "commander";
|
|
|
32
36
|
async function statusCommand() {
|
|
33
37
|
const config = loadConfig();
|
|
34
38
|
if (!config.apiKey) {
|
|
35
|
-
printError(
|
|
39
|
+
printError(missingSdkKeyMessage(config));
|
|
36
40
|
process.exit(1);
|
|
37
41
|
}
|
|
38
42
|
const api = createApiClient({
|
|
@@ -49,6 +53,7 @@ async function statusCommand() {
|
|
|
49
53
|
printKeyValue("Name", info.agent.name);
|
|
50
54
|
printKeyValue("Type", info.agent.agentType);
|
|
51
55
|
printKeyValue("Status", info.agent.status);
|
|
56
|
+
printKeyValue("Server", config.baseUrl);
|
|
52
57
|
printKeyValue("Wallets", String(info.walletCount));
|
|
53
58
|
if (walletsData.wallets.length > 0) {
|
|
54
59
|
printHeader("Wallets");
|
|
@@ -86,6 +91,155 @@ function progressBar(pct, width = 20) {
|
|
|
86
91
|
return `${color}[${"\u2588".repeat(filled)}${"\u2591".repeat(empty)}]\x1B[0m`;
|
|
87
92
|
}
|
|
88
93
|
|
|
94
|
+
// src/commands/doctor.ts
|
|
95
|
+
import chalk from "chalk";
|
|
96
|
+
function mark(status) {
|
|
97
|
+
if (status === "ok") return chalk.green("\u2713");
|
|
98
|
+
if (status === "warn") return chalk.yellow("\u26A0");
|
|
99
|
+
return chalk.red("\u2717");
|
|
100
|
+
}
|
|
101
|
+
async function doctorCommand() {
|
|
102
|
+
const config = loadConfig();
|
|
103
|
+
const checks = [];
|
|
104
|
+
const isSimulatedSandbox = config.sandboxExecution === "simulated";
|
|
105
|
+
checks.push({
|
|
106
|
+
name: "Base URL",
|
|
107
|
+
status: "ok",
|
|
108
|
+
detail: config.baseUrl
|
|
109
|
+
});
|
|
110
|
+
if (!config.apiKey) {
|
|
111
|
+
checks.push({
|
|
112
|
+
name: "SDK key",
|
|
113
|
+
status: "fail",
|
|
114
|
+
detail: missingSdkKeyMessage(config)
|
|
115
|
+
});
|
|
116
|
+
report(checks, null);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
checks.push({
|
|
120
|
+
name: "SDK key",
|
|
121
|
+
status: "ok",
|
|
122
|
+
detail: `${maskSecret(config.apiKey)} (from ${process.env.CONTO_API_KEY ? "environment" : ".env.local or ~/.conto/config.json"})`
|
|
123
|
+
});
|
|
124
|
+
const api = createApiClient({ baseUrl: config.baseUrl, apiKey: config.apiKey });
|
|
125
|
+
let setup;
|
|
126
|
+
try {
|
|
127
|
+
setup = await api.getSetup();
|
|
128
|
+
} catch (err) {
|
|
129
|
+
const message = err instanceof Error ? err.message : "Request failed";
|
|
130
|
+
checks.push({
|
|
131
|
+
name: "Authentication",
|
|
132
|
+
status: "fail",
|
|
133
|
+
detail: `${config.baseUrl}/api/sdk/setup: ${message}`
|
|
134
|
+
});
|
|
135
|
+
report(checks, null);
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
checks.push({
|
|
139
|
+
name: "Authentication",
|
|
140
|
+
status: "ok",
|
|
141
|
+
detail: `Authenticated as agent "${setup.agent.name}"`
|
|
142
|
+
});
|
|
143
|
+
checks.push({
|
|
144
|
+
name: "Agent status",
|
|
145
|
+
status: setup.agent.status === "ACTIVE" ? "ok" : "fail",
|
|
146
|
+
detail: setup.agent.status === "ACTIVE" ? "ACTIVE" : `${setup.agent.status}. Activate the agent in the dashboard.`
|
|
147
|
+
});
|
|
148
|
+
const scopes = setup.scopes || [];
|
|
149
|
+
const canRequest = scopes.includes("payments:request");
|
|
150
|
+
const canExecute = scopes.includes("payments:execute");
|
|
151
|
+
checks.push({
|
|
152
|
+
name: "Scope payments:request",
|
|
153
|
+
status: canRequest ? "ok" : "fail",
|
|
154
|
+
detail: canRequest ? "Granted" : "Missing. This key cannot request payments."
|
|
155
|
+
});
|
|
156
|
+
checks.push({
|
|
157
|
+
name: "Scope payments:execute",
|
|
158
|
+
status: canExecute ? "ok" : "warn",
|
|
159
|
+
detail: canExecute ? "Granted" : 'Missing. "conto pay" can request but not execute. Create a new standard SDK key.'
|
|
160
|
+
});
|
|
161
|
+
const wallets = setup.wallets || [];
|
|
162
|
+
if (wallets.length === 0) {
|
|
163
|
+
checks.push({
|
|
164
|
+
name: "Wallet",
|
|
165
|
+
status: "fail",
|
|
166
|
+
detail: 'No wallet linked to this agent. Run "npx create-conto-agent" or link one in the dashboard.'
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
for (const w of wallets) {
|
|
170
|
+
const chainLabel = `${w.chainName} (${w.chainId})${w.isTestnet ? " testnet" : ""}`;
|
|
171
|
+
checks.push({
|
|
172
|
+
name: `Wallet ${shortAddress(w.address)}`,
|
|
173
|
+
status: w.status === "ACTIVE" ? "ok" : "warn",
|
|
174
|
+
detail: `${chainLabel}, ${w.custodyType} custody, status ${w.status}`
|
|
175
|
+
});
|
|
176
|
+
const executionMode = isSimulatedSandbox ? "simulated" : w.executionMode || (w.isExecutable ? "managed" : "manual");
|
|
177
|
+
checks.push({
|
|
178
|
+
name: " Execution",
|
|
179
|
+
status: executionMode === "managed" || executionMode === "simulated" ? "ok" : "warn",
|
|
180
|
+
detail: executionMode === "managed" ? "Managed by custody provider (real transfers)" : executionMode === "simulated" ? `Sandbox simulated execution${config.sandboxExpiresAt ? ` until ${config.sandboxExpiresAt}` : ""}; no onchain transfer required` : executionMode === "manual" ? "Manual: agent signs its own transactions, then confirms via API" : "Unknown execution mode. Check wallet custody settings in the dashboard."
|
|
181
|
+
});
|
|
182
|
+
checks.push({
|
|
183
|
+
name: " Balance",
|
|
184
|
+
status: w.balance > 0 ? "ok" : "warn",
|
|
185
|
+
detail: w.balance > 0 ? `${printAmount(w.balance, w.currency)}` : `0 ${w.currency}. Fund this wallet before paying${w.isTestnet ? " (testnet faucet available via init)" : ""}.`
|
|
186
|
+
});
|
|
187
|
+
if (w.limits?.daily != null) {
|
|
188
|
+
checks.push({
|
|
189
|
+
name: " Daily limit",
|
|
190
|
+
status: "ok",
|
|
191
|
+
detail: `${printAmount(w.spent?.today ?? 0, "USD")} spent of ${printAmount(w.limits.daily, "USD")}`
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const caps = setup.capabilities;
|
|
196
|
+
if (caps) {
|
|
197
|
+
const sandboxCanExecute = isSimulatedSandbox && caps.canRequestPayments && canExecute;
|
|
198
|
+
checks.push({
|
|
199
|
+
name: "Payment readiness",
|
|
200
|
+
status: caps.canAutoExecute || sandboxCanExecute ? "ok" : caps.canRequestPayments ? "warn" : "fail",
|
|
201
|
+
detail: caps.canAutoExecute ? "Key and wallet can request and execute payments" : sandboxCanExecute ? "Sandbox can request and execute simulated payments" : caps.canRequestPayments ? "Requests work; execution is limited (see checks above)" : "This key cannot request payments"
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
report(checks, setup);
|
|
205
|
+
const failed = checks.some((c) => c.status === "fail");
|
|
206
|
+
if (failed) process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
function shortAddress(address) {
|
|
209
|
+
if (!address || address.length <= 14) return address;
|
|
210
|
+
return `${address.slice(0, 8)}...${address.slice(-6)}`;
|
|
211
|
+
}
|
|
212
|
+
function report(checks, setup) {
|
|
213
|
+
if (isJsonMode()) {
|
|
214
|
+
printJson({
|
|
215
|
+
ok: !checks.some((c) => c.status === "fail"),
|
|
216
|
+
checks: checks.map((c) => ({ name: c.name.trim(), status: c.status, detail: c.detail })),
|
|
217
|
+
setup
|
|
218
|
+
});
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
printHeader("Conto Doctor");
|
|
222
|
+
for (const c of checks) {
|
|
223
|
+
console.log(` ${mark(c.status)} ${chalk.bold(c.name)}`);
|
|
224
|
+
console.log(` ${chalk.dim(c.detail)}`);
|
|
225
|
+
}
|
|
226
|
+
console.log("");
|
|
227
|
+
const fails = checks.filter((c) => c.status === "fail").length;
|
|
228
|
+
const warns = checks.filter((c) => c.status === "warn").length;
|
|
229
|
+
if (fails === 0 && warns === 0) {
|
|
230
|
+
console.log(chalk.green(" All checks passed."));
|
|
231
|
+
} else if (fails === 0) {
|
|
232
|
+
console.log(
|
|
233
|
+
chalk.yellow(
|
|
234
|
+
` ${warns} warning${warns === 1 ? "" : "s"}. Payments may still work; read the notes above.`
|
|
235
|
+
)
|
|
236
|
+
);
|
|
237
|
+
} else {
|
|
238
|
+
console.log(chalk.red(` ${fails} check${fails === 1 ? "" : "s"} failed.`));
|
|
239
|
+
}
|
|
240
|
+
console.log("");
|
|
241
|
+
}
|
|
242
|
+
|
|
89
243
|
// src/commands/balance.ts
|
|
90
244
|
async function balanceCommand() {
|
|
91
245
|
const config = loadConfig();
|
|
@@ -130,7 +284,7 @@ async function balanceCommand() {
|
|
|
130
284
|
}
|
|
131
285
|
|
|
132
286
|
// src/commands/pay.ts
|
|
133
|
-
import
|
|
287
|
+
import chalk2 from "chalk";
|
|
134
288
|
async function payCommand(address, amountStr, options) {
|
|
135
289
|
const config = loadConfig();
|
|
136
290
|
if (!config.apiKey) {
|
|
@@ -173,11 +327,11 @@ async function payCommand(address, amountStr, options) {
|
|
|
173
327
|
printError("Payment denied by policy");
|
|
174
328
|
if (request.violations) {
|
|
175
329
|
for (const v of request.violations) {
|
|
176
|
-
console.log(
|
|
330
|
+
console.log(chalk2.red(` ${v.message}`));
|
|
177
331
|
}
|
|
178
332
|
}
|
|
179
333
|
if (request.reasons.length > 0) {
|
|
180
|
-
console.log(
|
|
334
|
+
console.log(chalk2.dim(`
|
|
181
335
|
Reasons: ${request.reasons.join(", ")}`));
|
|
182
336
|
}
|
|
183
337
|
process.exit(1);
|
|
@@ -189,7 +343,20 @@ async function payCommand(address, amountStr, options) {
|
|
|
189
343
|
}
|
|
190
344
|
printPending("Payment requires manual approval");
|
|
191
345
|
printKeyValue("Request ID", request.requestId);
|
|
192
|
-
console.log(
|
|
346
|
+
console.log(chalk2.dim(" Approve in the Conto dashboard to execute."));
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (request.status !== "APPROVED") {
|
|
350
|
+
if (isJsonMode()) {
|
|
351
|
+
printJson(request);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
printPending(`Payment is ${request.status}`);
|
|
355
|
+
printKeyValue("Request ID", request.requestId);
|
|
356
|
+
if (request.reasons.length > 0) {
|
|
357
|
+
console.log(chalk2.dim(` Reasons: ${request.reasons.join(", ")}`));
|
|
358
|
+
}
|
|
359
|
+
console.log(chalk2.dim(" Check the Conto dashboard for next steps."));
|
|
193
360
|
return;
|
|
194
361
|
}
|
|
195
362
|
if (options.dryRun) {
|
|
@@ -211,7 +378,11 @@ async function payCommand(address, amountStr, options) {
|
|
|
211
378
|
printJson(result);
|
|
212
379
|
return;
|
|
213
380
|
}
|
|
214
|
-
|
|
381
|
+
if (result.simulated) {
|
|
382
|
+
printSuccess("Payment recorded (simulated: no onchain transfer)");
|
|
383
|
+
} else {
|
|
384
|
+
printSuccess("Payment sent!");
|
|
385
|
+
}
|
|
215
386
|
printKeyValue("TX Hash", result.txHash);
|
|
216
387
|
printKeyValue("Amount", printAmount(result.amount, result.currency));
|
|
217
388
|
printKeyValue("Recipient", result.recipient);
|
|
@@ -219,11 +390,25 @@ async function payCommand(address, amountStr, options) {
|
|
|
219
390
|
printKeyValue("Explorer", result.explorerUrl);
|
|
220
391
|
console.log("");
|
|
221
392
|
} catch (err) {
|
|
393
|
+
const code = err.code;
|
|
222
394
|
const message = err instanceof Error ? err.message : "Payment failed";
|
|
223
395
|
if (isJsonMode()) {
|
|
224
|
-
printJson({ error: message });
|
|
225
|
-
|
|
226
|
-
|
|
396
|
+
printJson({ error: message, code });
|
|
397
|
+
process.exit(1);
|
|
398
|
+
}
|
|
399
|
+
printError(message);
|
|
400
|
+
if (code === "INSUFFICIENT_SCOPE") {
|
|
401
|
+
console.log(
|
|
402
|
+
chalk2.dim(' This SDK key cannot execute payments. Run "conto doctor" to see its scopes,')
|
|
403
|
+
);
|
|
404
|
+
console.log(chalk2.dim(" or create a new standard SDK key (includes payments:execute)."));
|
|
405
|
+
} else if (code === "SIMULATED_EXECUTION_BLOCKED" || code === "CUSTODY_NOT_CONFIGURED") {
|
|
406
|
+
console.log(
|
|
407
|
+
chalk2.dim(
|
|
408
|
+
" The wallet has no custody provider linked, so it cannot execute real transfers."
|
|
409
|
+
)
|
|
410
|
+
);
|
|
411
|
+
console.log(chalk2.dim(' Run "conto doctor" for wallet details.'));
|
|
227
412
|
}
|
|
228
413
|
process.exit(1);
|
|
229
414
|
}
|
|
@@ -233,7 +418,7 @@ async function payCommand(address, amountStr, options) {
|
|
|
233
418
|
async function transactionsCommand(id, options) {
|
|
234
419
|
const config = loadConfig();
|
|
235
420
|
if (!config.apiKey) {
|
|
236
|
-
printError(
|
|
421
|
+
printError(missingSdkKeyMessage(config));
|
|
237
422
|
process.exit(1);
|
|
238
423
|
}
|
|
239
424
|
const api = createApiClient({
|
|
@@ -251,27 +436,28 @@ async function transactionsCommand(id, options) {
|
|
|
251
436
|
printKeyValue("ID", tx.id);
|
|
252
437
|
printKeyValue("TX Hash", tx.txHash);
|
|
253
438
|
printKeyValue("Status", tx.status);
|
|
254
|
-
printKeyValue("Amount", printAmount(tx.amount, tx.currency));
|
|
255
|
-
printKeyValue("Recipient", tx.
|
|
256
|
-
|
|
439
|
+
printKeyValue("Amount", printAmount(Number(tx.amount), tx.currency));
|
|
440
|
+
printKeyValue("Recipient", tx.recipientAgent?.name || tx.merchantName || tx.toAddress);
|
|
441
|
+
printKeyValue("Recipient Address", tx.toAddress);
|
|
257
442
|
if (tx.purpose) printKeyValue("Purpose", tx.purpose);
|
|
258
|
-
if (tx.
|
|
259
|
-
printKeyValue("
|
|
260
|
-
printKeyValue("Created", new Date(tx.
|
|
443
|
+
if (tx.merchantCategory) printKeyValue("Category", tx.merchantCategory);
|
|
444
|
+
printKeyValue("Chain ID", tx.chainId || void 0);
|
|
445
|
+
printKeyValue("Created", new Date(tx.initiatedAt).toLocaleString());
|
|
261
446
|
if (tx.confirmedAt) printKeyValue("Confirmed", new Date(tx.confirmedAt).toLocaleString());
|
|
262
447
|
if (tx.alerts && tx.alerts.length > 0) {
|
|
263
448
|
printHeader("Alerts");
|
|
264
449
|
for (const a of tx.alerts) {
|
|
265
|
-
console.log(` [${a.
|
|
450
|
+
console.log(` [${a.alertType}] ${a.status}`);
|
|
266
451
|
}
|
|
267
452
|
}
|
|
268
453
|
} else {
|
|
269
|
-
const { transactions,
|
|
454
|
+
const { transactions, pagination } = await api.getTransactions({
|
|
270
455
|
limit: options?.limit ? Number(options.limit) : 10,
|
|
271
456
|
status: options?.status
|
|
272
457
|
});
|
|
458
|
+
const total = pagination?.total ?? transactions.length;
|
|
273
459
|
if (isJsonMode()) {
|
|
274
|
-
printJson({ transactions,
|
|
460
|
+
printJson({ transactions, pagination });
|
|
275
461
|
return;
|
|
276
462
|
}
|
|
277
463
|
if (transactions.length === 0) {
|
|
@@ -282,9 +468,9 @@ async function transactionsCommand(id, options) {
|
|
|
282
468
|
printTable(
|
|
283
469
|
["Date", "Amount", "Recipient", "Purpose", "Status", "TX Hash"],
|
|
284
470
|
transactions.map((tx) => [
|
|
285
|
-
new Date(tx.
|
|
286
|
-
printAmount(tx.amount, tx.currency),
|
|
287
|
-
tx.
|
|
471
|
+
new Date(tx.initiatedAt).toLocaleDateString(),
|
|
472
|
+
printAmount(Number(tx.amount), tx.currency),
|
|
473
|
+
tx.recipientAgent?.name || tx.merchantName || truncateAddress(tx.toAddress),
|
|
288
474
|
tx.purpose || "\u2014",
|
|
289
475
|
tx.status,
|
|
290
476
|
tx.txHash ? truncateAddress(tx.txHash, 8) : "\u2014"
|
|
@@ -304,16 +490,17 @@ async function transactionsCommand(id, options) {
|
|
|
304
490
|
}
|
|
305
491
|
|
|
306
492
|
// src/commands/wallets.ts
|
|
307
|
-
import
|
|
308
|
-
async function walletsCommand(subcommand) {
|
|
493
|
+
import chalk3 from "chalk";
|
|
494
|
+
async function walletsCommand(subcommand, options = {}) {
|
|
309
495
|
const config = loadConfig();
|
|
310
496
|
if (!config.apiKey) {
|
|
311
|
-
printError(
|
|
497
|
+
printError(missingSdkKeyMessage(config));
|
|
312
498
|
process.exit(1);
|
|
313
499
|
}
|
|
314
500
|
const api = createApiClient({
|
|
315
501
|
baseUrl: config.baseUrl,
|
|
316
|
-
apiKey: config.apiKey
|
|
502
|
+
apiKey: config.apiKey,
|
|
503
|
+
orgApiKey: config.orgApiKey
|
|
317
504
|
});
|
|
318
505
|
try {
|
|
319
506
|
await fetchChains(config.baseUrl);
|
|
@@ -345,6 +532,54 @@ async function walletsCommand(subcommand) {
|
|
|
345
532
|
printError("No wallets to fund.");
|
|
346
533
|
return;
|
|
347
534
|
}
|
|
535
|
+
if (options.faucet) {
|
|
536
|
+
if (!config.orgApiKey) {
|
|
537
|
+
printError(
|
|
538
|
+
'Faucet funding requires an organization key. Run "conto login" or create the project with "npx create-conto-agent".'
|
|
539
|
+
);
|
|
540
|
+
process.exit(1);
|
|
541
|
+
}
|
|
542
|
+
const results = [];
|
|
543
|
+
for (const w of wallets) {
|
|
544
|
+
const chainEntry = getChain(w.chainId);
|
|
545
|
+
if (!chainEntry?.faucetAvailable) {
|
|
546
|
+
results.push({
|
|
547
|
+
walletId: w.id,
|
|
548
|
+
address: w.address,
|
|
549
|
+
ok: false,
|
|
550
|
+
error: `No faucet available for chain ${w.chainId}`
|
|
551
|
+
});
|
|
552
|
+
if (!isJsonMode()) {
|
|
553
|
+
printError(`No faucet available for ${w.name} on chain ${w.chainId}.`);
|
|
554
|
+
}
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
try {
|
|
558
|
+
const faucetResult = await api.fundWallet(w.id);
|
|
559
|
+
results.push({ walletId: w.id, address: w.address, ok: true, ...faucetResult });
|
|
560
|
+
if (!isJsonMode()) {
|
|
561
|
+
printSuccess(
|
|
562
|
+
faucetResult.message || `Testnet funds requested for ${truncateAddress(w.address)}`
|
|
563
|
+
);
|
|
564
|
+
if (typeof faucetResult.updatedBalance === "number") {
|
|
565
|
+
printInfo(
|
|
566
|
+
`Updated balance: ${printAmount(faucetResult.updatedBalance, w.currency || "USD")}`
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
} catch (err) {
|
|
571
|
+
const message = err instanceof Error ? err.message : "Faucet request failed";
|
|
572
|
+
results.push({ walletId: w.id, address: w.address, ok: false, error: message });
|
|
573
|
+
if (!isJsonMode()) {
|
|
574
|
+
printError(message);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
if (isJsonMode()) {
|
|
579
|
+
printJson({ results });
|
|
580
|
+
}
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
348
583
|
for (const w of wallets) {
|
|
349
584
|
const chainEntry = getChain(w.chainId);
|
|
350
585
|
if (isJsonMode()) {
|
|
@@ -368,20 +603,20 @@ async function walletsCommand(subcommand) {
|
|
|
368
603
|
console.log("");
|
|
369
604
|
if (chainEntry?.faucetAvailable && config.testnet) {
|
|
370
605
|
console.log(
|
|
371
|
-
|
|
606
|
+
chalk3.cyan(
|
|
372
607
|
' This is a testnet wallet. Use "conto fund --faucet" to get free test tokens.'
|
|
373
608
|
)
|
|
374
609
|
);
|
|
375
610
|
console.log("");
|
|
376
611
|
} else {
|
|
377
|
-
console.log(` To fund your agent wallet, send ${
|
|
612
|
+
console.log(` To fund your agent wallet, send ${chalk3.bold(w.currency || "USD")} to:
|
|
378
613
|
`);
|
|
379
|
-
console.log(
|
|
614
|
+
console.log(chalk3.bold(` ${w.address}`));
|
|
380
615
|
console.log("");
|
|
381
616
|
const instructions = getFundingInstructions(w.currency || "USD", chainEntry);
|
|
382
617
|
console.log(` How to get ${w.currency || "USD"}:`);
|
|
383
618
|
for (const instruction of instructions) {
|
|
384
|
-
console.log(` ${
|
|
619
|
+
console.log(` ${chalk3.dim("\u2022")} ${instruction}`);
|
|
385
620
|
}
|
|
386
621
|
console.log("");
|
|
387
622
|
if (chainEntry) {
|
|
@@ -401,6 +636,13 @@ async function walletsCommand(subcommand) {
|
|
|
401
636
|
}
|
|
402
637
|
}
|
|
403
638
|
function getFundingInstructions(currency, chain) {
|
|
639
|
+
if (currency === "USDC.e" && chain?.chainId === "4217") {
|
|
640
|
+
return [
|
|
641
|
+
"Bridge USDC into Tempo to receive USDC.e",
|
|
642
|
+
"Transfer USDC.e from another Tempo wallet",
|
|
643
|
+
"Swap supported Tempo assets into USDC.e"
|
|
644
|
+
];
|
|
645
|
+
}
|
|
404
646
|
if (currency === "pathUSD") {
|
|
405
647
|
return [
|
|
406
648
|
"Swap USDC \u2192 pathUSD on Tempo DEX",
|
|
@@ -426,7 +668,7 @@ function getFundingInstructions(currency, chain) {
|
|
|
426
668
|
}
|
|
427
669
|
|
|
428
670
|
// src/commands/policies.ts
|
|
429
|
-
import
|
|
671
|
+
import chalk4 from "chalk";
|
|
430
672
|
import * as p from "@clack/prompts";
|
|
431
673
|
var POLICY_TYPES = [
|
|
432
674
|
{
|
|
@@ -728,21 +970,21 @@ async function listAgentPolicies(api) {
|
|
|
728
970
|
}
|
|
729
971
|
printHeader("Agent Policies");
|
|
730
972
|
for (const policy of policies) {
|
|
731
|
-
const scope = policy.assignedVia === "agent" ?
|
|
973
|
+
const scope = policy.assignedVia === "agent" ? chalk4.cyan("[agent]") : chalk4.dim("[org-wide]");
|
|
732
974
|
console.log(
|
|
733
975
|
`
|
|
734
|
-
${
|
|
976
|
+
${chalk4.bold(policy.name)} ${scope} ${chalk4.dim(`(${policy.policyType}, priority: ${policy.priority})`)}`
|
|
735
977
|
);
|
|
736
|
-
console.log(` ${
|
|
978
|
+
console.log(` ${chalk4.dim("ID:")} ${policy.id}`);
|
|
737
979
|
console.log(
|
|
738
|
-
` ${
|
|
980
|
+
` ${chalk4.dim("Active:")} ${policy.isActive ? chalk4.green("Yes") : chalk4.red("No")}`
|
|
739
981
|
);
|
|
740
982
|
if (policy.rules.length > 0) {
|
|
741
|
-
console.log(` ${
|
|
983
|
+
console.log(` ${chalk4.dim("Rules:")}`);
|
|
742
984
|
for (const rule of policy.rules) {
|
|
743
985
|
const valueDisplay = formatRuleValue(rule.ruleType, rule.value);
|
|
744
986
|
console.log(
|
|
745
|
-
` ${
|
|
987
|
+
` ${chalk4.dim("\u2022")} ${rule.ruleType} ${rule.operator} ${valueDisplay} \u2192 ${rule.action}`
|
|
746
988
|
);
|
|
747
989
|
}
|
|
748
990
|
}
|
|
@@ -764,18 +1006,18 @@ async function listAllPolicies(api) {
|
|
|
764
1006
|
const agentCount = policy._count?.agentPolicies ?? "?";
|
|
765
1007
|
console.log(
|
|
766
1008
|
`
|
|
767
|
-
${
|
|
1009
|
+
${chalk4.bold(policy.name)} ${chalk4.dim(`(${policy.policyType}, priority: ${policy.priority}, ${agentCount} agents)`)}`
|
|
768
1010
|
);
|
|
769
|
-
console.log(` ${
|
|
1011
|
+
console.log(` ${chalk4.dim("ID:")} ${policy.id}`);
|
|
770
1012
|
console.log(
|
|
771
|
-
` ${
|
|
1013
|
+
` ${chalk4.dim("Active:")} ${policy.isActive ? chalk4.green("Yes") : chalk4.red("No")}`
|
|
772
1014
|
);
|
|
773
1015
|
if (policy.rules.length > 0) {
|
|
774
|
-
console.log(` ${
|
|
1016
|
+
console.log(` ${chalk4.dim("Rules:")}`);
|
|
775
1017
|
for (const rule of policy.rules) {
|
|
776
1018
|
const valueDisplay = formatRuleValue(rule.ruleType, rule.value);
|
|
777
1019
|
console.log(
|
|
778
|
-
` ${
|
|
1020
|
+
` ${chalk4.dim("\u2022")} [${rule.id.slice(-6)}] ${rule.ruleType} ${rule.operator} ${valueDisplay} \u2192 ${rule.action}`
|
|
779
1021
|
);
|
|
780
1022
|
}
|
|
781
1023
|
}
|
|
@@ -957,8 +1199,8 @@ async function promptForRule(policyType) {
|
|
|
957
1199
|
};
|
|
958
1200
|
}
|
|
959
1201
|
function printPolicyHelp() {
|
|
960
|
-
console.log(
|
|
961
|
-
console.log(
|
|
1202
|
+
console.log(chalk4.bold("\n Conto Policy Management\n"));
|
|
1203
|
+
console.log(chalk4.bold(" Commands:"));
|
|
962
1204
|
console.log(" conto policies List agent policies");
|
|
963
1205
|
console.log(" conto policies all List all org policies");
|
|
964
1206
|
console.log(" conto policies create Create a new policy");
|
|
@@ -969,11 +1211,11 @@ function printPolicyHelp() {
|
|
|
969
1211
|
console.log(" conto policies add-rule <id> Add a rule");
|
|
970
1212
|
console.log(" conto policies remove-rule <id> <rid> Remove a rule");
|
|
971
1213
|
console.log(" conto policies help This help page");
|
|
972
|
-
console.log(
|
|
1214
|
+
console.log(chalk4.bold("\n Policy Types:"));
|
|
973
1215
|
for (const pt of POLICY_TYPES) {
|
|
974
|
-
console.log(` ${
|
|
1216
|
+
console.log(` ${chalk4.cyan(pt.value.padEnd(22))} ${chalk4.dim(pt.hint)}`);
|
|
975
1217
|
}
|
|
976
|
-
console.log(
|
|
1218
|
+
console.log(chalk4.bold("\n Common Rule Types:"));
|
|
977
1219
|
const commonRules = [
|
|
978
1220
|
["MAX_AMOUNT", "Max per-transaction amount (e.g. 500)"],
|
|
979
1221
|
["DAILY_LIMIT", "Max total spend per day (e.g. 1000)"],
|
|
@@ -987,33 +1229,33 @@ function printPolicyHelp() {
|
|
|
987
1229
|
["DATE_RANGE", 'JSON: {"start":"2025-01-01","end":"2025-12-31"}']
|
|
988
1230
|
];
|
|
989
1231
|
for (const [rule, desc] of commonRules) {
|
|
990
|
-
console.log(` ${
|
|
1232
|
+
console.log(` ${chalk4.cyan(rule.padEnd(28))} ${chalk4.dim(desc)}`);
|
|
991
1233
|
}
|
|
992
|
-
console.log(
|
|
1234
|
+
console.log(chalk4.bold("\n Value Examples:"));
|
|
993
1235
|
console.log(" Spend limits: 500");
|
|
994
1236
|
console.log(' Address lists: ["0xabc...","0xdef..."]');
|
|
995
1237
|
console.log(' Country codes: ["CU","IR","KP","SY","RU"]');
|
|
996
1238
|
console.log(" Trust score: 50 (0-100)");
|
|
997
1239
|
console.log(' Date range: {"start":"2025-01-01","end":"2025-12-31"}');
|
|
998
1240
|
console.log(' Categories: ["API_PROVIDER","CLOUD","SAAS"]');
|
|
999
|
-
console.log(
|
|
1241
|
+
console.log(chalk4.bold("\n Operators:"));
|
|
1000
1242
|
console.log(" LTE (<= at most) GTE (>= at least) EQUALS NOT_EQUALS");
|
|
1001
1243
|
console.log(" IN_LIST NOT_IN_LIST BETWEEN DENY");
|
|
1002
|
-
console.log(
|
|
1003
|
-
console.log(` ${
|
|
1004
|
-
console.log(` ${
|
|
1005
|
-
console.log(` ${
|
|
1006
|
-
console.log(
|
|
1007
|
-
console.log(
|
|
1244
|
+
console.log(chalk4.bold("\n Actions:"));
|
|
1245
|
+
console.log(` ${chalk4.green("ALLOW")} Payment proceeds if rule passes`);
|
|
1246
|
+
console.log(` ${chalk4.red("DENY")} Payment is blocked`);
|
|
1247
|
+
console.log(` ${chalk4.yellow("REQUIRE_APPROVAL")} Payment needs human approval`);
|
|
1248
|
+
console.log(chalk4.bold("\n Examples:"));
|
|
1249
|
+
console.log(chalk4.dim(" # Create a $500/day spend limit"));
|
|
1008
1250
|
console.log(" conto policies create");
|
|
1009
|
-
console.log(
|
|
1251
|
+
console.log(chalk4.dim(" # Add a weekly limit rule to an existing policy"));
|
|
1010
1252
|
console.log(" conto policies add-rule cmn4abc123");
|
|
1011
|
-
console.log(
|
|
1253
|
+
console.log(chalk4.dim(" # Deactivate a policy without deleting"));
|
|
1012
1254
|
console.log(" conto policies update cmn4abc123");
|
|
1013
|
-
console.log(
|
|
1255
|
+
console.log(chalk4.dim(" # View all policies as JSON"));
|
|
1014
1256
|
console.log(" conto policies all --json");
|
|
1015
1257
|
console.log(`
|
|
1016
|
-
${
|
|
1258
|
+
${chalk4.dim("Full docs: https://conto.finance/docs/cli/policies")}
|
|
1017
1259
|
`);
|
|
1018
1260
|
}
|
|
1019
1261
|
function formatRuleValue(ruleType, value) {
|
|
@@ -1030,7 +1272,7 @@ function formatRuleValue(ruleType, value) {
|
|
|
1030
1272
|
}
|
|
1031
1273
|
|
|
1032
1274
|
// src/commands/limits.ts
|
|
1033
|
-
import
|
|
1275
|
+
import chalk5 from "chalk";
|
|
1034
1276
|
async function limitsCommand() {
|
|
1035
1277
|
const config = loadConfig();
|
|
1036
1278
|
if (!config.apiKey) {
|
|
@@ -1054,21 +1296,21 @@ async function limitsCommand() {
|
|
|
1054
1296
|
printHeader("Spending Limits");
|
|
1055
1297
|
for (const l of limits) {
|
|
1056
1298
|
console.log(`
|
|
1057
|
-
${
|
|
1299
|
+
${chalk5.bold(l.walletName)}`);
|
|
1058
1300
|
const dailyPct = l.daily.limit > 0 ? Math.round(l.daily.spent / l.daily.limit * 100) : 0;
|
|
1059
1301
|
console.log(
|
|
1060
|
-
` ${
|
|
1302
|
+
` ${chalk5.dim("Daily:")} ${bar(dailyPct)} ${printAmount(l.daily.spent, "USD")} / ${printAmount(l.daily.limit, "USD")} ${chalk5.dim(`(${printAmount(l.daily.remaining, "USD")} remaining)`)}`
|
|
1061
1303
|
);
|
|
1062
1304
|
if (l.weekly) {
|
|
1063
1305
|
const weeklyPct = l.weekly.limit > 0 ? Math.round(l.weekly.spent / l.weekly.limit * 100) : 0;
|
|
1064
1306
|
console.log(
|
|
1065
|
-
` ${
|
|
1307
|
+
` ${chalk5.dim("Weekly:")} ${bar(weeklyPct)} ${printAmount(l.weekly.spent, "USD")} / ${printAmount(l.weekly.limit, "USD")} ${chalk5.dim(`(${printAmount(l.weekly.remaining, "USD")} remaining)`)}`
|
|
1066
1308
|
);
|
|
1067
1309
|
}
|
|
1068
1310
|
if (l.monthly) {
|
|
1069
1311
|
const monthlyPct = l.monthly.limit > 0 ? Math.round(l.monthly.spent / l.monthly.limit * 100) : 0;
|
|
1070
1312
|
console.log(
|
|
1071
|
-
` ${
|
|
1313
|
+
` ${chalk5.dim("Monthly:")} ${bar(monthlyPct)} ${printAmount(l.monthly.spent, "USD")} / ${printAmount(l.monthly.limit, "USD")} ${chalk5.dim(`(${printAmount(l.monthly.remaining, "USD")} remaining)`)}`
|
|
1072
1314
|
);
|
|
1073
1315
|
}
|
|
1074
1316
|
printKeyValue(" Per-TX max", printAmount(l.perTransaction, "USD"));
|
|
@@ -1092,11 +1334,11 @@ function bar(pct, width = 15) {
|
|
|
1092
1334
|
}
|
|
1093
1335
|
|
|
1094
1336
|
// src/commands/alerts.ts
|
|
1095
|
-
import
|
|
1337
|
+
import chalk6 from "chalk";
|
|
1096
1338
|
async function alertsCommand(options = {}) {
|
|
1097
1339
|
const config = loadConfig();
|
|
1098
1340
|
if (!config.apiKey) {
|
|
1099
|
-
printError(
|
|
1341
|
+
printError(missingSdkKeyMessage(config));
|
|
1100
1342
|
process.exit(1);
|
|
1101
1343
|
}
|
|
1102
1344
|
const api = createApiClient({
|
|
@@ -1104,15 +1346,16 @@ async function alertsCommand(options = {}) {
|
|
|
1104
1346
|
apiKey: config.apiKey
|
|
1105
1347
|
});
|
|
1106
1348
|
try {
|
|
1349
|
+
const activeOnly = options.active || options.unread;
|
|
1107
1350
|
const { alerts } = await api.getAlerts({
|
|
1108
|
-
status:
|
|
1351
|
+
status: activeOnly ? "ACTIVE" : void 0
|
|
1109
1352
|
});
|
|
1110
1353
|
if (isJsonMode()) {
|
|
1111
1354
|
printJson(alerts);
|
|
1112
1355
|
return;
|
|
1113
1356
|
}
|
|
1114
1357
|
if (alerts.length === 0) {
|
|
1115
|
-
console.log("\n No alerts." + (
|
|
1358
|
+
console.log("\n No alerts." + (activeOnly ? " (showing active only)" : ""));
|
|
1116
1359
|
return;
|
|
1117
1360
|
}
|
|
1118
1361
|
printHeader(`Alerts (${alerts.length})`);
|
|
@@ -1121,7 +1364,7 @@ async function alertsCommand(options = {}) {
|
|
|
1121
1364
|
alerts.map((a) => [
|
|
1122
1365
|
new Date(a.createdAt).toLocaleDateString(),
|
|
1123
1366
|
severityColor(a.severity),
|
|
1124
|
-
a.
|
|
1367
|
+
a.alertType,
|
|
1125
1368
|
a.message.length > 50 ? a.message.slice(0, 50) + "..." : a.message,
|
|
1126
1369
|
a.status
|
|
1127
1370
|
])
|
|
@@ -1140,20 +1383,20 @@ async function alertsCommand(options = {}) {
|
|
|
1140
1383
|
function severityColor(severity) {
|
|
1141
1384
|
switch (severity.toUpperCase()) {
|
|
1142
1385
|
case "CRITICAL":
|
|
1143
|
-
return
|
|
1386
|
+
return chalk6.red.bold(severity);
|
|
1144
1387
|
case "HIGH":
|
|
1145
|
-
return
|
|
1388
|
+
return chalk6.red(severity);
|
|
1146
1389
|
case "MEDIUM":
|
|
1147
|
-
return
|
|
1390
|
+
return chalk6.yellow(severity);
|
|
1148
1391
|
case "LOW":
|
|
1149
|
-
return
|
|
1392
|
+
return chalk6.dim(severity);
|
|
1150
1393
|
default:
|
|
1151
1394
|
return severity;
|
|
1152
1395
|
}
|
|
1153
1396
|
}
|
|
1154
1397
|
|
|
1155
1398
|
// src/commands/config.ts
|
|
1156
|
-
import
|
|
1399
|
+
import chalk7 from "chalk";
|
|
1157
1400
|
async function configCommand(key, value) {
|
|
1158
1401
|
if (key && value) {
|
|
1159
1402
|
const global = loadGlobalConfig();
|
|
@@ -1167,31 +1410,36 @@ async function configCommand(key, value) {
|
|
|
1167
1410
|
}
|
|
1168
1411
|
target[parts[parts.length - 1]] = value;
|
|
1169
1412
|
saveGlobalConfig(global);
|
|
1170
|
-
|
|
1413
|
+
const displayValue = isSensitiveConfigKey(key) ? maskSecret(value) : value;
|
|
1414
|
+
printSuccess(`Set ${key} = ${displayValue}`);
|
|
1171
1415
|
return;
|
|
1172
1416
|
}
|
|
1173
1417
|
const config = loadConfig();
|
|
1174
1418
|
if (isJsonMode()) {
|
|
1175
|
-
printJson(
|
|
1419
|
+
printJson({
|
|
1420
|
+
...config,
|
|
1421
|
+
apiKey: config.apiKey ? maskSecret(config.apiKey) : void 0,
|
|
1422
|
+
orgApiKey: config.orgApiKey ? maskSecret(config.orgApiKey) : void 0
|
|
1423
|
+
});
|
|
1176
1424
|
return;
|
|
1177
1425
|
}
|
|
1178
1426
|
printHeader("Configuration");
|
|
1179
1427
|
printKeyValue(
|
|
1180
1428
|
"API Key",
|
|
1181
|
-
config.apiKey ?
|
|
1429
|
+
config.apiKey ? maskSecret(config.apiKey) : chalk7.dim("not set")
|
|
1182
1430
|
);
|
|
1183
1431
|
printKeyValue("Base URL", config.baseUrl);
|
|
1184
|
-
printKeyValue("Agent ID", config.agentId ||
|
|
1185
|
-
printKeyValue("Chain", config.chainName ||
|
|
1186
|
-
printKeyValue("Chain ID", config.chainId ||
|
|
1187
|
-
printKeyValue("Currency", config.currency ||
|
|
1188
|
-
printKeyValue("Explorer", config.explorerUrl ||
|
|
1189
|
-
printKeyValue("Wallet ID", config.walletId ||
|
|
1190
|
-
printKeyValue("Wallet Address", config.walletAddress ||
|
|
1432
|
+
printKeyValue("Agent ID", config.agentId || chalk7.dim("not set"));
|
|
1433
|
+
printKeyValue("Chain", config.chainName || chalk7.dim("not set"));
|
|
1434
|
+
printKeyValue("Chain ID", config.chainId || chalk7.dim("not set"));
|
|
1435
|
+
printKeyValue("Currency", config.currency || chalk7.dim("not set"));
|
|
1436
|
+
printKeyValue("Explorer", config.explorerUrl || chalk7.dim("not set"));
|
|
1437
|
+
printKeyValue("Wallet ID", config.walletId || chalk7.dim("not set"));
|
|
1438
|
+
printKeyValue("Wallet Address", config.walletAddress || chalk7.dim("not set"));
|
|
1191
1439
|
printKeyValue("Testnet", config.testnet ? "Yes" : "No");
|
|
1192
1440
|
console.log("");
|
|
1193
|
-
console.log(
|
|
1194
|
-
console.log(
|
|
1441
|
+
console.log(chalk7.dim(" Config sources: ~/.conto/config.json + .env.local"));
|
|
1442
|
+
console.log(chalk7.dim(" Update with: conto config <key> <value>"));
|
|
1195
1443
|
console.log("");
|
|
1196
1444
|
}
|
|
1197
1445
|
|
|
@@ -1225,10 +1473,13 @@ async function mcpCommand() {
|
|
|
1225
1473
|
printError('Not configured. Run "npx create-conto-agent" or "conto login" first.');
|
|
1226
1474
|
process.exit(1);
|
|
1227
1475
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1476
|
+
console.error(`Starting Conto MCP server (${config.baseUrl})...`);
|
|
1477
|
+
console.error(`Using SDK key ${maskSecret(config.apiKey)}.`);
|
|
1478
|
+
console.error("Press Ctrl+C to stop.\n");
|
|
1479
|
+
const isWindows = process.platform === "win32";
|
|
1480
|
+
const child = spawn(isWindows ? "npx.cmd" : "npx", ["--yes", "@conto_finance/mcp-server"], {
|
|
1231
1481
|
stdio: "inherit",
|
|
1482
|
+
shell: isWindows,
|
|
1232
1483
|
env: {
|
|
1233
1484
|
...process.env,
|
|
1234
1485
|
CONTO_API_KEY: config.apiKey,
|
|
@@ -1236,8 +1487,8 @@ async function mcpCommand() {
|
|
|
1236
1487
|
}
|
|
1237
1488
|
});
|
|
1238
1489
|
child.on("error", (err) => {
|
|
1239
|
-
|
|
1240
|
-
|
|
1490
|
+
console.error(`Failed to start MCP server: ${err.message}`);
|
|
1491
|
+
console.error("Install it with: npm install -g @conto_finance/mcp-server");
|
|
1241
1492
|
process.exit(1);
|
|
1242
1493
|
});
|
|
1243
1494
|
child.on("exit", (code) => {
|
|
@@ -1247,55 +1498,65 @@ async function mcpCommand() {
|
|
|
1247
1498
|
|
|
1248
1499
|
// src/cli.ts
|
|
1249
1500
|
var program = new Command();
|
|
1250
|
-
program.name("conto").description("Conto CLI \u2014 Agentic Payments Control Center").version(
|
|
1501
|
+
program.name("conto").description("Conto CLI \u2014 Agentic Payments Control Center").version(CLI_PACKAGE_VERSION).option("--json", "Output in JSON format").hook("preAction", (thisCommand) => {
|
|
1251
1502
|
const opts = thisCommand.opts();
|
|
1252
1503
|
if (opts.json) {
|
|
1253
1504
|
setJsonMode(true);
|
|
1254
1505
|
}
|
|
1255
1506
|
});
|
|
1256
|
-
program.command("init").description("Run the
|
|
1507
|
+
program.command("init").description("Run the setup wizard (interactive, or headless with --sandbox/--api-key)").option(
|
|
1508
|
+
"--chain <chain>",
|
|
1509
|
+
"Chain ID from /api/chains (for example 42431, 4217, 8453, solana-mainnet)"
|
|
1510
|
+
).option("--name <name>", "Agent name").option("--type <type>", "Agent type").option("--limit <limit>", "Daily spending limit in USD").option("--base-url <url>", "Conto instance URL").option("--sandbox", "Create an anonymous test-mode sandbox (headless, no account needed)").option("--api-key <key>", "Existing organization API key (skips browser authentication)").option("--no-install", "Skip installing the conto CLI into the project").action(async (opts, command) => {
|
|
1511
|
+
if (command.parent?.opts()?.json) {
|
|
1512
|
+
setJsonMode(true);
|
|
1513
|
+
}
|
|
1257
1514
|
await runInit({
|
|
1258
1515
|
chain: opts.chain,
|
|
1259
1516
|
name: opts.name,
|
|
1260
1517
|
type: opts.type,
|
|
1261
1518
|
limit: opts.limit ? Number(opts.limit) : void 0,
|
|
1262
|
-
baseUrl: opts.baseUrl
|
|
1519
|
+
baseUrl: opts.baseUrl,
|
|
1520
|
+
install: opts.install,
|
|
1521
|
+
sandbox: opts.sandbox === true,
|
|
1522
|
+
apiKey: opts.apiKey
|
|
1263
1523
|
});
|
|
1264
1524
|
});
|
|
1265
1525
|
program.command("status").description("Agent info, wallet balances, spending summary").action(statusCommand);
|
|
1526
|
+
program.command("doctor").description("Diagnose setup: auth, key scopes, wallet, chain, balance, base URL").action(doctorCommand);
|
|
1266
1527
|
program.command("balance").description("Wallet balances across all linked wallets").action(balanceCommand);
|
|
1267
1528
|
program.command("pay <address> <amount>").description("Request + execute a payment").option("--purpose <purpose>", "Payment purpose").option("--category <category>", "Spend category").option("--dry-run", "Policy check without executing").option("--wallet <walletId>", "Specific wallet to use").action(payCommand);
|
|
1268
1529
|
program.command("transactions [id]").description("List recent transactions or view details").option("--limit <n>", "Number of transactions", "10").option("--status <status>", "Filter by status").action(transactionsCommand);
|
|
1269
1530
|
program.command("wallets").description("List wallets with balances").action(() => walletsCommand("list"));
|
|
1270
|
-
program.command("fund").description("Show wallet funding instructions").action(() => walletsCommand("fund"));
|
|
1531
|
+
program.command("fund").description("Show wallet funding instructions").option("--faucet", "Request testnet funds from the configured faucet").action((opts) => walletsCommand("fund", { faucet: opts.faucet === true }));
|
|
1271
1532
|
program.command("policies [subcommand] [id] [extra]").description(
|
|
1272
1533
|
"Manage spending policies (list, all, create, update, delete, assign, unassign, add-rule, remove-rule)"
|
|
1273
1534
|
).action(
|
|
1274
1535
|
(subcommand, id, extra) => policiesCommand(subcommand || "list", id, extra)
|
|
1275
1536
|
);
|
|
1276
1537
|
program.command("limits").description("Show spending limits and remaining budget").action(limitsCommand);
|
|
1277
|
-
program.command("alerts").description("List alerts").option("--
|
|
1538
|
+
program.command("alerts").description("List alerts").option("--active", "Show only active alerts").option("--unread", "Alias for --active").action(alertsCommand);
|
|
1278
1539
|
program.command("config [key] [value]").description("Show or update configuration").action(configCommand);
|
|
1279
1540
|
program.command("login").description("Authenticate with Conto").option("--base-url <url>", "Conto instance URL").action(loginCommand);
|
|
1280
1541
|
program.command("logout").description("Clear stored credentials").action(async () => {
|
|
1281
|
-
const { clearGlobalConfig } = await import("./config-
|
|
1542
|
+
const { clearGlobalConfig } = await import("./config-RZBPNEBZ.js");
|
|
1282
1543
|
clearGlobalConfig();
|
|
1283
|
-
const { printSuccess:
|
|
1284
|
-
|
|
1544
|
+
const { printSuccess: printSuccess2 } = await import("./output-IN47X4NU.js");
|
|
1545
|
+
printSuccess2("Logged out. Credentials cleared.");
|
|
1285
1546
|
});
|
|
1286
1547
|
program.command("mcp").description("Start MCP server for AI agent integration").action(mcpCommand);
|
|
1287
1548
|
program.command("docs [topic]").description("Open Conto documentation (cli, policies, sdk, api)").action(async (topic) => {
|
|
1288
1549
|
const open = (await import("open")).default;
|
|
1289
1550
|
const urls = {
|
|
1290
|
-
cli: "https://
|
|
1291
|
-
policies: "https://
|
|
1292
|
-
commands: "https://
|
|
1293
|
-
sdk: "https://
|
|
1294
|
-
api: "https://
|
|
1551
|
+
cli: "https://conto.finance/docs/cli/quickstart",
|
|
1552
|
+
policies: "https://conto.finance/docs/cli/policies",
|
|
1553
|
+
commands: "https://conto.finance/docs/cli/commands",
|
|
1554
|
+
sdk: "https://conto.finance/docs/sdk/installation",
|
|
1555
|
+
api: "https://conto.finance/docs/api"
|
|
1295
1556
|
};
|
|
1296
1557
|
const url = urls[topic || "cli"] || urls.cli;
|
|
1297
|
-
const { printInfo:
|
|
1298
|
-
|
|
1558
|
+
const { printInfo: printInfo2 } = await import("./output-IN47X4NU.js");
|
|
1559
|
+
printInfo2(`Opening ${url}`);
|
|
1299
1560
|
open(url);
|
|
1300
1561
|
});
|
|
1301
1562
|
program.parse();
|