@flop-labs/sdk 0.8.0 → 0.10.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/README.md +2 -2
  3. package/dist/bundle/index.esm.js +1 -1
  4. package/dist/bundle/index.esm.js.map +1 -1
  5. package/dist/bundle/index.umd.cjs +1 -1
  6. package/dist/bundle/index.umd.cjs.map +1 -1
  7. package/dist/client.d.ts +2 -0
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +4 -1
  10. package/dist/client.js.map +1 -1
  11. package/dist/compute-channel/agent-driver.d.ts.map +1 -1
  12. package/dist/compute-channel/agent-driver.js +4 -1
  13. package/dist/compute-channel/agent-driver.js.map +1 -1
  14. package/dist/compute-channel/channel-price.d.ts +34 -0
  15. package/dist/compute-channel/channel-price.d.ts.map +1 -0
  16. package/dist/compute-channel/channel-price.js +63 -0
  17. package/dist/compute-channel/channel-price.js.map +1 -0
  18. package/dist/compute-channel/deepseek-v41.d.ts +2 -2
  19. package/dist/compute-channel/direct-session-chain.d.ts.map +1 -1
  20. package/dist/compute-channel/direct-session-chain.js +6 -1
  21. package/dist/compute-channel/direct-session-chain.js.map +1 -1
  22. package/dist/compute-channel/direct-session.d.ts +2 -0
  23. package/dist/compute-channel/direct-session.d.ts.map +1 -1
  24. package/dist/compute-channel/direct-session.js +2 -2
  25. package/dist/compute-channel/direct-session.js.map +1 -1
  26. package/dist/compute-channel/index.d.ts +4 -0
  27. package/dist/compute-channel/index.d.ts.map +1 -1
  28. package/dist/compute-channel/index.js +4 -0
  29. package/dist/compute-channel/index.js.map +1 -1
  30. package/dist/compute-channel/kimi-k31.d.ts +73 -0
  31. package/dist/compute-channel/kimi-k31.d.ts.map +1 -0
  32. package/dist/compute-channel/kimi-k31.js +265 -0
  33. package/dist/compute-channel/kimi-k31.js.map +1 -0
  34. package/dist/compute-channel/long-session-chain.d.ts.map +1 -1
  35. package/dist/compute-channel/long-session-chain.js +52 -7
  36. package/dist/compute-channel/long-session-chain.js.map +1 -1
  37. package/dist/compute-channel/long-session.d.ts +32 -7
  38. package/dist/compute-channel/long-session.d.ts.map +1 -1
  39. package/dist/compute-channel/long-session.js +111 -40
  40. package/dist/compute-channel/long-session.js.map +1 -1
  41. package/dist/compute-channel/model-config.d.ts +6 -4
  42. package/dist/compute-channel/model-config.d.ts.map +1 -1
  43. package/dist/compute-channel/model-config.js +57 -7
  44. package/dist/compute-channel/model-config.js.map +1 -1
  45. package/dist/compute-channel/peer-info.d.ts +37 -2
  46. package/dist/compute-channel/peer-info.d.ts.map +1 -1
  47. package/dist/compute-channel/peer-info.js +25 -5
  48. package/dist/compute-channel/peer-info.js.map +1 -1
  49. package/dist/compute-channel/response-length.d.ts +84 -0
  50. package/dist/compute-channel/response-length.d.ts.map +1 -0
  51. package/dist/compute-channel/response-length.js +85 -0
  52. package/dist/compute-channel/response-length.js.map +1 -0
  53. package/dist/compute-channel/session-estimate.d.ts +3 -1
  54. package/dist/compute-channel/session-estimate.d.ts.map +1 -1
  55. package/dist/compute-channel/session-estimate.js +16 -3
  56. package/dist/compute-channel/session-estimate.js.map +1 -1
  57. package/dist/compute-channel/session.d.ts +16 -2
  58. package/dist/compute-channel/session.d.ts.map +1 -1
  59. package/dist/compute-channel/session.js +34 -10
  60. package/dist/compute-channel/session.js.map +1 -1
  61. package/dist/compute-channel/toploc-completion-rpc.d.ts.map +1 -1
  62. package/dist/compute-channel/toploc-completion-rpc.js +3 -1
  63. package/dist/compute-channel/toploc-completion-rpc.js.map +1 -1
  64. package/dist/compute-channel/transcript.d.ts +5 -2
  65. package/dist/compute-channel/transcript.d.ts.map +1 -1
  66. package/dist/compute-channel/transcript.js +6 -3
  67. package/dist/compute-channel/transcript.js.map +1 -1
  68. package/dist/compute-channel/transport-http.d.ts +9 -0
  69. package/dist/compute-channel/transport-http.d.ts.map +1 -1
  70. package/dist/compute-channel/transport-http.js +4 -0
  71. package/dist/compute-channel/transport-http.js.map +1 -1
  72. package/dist/compute-channel/warm-pool.d.ts +127 -0
  73. package/dist/compute-channel/warm-pool.d.ts.map +1 -0
  74. package/dist/compute-channel/warm-pool.js +169 -0
  75. package/dist/compute-channel/warm-pool.js.map +1 -0
  76. package/dist/discovery/metered-pricing.d.ts.map +1 -1
  77. package/dist/discovery/metered-pricing.js +10 -1
  78. package/dist/discovery/metered-pricing.js.map +1 -1
  79. package/dist/faucet.d.ts +1 -1
  80. package/dist/faucet.d.ts.map +1 -1
  81. package/dist/faucet.js +1 -1
  82. package/dist/faucet.js.map +1 -1
  83. package/dist/miner-admission.d.ts +14 -3
  84. package/dist/miner-admission.d.ts.map +1 -1
  85. package/dist/miner-admission.js +26 -6
  86. package/dist/miner-admission.js.map +1 -1
  87. package/dist/runtime-compatibility.d.ts +1 -1
  88. package/dist/runtime-compatibility.d.ts.map +1 -1
  89. package/dist/runtime-compatibility.js +11 -2
  90. package/dist/runtime-compatibility.js.map +1 -1
  91. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -7,6 +7,79 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.10.0] - 2026-11-24
11
+
12
+ ### Added
13
+
14
+ - `LongSessionConfig.minOfferWindowSeconds`: the shortest miner-signed offer window a long
15
+ session takes (default `windowSeconds`, unchanged). A bare open still asks for `windowSeconds`.
16
+ - Warm-pool reopen flow (#4643): `selectStandbys`, `freezePrimary`, `oldChannelAction` /
17
+ `watchOldChannel` and `reopenOnStandby` reopen a session on a matching standby miner after a
18
+ `TurnTimeoutError`, replay the transcript and publish lineage; `StandbyExhaustedError` when
19
+ every standby fails. `ChannelSession.lastCosignedCheckpoint()` returns the last checkpoint the
20
+ agent co-signed.
21
+
22
+ ### Changed
23
+
24
+ - `SUPPORTED_SPEC_VERSIONS` admits runtime `1014035` (candidate 1.14.35, D-0554 / #4581), the
25
+ spec the public Testnet (`flop-testnet`) launched on, and `SUPPORTED_SPEC_VERSION_RANGE` now
26
+ ends at `1014035`. `1014034` stays admitted so devnet clients work before and after `setCode`.
27
+ - **Breaking:** spot compute-channel tariffs price work per channel (#4581 / D-0554):
28
+ `forceSettlePayable(basePerTurn, turns, aggregateGn, pricePerGn)` takes a required price;
29
+ `ChannelSession.open` takes the price or a reader as a third argument and `fromOpenChannel`
30
+ takes `pricePerGn`; `LongSessionConfig.worstCaseTurnPlanck` is replaced by `worstCaseTurnGn`
31
+ (the session prices it at the model price before an open, then re-checks and tops up to the
32
+ pinned price); `LongSessionRuntime` gains `modelPricePerGn` and both channel snapshots carry
33
+ `pricePerGn`. New `readChannelPricePerGn`, `readModelPricePerGn` and
34
+ `resolveChannelPricePerGn` mirror the pallet rule (forward or unpinned channel, or a runtime
35
+ without `ChannelPricePerGn`: one atom per `G_n`). `estimateSession` sizes escrow to
36
+ `BasePerTurn·turns + price·ΣG_n`, so it now always includes the per-turn base.
37
+
38
+ ## [0.9.0] - 2026-11-23
39
+
40
+ ### Added
41
+
42
+ - `LongSessionRuntime.requestOffer`: when no listed offer fits, a long session asks the miner's
43
+ `POST /session/offer` for a freshly signed offer and checks it exactly as a listed one, before
44
+ falling back to a bare open. The live runtime returns no offer on any non-200 reply, a malformed
45
+ or oversized body, a redirect or a 10 s timeout, so miners without the route get a bare open.
46
+ - `computeChannel.predictResponseLength`: one shared completion-length predictor returning p50/p90
47
+ completion tokens with their source (`heuristic`, `history:<window>` or `model:<id>`), for
48
+ pre-request previews only. `responseLengthHistory` builds a per-model baseline from aggregate
49
+ `(prompt, completion)` token counts by prompt bucket; `estimatePromptTokens` is the shared
50
+ `⌈chars / 4⌉` prompt heuristic. `previewTurn` prices a turn at `max_tokens` (`bound`, what holds
51
+ and caps are sized by) and at the predicted p50/p90 through `estimateSession`, and suggests a
52
+ `max_tokens` no larger than the caller's. Billing and settlement never read a prediction.
53
+ - `computeChannel.fetchSessionInfoEvidence` keeps a miner's v2-asking signed session info as
54
+ evidence (`{ challenge, proof }`), and `computeChannel.verifySessionInfoEvidence` re-verifies it
55
+ later for an exact chain, account, session key and model identity.
56
+ - Session info proof v2: `fetchSessionInfoProof` / `fetchProvenSessionInfo` take an optional
57
+ `version` 2, and `verifySessionInfoProof` accepts a `flop-session-info-v2` proof, which also signs
58
+ the inference backend's build and chat profile (`backend`). v1 proofs verify as before and never
59
+ carry a backend; a v2 proof with its backend stripped or altered does not verify.
60
+ `test-vectors/compute-channel/session-info-proof-v2.json` pins the encoding.
61
+ - `parseMeteringConfig` meters `moonshotai/Kimi-K3.1-Pro` @ `d9e99b07` as the unverified
62
+ `kimi-k31-reference-v1` family (devnet only, text-only), and only for its exact config bytes; any
63
+ other `kimi_k31` config keeps the MLA/KDA refusals. It reports BF16 activations and expert-only
64
+ MXFP4 weights, bills `ceil(F / 10^9)` once per turn with the router, gate products and attention
65
+ residuals counted (arch hash `cee27be3…e7af`). It is priced only when both the model hash and the
66
+ miner's measured root are content root `0xbfe37d42…ca90`.
67
+ The module is exported from `computeChannel`, including `refuseKimiK31Media`.
68
+
69
+ ### Changed
70
+
71
+ - `SUPPORTED_SPEC_VERSIONS` admits devnet runtime `1014034` (candidate 1.14.34, D-0553 / #4575), and `SUPPORTED_SPEC_VERSION_RANGE` now ends at `1014034`. `1014031` stays admitted so clients work before and after `setCode`; `1014032` and `1014033` stay rejected.
72
+
73
+ ### Fixed
74
+
75
+ - `computeChannel.LongSession` keeps waiting when the miner's `/session/close` hand-off times out
76
+ or loses its connection, since the miner answers only after DA publish, TOPLOC and `settle`. It
77
+ polls the finalized channel for up to 600 s on `close()` (capped by the channel window's length),
78
+ or one turn timeout on a rollover while a request waits, and journals the channel `closed` once
79
+ it finalizes `Closed`; `close()` reconciles a rolled-over channel that finalized later. A close
80
+ that never finalizes is still `orphaned` for the timeout refund, and a refusal from the miner
81
+ still orphans at once.
82
+
10
83
  ## [0.8.0] - 2026-11-21
11
84
 
12
85
  ### Added
@@ -594,7 +667,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
594
667
 
595
668
  - `inspectHuggingFace` resolves an immutable inventory and bounded config before weight transfer. `fetchHuggingFaceToDir` supports an external `resumeState` receipt with hashed file reuse and pending-rename crash recovery.
596
669
 
597
-
598
670
  - Opt-in miner turn-evidence persistence before transcript/fence mutation, for
599
671
  private encrypted replay and retirement handoff without changing receipt bytes.
600
672
  - Hash-verified whole-blob retrieval on `HttpValidatorDa` for watchtower DA reads
package/README.md CHANGED
@@ -30,9 +30,9 @@ For the examples, set `FLOP_HTLC_TEE_REQUIREMENTS` to that canonical hex from yo
30
30
 
31
31
  TypeScript SDK for the FLOP Network — HTLC workflows, PoI proofs, and account management.
32
32
 
33
- `SUPPORTED_SPEC_VERSIONS` in this source admits exactly `1013000`, `1014000`, `1014001`, `1014002`, `1014003`, `1014004`, `1014005`, `1014007`, `1014008`, `1014009`, `1014010`, `1014011`, `1014012`, `1014013`, `1014014`, `1014015`, `1014016`, `1014017`, `1014018`, `1014019`, `1014020`, `1014021`, `1014022`, `1014023`, `1014024`, `1014025`, `1014026`, `1014027`, `1014029`, `1014031`.
33
+ `SUPPORTED_SPEC_VERSIONS` in this source admits exactly `1013000`, `1014000`, `1014001`, `1014002`, `1014003`, `1014004`, `1014005`, `1014007`, `1014008`, `1014009`, `1014010`, `1014011`, `1014012`, `1014013`, `1014014`, `1014015`, `1014016`, `1014017`, `1014018`, `1014019`, `1014020`, `1014021`, `1014022`, `1014023`, `1014024`, `1014025`, `1014026`, `1014027`, `1014029`, `1014031`, `1014034`, `1014035`.
34
34
  `SUPPORTED_SPEC_VERSION_RANGE` retains its exported shape as the envelope
35
- `1013000..1014031`; admission requires exact membership (including no `1014006`, `1014028` or `1014030`). The published `0.4.0` executable stops at `1014011` and also excludes `1014006`;
35
+ `1013000..1014035`; admission requires exact membership (including no `1014006`, `1014028`, `1014030`, `1014032` or `1014033`). The published `0.4.0` executable stops at `1014011` and also excludes `1014006`;
36
36
  its bundled README has stale connection and HTLC examples. These source corrections
37
37
  are unreleased: installing `@latest` does not deliver them until a new version is
38
38
  published. The examples below describe this source candidate. Qualification covers