| … | … | @@ -2444,6 +2444,46 @@ SessionState's truncate / reorg / named-session machinery. |
| 2444 | 2444 | recovery ended. The drill SCENARIO_TIMEOUT is now 300 s (an uncached s18 exceeded |
| 2445 | 2445 | 180 s). |
| 2446 | 2446 | - **M5g-3 COMPLETE 2026-10-03** (3a–3e). Next: M5g-4, the rest of the Hypercore surface. |
| 2447 | - **M5g-4 — split (design 2026-10-03).** Read in full: index.js's class surface, lib/info.js, |
| 2448 | compact-encoding's `from` and its raw codecs. |
| 2449 | - **4a:** value encodings (byte-level, the user's choice 2026-10-03), `encodeBatch`, |
| 2450 | DECODING_ERROR, `onseq` / `onwait` / `waits`, `postappend`, the getters, the setters, and |
| 2451 | `info()`. |
| 2452 | - **4b:** `treeHash` / `signable` / `missingNodes` / `proof` / `applyProof` / |
| 2453 | `verifyFullyRemote`, plus the statics. |
| 2454 | - **4c:** read / write / byte streams. |
| 2455 | - **4d:** marks (lib/mark-bitfield.js, `markBlock` / `startMarking` / `clearMarkings` / |
| 2456 | `sweep`), `purge`, `compact`, `audit`. |
| 2457 | - **4e:** `registerExtension` (with the replicator's extension messages), `inspect`. |
| 2458 | - **M5g-4a design.** |
| 2459 | - **Encodings are byte-level hooks:** |
| 2460 | - A `ValueEncoding` is `encode(Buf) → Buf` / `decode(Buf) → Buf` over the bytes of JS's |
| 2461 | value: UTF-8 for a string, `JSON.stringify` text for json / ndjson. |
| 2462 | - The named codecs are compact-encoding's RAW ones (no length prefix): binary, utf-8, |
| 2463 | ascii, hex, base64, ucs2, json (`JSON.stringify(v)`), ndjson (`+ '\n'`). |
| 2464 | - Decoding returns the value's bytes in the same representation. |
| 2465 | - A decode throw becomes DECODING_ERROR (message: JS's `err.message`; for json the text is |
| 2466 | keetd's own, since V8's JSON.parse wording belongs to the engine, so the gate compares |
| 2467 | the code only). |
| 2468 | - **JS's `_encode` lets a Buffer BYPASS the encoding.** `Session::append(Buf)` stays JS's |
| 2469 | Buffer path; `appendValues` is the value path (encode at offset `padding`, as `_encode`). |
| 2470 | `encodeBatch` replaces both. |
| 2471 | - **get:** |
| 2472 | - `onseq(index)`, then `_get`; there, `waits++`, `opts.onwait` and the session's `onwait` |
| 2473 | before the replicator; |
| 2474 | - `get({ valueEncoding })` overrides the session's. |
| 2475 | - `isValidIndex` cannot fail for keetd's unsigned indices. |
| 2476 | - **Getters:** `id` (z32 of the key), `manifest`, `getManifest({ raw })` (the encoded |
| 2477 | manifest), `signedLength`, `remoteContiguousLength`, `contiguousLength`, |
| 2478 | `contiguousByteLength` (0 in 11.37), `globalCache` (opaque, Core's option), `recovering`, |
| 2479 | `waits`. |
| 2480 | - **Setters:** `setKeyPair`; `setEncryption(provider | null)`; `setEncryptionKey(key, |
| 2481 | { block })`; `setGroup(topic)` (Core.setGroup: createGroup, STORAGE_CONFLICT on another |
| 2482 | group); the session `group` option. |
| 2483 | - **`info({ storage })` → `{ key, discoveryKey, length, contiguousLength, byteLength, fork, |
| 2484 | padding, storage }`.** 11.37's `Info.storage` reads `core.oplog` etc., which no longer |
| 2485 | exist; its TypeError is caught, so `storage` is always null. keetd returns null. |
| 2486 | - **Gate:** the core gate, a new `surface` script. |
| 2447 | 2487 | - **M5g-4 — the rest of the surface:** |
| 2448 | 2488 | - value encodings and `encodeBatch` (DECODING_ERROR); `postappend`, `onseq`, `onwait`; |
| 2449 | 2489 | - `setEncryption` / `setEncryptionKey` / `setKeyPair` / `setGroup`; |