taximeter 0.1.1 → 0.2.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,19 @@
1
1
  # Taximeter
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Default to rejecting parsed payments for unknown assets. Set `policy.unknownAsset` to `allow` to opt in and configure exact contract-address budgets for custom tokens.
8
+
9
+ Replace full ledger replay during payment gating with transactional, rebuildable payment projections and exact timestamp-indexed budget sums. Preserve append-only source records, retry and settlement semantics, and precise rolling-window boundaries. Existing databases migrate to schema version 2 when opened; older 0.1.x clients cannot reopen the migrated schema.
10
+
11
+ ## 0.1.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Exclude development specifications, verification transcripts, design decisions, contribution files, and recording sources from the npm package. Keep the CLI, SDK, dashboard, usage documentation, demo image, license, security guidance, changelog, and example configuration. Link to repository-only documentation from packaged guides.
16
+
3
17
  ## 0.1.1
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -16,7 +16,8 @@ from source with the quickstart below. Requires Node 20 or newer.
16
16
 
17
17
  This local recording shows 20 payments passing and payment 21 being blocked at
18
18
  an exact total of 140 atomic units. It uses synthetic x402 envelopes and never
19
- moves money. [Record the demo](docs/RECORDING.md) with the included simulation.
19
+ moves money. [Record the demo](https://github.com/Ding808/taximeter/blob/main/docs/RECORDING.md)
20
+ with the simulation in the source checkout.
20
21
 
21
22
  ## Why
22
23
 
@@ -50,7 +51,7 @@ Open a terminal in this source checkout, with Node 20+ and npm installed.
50
51
  You should now see:
51
52
 
52
53
  ```text
53
- Taximeter 0.1.1
54
+ Taximeter 0.2.0
54
55
  Proxy: http://127.0.0.1:8402
55
56
  Dashboard: http://127.0.0.1:8403
56
57
  Point an HTTP-proxy-aware agent at http://127.0.0.1:8402.
@@ -60,7 +61,7 @@ HTTPS CONNECT is unmetered; use --upstream or withMeter for HTTPS payments.
60
61
  Open [the local dashboard](http://127.0.0.1:8403). It explains how to connect an
61
62
  agent before the first payment arrives. Stop the process with Ctrl+C.
62
63
  The prebuilt npm package starts directly; installing it does not build the frontend.
63
- Dependency download time depends on the connection. See [measured verification](VERIFICATION.md).
64
+ Dependency download time depends on the connection.
64
65
 
65
66
  Choose the connection mode your agent supports:
66
67
 
@@ -115,6 +116,8 @@ their amount before forwarding the payment replay.
115
116
  Policy evaluation and reservation share one SQLite transaction, so concurrent
116
117
  payments cannot all consume the same remaining capacity.
117
118
  Append-only payment, outcome, and diagnostic records derive every total with BigInt.
119
+ Payment checks use an incrementally maintained index of exact budget sums, avoiding
120
+ a replay of all prior payments. The index can be rebuilt from the original log.
118
121
  The local dashboard polls that ledger every second and exports the same counted amounts.
119
122
 
120
123
  An initial 402 challenge is an offer, not spend. Reported settlement counts as
@@ -126,7 +129,8 @@ Repeated EIP-3009 authorizations count once across retries, using network, contr
126
129
  payer, nonce, amount, recipient, and validity bounds. Conflicting authorization
127
130
  details receive separate reservations. Each unresolved forwarding attempt keeps
128
131
  capacity reserved; an old unconfirmed retry must reacquire capacity in the current
129
- window. [Protocol notes](SPEC-NOTES.md) explain these rules and the supported subset.
132
+ window. [Protocol notes](https://github.com/Ding808/taximeter/blob/main/SPEC-NOTES.md)
133
+ explain these rules and the supported subset.
130
134
 
131
135
  CSV `amount` is the counted contribution, including zero for blocked/known failed
132
136
  rows. `authorizedAmount` retains the original amount. Sum `amount` with BigInt
@@ -136,6 +140,11 @@ as text to prevent a spreadsheet application from rounding them.
136
140
 
137
141
  ## Configuration
138
142
 
143
+ When upgrading from 0.1.x, upgrade all writers together. Opening an existing
144
+ ledger builds the new budget index once and upgrades its schema; the source log
145
+ is preserved. Older 0.1.x clients cannot reopen that migrated database. Parsed
146
+ unknown assets now require an explicit opt-in as described below.
147
+
139
148
  No file is required. Start from [the example](taximeter.config.example.json) when
140
149
  needed. Precedence, highest first: flags, environment, explicit `--config` file,
141
150
  `taximeter.config.json` in the working directory, `~/.taximeter/config.json`, defaults.
@@ -156,6 +165,7 @@ invalid values are rejected with Zod.
156
165
  | `policy.allowPayTo` | `[]` | Empty allows all recipients; otherwise exact case-insensitive addresses. |
157
166
  | `policy.maxSinglePayment` | `"1000000"` | One USDC per authorization by default; `null` disables the cap. |
158
167
  | `policy.maxSingleAsset` | `USDC` | Asset to which the single-payment cap applies. |
168
+ | `policy.unknownAsset` | `"deny"` | `deny` blocks parsed payments whose network and contract are absent from the offline asset registry; `allow` opts in to those assets. |
159
169
  | `ports.proxy` | `8402` | Loopback HTTP listener; `0` selects an available port. |
160
170
  | `ports.dashboard` | `8403` | Loopback dashboard listener; `0` selects an available port. |
161
171
  | `db` | `~/.taximeter/ledger.db` | SQLite path; relative paths resolve against the working directory. |
@@ -166,9 +176,16 @@ All commands accept `--db` and `--config`. Start also accepts `--proxy-port`,
166
176
  `TAXIMETER_PORT`, and `TAXIMETER_DASHBOARD_PORT`.
167
177
 
168
178
  Missing task/agent labels share an **Unattributed** bucket. Supply `Taximeter-Task`
169
- and `Taximeter-Agent` headers, or SDK options. The local USDC registry recognizes
170
- Base and Base Sepolia; other contracts remain separate atomic-unit balances with
171
- unknown decimals. Default USDC budgets do not cap unknown assets.
179
+ and `Taximeter-Agent` headers, or SDK options. The offline asset registry recognizes
180
+ USDC by its network and contract on Base and Base Sepolia. Parsed payments for
181
+ other assets are denied by default with `unknown_asset`; supplied symbols or
182
+ decimal metadata cannot make a token known. Unsupported or unparseable payment
183
+ formats still pass through with a diagnostic.
184
+
185
+ Custom-token budgets require `policy.unknownAsset: "allow"`. This opts in to parsed
186
+ unknown assets, which remain separate atomic-unit balances with unknown decimals.
187
+ Configure budgets using the exact contract address and, when needed, its network.
188
+ Default USDC budgets do not cap these assets; only matching budgets and caps apply.
172
189
 
173
190
  A denied replay receives HTTP 402 before it reaches the upstream. For a cap of
174
191
  140 atomic units already fully consumed, the response is:
@@ -183,9 +200,10 @@ A denied replay receives HTTP 402 before it reaches the upstream. For a cap of
183
200
  }
184
201
  ```
185
202
 
186
- Reasons are `host_denied`, `host_not_allowed`, `recipient_not_allowed`,
203
+ Reasons are `host_denied`, `host_not_allowed`, `recipient_not_allowed`, `unknown_asset`,
187
204
  `max_single_payment`, `per_task_budget`, `per_agent_budget`, and `global_budget`.
188
- Host/recipient denials have `budget: null` and `remaining: null`.
205
+ Host, recipient, and unknown-asset denials have `budget: null`, `spent: "0"`, and
206
+ `remaining: null`.
189
207
 
190
208
  ## What this is not
191
209
 
@@ -201,6 +219,6 @@ to report a problem.
201
219
 
202
220
  ## Contributing / license
203
221
 
204
- Read [CONTRIBUTING.md](CONTRIBUTING.md), [the decisions](DECISIONS.md), and
205
- [the specification](SPEC.md). Test and release evidence is in [VERIFICATION.md](VERIFICATION.md).
222
+ See the [contribution guide](https://github.com/Ding808/taximeter/blob/main/CONTRIBUTING.md)
223
+ for development instructions, design documents, and verification evidence.
206
224
  Licensed under [MIT](LICENSE).
package/SECURITY.md CHANGED
@@ -7,7 +7,7 @@ on-chain settlement.
7
7
 
8
8
  ## Supported version
9
9
 
10
- Security fixes currently target the `0.1.0` release line. No older release line
10
+ Security fixes currently target the `0.2.x` release line. No older release line
11
11
  is maintained. This policy describes support; it is not a claim that the package
12
12
  has already been published or independently audited.
13
13
 
@@ -31,7 +31,10 @@ against a hostile agent or another process running as the same user.
31
31
 
32
32
  - Unsupported or malformed payment forms pass through with a diagnostic.
33
33
  Supported parsing is narrower than the full x402 protocol; see
34
- [SPEC-NOTES.md](SPEC-NOTES.md).
34
+ [protocol notes](https://github.com/Ding808/taximeter/blob/main/SPEC-NOTES.md).
35
+ - Parsed payments outside the offline asset registry are denied by default.
36
+ Setting `policy.unknownAsset` to `allow` permits them; only matching contract
37
+ budgets and caps then apply. Metadata supplied with a payment does not make its asset trusted.
35
38
  - HTTPS CONNECT tunnels encrypted bytes without metering their payments.
36
39
  Taximeter does not install a certificate authority or intercept TLS.
37
40
  - The SDK must wrap the transport inside the payment wrapper. Redirects and