taximeter 0.1.2 → 0.2.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.
@@ -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-Bts-0doc.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-AWIe7JNX.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.1.2.tgz`.
11
+ tarball there, and use `npm install ./taximeter-0.2.1.tgz`.
12
12
 
13
13
  ## Try it locally
14
14
 
@@ -132,11 +132,32 @@ environment, with explicit SDK options taking precedence. See the
132
132
  files or environment settings. Keep budgets consistent across writers sharing
133
133
  the same database.
134
134
 
135
+ `config.policy.unknownAsset` defaults to `"deny"`. Only network and contract pairs
136
+ in Taximeter's offline asset registry are known; payment-supplied symbols and
137
+ decimal metadata do not establish trust. To use custom-token budgets, explicitly
138
+ set `config.policy.unknownAsset` to `"allow"` and configure the matching contract
139
+ and network budget. This permits parsed unknown assets; the default USDC budgets
140
+ do not cap them.
141
+
135
142
  The wrapper closes only a ledger it created. For an injected ledger, close all
136
143
  wrappers after their requests finish, then let the owner close the ledger.
137
144
  Reusing a closed wrapper passes requests directly to the original transport
138
145
  without metering. Do not use a closed wrapper for later payments.
139
146
 
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
151
+ from the append-only log inside a transaction.
152
+
153
+ From 0.2.1, opening an on-disk schema-1 ledger prints `Migrating ledger…` to stderr
154
+ and saves a standalone, WAL-aware backup at
155
+ `<database>.backup-v1-<unique suffix>/ledger.db` before upgrading. The saved path
156
+ is printed before the synchronous backfill begins. A backup failure aborts the
157
+ 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)
159
+ before using a backup with an older client.
160
+
140
161
  ## Fetch behavior and limits
141
162
 
142
163
  - Use a Node fetch implementation that accepts standard `string`, `URL`, or
@@ -159,6 +180,9 @@ without metering. Do not use a closed wrapper for later payments.
159
180
  returns a 402 JSON response with `error: "blocked_by_taximeter"`, `reason`,
160
181
  `budget`, `spent`, and `remaining`, and records a blocked event. The enclosing
161
182
  payment client can apply its own response handling or throw its own error.
183
+ - A parsed unknown asset is denied by default with `reason: "unknown_asset"`,
184
+ `budget: null`, `spent: "0"`, and `remaining: null`. Unsupported or unparseable
185
+ payment formats still pass through with a diagnostic.
162
186
  - If the transport throws after forwarding an authorization, the original
163
187
  error is rethrown and the authorization remains reserved with unknown
164
188
  settlement. Missing settlement evidence has the same conservative treatment.
@@ -171,7 +195,7 @@ without metering. Do not use a closed wrapper for later payments.
171
195
  The initial adapter meters exact EVM EIP-3009 payments: legacy v1 on Base and
172
196
  Base Sepolia, and v2 with EVM CAIP-2 networks. Permit2, ERC-7710, other schemes,
173
197
  and other rails remain unmetered. Known Base/Base Sepolia USDC uses six decimal
174
- places; unknown tokens remain exact atomic units. Budgets and totals are
198
+ places; explicitly allowed unknown tokens remain exact atomic units. Budgets and totals are
175
199
  separate for every network and asset. See
176
200
  [protocol notes](https://github.com/Ding808/taximeter/blob/main/SPEC-NOTES.md) for
177
201
  wire formats, challenge correlation, idempotency, and settlement rules.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taximeter",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "A taximeter for your AI agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,7 +9,8 @@
9
9
  "denyHosts": [],
10
10
  "allowPayTo": [],
11
11
  "maxSinglePayment": "1000000",
12
- "maxSingleAsset": "USDC"
12
+ "maxSingleAsset": "USDC",
13
+ "unknownAsset": "deny"
13
14
  },
14
15
  "ports": { "proxy": 8402, "dashboard": 8403 },
15
16
  "db": "~/.taximeter/ledger.db"