taximeter 0.2.2 → 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-DSVhxCXF.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.2.tgz`.
11
+ tarball there, and use `npm install ./taximeter-0.3.0.tgz`.
12
12
 
13
13
  ## Try it locally
14
14
 
@@ -137,6 +137,13 @@ environment, with explicit SDK options taking precedence. See the
137
137
  files or environment settings. Keep budgets consistent across writers sharing
138
138
  the same database.
139
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
+
140
147
  `config.policy.unknownAsset` defaults to `"deny"`. Only network and contract pairs
141
148
  in Taximeter's offline asset registry are known; payment-supplied symbols and
142
149
  decimal metadata do not establish trust. To use custom-token budgets, explicitly
@@ -149,18 +156,19 @@ wrappers after their requests finish, then let the owner close the ledger.
149
156
  Reusing a closed wrapper passes requests directly to the original transport
150
157
  without metering. Do not use a closed wrapper for later payments.
151
158
 
152
- Version 0.2.x upgrades existing ledgers to schema version 2 when opening them.
153
- Source events and outcomes remain unchanged; the added budget index is rebuilt
154
- from those records. Upgrade all writers together. Older 0.1.x clients cannot
155
- 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
156
164
  from the append-only log inside a transaction.
157
165
 
158
- 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
159
167
  and saves a standalone, WAL-aware backup at
160
- `<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
161
169
  is printed before the synchronous backfill begins. A backup failure aborts the
162
170
  upgrade; a backfill failure rolls it back and retains the completed backup.
163
- 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)
164
172
  before using a backup with an older client.
165
173
 
166
174
  ## Fetch behavior and limits
@@ -183,7 +191,10 @@ before using a backup with an older client.
183
191
  wrapper composition above.
184
192
  - Recognized authorizations reserve capacity before forwarding. A policy denial
185
193
  returns a 402 JSON response with `error: "blocked_by_taximeter"`, `reason`,
186
- `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
187
198
  payment client can apply its own response handling or throw its own error.
188
199
  - A parsed unknown asset is denied by default with `reason: "unknown_asset"`,
189
200
  `budget: null`, `spent: "0"`, and `remaining: null`. Unsupported or unparseable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taximeter",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "A taximeter for your AI agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",