taximeter 0.1.2 → 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.
@@ -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-BFxfiuVt.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.0.tgz`.
12
12
 
13
13
  ## Try it locally
14
14
 
@@ -132,11 +132,24 @@ 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.0 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
+
140
153
  ## Fetch behavior and limits
141
154
 
142
155
  - Use a Node fetch implementation that accepts standard `string`, `URL`, or
@@ -159,6 +172,9 @@ without metering. Do not use a closed wrapper for later payments.
159
172
  returns a 402 JSON response with `error: "blocked_by_taximeter"`, `reason`,
160
173
  `budget`, `spent`, and `remaining`, and records a blocked event. The enclosing
161
174
  payment client can apply its own response handling or throw its own error.
175
+ - A parsed unknown asset is denied by default with `reason: "unknown_asset"`,
176
+ `budget: null`, `spent: "0"`, and `remaining: null`. Unsupported or unparseable
177
+ payment formats still pass through with a diagnostic.
162
178
  - If the transport throws after forwarding an authorization, the original
163
179
  error is rethrown and the authorization remains reserved with unknown
164
180
  settlement. Missing settlement evidence has the same conservative treatment.
@@ -171,7 +187,7 @@ without metering. Do not use a closed wrapper for later payments.
171
187
  The initial adapter meters exact EVM EIP-3009 payments: legacy v1 on Base and
172
188
  Base Sepolia, and v2 with EVM CAIP-2 networks. Permit2, ERC-7710, other schemes,
173
189
  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
190
+ places; explicitly allowed unknown tokens remain exact atomic units. Budgets and totals are
175
191
  separate for every network and asset. See
176
192
  [protocol notes](https://github.com/Ding808/taximeter/blob/main/SPEC-NOTES.md) for
177
193
  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.0",
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"