@conto_finance/create-conto-agent 0.4.5 → 0.4.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.7
4
+
5
+ - Add `conto test-report` to export allowed, denied, and optional human-review payment evidence without executing a payment. Reports use owner-only files, refuse overwrites, and distinguish payment completion, control verification, audit evidence, and saving. Incomplete evidence exits with status 2.
6
+
7
+ ## 0.4.6
8
+
9
+ - Generated starters support `--status REQUEST_ID` and `--resume REQUEST_ID`, so continuing after owner approval uses the existing request instead of creating another payment.
10
+
3
11
  ## 0.4.5
4
12
 
5
13
  - `sandbox claim` and `sandbox claim-status` hand an anonymous sandbox to its owner through the
@@ -20,7 +20,7 @@ import {
20
20
  // package.json
21
21
  var package_default = {
22
22
  name: "@conto_finance/create-conto-agent",
23
- version: "0.4.5",
23
+ version: "0.4.7",
24
24
  description: "Set up an AI agent with Conto spending controls",
25
25
  bin: {
26
26
  "create-conto-agent": "bin/create-conto-agent.js",
@@ -71,19 +71,19 @@ var package_default = {
71
71
  email: "support@conto.finance"
72
72
  },
73
73
  dependencies: {
74
- "@clack/prompts": "^0.9.1",
74
+ "@clack/prompts": "^1.8.1",
75
75
  chalk: "^5.4.1",
76
76
  "cli-table3": "^0.6.5",
77
77
  commander: "^13.1.0",
78
- open: "^10.1.0"
78
+ open: "^11.0.4"
79
79
  },
80
80
  overrides: {
81
81
  esbuild: "0.28.1"
82
82
  },
83
83
  devDependencies: {
84
- "@types/node": "22.19.18",
85
- tsup: "^8.5.1",
86
- typescript: "^5.9.3"
84
+ "@types/node": "26.6.5",
85
+ tsup: "^9.0.0",
86
+ typescript: "^6.0.3"
87
87
  }
88
88
  };
89
89
 
@@ -1731,7 +1731,7 @@ async function runOrganizationInit(options) {
1731
1731
  const agentName = options.name || resumed?.agentName || (interactive ? await p.text({
1732
1732
  message: "Agent name",
1733
1733
  placeholder: "my-procurement-bot",
1734
- validate: (v) => v.length < 2 ? "Name must be at least 2 characters" : void 0
1734
+ validate: (v) => (v ?? "").length < 2 ? "Name must be at least 2 characters" : void 0
1735
1735
  }) : HEADLESS_DEFAULT_NAME);
1736
1736
  if (p.isCancel(agentName)) {
1737
1737
  p.cancel("Setup cancelled.");
@@ -2322,7 +2322,7 @@ async function runSandboxInit(options) {
2322
2322
  },
2323
2323
  nextSteps: [
2324
2324
  "node example.mjs",
2325
- "node example.mjs --execute",
2325
+ "node example.mjs --resume REQUEST_ID",
2326
2326
  `${cli} doctor`,
2327
2327
  `${cli} pay 0x742d35Cc6634C0532925a3b844Bc454e4438f44e 1 --purpose test`,
2328
2328
  `${cli} sandbox claim --json`
@@ -2354,7 +2354,8 @@ async function runSandboxInit(options) {
2354
2354
  console.log("");
2355
2355
  console.log(chalk.bold(" Next steps:"));
2356
2356
  console.log(` 1. Run the example: ${chalk.cyan("node example.mjs")}`);
2357
- console.log(` 2. Execute it: ${chalk.cyan("node example.mjs --execute")}`);
2357
+ console.log(` 2. Continue it: ${chalk.cyan("node example.mjs --resume REQUEST_ID")}`);
2358
+ console.log(" Replace REQUEST_ID with the ID printed by the example.");
2358
2359
  console.log(` 3. Verify setup: ${chalk.cyan(`${cli} doctor`)}`);
2359
2360
  console.log("");
2360
2361
  printInfo(
@@ -2412,7 +2413,9 @@ function writeExampleFile(dir) {
2412
2413
  //
2413
2414
  // Usage:
2414
2415
  // node example.mjs Check setup and request a test payment (no funds move)
2415
- // node example.mjs --execute Also execute the payment if it is approved
2416
+ // node example.mjs --execute Start a new payment and execute it if approved
2417
+ // node example.mjs --resume REQUEST_ID Check and continue the same request
2418
+ // node example.mjs --status REQUEST_ID Read status without executing
2416
2419
  //
2417
2420
  // Reads CONTO_API_KEY and CONTO_BASE_URL from .env.local in this directory.
2418
2421
  // Docs: https://conto.finance/docs
@@ -2451,6 +2454,22 @@ async function api(method, path, body) {
2451
2454
  }
2452
2455
 
2453
2456
  async function main() {
2457
+ const resumeIndex = process.argv.indexOf('--resume');
2458
+ const statusIndex = process.argv.indexOf('--status');
2459
+ if (resumeIndex >= 0 || statusIndex >= 0) {
2460
+ const requestId = process.argv[(resumeIndex >= 0 ? resumeIndex : statusIndex) + 1];
2461
+ if (!requestId || !/^[a-zA-Z0-9_-]+$/.test(requestId)) {
2462
+ throw new Error('Supply the saved request ID after --resume or --status.');
2463
+ }
2464
+ lastRequestId = requestId;
2465
+ const current = await api('GET', '/api/sdk/payments/' + requestId);
2466
+ console.log(JSON.stringify(current, null, 2));
2467
+ // Approval may already have executed it. Never create another request here.
2468
+ if (resumeIndex >= 0 && current.status === 'approved') {
2469
+ console.log(JSON.stringify(await api('POST', '/api/sdk/payments/' + requestId + '/execute'), null, 2));
2470
+ }
2471
+ return;
2472
+ }
2454
2473
  // 1. Setup snapshot: agent, key scopes, wallets. Same data as "conto doctor".
2455
2474
  const setup = await api('GET', '/api/sdk/setup');
2456
2475
  console.log(\`Agent: \${setup.agent.name} (\${setup.agent.status})\`);
@@ -2493,7 +2512,7 @@ async function main() {
2493
2512
  return;
2494
2513
  }
2495
2514
  if (request.status === 'REQUIRES_APPROVAL') {
2496
- console.log('Approve it in the Conto dashboard, then execute it from there or via the API.');
2515
+ console.log('Ask the owner to review it in Conto. Then run: node example.mjs --resume ' + lastRequestId);
2497
2516
  return;
2498
2517
  }
2499
2518
  if (request.status !== 'APPROVED') {
@@ -2505,7 +2524,8 @@ async function main() {
2505
2524
  // quickstart includes the payments:execute scope.
2506
2525
  if (!EXECUTE) {
2507
2526
  console.log(\`\\nApproved (request \${request.requestId}). No funds moved.\`);
2508
- console.log('Re-run with --execute to send it, or use: npx @conto_finance/create-conto-agent pay <address> <amount>');
2527
+ console.log('Continue this same request: node example.mjs --resume ' + lastRequestId);
2528
+ console.log('Each run without --resume creates a new payment intent.');
2509
2529
  return;
2510
2530
  }
2511
2531
  const result = await api('POST', \`/api/sdk/payments/\${request.requestId}/execute\`);
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { };
package/dist/cli.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  retryAfterSeconds,
18
18
  runInit,
19
19
  writeProjectStateFile
20
- } from "./chunk-TBAJKVGC.js";
20
+ } from "./chunk-HSJDGYZ5.js";
21
21
  import {
22
22
  VELOCITY_PERIODS,
23
23
  buildVelocityCountValue,
@@ -53,6 +53,9 @@ import {
53
53
  // src/cli.ts
54
54
  import { Command } from "commander";
55
55
 
56
+ // src/commands/test-report.ts
57
+ import fs from "fs";
58
+
56
59
  // src/lib/api-client.ts
57
60
  var REQUEST_TIMEOUT_MS = 3e4;
58
61
  function assertSecureBaseUrl(baseUrl) {
@@ -128,6 +131,12 @@ var ApiClient = class {
128
131
  clearTimeout(timeoutId);
129
132
  }
130
133
  }
134
+ async getTestReport(options) {
135
+ const query = new URLSearchParams({ allowed: options.allowed, denied: options.denied });
136
+ if (options.review) query.set("review", options.review);
137
+ if (options.reviewOutcome) query.set("reviewOutcome", options.reviewOutcome);
138
+ return this.request("GET", `/api/sdk/test-report?${query}`);
139
+ }
131
140
  // ── Org-level Admin APIs (used during init) ──
132
141
  async createWallet(params) {
133
142
  return this.request("POST", "/api/wallets", { body: params, auth: "org" });
@@ -277,6 +286,44 @@ function createApiClient(options) {
277
286
  return new ApiClient(options);
278
287
  }
279
288
 
289
+ // src/commands/test-report.ts
290
+ async function testReportCommand(options) {
291
+ try {
292
+ const config = loadConfig();
293
+ if (!config.apiKey) throw new Error(missingSdkKeyMessage(config));
294
+ const report = await createApiClient({
295
+ baseUrl: config.baseUrl,
296
+ apiKey: config.apiKey
297
+ }).getTestReport(options);
298
+ const fd = fs.openSync(options.output, "wx", 384);
299
+ try {
300
+ fs.writeFileSync(
301
+ fd,
302
+ JSON.stringify(
303
+ { ...report, milestones: { ...report.milestones, savedForReview: true } },
304
+ null,
305
+ 2
306
+ ) + "\n"
307
+ );
308
+ } catch (error) {
309
+ fs.closeSync(fd);
310
+ fs.unlinkSync(options.output);
311
+ throw error;
312
+ }
313
+ fs.closeSync(fd);
314
+ printJson({
315
+ savedTo: options.output,
316
+ milestones: { ...report.milestones, savedForReview: true },
317
+ reviewCoverage: report.reviewCoverage
318
+ });
319
+ if (!report.milestones.controlsVerified || !report.milestones.evidencePrepared)
320
+ process.exitCode = 2;
321
+ } catch (error) {
322
+ printError(error instanceof Error ? error.message : "Could not save the test report.");
323
+ process.exitCode = 1;
324
+ }
325
+ }
326
+
280
327
  // src/commands/status.ts
281
328
  async function statusCommand() {
282
329
  const config = loadConfig();
@@ -1891,7 +1938,7 @@ async function promptForRule(policyType) {
1891
1938
  message: "Max transactions in that window",
1892
1939
  placeholder: "5",
1893
1940
  validate: (v) => {
1894
- const result = buildVelocityCountValue(v, period);
1941
+ const result = buildVelocityCountValue(v ?? "", period);
1895
1942
  return result.ok ? void 0 : result.error;
1896
1943
  }
1897
1944
  });
@@ -1932,7 +1979,7 @@ async function promptForRule(policyType) {
1932
1979
  message: `Value: ${valueHint}`,
1933
1980
  placeholder,
1934
1981
  validate: ruleStr === "TRUST_SCORE" ? (v) => {
1935
- const result = parseTrustScoreInput(v);
1982
+ const result = parseTrustScoreInput(v ?? "");
1936
1983
  return result.ok ? void 0 : result.error;
1937
1984
  } : void 0
1938
1985
  });
@@ -2348,7 +2395,7 @@ async function testWebhook(url) {
2348
2395
  }
2349
2396
 
2350
2397
  // src/commands/sandbox.ts
2351
- import fs from "fs";
2398
+ import fs2 from "fs";
2352
2399
  import path from "path";
2353
2400
  import { setTimeout as sleep } from "timers/promises";
2354
2401
  import chalk8 from "chalk";
@@ -2612,7 +2659,7 @@ var TEST_MODE_AFTER_CLAIM = {
2612
2659
  credentialsPromoted: false
2613
2660
  };
2614
2661
  function cliPrefix() {
2615
- return fs.existsSync(path.join(process.cwd(), "node_modules", ".bin", "conto")) ? "npx conto" : "npx @conto_finance/create-conto-agent";
2662
+ return fs2.existsSync(path.join(process.cwd(), "node_modules", ".bin", "conto")) ? "npx conto" : "npx @conto_finance/create-conto-agent";
2616
2663
  }
2617
2664
  function emit(report) {
2618
2665
  if (isJsonMode()) {
@@ -2737,7 +2784,7 @@ function markExpired(cwd, state) {
2737
2784
  return expired;
2738
2785
  }
2739
2786
  function claimedReport(command, state, extra = {}) {
2740
- const setupKeyFileExists = fs.existsSync(path.join(process.cwd(), SANDBOX_SETUP_ENV_FILE));
2787
+ const setupKeyFileExists = fs2.existsSync(path.join(process.cwd(), SANDBOX_SETUP_ENV_FILE));
2741
2788
  return {
2742
2789
  command,
2743
2790
  status: "claimed",
@@ -3362,6 +3409,7 @@ program.command("status").description("Agent info, wallet balances, spending sum
3362
3409
  program.command("doctor").description("Diagnose setup: auth, key scopes, wallet, chain, balance, base URL").action(doctorCommand);
3363
3410
  program.command("balance").description("Wallet balances across all linked wallets").action(balanceCommand);
3364
3411
  program.command("pay <address> <amount>").description("Request + execute a payment").option("--purpose <purpose>", "Payment purpose").option("--category <category>", "Spend category").option("--dry-run", "Validate input and show the request without sending it (no policy check)").option("--wallet <walletId>", "Specific wallet to use").action(payCommand);
3412
+ program.command("test-report").description("Save buyer-side payment, control, and review evidence without executing payments").requiredOption("--allowed <id>", "Completed allowed payment request ID").requiredOption("--denied <id>", "Policy-denied payment request ID").option("--review <id>", "Review exercise payment request ID").option("--review-outcome <outcome>", "Expected review outcome: approved, denied, or expired").requiredOption("--output <file>", "New owner-only JSON report file (never overwritten)").action(testReportCommand);
3365
3413
  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);
3366
3414
  program.command("wallets").description("List wallets with balances").action(() => walletsCommand("list"));
3367
3415
  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 }));
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runInit
3
- } from "./chunk-TBAJKVGC.js";
3
+ } from "./chunk-HSJDGYZ5.js";
4
4
  import {
5
5
  isJsonMode,
6
6
  printJson,
@@ -49,4 +49,5 @@ declare function validatePaymentRequest(input: {
49
49
  walletId?: string;
50
50
  }): PaymentValidation;
51
51
 
52
- export { type PaymentRequestBody, type PaymentValidation, VELOCITY_PERIODS, type ValidationResult, type VelocityPeriod, buildVelocityCountValue, parseTrustScoreInput, validatePaymentRequest };
52
+ export { VELOCITY_PERIODS, buildVelocityCountValue, parseTrustScoreInput, validatePaymentRequest };
53
+ export type { PaymentRequestBody, PaymentValidation, ValidationResult, VelocityPeriod };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conto_finance/create-conto-agent",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Set up an AI agent with Conto spending controls",
5
5
  "bin": {
6
6
  "create-conto-agent": "bin/create-conto-agent.js",
@@ -51,18 +51,18 @@
51
51
  "email": "support@conto.finance"
52
52
  },
53
53
  "dependencies": {
54
- "@clack/prompts": "^0.9.1",
54
+ "@clack/prompts": "^1.8.1",
55
55
  "chalk": "^5.4.1",
56
56
  "cli-table3": "^0.6.5",
57
57
  "commander": "^13.1.0",
58
- "open": "^10.1.0"
58
+ "open": "^11.0.4"
59
59
  },
60
60
  "overrides": {
61
61
  "esbuild": "0.28.1"
62
62
  },
63
63
  "devDependencies": {
64
- "@types/node": "22.19.18",
65
- "tsup": "^8.5.1",
66
- "typescript": "^5.9.3"
64
+ "@types/node": "26.6.5",
65
+ "tsup": "^9.0.0",
66
+ "typescript": "^6.0.3"
67
67
  }
68
68
  }