@flop-labs/sdk 0.7.2 → 0.8.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 +93 -0
- package/README.md +2 -2
- package/dist/bundle/index.esm.js +1 -1
- package/dist/bundle/index.esm.js.map +1 -1
- package/dist/bundle/index.umd.cjs +1 -1
- package/dist/bundle/index.umd.cjs.map +1 -1
- package/dist/compute-channel/capacity-reservation.d.ts +5 -3
- package/dist/compute-channel/capacity-reservation.d.ts.map +1 -1
- package/dist/compute-channel/capacity-reservation.js +7 -3
- package/dist/compute-channel/capacity-reservation.js.map +1 -1
- package/dist/compute-channel/deepseek-v41.d.ts +13 -6
- package/dist/compute-channel/deepseek-v41.d.ts.map +1 -1
- package/dist/compute-channel/deepseek-v41.js +19 -10
- package/dist/compute-channel/deepseek-v41.js.map +1 -1
- package/dist/compute-channel/flop-submitter.d.ts +53 -4
- package/dist/compute-channel/flop-submitter.d.ts.map +1 -1
- package/dist/compute-channel/flop-submitter.js +94 -4
- package/dist/compute-channel/flop-submitter.js.map +1 -1
- package/dist/compute-channel/forward-holdings.d.ts +32 -0
- package/dist/compute-channel/forward-holdings.d.ts.map +1 -0
- package/dist/compute-channel/forward-holdings.js +157 -0
- package/dist/compute-channel/forward-holdings.js.map +1 -0
- package/dist/compute-channel/index.d.ts +5 -0
- package/dist/compute-channel/index.d.ts.map +1 -1
- package/dist/compute-channel/index.js +5 -0
- package/dist/compute-channel/index.js.map +1 -1
- package/dist/compute-channel/long-session-chain.d.ts +16 -0
- package/dist/compute-channel/long-session-chain.d.ts.map +1 -0
- package/dist/compute-channel/long-session-chain.js +212 -0
- package/dist/compute-channel/long-session-chain.js.map +1 -0
- package/dist/compute-channel/long-session.d.ts +256 -0
- package/dist/compute-channel/long-session.d.ts.map +1 -0
- package/dist/compute-channel/long-session.js +623 -0
- package/dist/compute-channel/long-session.js.map +1 -0
- package/dist/compute-channel/miner-host.d.ts.map +1 -1
- package/dist/compute-channel/miner-host.js +5 -3
- package/dist/compute-channel/miner-host.js.map +1 -1
- package/dist/compute-channel/model-config.d.ts +16 -3
- package/dist/compute-channel/model-config.d.ts.map +1 -1
- package/dist/compute-channel/model-config.js +71 -2
- package/dist/compute-channel/model-config.js.map +1 -1
- package/dist/compute-channel/session-estimate.d.ts.map +1 -1
- package/dist/compute-channel/session-estimate.js +12 -1
- package/dist/compute-channel/session-estimate.js.map +1 -1
- package/dist/compute-channel/spend-journal.d.ts +172 -0
- package/dist/compute-channel/spend-journal.d.ts.map +1 -0
- package/dist/compute-channel/spend-journal.js +429 -0
- package/dist/compute-channel/spend-journal.js.map +1 -0
- package/dist/compute-channel/transcript.d.ts +3 -1
- package/dist/compute-channel/transcript.d.ts.map +1 -1
- package/dist/compute-channel/transcript.js +2 -0
- package/dist/compute-channel/transcript.js.map +1 -1
- package/dist/compute-channel/transport-http.d.ts +34 -1
- package/dist/compute-channel/transport-http.d.ts.map +1 -1
- package/dist/compute-channel/transport-http.js +66 -4
- package/dist/compute-channel/transport-http.js.map +1 -1
- package/dist/direct-swap/retained-runtime-releases.d.ts.map +1 -1
- package/dist/direct-swap/retained-runtime-releases.js +11 -1
- package/dist/direct-swap/retained-runtime-releases.js.map +1 -1
- package/dist/discovery/metered-pricing.d.ts.map +1 -1
- package/dist/discovery/metered-pricing.js +8 -1
- package/dist/discovery/metered-pricing.js.map +1 -1
- package/dist/faucet.d.ts +1 -1
- package/dist/faucet.js +1 -1
- package/dist/miner-admission.d.ts +1 -1
- package/dist/miner-admission.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,99 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.8.0] - 2026-11-21
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Retained voucher sources accept the deployed devnet `tzkv-runtime` 1014031 release (exact source,
|
|
15
|
+
genesis, code and metadata hashes); any other retained release is still refused.
|
|
16
|
+
- `compute-channel` `assertNoForwardHoldings(api, account)` / `forwardHoldings`: at the finalized
|
|
17
|
+
head, refuses an account that holds forward units (total or active), resale listings, open
|
|
18
|
+
draws, forward channels as agent or miner, funded forward offers, posted bids or bid claims, and
|
|
19
|
+
fails closed when any of that storage cannot be read or a scan is unbounded.
|
|
20
|
+
- `LongSessionConfig.beforeSpend(kind)`: runs before every open and top-up, before anything is
|
|
21
|
+
journaled or signed; a throw refuses that spend.
|
|
22
|
+
- `LongTurnOptions.acceptReceipt(receipt)`: runs on the miner's receipt after the tariff check and
|
|
23
|
+
before the turn is acknowledged; a throw refuses the turn without acking or co-signing it.
|
|
24
|
+
- `compute-channel` long sessions for agent launch lanes: `LongSession.open|turn|recover|close`
|
|
25
|
+
buys a channel from a named miner only when a request needs it (a fitting miner-signed offer,
|
|
26
|
+
else a bare `open_channel` priced from the chain's unconsented floor; never `force_open`),
|
|
27
|
+
verifies the miner's info proof and finalized registration, calibration and model identity
|
|
28
|
+
before funding, tops up and rolls over on demand, checks each turn's tariff against the
|
|
29
|
+
finalized escrow before acknowledging it, and replays a journaled result for a repeated
|
|
30
|
+
request id. `SpendJournal` and the owner-only `FileSpendJournal` record each spend's signed
|
|
31
|
+
transaction hash and debit a lifetime budget before broadcast, freeze purchases while an
|
|
32
|
+
outcome is unknown, and allow one spender per (genesis, payer).
|
|
33
|
+
- `SpendingSubmitter.prepare` on `FlopChainSubmitter` and `SessionChainSubmitter` signs with an
|
|
34
|
+
explicit nonce and a 64-block mortal era before broadcasting; `SessionChainSubmitter` takes a
|
|
35
|
+
`waitForFinality` flag. `computeChannelSpend` exposes the declared-spend table.
|
|
36
|
+
- `parseMeteringConfig` meters `deepseek-ai/DeepSeek-V4.1-Flash-1017` at its pinned config as the
|
|
37
|
+
`deepseek-v41-reference-v1` family, for devnet only. No certificate proves its g_n:
|
|
38
|
+
`meteringIsUnverified` marks it, `UNVERIFIED_METERING` names it, and the miner host reports
|
|
39
|
+
provenance `GnSource.UnverifiedMinerComputed`. The DeepSeek-V4.1 module, including
|
|
40
|
+
`DEEPSEEK_V41_REVISION` and `DEEPSEEK_V41_CONTENT_ROOT`, is now exported from `computeChannel`.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- `fetchSessionInfoProof` allows the whole exchange 25 s (was 10 s).
|
|
45
|
+
- `SessionChainSubmitter` accepts `openChannelWithOffer` and `openChannelWithProfiledOffer`,
|
|
46
|
+
declaring their escrow as the session spend.
|
|
47
|
+
- `WeightQuantization.bits` can be `null`, for the mixed `fp8+mxfp4` method only.
|
|
48
|
+
- The DeepSeek-V4.1 execution profile pins publisher revision `08c8657f`, so its arch hash is now
|
|
49
|
+
`a242fa26…97e2`.
|
|
50
|
+
- `meteringArchHash`, `meteredReferenceGn` and session estimates throw on an unknown family tag
|
|
51
|
+
instead of metering it as a legacy architecture.
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- `notifyMinerOpen` retries the miner's `400 channel not found on-chain` for up to 60 s (every 2 s,
|
|
56
|
+
within the caller's abort signal). The opener waits for its own node's finality, but the miner reads
|
|
57
|
+
its own node, which the RPC pool serves while up to ~30 blocks behind, so a just-opened channel was
|
|
58
|
+
refused and its escrow left for the timeout refund (seen on devnet tools probes). Any other refusal
|
|
59
|
+
still fails at once.
|
|
60
|
+
- `LongSession` no longer buys or serves work its channel cannot settle. The pallet settles at most
|
|
61
|
+
`min(pinned reservation rate, current cap) x max_duration` G_n per channel. A turn's worst-case
|
|
62
|
+
G_n is `worstCaseTurnPlanck - BasePerTurn`. Before buying, the session refuses an offer or bare
|
|
63
|
+
window whose allowance at the miner's reservation rate is below one worst-case turn. After
|
|
64
|
+
inclusion it re-checks the pinned snapshot. Before each turn it refuses when the verified G_n plus
|
|
65
|
+
the worst-case turn would pass the live channel's allowance. It rolls over only when a new channel
|
|
66
|
+
could settle that turn; otherwise it throws `CalibratedAllowanceError`
|
|
67
|
+
(`CALIBRATED_ALLOWANCE_TOO_SMALL`), which names the miner's rate, and keeps the channel. Exported
|
|
68
|
+
`settleableAllowance(channel)`.
|
|
69
|
+
- `reservationRateUpdate(cap, sessions, current, owned?)`: a stored rate equal to `owned`, the rate
|
|
70
|
+
the caller's keeper set itself, now follows the cap both ways. Any other stored rate is still only
|
|
71
|
+
lowered.
|
|
72
|
+
|
|
73
|
+
- `LongSession` keeps a channel after a miner refuses a turn before serving it. That is an HTTP
|
|
74
|
+
400/413 from `/session/turn` with no stream, frame or receipt, now `MinerTurnRejectedError`
|
|
75
|
+
from `HttpSessionTransport`. The miner's turn index and fence are unchanged, so a retry no
|
|
76
|
+
longer buys a new channel. Every other turn failure still retires the channel.
|
|
77
|
+
- `LongSession.turn` refuses a turn whose `/session/turn` body would pass the worker's limit with
|
|
78
|
+
`TurnTooLargeError`, before buying or sending. New exports: `MAX_SESSION_TURN_BODY_BYTES` (1 MiB),
|
|
79
|
+
`sessionTurnBody` and `sessionTurnBodyBytes`.
|
|
80
|
+
- `SpendingSubmitter.prepare` refuses to sign when the finalized head's `timestamp.now` is older
|
|
81
|
+
than a quarter of the spend era in wall time (or that far ahead of the local clock), or when it or `babe.expectedBlockTime` cannot be
|
|
82
|
+
read. A uniformly lagging RPC node had produced a spend whose era expired. New:
|
|
83
|
+
`assertFinalizedHeadFresh`.
|
|
84
|
+
- When finalized evidence resolves an ambiguous spend, `FileSpendJournal.resolve` keeps the
|
|
85
|
+
original send error in `reason`.
|
|
86
|
+
- `FileSpendJournal`'s one-spender lock is per (genesis, payer) again across journal directories:
|
|
87
|
+
it lives in `~/.flop/payers/<sha256(genesis|account)>/` (`payersRoot` option,
|
|
88
|
+
`defaultPayersRoot`), keyed by the decoded account so any SS58 format of it is the same payer.
|
|
89
|
+
That directory registers every journal used for the payer, and an unresolved spend in any of
|
|
90
|
+
them freezes purchases from all of them (`SpendingFrozenError.journalDir` names the journal).
|
|
91
|
+
- Journal recovery no longer depends on the miner or the model: `reconcileSpendJournal(journal,
|
|
92
|
+
reader)` with the journal-only `createJournalChainReader(api)` resolves spends and channel
|
|
93
|
+
states from finalized chain state without miner admission, calibration or model identity, so
|
|
94
|
+
recovery works after the miner went inactive, its lease expired or the model was withdrawn.
|
|
95
|
+
`LongSession` uses the same reconciliation, and purchases keep those checks.
|
|
96
|
+
|
|
97
|
+
### Security
|
|
98
|
+
|
|
99
|
+
- `meteredPricing` prices DeepSeek-V4.1 only when the model hash and the miner's reported measured
|
|
100
|
+
root are both the pinned checkpoint root. The same config under another hash, or a miner that
|
|
101
|
+
measured other bytes, gets no quote.
|
|
102
|
+
|
|
10
103
|
## [0.7.2] - 2026-11-20
|
|
11
104
|
|
|
12
105
|
### Changed
|
package/README.md
CHANGED
|
@@ -374,14 +374,14 @@ const response = await x402Fetch('https://api.example.com/inference', {
|
|
|
374
374
|
});
|
|
375
375
|
```
|
|
376
376
|
|
|
377
|
-
#### `parsePaymentHeaders(
|
|
377
|
+
#### `parsePaymentHeaders(response)`
|
|
378
378
|
|
|
379
379
|
Parse x402 payment headers from response.
|
|
380
380
|
|
|
381
381
|
```typescript
|
|
382
382
|
import { parsePaymentHeaders } from '@flop-labs/sdk';
|
|
383
383
|
|
|
384
|
-
const payment = parsePaymentHeaders(response
|
|
384
|
+
const payment = parsePaymentHeaders(response);
|
|
385
385
|
```
|
|
386
386
|
|
|
387
387
|
### Named-miner sessions
|