@conto_finance/create-conto-agent 0.5.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ - `conto spending export` downloads the organization's spend as CSV, up to 20,000 rows, to stdout or
6
+ to a new private file with `--output`. It never overwrites a file. `--format json --limit 500`
7
+ returns one page and `nextCursor`, and `--cursor` with the same `--from` and `--to` gets the next.
8
+ It uses the configured organization API key, which needs `transactions:read`.
9
+ - `conto policies create` and `conto policies add-rule` save a budget cap as an amount and a period, such as
10
+ `{"amount":500,"period":"MONTHLY"}`. Earlier versions saved a bare number, which the server
11
+ cannot read as a budget, so the rule denied every payment its policy covered. The date range
12
+ example now starts today instead of showing a range that has already ended.
13
+
14
+ ## 0.5.1
15
+
16
+ - `conto pay` no longer invites a second payment after a failed call. Every run sends an idempotency
17
+ key and prints it, and prints the request ID before sending. A timeout, dropped connection,
18
+ non-JSON response, or server error now exits 6 with "outcome unknown" and the command to check the
19
+ payment. Retrying with `--idempotency-key <key>` returns the same request. Payment calls also
20
+ refuse redirects, so the SDK key never follows one.
21
+ - `conto pay status <requestId>` now works for a payment that needed no approval. It reports the
22
+ stored status and sends nothing. Earlier versions failed with "This payment does not need approval."
23
+ - `init` keeps other lines and comments in an existing `.env.local` and replaces only its `CONTO_*`
24
+ keys. It asks before replacing an existing `conto.config.json` or `example.mjs`. A headless run
25
+ keeps them and lists them under `keptFiles`, and `--overwrite` replaces them.
26
+ - `conto limits` shows no limit as `unlimited` instead of $0, and `--json` emits `null` for it.
27
+ Weekly and monthly are always present in `--json` now.
28
+ - `conto login` to a different server removes the agent key and the agent, wallet, and network
29
+ details saved for the old one, so that key is never sent to the new server. It also prints the
30
+ login link in case the browser does not open.
31
+ - Empty table cells and missing values print `-` instead of an em dash, and chain labels read
32
+ "Testnet: free pathUSD, no real funds" instead of using a dash.
33
+ - `conto channels add --type webhook --json` no longer prints a signing secret taken from
34
+ `CONTO_WEBHOOK_SECRET`. Earlier versions printed it to stdout, so rotate it if that output was
35
+ logged. A generated secret is still shown once.
36
+ - Credentials in a base URL, such as `https://user:password@host`, are dropped when the config loads,
37
+ so `conto config`, `conto status`, and error messages no longer print them.
38
+
3
39
  ## 0.5.0
4
40
 
5
41
  - `conto pay` handles payments that need approval. It prints the review link, opens it in a
package/README.md CHANGED
@@ -47,6 +47,15 @@ This sends one synthetic signed event to a loopback address. It creates no payme
47
47
  locally and prints the request it would send. It contacts nothing and does not evaluate policy. Use
48
48
  `npx @conto_finance/create-conto-agent limits` to see current limits.
49
49
 
50
+ Every `pay` run prints an idempotency key and, before sending, the request ID. Exit code 6 means the
51
+ outcome is unknown and the payment may have gone through. Do not run the same command again, because
52
+ that starts a new payment. Run `pay status <requestId>`, or, with no request ID yet, retry with
53
+ `--idempotency-key <key>`.
54
+
55
+ Setup keeps the other lines in an existing `.env.local` and replaces only its `CONTO_*` keys. It asks
56
+ before replacing an existing `conto.config.json` or `example.mjs`. A headless run keeps them unless
57
+ you pass `--overwrite`.
58
+
50
59
  ## Hand a sandbox to its owner
51
60
 
52
61
  ```bash
@@ -107,6 +116,18 @@ new setup. Resources the old setup created stay in the organization.
107
116
  | 3 | Partial setup, run the resume command |
108
117
  | 4 | Reconciliation or owner action needed first, see the output |
109
118
 
119
+ ## Accounting export
120
+
121
+ `conto spending export` downloads organization-wide accounting CSV using your configured
122
+ organization API key (`transactions:read`). Set the range with `--from` and `--to` ISO timestamps.
123
+ `--from` is included and `--to` is not. Use `--output spend.csv` to save a new private file without
124
+ overwriting an existing file. Without `--output`, the export goes to stdout.
125
+
126
+ `conto spending export --format json --limit 500` returns one page and `nextCursor`.
127
+ Pass `--cursor` with the same date bounds for the next page. CSV is limited to 20,000 rows and a
128
+ JSON page to 1,000. Categories are applied at export time. The nullable `receiptPath` links to an
129
+ authenticated Conto transaction receipt, not a merchant invoice.
130
+
110
131
  ## Documentation
111
132
 
112
133
  - [CLI quickstart](https://conto.finance/docs/cli/quickstart)
@@ -30,6 +30,25 @@ function buildVelocityCountValue(input, period) {
30
30
  }
31
31
  return { ok: true, value: JSON.stringify({ maxCount: count, period: normalizedPeriod }) };
32
32
  }
33
+ var BUDGET_PERIODS = ["DAILY", "WEEKLY", "MONTHLY", "QUARTERLY", "YEARLY"];
34
+ function buildBudgetCapValue(input, period) {
35
+ const trimmed = input.trim();
36
+ const amount = Number(trimmed);
37
+ if (trimmed === "" || !Number.isFinite(amount) || amount <= 0) {
38
+ return { ok: false, error: "Budget amount must be a number greater than 0." };
39
+ }
40
+ const normalizedPeriod = period.toUpperCase();
41
+ if (!BUDGET_PERIODS.includes(normalizedPeriod)) {
42
+ return { ok: false, error: `Period must be one of ${BUDGET_PERIODS.join(", ")}.` };
43
+ }
44
+ return { ok: true, value: JSON.stringify({ amount, period: normalizedPeriod }) };
45
+ }
46
+ function dateRangePlaceholder(now = /* @__PURE__ */ new Date()) {
47
+ const start = now.toISOString().slice(0, 10);
48
+ const end = new Date(now);
49
+ end.setUTCFullYear(end.getUTCFullYear() + 1);
50
+ return JSON.stringify({ start, end: end.toISOString().slice(0, 10) });
51
+ }
33
52
  var EVM_ADDRESS = /^0x[a-fA-F0-9]{40}$/;
34
53
  var SOLANA_ADDRESS = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
35
54
  var MAX_PAYMENT_AMOUNT = 1e9;
@@ -72,5 +91,8 @@ export {
72
91
  parseTrustScoreInput,
73
92
  VELOCITY_PERIODS,
74
93
  buildVelocityCountValue,
94
+ BUDGET_PERIODS,
95
+ buildBudgetCapValue,
96
+ dateRangePlaceholder,
75
97
  validatePaymentRequest
76
98
  };
@@ -38,7 +38,7 @@ function printPending(text) {
38
38
  }
39
39
  function printKeyValue(key, value) {
40
40
  if (jsonMode) return;
41
- console.log(` ${chalk.dim(key + ":")} ${value ?? chalk.dim("\u2014")}`);
41
+ console.log(` ${chalk.dim(key + ":")} ${value ?? chalk.dim("-")}`);
42
42
  }
43
43
  function printTable(headers, rows, options) {
44
44
  if (jsonMode) return;