taximeter 0.2.1 → 0.3.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.
@@ -6,7 +6,7 @@
6
6
  <meta name="color-scheme" content="light dark" />
7
7
  <meta name="description" content="A taximeter for your AI agents. Your local payment ledger." />
8
8
  <title>Taximeter — Local ledger</title>
9
- <script type="module" crossorigin src="/assets/index-AWIe7JNX.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-_UDg88nw.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-De4zKRDL.css">
11
11
  </head>
12
12
  <body>
package/docs/SDK.md CHANGED
@@ -8,7 +8,7 @@ Install the registry release with `npm install taximeter`. From a source checkou
8
8
  run `npm ci` and `npm run build`, then save the examples at the repository root.
9
9
  Their `import "taximeter"` statements resolve the package's own built exports.
10
10
  To try a local build in another project, run `npm pack`, copy the resulting
11
- tarball there, and use `npm install ./taximeter-0.2.1.tgz`.
11
+ tarball there, and use `npm install ./taximeter-0.3.0.tgz`.
12
12
 
13
13
  ## Try it locally
14
14
 
@@ -112,6 +112,11 @@ The local example and factory were exercised with ordinary loopback traffic;
112
112
  the integration tests use synthetic x402 authorizations. No wallet or genuine
113
113
  payment was used to validate these examples.
114
114
 
115
+ A separate [live testnet example](https://github.com/Ding808/taximeter/tree/main/examples/live-testnet)
116
+ validates the actual CLI proxy with the official client, Express server, and a
117
+ Base Sepolia transfer. That evidence covers explicit upstream mode; it does not
118
+ turn the SDK factory above into a tested live-wallet integration.
119
+
115
120
  ## Options and lifecycle
116
121
 
117
122
  `withMeter(fetchImpl, options)` returns a fetch-compatible function with a
@@ -132,6 +137,13 @@ environment, with explicit SDK options taking precedence. See the
132
137
  files or environment settings. Keep budgets consistent across writers sharing
133
138
  the same database.
134
139
 
140
+ Budgets also accept optional `maxPayments`, a positive safe integer. It uses the
141
+ same scope, asset/network match, rolling window, and reservation rules as amount.
142
+ For example, `config: { budgets: { global: { maxPayments: 1000 } } }` adds a
143
+ count cap while inheriting the default amount and window. Omitted fields in this
144
+ SDK patch keep their lower-layer values. The CLI's human-unit syntax is for CLI
145
+ input only; SDK amounts remain exact atomic integer strings.
146
+
135
147
  `config.policy.unknownAsset` defaults to `"deny"`. Only network and contract pairs
136
148
  in Taximeter's offline asset registry are known; payment-supplied symbols and
137
149
  decimal metadata do not establish trust. To use custom-token budgets, explicitly
@@ -144,18 +156,19 @@ wrappers after their requests finish, then let the owner close the ledger.
144
156
  Reusing a closed wrapper passes requests directly to the original transport
145
157
  without metering. Do not use a closed wrapper for later payments.
146
158
 
147
- Version 0.2.x upgrades existing ledgers to schema version 2 when opening them.
148
- Source events and outcomes remain unchanged; the added budget index is rebuilt
149
- from those records. Upgrade all writers together. Older 0.1.x clients cannot
150
- reopen a migrated database. `ledger.rebuildCache()` repairs the derived index
159
+ The count-budget release upgrades existing ledgers to schema version 3 when opening them.
160
+ Source events and outcomes remain unchanged; the amount/count index is rebuilt
161
+ from those records. Stop all old proxy and SDK writers before upgrading them
162
+ together. Older 0.1.x/0.2.x clients cannot reopen a migrated database, and an
163
+ already-open old writer must not share the upgraded cache. `ledger.rebuildCache()` repairs the derived index
151
164
  from the append-only log inside a transaction.
152
165
 
153
- From 0.2.1, opening an on-disk schema-1 ledger prints `Migrating ledger…` to stderr
166
+ Opening an on-disk schema-1 or schema-2 ledger prints `Migrating ledger…` to stderr
154
167
  and saves a standalone, WAL-aware backup at
155
- `<database>.backup-v1-<unique suffix>/ledger.db` before upgrading. The saved path
168
+ `<database>.backup-v<original schema>-<unique suffix>/ledger.db` before upgrading. The saved path
156
169
  is printed before the synchronous backfill begins. A backup failure aborts the
157
170
  upgrade; a backfill failure rolls it back and retains the completed backup.
158
- Fresh and schema-2 databases skip this step. See the [rollback instructions](../README.md#configuration)
171
+ Fresh and schema-3 databases skip this step. See the [rollback instructions](../README.md#configuration)
159
172
  before using a backup with an older client.
160
173
 
161
174
  ## Fetch behavior and limits
@@ -178,7 +191,10 @@ before using a backup with an older client.
178
191
  wrapper composition above.
179
192
  - Recognized authorizations reserve capacity before forwarding. A policy denial
180
193
  returns a 402 JSON response with `error: "blocked_by_taximeter"`, `reason`,
181
- `budget`, `spent`, and `remaining`, and records a blocked event. The enclosing
194
+ `budget`, `spent`, `remaining`, and an advisory `fix` command, and records a blocked event.
195
+ Count denials use decimal count strings in those numeric fields. The same fix
196
+ is printed to stderr once per reason per process, including across SDK wrappers.
197
+ It never runs automatically or changes the current configuration. The enclosing
182
198
  payment client can apply its own response handling or throw its own error.
183
199
  - A parsed unknown asset is denied by default with `reason: "unknown_asset"`,
184
200
  `budget: null`, `spent: "0"`, and `remaining: null`. Unsupported or unparseable
package/docs/demo.gif CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taximeter",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "A taximeter for your AI agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",