@conto_finance/create-conto-agent 0.3.0 → 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.
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
saveGlobalConfig,
|
|
12
12
|
writeContoConfig,
|
|
13
13
|
writeEnvLocal
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WMVGNUSL.js";
|
|
15
15
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "@conto_finance/create-conto-agent",
|
|
19
|
-
version: "0.3.
|
|
19
|
+
version: "0.3.1",
|
|
20
20
|
description: "CLI quickstart for Conto \u2014 Agentic Payments Control Center",
|
|
21
21
|
bin: {
|
|
22
22
|
"create-conto-agent": "bin/create-conto-agent.js",
|
|
@@ -35,7 +35,7 @@ var package_default = {
|
|
|
35
35
|
test: "npm run build && node --test test/*.test.mjs"
|
|
36
36
|
},
|
|
37
37
|
engines: {
|
|
38
|
-
node: ">=
|
|
38
|
+
node: ">=20.19.0"
|
|
39
39
|
},
|
|
40
40
|
keywords: [
|
|
41
41
|
"conto",
|
|
@@ -69,7 +69,7 @@ var package_default = {
|
|
|
69
69
|
esbuild: "0.28.1"
|
|
70
70
|
},
|
|
71
71
|
devDependencies: {
|
|
72
|
-
"@types/node": "
|
|
72
|
+
"@types/node": "22.19.18",
|
|
73
73
|
tsup: "^8.5.1",
|
|
74
74
|
typescript: "^5.9.3"
|
|
75
75
|
}
|
|
@@ -947,7 +947,8 @@ async function runSandboxInit(options) {
|
|
|
947
947
|
"",
|
|
948
948
|
"# Sandbox (shown once, keep private)",
|
|
949
949
|
["CONTO_SANDBOX_API_KEY", sandbox.credentials.apiKey],
|
|
950
|
-
["CONTO_SANDBOX_EXPIRES_AT", sandbox.expiresAt]
|
|
950
|
+
["CONTO_SANDBOX_EXPIRES_AT", sandbox.expiresAt],
|
|
951
|
+
["CONTO_SANDBOX_EXECUTION", "simulated"]
|
|
951
952
|
]);
|
|
952
953
|
writeContoConfig(cwd, {
|
|
953
954
|
agent: {
|
|
@@ -1001,6 +1002,11 @@ async function runSandboxInit(options) {
|
|
|
1001
1002
|
baseUrl,
|
|
1002
1003
|
apiKey: sandbox.credentials.sdkKey,
|
|
1003
1004
|
orgApiKey: sandbox.credentials.apiKey
|
|
1005
|
+
},
|
|
1006
|
+
sandbox: {
|
|
1007
|
+
mode: "test",
|
|
1008
|
+
expiresAt: sandbox.expiresAt,
|
|
1009
|
+
execution: "simulated"
|
|
1004
1010
|
}
|
|
1005
1011
|
});
|
|
1006
1012
|
let cliResolves = hasLocalCliBin(cwd);
|
|
@@ -1148,7 +1154,15 @@ async function main() {
|
|
|
1148
1154
|
for (const w of setup.wallets || []) {
|
|
1149
1155
|
console.log(\`Wallet: \${w.address}\`);
|
|
1150
1156
|
console.log(\` Chain: \${w.chainName} (\${w.chainId})\${w.isTestnet ? ' testnet' : ''}\`);
|
|
1151
|
-
|
|
1157
|
+
const executionLabel =
|
|
1158
|
+
w.executionMode === 'managed'
|
|
1159
|
+
? 'managed execution'
|
|
1160
|
+
: w.executionMode === 'simulated'
|
|
1161
|
+
? 'simulated execution'
|
|
1162
|
+
: w.executionMode === 'manual'
|
|
1163
|
+
? 'manual execution'
|
|
1164
|
+
: '';
|
|
1165
|
+
console.log(\` Custody: \${w.custodyType}\${executionLabel ? \` (\${executionLabel})\` : ''}\`);
|
|
1152
1166
|
console.log(\` Balance: \${w.balance} \${w.currency}\`);
|
|
1153
1167
|
console.log(\` Daily: \${w.spent?.today ?? 0} / \${w.limits?.daily ?? 'unlimited'}\\n\`);
|
|
1154
1168
|
}
|
|
@@ -6,6 +6,8 @@ var CONTO_DIR = path.join(os.homedir(), ".conto");
|
|
|
6
6
|
var CONFIG_FILE = path.join(CONTO_DIR, "config.json");
|
|
7
7
|
var PRIVATE_DIR_MODE = 448;
|
|
8
8
|
var PRIVATE_FILE_MODE = 384;
|
|
9
|
+
var DEFAULT_VISIBLE_SECRET_CHARS = 10;
|
|
10
|
+
var SENSITIVE_CONFIG_KEY_PATTERN = /(^|\.)(apiKey|orgApiKey)$/i;
|
|
9
11
|
function ensureContoDir() {
|
|
10
12
|
if (!fs.existsSync(CONTO_DIR)) {
|
|
11
13
|
fs.mkdirSync(CONTO_DIR, { recursive: true, mode: PRIVATE_DIR_MODE });
|
|
@@ -43,8 +45,20 @@ function loadProjectEnv(dir) {
|
|
|
43
45
|
}
|
|
44
46
|
return {};
|
|
45
47
|
}
|
|
48
|
+
function loadProjectConfig(dir) {
|
|
49
|
+
const configPath = path.join(dir || process.cwd(), "conto.config.json");
|
|
50
|
+
try {
|
|
51
|
+
if (fs.existsSync(configPath)) {
|
|
52
|
+
const raw = fs.readFileSync(configPath, "utf-8");
|
|
53
|
+
return JSON.parse(raw);
|
|
54
|
+
}
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
46
59
|
function loadConfig() {
|
|
47
60
|
const global = loadGlobalConfig();
|
|
61
|
+
const project = loadProjectConfig();
|
|
48
62
|
const env = loadProjectEnv();
|
|
49
63
|
return {
|
|
50
64
|
apiKey: env.CONTO_API_KEY || global.server?.apiKey,
|
|
@@ -57,7 +71,11 @@ function loadConfig() {
|
|
|
57
71
|
walletId: env.CONTO_WALLET_ID || global.wallet?.id,
|
|
58
72
|
walletAddress: env.CONTO_WALLET_ADDRESS || global.wallet?.address,
|
|
59
73
|
orgApiKey: global.server?.orgApiKey,
|
|
60
|
-
|
|
74
|
+
// Sandbox metadata is project-scoped and ephemeral. Do not let a prior
|
|
75
|
+
// sandbox stored in ~/.conto/config.json bleed into unrelated agents.
|
|
76
|
+
sandboxExecution: env.CONTO_SANDBOX_EXECUTION || project.sandbox?.execution,
|
|
77
|
+
sandboxExpiresAt: env.CONTO_SANDBOX_EXPIRES_AT || project.sandbox?.expiresAt,
|
|
78
|
+
testnet: global.network?.testnet || project.network?.testnet || env.CONTO_CHAIN_ID === "42431"
|
|
61
79
|
};
|
|
62
80
|
}
|
|
63
81
|
function writeEnvLocal(dir, entries) {
|
|
@@ -75,13 +93,35 @@ function clearGlobalConfig() {
|
|
|
75
93
|
fs.unlinkSync(CONFIG_FILE);
|
|
76
94
|
}
|
|
77
95
|
}
|
|
96
|
+
function isSensitiveConfigKey(key) {
|
|
97
|
+
return SENSITIVE_CONFIG_KEY_PATTERN.test(key);
|
|
98
|
+
}
|
|
99
|
+
function maskSecret(value, visibleChars = DEFAULT_VISIBLE_SECRET_CHARS) {
|
|
100
|
+
if (!value) return "";
|
|
101
|
+
const prefixLength = Math.max(1, Math.min(visibleChars, value.length));
|
|
102
|
+
return `${value.slice(0, prefixLength)}...`;
|
|
103
|
+
}
|
|
104
|
+
function missingSdkKeyMessage(config) {
|
|
105
|
+
if (config.orgApiKey) {
|
|
106
|
+
return [
|
|
107
|
+
"Logged in with an organization key, but no agent SDK key is configured.",
|
|
108
|
+
'Run "npx create-conto-agent --api-key <org-api-key>" to create an agent,',
|
|
109
|
+
"or set CONTO_API_KEY to an existing conto_agent_ key."
|
|
110
|
+
].join(" ");
|
|
111
|
+
}
|
|
112
|
+
return 'Not configured. Run "npx create-conto-agent" first, or set CONTO_API_KEY.';
|
|
113
|
+
}
|
|
78
114
|
|
|
79
115
|
export {
|
|
80
116
|
loadGlobalConfig,
|
|
81
117
|
saveGlobalConfig,
|
|
82
118
|
loadProjectEnv,
|
|
119
|
+
loadProjectConfig,
|
|
83
120
|
loadConfig,
|
|
84
121
|
writeEnvLocal,
|
|
85
122
|
writeContoConfig,
|
|
86
|
-
clearGlobalConfig
|
|
123
|
+
clearGlobalConfig,
|
|
124
|
+
isSensitiveConfigKey,
|
|
125
|
+
maskSecret,
|
|
126
|
+
missingSdkKeyMessage
|
|
87
127
|
};
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
fetchChains,
|
|
6
6
|
getChain,
|
|
7
7
|
runInit
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QN5FG53Q.js";
|
|
9
9
|
import {
|
|
10
10
|
isJsonMode,
|
|
11
11
|
printAmount,
|
|
@@ -21,10 +21,13 @@ import {
|
|
|
21
21
|
truncateAddress
|
|
22
22
|
} from "./chunk-K4LBO234.js";
|
|
23
23
|
import {
|
|
24
|
+
isSensitiveConfigKey,
|
|
24
25
|
loadConfig,
|
|
25
26
|
loadGlobalConfig,
|
|
27
|
+
maskSecret,
|
|
28
|
+
missingSdkKeyMessage,
|
|
26
29
|
saveGlobalConfig
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WMVGNUSL.js";
|
|
28
31
|
|
|
29
32
|
// src/cli.ts
|
|
30
33
|
import { Command } from "commander";
|
|
@@ -33,7 +36,7 @@ import { Command } from "commander";
|
|
|
33
36
|
async function statusCommand() {
|
|
34
37
|
const config = loadConfig();
|
|
35
38
|
if (!config.apiKey) {
|
|
36
|
-
printError(
|
|
39
|
+
printError(missingSdkKeyMessage(config));
|
|
37
40
|
process.exit(1);
|
|
38
41
|
}
|
|
39
42
|
const api = createApiClient({
|
|
@@ -98,6 +101,7 @@ function mark(status) {
|
|
|
98
101
|
async function doctorCommand() {
|
|
99
102
|
const config = loadConfig();
|
|
100
103
|
const checks = [];
|
|
104
|
+
const isSimulatedSandbox = config.sandboxExecution === "simulated";
|
|
101
105
|
checks.push({
|
|
102
106
|
name: "Base URL",
|
|
103
107
|
status: "ok",
|
|
@@ -107,7 +111,7 @@ async function doctorCommand() {
|
|
|
107
111
|
checks.push({
|
|
108
112
|
name: "SDK key",
|
|
109
113
|
status: "fail",
|
|
110
|
-
detail:
|
|
114
|
+
detail: missingSdkKeyMessage(config)
|
|
111
115
|
});
|
|
112
116
|
report(checks, null);
|
|
113
117
|
process.exit(1);
|
|
@@ -115,7 +119,7 @@ async function doctorCommand() {
|
|
|
115
119
|
checks.push({
|
|
116
120
|
name: "SDK key",
|
|
117
121
|
status: "ok",
|
|
118
|
-
detail: `${config.apiKey
|
|
122
|
+
detail: `${maskSecret(config.apiKey)} (from ${process.env.CONTO_API_KEY ? "environment" : ".env.local or ~/.conto/config.json"})`
|
|
119
123
|
});
|
|
120
124
|
const api = createApiClient({ baseUrl: config.baseUrl, apiKey: config.apiKey });
|
|
121
125
|
let setup;
|
|
@@ -169,11 +173,11 @@ async function doctorCommand() {
|
|
|
169
173
|
status: w.status === "ACTIVE" ? "ok" : "warn",
|
|
170
174
|
detail: `${chainLabel}, ${w.custodyType} custody, status ${w.status}`
|
|
171
175
|
});
|
|
172
|
-
const executionMode = w.executionMode || (w.isExecutable ? "managed" : "manual");
|
|
176
|
+
const executionMode = isSimulatedSandbox ? "simulated" : w.executionMode || (w.isExecutable ? "managed" : "manual");
|
|
173
177
|
checks.push({
|
|
174
178
|
name: " Execution",
|
|
175
|
-
status: executionMode === "managed" ? "ok" : "warn",
|
|
176
|
-
detail: executionMode === "managed" ? "Managed by custody provider (real transfers)" : executionMode === "manual" ? "Manual: agent signs its own transactions, then confirms via API" : "
|
|
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."
|
|
177
181
|
});
|
|
178
182
|
checks.push({
|
|
179
183
|
name: " Balance",
|
|
@@ -190,10 +194,11 @@ async function doctorCommand() {
|
|
|
190
194
|
}
|
|
191
195
|
const caps = setup.capabilities;
|
|
192
196
|
if (caps) {
|
|
197
|
+
const sandboxCanExecute = isSimulatedSandbox && caps.canRequestPayments && canExecute;
|
|
193
198
|
checks.push({
|
|
194
199
|
name: "Payment readiness",
|
|
195
|
-
status: caps.canAutoExecute ? "ok" : caps.canRequestPayments ? "warn" : "fail",
|
|
196
|
-
detail: caps.canAutoExecute ? "Key and wallet can request and execute payments" : caps.canRequestPayments ? "Requests work; execution is limited (see checks above)" : "This key cannot request payments"
|
|
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"
|
|
197
202
|
});
|
|
198
203
|
}
|
|
199
204
|
report(checks, setup);
|
|
@@ -413,7 +418,7 @@ async function payCommand(address, amountStr, options) {
|
|
|
413
418
|
async function transactionsCommand(id, options) {
|
|
414
419
|
const config = loadConfig();
|
|
415
420
|
if (!config.apiKey) {
|
|
416
|
-
printError(
|
|
421
|
+
printError(missingSdkKeyMessage(config));
|
|
417
422
|
process.exit(1);
|
|
418
423
|
}
|
|
419
424
|
const api = createApiClient({
|
|
@@ -431,27 +436,28 @@ async function transactionsCommand(id, options) {
|
|
|
431
436
|
printKeyValue("ID", tx.id);
|
|
432
437
|
printKeyValue("TX Hash", tx.txHash);
|
|
433
438
|
printKeyValue("Status", tx.status);
|
|
434
|
-
printKeyValue("Amount", printAmount(tx.amount, tx.currency));
|
|
435
|
-
printKeyValue("Recipient", tx.
|
|
436
|
-
|
|
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);
|
|
437
442
|
if (tx.purpose) printKeyValue("Purpose", tx.purpose);
|
|
438
|
-
if (tx.
|
|
439
|
-
printKeyValue("
|
|
440
|
-
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());
|
|
441
446
|
if (tx.confirmedAt) printKeyValue("Confirmed", new Date(tx.confirmedAt).toLocaleString());
|
|
442
447
|
if (tx.alerts && tx.alerts.length > 0) {
|
|
443
448
|
printHeader("Alerts");
|
|
444
449
|
for (const a of tx.alerts) {
|
|
445
|
-
console.log(` [${a.
|
|
450
|
+
console.log(` [${a.alertType}] ${a.status}`);
|
|
446
451
|
}
|
|
447
452
|
}
|
|
448
453
|
} else {
|
|
449
|
-
const { transactions,
|
|
454
|
+
const { transactions, pagination } = await api.getTransactions({
|
|
450
455
|
limit: options?.limit ? Number(options.limit) : 10,
|
|
451
456
|
status: options?.status
|
|
452
457
|
});
|
|
458
|
+
const total = pagination?.total ?? transactions.length;
|
|
453
459
|
if (isJsonMode()) {
|
|
454
|
-
printJson({ transactions,
|
|
460
|
+
printJson({ transactions, pagination });
|
|
455
461
|
return;
|
|
456
462
|
}
|
|
457
463
|
if (transactions.length === 0) {
|
|
@@ -462,9 +468,9 @@ async function transactionsCommand(id, options) {
|
|
|
462
468
|
printTable(
|
|
463
469
|
["Date", "Amount", "Recipient", "Purpose", "Status", "TX Hash"],
|
|
464
470
|
transactions.map((tx) => [
|
|
465
|
-
new Date(tx.
|
|
466
|
-
printAmount(tx.amount, tx.currency),
|
|
467
|
-
tx.
|
|
471
|
+
new Date(tx.initiatedAt).toLocaleDateString(),
|
|
472
|
+
printAmount(Number(tx.amount), tx.currency),
|
|
473
|
+
tx.recipientAgent?.name || tx.merchantName || truncateAddress(tx.toAddress),
|
|
468
474
|
tx.purpose || "\u2014",
|
|
469
475
|
tx.status,
|
|
470
476
|
tx.txHash ? truncateAddress(tx.txHash, 8) : "\u2014"
|
|
@@ -485,15 +491,16 @@ async function transactionsCommand(id, options) {
|
|
|
485
491
|
|
|
486
492
|
// src/commands/wallets.ts
|
|
487
493
|
import chalk3 from "chalk";
|
|
488
|
-
async function walletsCommand(subcommand) {
|
|
494
|
+
async function walletsCommand(subcommand, options = {}) {
|
|
489
495
|
const config = loadConfig();
|
|
490
496
|
if (!config.apiKey) {
|
|
491
|
-
printError(
|
|
497
|
+
printError(missingSdkKeyMessage(config));
|
|
492
498
|
process.exit(1);
|
|
493
499
|
}
|
|
494
500
|
const api = createApiClient({
|
|
495
501
|
baseUrl: config.baseUrl,
|
|
496
|
-
apiKey: config.apiKey
|
|
502
|
+
apiKey: config.apiKey,
|
|
503
|
+
orgApiKey: config.orgApiKey
|
|
497
504
|
});
|
|
498
505
|
try {
|
|
499
506
|
await fetchChains(config.baseUrl);
|
|
@@ -525,6 +532,54 @@ async function walletsCommand(subcommand) {
|
|
|
525
532
|
printError("No wallets to fund.");
|
|
526
533
|
return;
|
|
527
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
|
+
}
|
|
528
583
|
for (const w of wallets) {
|
|
529
584
|
const chainEntry = getChain(w.chainId);
|
|
530
585
|
if (isJsonMode()) {
|
|
@@ -1283,7 +1338,7 @@ import chalk6 from "chalk";
|
|
|
1283
1338
|
async function alertsCommand(options = {}) {
|
|
1284
1339
|
const config = loadConfig();
|
|
1285
1340
|
if (!config.apiKey) {
|
|
1286
|
-
printError(
|
|
1341
|
+
printError(missingSdkKeyMessage(config));
|
|
1287
1342
|
process.exit(1);
|
|
1288
1343
|
}
|
|
1289
1344
|
const api = createApiClient({
|
|
@@ -1291,15 +1346,16 @@ async function alertsCommand(options = {}) {
|
|
|
1291
1346
|
apiKey: config.apiKey
|
|
1292
1347
|
});
|
|
1293
1348
|
try {
|
|
1349
|
+
const activeOnly = options.active || options.unread;
|
|
1294
1350
|
const { alerts } = await api.getAlerts({
|
|
1295
|
-
status:
|
|
1351
|
+
status: activeOnly ? "ACTIVE" : void 0
|
|
1296
1352
|
});
|
|
1297
1353
|
if (isJsonMode()) {
|
|
1298
1354
|
printJson(alerts);
|
|
1299
1355
|
return;
|
|
1300
1356
|
}
|
|
1301
1357
|
if (alerts.length === 0) {
|
|
1302
|
-
console.log("\n No alerts." + (
|
|
1358
|
+
console.log("\n No alerts." + (activeOnly ? " (showing active only)" : ""));
|
|
1303
1359
|
return;
|
|
1304
1360
|
}
|
|
1305
1361
|
printHeader(`Alerts (${alerts.length})`);
|
|
@@ -1308,7 +1364,7 @@ async function alertsCommand(options = {}) {
|
|
|
1308
1364
|
alerts.map((a) => [
|
|
1309
1365
|
new Date(a.createdAt).toLocaleDateString(),
|
|
1310
1366
|
severityColor(a.severity),
|
|
1311
|
-
a.
|
|
1367
|
+
a.alertType,
|
|
1312
1368
|
a.message.length > 50 ? a.message.slice(0, 50) + "..." : a.message,
|
|
1313
1369
|
a.status
|
|
1314
1370
|
])
|
|
@@ -1354,18 +1410,23 @@ async function configCommand(key, value) {
|
|
|
1354
1410
|
}
|
|
1355
1411
|
target[parts[parts.length - 1]] = value;
|
|
1356
1412
|
saveGlobalConfig(global);
|
|
1357
|
-
|
|
1413
|
+
const displayValue = isSensitiveConfigKey(key) ? maskSecret(value) : value;
|
|
1414
|
+
printSuccess(`Set ${key} = ${displayValue}`);
|
|
1358
1415
|
return;
|
|
1359
1416
|
}
|
|
1360
1417
|
const config = loadConfig();
|
|
1361
1418
|
if (isJsonMode()) {
|
|
1362
|
-
printJson(
|
|
1419
|
+
printJson({
|
|
1420
|
+
...config,
|
|
1421
|
+
apiKey: config.apiKey ? maskSecret(config.apiKey) : void 0,
|
|
1422
|
+
orgApiKey: config.orgApiKey ? maskSecret(config.orgApiKey) : void 0
|
|
1423
|
+
});
|
|
1363
1424
|
return;
|
|
1364
1425
|
}
|
|
1365
1426
|
printHeader("Configuration");
|
|
1366
1427
|
printKeyValue(
|
|
1367
1428
|
"API Key",
|
|
1368
|
-
config.apiKey ?
|
|
1429
|
+
config.apiKey ? maskSecret(config.apiKey) : chalk7.dim("not set")
|
|
1369
1430
|
);
|
|
1370
1431
|
printKeyValue("Base URL", config.baseUrl);
|
|
1371
1432
|
printKeyValue("Agent ID", config.agentId || chalk7.dim("not set"));
|
|
@@ -1413,7 +1474,7 @@ async function mcpCommand() {
|
|
|
1413
1474
|
process.exit(1);
|
|
1414
1475
|
}
|
|
1415
1476
|
console.error(`Starting Conto MCP server (${config.baseUrl})...`);
|
|
1416
|
-
console.error(`Using SDK key ${config.apiKey
|
|
1477
|
+
console.error(`Using SDK key ${maskSecret(config.apiKey)}.`);
|
|
1417
1478
|
console.error("Press Ctrl+C to stop.\n");
|
|
1418
1479
|
const isWindows = process.platform === "win32";
|
|
1419
1480
|
const child = spawn(isWindows ? "npx.cmd" : "npx", ["--yes", "@conto_finance/mcp-server"], {
|
|
@@ -1467,21 +1528,21 @@ program.command("balance").description("Wallet balances across all linked wallet
|
|
|
1467
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);
|
|
1468
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);
|
|
1469
1530
|
program.command("wallets").description("List wallets with balances").action(() => walletsCommand("list"));
|
|
1470
|
-
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 }));
|
|
1471
1532
|
program.command("policies [subcommand] [id] [extra]").description(
|
|
1472
1533
|
"Manage spending policies (list, all, create, update, delete, assign, unassign, add-rule, remove-rule)"
|
|
1473
1534
|
).action(
|
|
1474
1535
|
(subcommand, id, extra) => policiesCommand(subcommand || "list", id, extra)
|
|
1475
1536
|
);
|
|
1476
1537
|
program.command("limits").description("Show spending limits and remaining budget").action(limitsCommand);
|
|
1477
|
-
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);
|
|
1478
1539
|
program.command("config [key] [value]").description("Show or update configuration").action(configCommand);
|
|
1479
1540
|
program.command("login").description("Authenticate with Conto").option("--base-url <url>", "Conto instance URL").action(loginCommand);
|
|
1480
1541
|
program.command("logout").description("Clear stored credentials").action(async () => {
|
|
1481
|
-
const { clearGlobalConfig } = await import("./config-
|
|
1542
|
+
const { clearGlobalConfig } = await import("./config-RZBPNEBZ.js");
|
|
1482
1543
|
clearGlobalConfig();
|
|
1483
|
-
const { printSuccess:
|
|
1484
|
-
|
|
1544
|
+
const { printSuccess: printSuccess2 } = await import("./output-IN47X4NU.js");
|
|
1545
|
+
printSuccess2("Logged out. Credentials cleared.");
|
|
1485
1546
|
});
|
|
1486
1547
|
program.command("mcp").description("Start MCP server for AI agent integration").action(mcpCommand);
|
|
1487
1548
|
program.command("docs [topic]").description("Open Conto documentation (cli, policies, sdk, api)").action(async (topic) => {
|
|
@@ -1494,8 +1555,8 @@ program.command("docs [topic]").description("Open Conto documentation (cli, poli
|
|
|
1494
1555
|
api: "https://conto.finance/docs/api"
|
|
1495
1556
|
};
|
|
1496
1557
|
const url = urls[topic || "cli"] || urls.cli;
|
|
1497
|
-
const { printInfo:
|
|
1498
|
-
|
|
1558
|
+
const { printInfo: printInfo2 } = await import("./output-IN47X4NU.js");
|
|
1559
|
+
printInfo2(`Opening ${url}`);
|
|
1499
1560
|
open(url);
|
|
1500
1561
|
});
|
|
1501
1562
|
program.parse();
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearGlobalConfig,
|
|
3
|
+
isSensitiveConfigKey,
|
|
3
4
|
loadConfig,
|
|
4
5
|
loadGlobalConfig,
|
|
6
|
+
loadProjectConfig,
|
|
5
7
|
loadProjectEnv,
|
|
8
|
+
maskSecret,
|
|
9
|
+
missingSdkKeyMessage,
|
|
6
10
|
saveGlobalConfig,
|
|
7
11
|
writeContoConfig,
|
|
8
12
|
writeEnvLocal
|
|
9
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WMVGNUSL.js";
|
|
10
14
|
export {
|
|
11
15
|
clearGlobalConfig,
|
|
16
|
+
isSensitiveConfigKey,
|
|
12
17
|
loadConfig,
|
|
13
18
|
loadGlobalConfig,
|
|
19
|
+
loadProjectConfig,
|
|
14
20
|
loadProjectEnv,
|
|
21
|
+
maskSecret,
|
|
22
|
+
missingSdkKeyMessage,
|
|
15
23
|
saveGlobalConfig,
|
|
16
24
|
writeContoConfig,
|
|
17
25
|
writeEnvLocal
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runInit
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QN5FG53Q.js";
|
|
4
4
|
import {
|
|
5
5
|
setJsonMode
|
|
6
6
|
} from "./chunk-K4LBO234.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-WMVGNUSL.js";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
var CLI_COMMANDS = /* @__PURE__ */ new Set([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conto_finance/create-conto-agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "CLI quickstart for Conto — Agentic Payments Control Center",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-conto-agent": "bin/create-conto-agent.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"test": "npm run build && node --test test/*.test.mjs"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": ">=
|
|
22
|
+
"node": ">=20.19.0"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
25
25
|
"conto",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"esbuild": "0.28.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@types/node": "
|
|
56
|
+
"@types/node": "22.19.18",
|
|
57
57
|
"tsup": "^8.5.1",
|
|
58
58
|
"typescript": "^5.9.3"
|
|
59
59
|
}
|