@blockcast/fec-worker 0.1.0 → 0.3.0-main.10140e847083
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/README.md +28 -23
- package/dist/block-order.d.ts +22 -0
- package/dist/block-order.d.ts.map +1 -0
- package/dist/block-order.js +48 -0
- package/dist/block-order.js.map +1 -0
- package/dist/fec-worker-client.d.ts +23 -20
- package/dist/fec-worker-client.d.ts.map +1 -1
- package/dist/fec-worker-client.js +102 -54
- package/dist/fec-worker-client.js.map +1 -1
- package/dist/fec-worker-types.d.ts +162 -88
- package/dist/fec-worker-types.d.ts.map +1 -1
- package/dist/fec-worker-types.js +2 -2
- package/dist/fec-worker.js +328 -195
- package/dist/fec-worker.js.map +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/shred-fec-worker.js +23 -2
- package/dist/shred-fec-worker.js.map +2 -2
- package/dist/shred-worker-types.d.ts +16 -1
- package/dist/shred-worker-types.d.ts.map +1 -1
- package/dist/shred-worker-types.js +16 -1
- package/dist/shred-worker-types.js.map +1 -1
- package/package.json +10 -8
- package/src/block-order.ts +59 -0
- package/src/fec-worker-client.ts +107 -56
- package/src/fec-worker-types.ts +161 -84
- package/src/fec-worker.ts +517 -468
- package/src/index.ts +3 -0
- package/src/shred-fec-worker.ts +34 -3
- package/src/shred-worker-types.ts +16 -1
- package/src/__tests__/fec-worker-alta.test.ts +0 -231
- package/src/__tests__/fec-worker-cleanup-integration.test.ts +0 -250
- package/src/__tests__/fec-worker-pending-queue.test.ts +0 -315
- package/src/__tests__/fec-worker-repair-size.test.ts +0 -1029
- package/src/__tests__/fec-worker-wasm-contract.test.ts +0 -84
- package/src/__tests__/shred-fec-worker.test.ts +0 -448
- package/src/fec-worker-client.test.ts +0 -530
- package/src/fec-worker-types.test.ts +0 -400
- package/src/shred-worker-client.test.ts +0 -182
- package/src/transfer.test.ts +0 -24
|
@@ -2,11 +2,23 @@
|
|
|
2
2
|
* @blockcast/fec-worker — Shared Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Defines the Worker message protocol (commands/events), FecTrackStats shape
|
|
5
|
-
* consumed by fec-panel (Phase 5) and CmcdProducer (Phase 6), and
|
|
6
|
-
*
|
|
5
|
+
* consumed by fec-panel (Phase 5) and CmcdProducer (Phase 6), and the relay
|
|
6
|
+
* block signature stub.
|
|
7
7
|
*
|
|
8
8
|
* Types here are importable from both main thread and Worker contexts.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* FEC block profile (BLO-35597, ISO/IEC 23008-1 Annex C): the catalog
|
|
12
|
+
* `fec.blockProfile` token. Required and never inferred; the only profile is
|
|
13
|
+
* `iso-ssbg1-v1` (C.3.3 ssbg_mode1): SS_ID increments by one per source
|
|
14
|
+
* packet mod 2^32; a block is `[SS_Start, SS_Start + SSB_length)` keyed by
|
|
15
|
+
* SS_Start; `k` is only the maximum SSB_length; repair ESI =
|
|
16
|
+
* SSB_length + RS_ID. The retired `k-padded-v1` token is refused like any
|
|
17
|
+
* unknown one.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors @blockcast/mmt-base `FecBlockProfile`.
|
|
20
|
+
*/
|
|
21
|
+
export type FecBlockProfile = "iso-ssbg1-v1";
|
|
10
22
|
/** Per-track FEC configuration. Matches design spec section 3.2 FecTrackConfig. */
|
|
11
23
|
export interface FecTrackConfig {
|
|
12
24
|
/** Codec string, e.g. 'avc1.64001f', 'mp4a.40.2' */
|
|
@@ -26,39 +38,58 @@ export interface FecTrackConfig {
|
|
|
26
38
|
sampleRate?: number;
|
|
27
39
|
/** FEC algorithm identifier: 'raptor', 'reed-solomon', 'none' */
|
|
28
40
|
algorithm: string;
|
|
29
|
-
/**
|
|
41
|
+
/** Block profile; the Worker refuses to configure without a known token. */
|
|
42
|
+
blockProfile: FecBlockProfile;
|
|
43
|
+
/** Source symbols per block (K). Under `iso-ssbg1-v1` the maximum SSB_length (kMax). */
|
|
30
44
|
k: number;
|
|
31
45
|
/** Repair symbols per block (P). NOT symbol size. */
|
|
32
46
|
repairCount: number;
|
|
33
47
|
/** Bytes per symbol */
|
|
34
48
|
symbolSize: number;
|
|
35
|
-
/**
|
|
49
|
+
/** Retained decoder horizon as a BLOCK COUNT, not D. `isRetiredSbn`
|
|
50
|
+
* retires blocks more than this many blocks behind the live SS_ID, by
|
|
51
|
+
* `isoBlocksBehind(SS_ID, live SS_ID, k)` (block-order.ts), the lower
|
|
52
|
+
* bound every ISO receiver layer shares, and `MmtFecDecoder::new`
|
|
53
|
+
* documents it as "the number of interleaved blocks".
|
|
54
|
+
* Never assign `deriveFecInterleaveDepth()` here — that returns media units
|
|
55
|
+
* per block, which is a different quantity (BLO-35597). */
|
|
36
56
|
interleaveDepth: number;
|
|
37
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Catalog interleave span in integer milliseconds. A positive value is the complete
|
|
59
|
+
* source-plus-repair span; zero represents an absent/zero catalog span and
|
|
60
|
+
* carries no elapsed-time deadline.
|
|
61
|
+
*/
|
|
38
62
|
interleaveMs: number;
|
|
39
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Positive cleanup budget. For a positive `interleaveMs` this is the
|
|
65
|
+
* catalog span plus its explicit reorder allowance. For zero it is a
|
|
66
|
+
* receiver-local bound only, never an inferred catalog deadline.
|
|
67
|
+
*/
|
|
40
68
|
deliveryWindowMs: number;
|
|
41
69
|
/** FEC encoding mode */
|
|
42
70
|
fecMode: "subframe" | "object";
|
|
43
71
|
/** MoQ repair track name (optional) */
|
|
44
72
|
repairTrack?: string;
|
|
45
|
-
/** Whether ALTA publisher auth is enabled (AUTH-01) */
|
|
46
|
-
altaEnabled: boolean;
|
|
47
73
|
/** Whether relay block signature verification is enabled (AUTH-01) */
|
|
48
74
|
relayBlockSigEnabled: boolean;
|
|
49
75
|
}
|
|
50
76
|
/** Per-block snapshot for live block visualization and stats. */
|
|
51
77
|
export interface FecBlockSnapshot {
|
|
52
|
-
/**
|
|
78
|
+
/** Block key: the block's SS_Start. */
|
|
53
79
|
sbn: number;
|
|
54
80
|
/** Current block state */
|
|
55
|
-
state: "collecting" | "complete" | "recovered" | "failed"
|
|
81
|
+
state: "collecting" | "complete" | "recovered" | "failed";
|
|
56
82
|
/** Number of source symbols received */
|
|
57
83
|
sourceReceived: number;
|
|
58
84
|
/** Number of repair symbols received */
|
|
59
85
|
repairReceived: number;
|
|
60
|
-
/**
|
|
86
|
+
/** Configured source-block geometry (K); under `iso-ssbg1-v1` the block's SSB_length. */
|
|
61
87
|
k: number;
|
|
88
|
+
/** Authored source symbols (SSB_length) once a repair symbol declared it.
|
|
89
|
+
* Under `iso-ssbg1-v1` a block is only known from a repair symbol, so it is
|
|
90
|
+
* always set — except on a cleanup tombstone for a block the Worker never
|
|
91
|
+
* saw, whose length nothing declared. */
|
|
92
|
+
ssbLength?: number;
|
|
62
93
|
/** Expected repair symbols (P) */
|
|
63
94
|
repairCount: number;
|
|
64
95
|
/** Timestamp of first symbol arrival (ms) */
|
|
@@ -67,10 +98,11 @@ export interface FecBlockSnapshot {
|
|
|
67
98
|
lastSymbolTs: number;
|
|
68
99
|
/** Timestamp when block completed (ms), undefined if not yet complete */
|
|
69
100
|
completedTs?: number;
|
|
70
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Cleanup timestamp (ms). It is the catalog completion deadline when
|
|
103
|
+
* `config.interleaveMs > 0`, and a local retention timestamp otherwise.
|
|
104
|
+
*/
|
|
71
105
|
deadlineTs: number;
|
|
72
|
-
/** Count of source symbols with valid ALTA signature (AUTH-02) */
|
|
73
|
-
altaVerified: number;
|
|
74
106
|
/** Relay block signature validity: true/false after verification, null if not yet verified (AUTH-02) */
|
|
75
107
|
relayBlockSigValid: boolean | null;
|
|
76
108
|
}
|
|
@@ -88,51 +120,17 @@ export interface FecTrackStats {
|
|
|
88
120
|
blocksRecovered: number;
|
|
89
121
|
/** Blocks that failed (unrecoverable) */
|
|
90
122
|
blocksFailed: number;
|
|
91
|
-
/** Frames replaced with green-fill */
|
|
92
|
-
greenFillFrames: number;
|
|
93
123
|
/** Recovery success rate 0-100 */
|
|
94
124
|
recoveryRate: number;
|
|
95
|
-
/** Packets with valid publisher ALTA signature */
|
|
96
|
-
altaVerified: number;
|
|
97
|
-
/** Packets with MAC / signature / hash-chain mismatch (tamper-confirmed) */
|
|
98
|
-
altaFailed: number;
|
|
99
|
-
/** Packets that couldn't be verified due to missing trailer / not-ready verifier /
|
|
100
|
-
* late-joiner bootstrap gap. Neither tamper nor error — just unverifiable. */
|
|
101
|
-
altaPending: number;
|
|
102
|
-
/** Deferred-queue entries evicted by cap (queue full). Separate counter so
|
|
103
|
-
* cap misconfiguration is distinguishable from natural bootstrap-gap noise. */
|
|
104
|
-
altaPendingEvictedCap: number;
|
|
105
|
-
/** Deferred-queue entries evicted by TTL (retry window expired). */
|
|
106
|
-
altaPendingEvictedTtl: number;
|
|
107
|
-
/** verifyDetached / parse threw an exception (WASM trap, OOM, unmarshal panic).
|
|
108
|
-
* Not counted as altaFailed because the cause isn't crypto — helps ops
|
|
109
|
-
* distinguish infrastructure flake from tamper. */
|
|
110
|
-
altaError: number;
|
|
111
|
-
/** True if ALTA was enabled at configure time but the verifier WASM init
|
|
112
|
-
* failed. Ops alerting should treat this as "ALTA disabled due to error",
|
|
113
|
-
* distinct from "ALTA disabled by config" (altaEnabled flag not present). */
|
|
114
|
-
altaInitFailed: boolean;
|
|
115
|
-
/** Diagnostic: last ≤16 altaFailed events with full context (seq, error
|
|
116
|
-
* string from the verifier, auth+payload lengths, and which code path
|
|
117
|
-
* raised the failure). Bounded so it can't blow memory. Intended for
|
|
118
|
-
* investigation — not a stable API; consumers should treat it as
|
|
119
|
-
* opt-in and defensive (may be undefined). */
|
|
120
|
-
altaFailedDetails?: Array<{
|
|
121
|
-
seq: number;
|
|
122
|
-
error: string;
|
|
123
|
-
authLen: number;
|
|
124
|
-
payloadLen: number;
|
|
125
|
-
path: string;
|
|
126
|
-
}>;
|
|
127
125
|
/** Blocks with valid relay signature */
|
|
128
126
|
relayBlocksVerified: number;
|
|
129
127
|
/** Blocks with invalid relay signature */
|
|
130
128
|
relayBlocksFailed: number;
|
|
131
|
-
/**
|
|
129
|
+
/** Live media position: the newest accepted SS_ID / SS_Start. */
|
|
132
130
|
liveSbn: number;
|
|
133
131
|
/** Active block snapshots */
|
|
134
132
|
blocks: FecBlockSnapshot[];
|
|
135
|
-
/** Number of blocks in the
|
|
133
|
+
/** Number of blocks in the FEC block span */
|
|
136
134
|
interleaveWindowBlocks: number;
|
|
137
135
|
/** Average recovery latency (ms) */
|
|
138
136
|
avgRecoveryMs: number;
|
|
@@ -140,6 +138,52 @@ export interface FecTrackStats {
|
|
|
140
138
|
maxRecoveryMs: number;
|
|
141
139
|
/** Repair symbols rejected before WASM because their byte length did not match T. */
|
|
142
140
|
repairSymbolSizeMismatch?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Source symbols whose SBN had already fallen below the retained window.
|
|
143
|
+
*
|
|
144
|
+
* This and its two peers below are dropped before WASM and narrow the
|
|
145
|
+
* explanations for a block that settles at K-1 source symbols (BLO-35597
|
|
146
|
+
* defect 2): a late symbol past retention, a symbol for a block that had
|
|
147
|
+
* already settled (complete, recovered *or failed*), or a repeated
|
|
148
|
+
* (SBN, ESI).
|
|
149
|
+
*
|
|
150
|
+
* They narrow; they do not uniquely attribute. A symbol lost in transit
|
|
151
|
+
* never reaches the worker and increments nothing, so all three reading
|
|
152
|
+
* zero on a short block means only that no *receiver-side* drop was
|
|
153
|
+
* recorded — wire loss and a short authored block both remain open. Use
|
|
154
|
+
* `FecBlockSnapshot.ssbLength` to separate them: below `k` is a genuinely
|
|
155
|
+
* short authored block, equal to `k` with fewer accepted is loss-or-late.
|
|
156
|
+
* `ssbLength` is undefined until a repair symbol declares it, in which case
|
|
157
|
+
* both stay open.
|
|
158
|
+
*
|
|
159
|
+
* All three are cumulative across decoder epochs: `configure` clears block
|
|
160
|
+
* tracking but none of them, so they stay comparable against the
|
|
161
|
+
* `sourceSymbols` denominator. Only a reset zeroes them.
|
|
162
|
+
*/
|
|
163
|
+
sourceDroppedRetired?: number;
|
|
164
|
+
/** Source symbols for a block that had already completed, recovered or failed. */
|
|
165
|
+
sourceDroppedTerminal?: number;
|
|
166
|
+
/**
|
|
167
|
+
* Source symbols repeating an (SBN, ESI) already accepted in the current
|
|
168
|
+
* epoch; `configure` clears the accepted-ESI sets.
|
|
169
|
+
*
|
|
170
|
+
* Unlike the other two, this one cannot fire once a block settles — the
|
|
171
|
+
* terminal check returns first, and marking a block terminal retires its
|
|
172
|
+
* accepted-ESI set anyway — so a non-zero value means the repeat reached
|
|
173
|
+
* the worker while the block was **still collecting**. It attributes the
|
|
174
|
+
* timing, not the origin: usually a duplicate packet on the wire,
|
|
175
|
+
* sometimes an SBN/ESI derivation collision.
|
|
176
|
+
*/
|
|
177
|
+
sourceDroppedDuplicate?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Accepted source symbols whose block never became known (no repair
|
|
180
|
+
* symbol named a range containing them) before their SS_ID fell behind
|
|
181
|
+
* the retained horizon. They were already fed to the decoder and routed
|
|
182
|
+
* directly; this counts the bookkeeping retired with them, i.e. evidence
|
|
183
|
+
* that a block's repair symbols never arrived. The decoder retires its
|
|
184
|
+
* own copies by the same horizon inside `cleanup_by_ss_start`.
|
|
185
|
+
*/
|
|
186
|
+
sourceUnplacedRetired: number;
|
|
143
187
|
/** Native decoder counters, converted to numbers so browser diagnostics remain JSON-safe. */
|
|
144
188
|
decoder?: {
|
|
145
189
|
sourcePackets: number;
|
|
@@ -152,64 +196,70 @@ export interface FecTrackStats {
|
|
|
152
196
|
};
|
|
153
197
|
}
|
|
154
198
|
/** Stable identities for Worker failures whose message text contains live values. */
|
|
155
|
-
export type FecWorkerErrorCode = "recovered-symbol-size-unconfigured" | "recovered-block-too-short" | "
|
|
199
|
+
export type FecWorkerErrorCode = "recovered-symbol-size-unconfigured" | "recovered-block-too-short" | "recovered-symbol-ssb-length-invalid" | "repair-symbol-size-mismatch" | "repair-ssb-length-conflict"
|
|
200
|
+
/** `iso-ssbg1-v1`: a repair's `[SS_Start, SS_Start + SSB_length)` overlaps a different known block. */
|
|
201
|
+
| "repair-block-overlap"
|
|
202
|
+
/** `iso-ssbg1-v1`: a recovered symbol's ssbg_mode1 length field exceeds T-2 or its padding is non-zero. */
|
|
203
|
+
| "recovered-ssbg1-symbol-invalid"
|
|
204
|
+
/** `iso-ssbg1-v1`: the decoder returned a recovered block for a source the Worker could not place in a known block. */
|
|
205
|
+
| "recovered-block-unplaced" | "reset-failed" | "unknown-command" | "command-failed" | "worker-runtime" | "worker-message";
|
|
156
206
|
/** Per-frame metadata emitted with frame events from Worker. */
|
|
157
207
|
export interface FrameMeta {
|
|
158
|
-
/** ALTA verification result: true/false after check, null when ALTA not configured (AUTH-04) */
|
|
159
|
-
altaVerified: boolean | null;
|
|
160
208
|
/** Whether this frame was recovered via FEC (not received directly) */
|
|
161
209
|
recovered: boolean;
|
|
162
|
-
/**
|
|
210
|
+
/** Block key this frame belongs to: the block's SS_Start */
|
|
163
211
|
sbn: number;
|
|
164
|
-
/** Encoding Symbol ID within the recovered source block (0..
|
|
212
|
+
/** Encoding Symbol ID within the recovered source block (0..ssbLength-1).
|
|
213
|
+
* Under `iso-ssbg1-v1` a recovered frame is the full T-byte ssbg_mode1
|
|
214
|
+
* symbol (length field, packet, zero padding); the Worker validates but
|
|
215
|
+
* never trims it. */
|
|
165
216
|
esi?: number;
|
|
217
|
+
/**
|
|
218
|
+
* Authored source-symbol count of the recovered block (the repair
|
|
219
|
+
* symbols' SSB_length, 1..K). Recovered frames are ESI 0..ssbLength-1;
|
|
220
|
+
* ESIs ssbLength..K-1 are encoder zero padding and are never emitted.
|
|
221
|
+
*/
|
|
222
|
+
ssbLength?: number;
|
|
166
223
|
}
|
|
167
224
|
/** Discriminated union of all commands sent from main thread to Worker. */
|
|
168
225
|
export type FecWorkerCommand = {
|
|
169
226
|
type: "configure";
|
|
170
227
|
config: FecTrackConfig;
|
|
171
228
|
wasmModule: WebAssembly.Module;
|
|
172
|
-
/**
|
|
173
|
-
* ALTA public key as PKCS#8 SubjectPublicKeyInfo DER bytes (self-describing).
|
|
174
|
-
* Algorithm (Ed25519 or ECDSA P-256) is auto-detected from the SPKI OID.
|
|
175
|
-
* Ed25519 SPKI is 44 bytes; P-256 uncompressed is 91 bytes.
|
|
176
|
-
*/
|
|
177
|
-
altaPublicKey?: ArrayBuffer;
|
|
178
|
-
/** Pre-compiled ALTA WASM module. Structured-cloneable (NOT transferable) — do not add to transfer list. */
|
|
179
|
-
altaWasmModule?: WebAssembly.Module;
|
|
180
229
|
} | {
|
|
181
230
|
type: "feedSource";
|
|
182
231
|
/** Flat 32-bit Source Symbol ID from the MMTP Source FEC Payload ID
|
|
183
|
-
* (ISO 23008-1 §C.5.2).
|
|
184
|
-
* and
|
|
232
|
+
* (ISO 23008-1 §C.5.2). SS_IDs are consecutive per source packet mod
|
|
233
|
+
* 2^32 and the block comes from a repair's range — do NOT
|
|
234
|
+
* pre-compute a block. */
|
|
185
235
|
ssId: number;
|
|
236
|
+
/** The protected packet exactly, unpadded and without its SS_ID (at
|
|
237
|
+
* most T-2 bytes). */
|
|
186
238
|
data: ArrayBuffer;
|
|
187
239
|
ts: number;
|
|
188
|
-
/** Optional ALTA authenticator bytes (detached mode — 08-07 MMTP
|
|
189
|
-
* trailer). Present when the source packet carried a
|
|
190
|
-
* `[0xF0A1][len][auth]` trailer and ALTA is enabled at the worker.
|
|
191
|
-
* When omitted, the worker skips verification and the packet
|
|
192
|
-
* counts as `altaPending`. */
|
|
193
|
-
altaAuth?: ArrayBuffer;
|
|
194
|
-
/** Byte offset within `data` where the signed MMTP payload ends
|
|
195
|
-
* (== where the trailer began on the wire). Required when
|
|
196
|
-
* `altaAuth` is present. Worker constructs
|
|
197
|
-
* `payload = new Uint8Array(data, 0, altaPayloadEnd)` for
|
|
198
|
-
* `verifyDetached(altaAuth, payload)`. */
|
|
199
|
-
altaPayloadEnd?: number;
|
|
200
240
|
} | {
|
|
201
241
|
type: "feedRepair";
|
|
202
|
-
/** SS_Start: SS_ID of the first source symbol in the block
|
|
203
|
-
*
|
|
204
|
-
*
|
|
242
|
+
/** SS_Start: SS_ID of the first source symbol in the block, from the
|
|
243
|
+
* MMTP Repair FEC Payload ID (ISO 23008-1 §C.5.3): any uint32; the
|
|
244
|
+
* block key. */
|
|
205
245
|
ssStart: number;
|
|
206
|
-
/**
|
|
246
|
+
/** Authored source-symbol count for this block; 1..configured K. */
|
|
207
247
|
ssbLength: number;
|
|
208
|
-
/** RS_ID: repair symbol index within the block; WASM maps to
|
|
209
|
-
*
|
|
248
|
+
/** RS_ID: repair symbol index within the block; WASM maps to repair
|
|
249
|
+
* ESI = SSB_length + RS_ID. */
|
|
210
250
|
rsId: number;
|
|
211
251
|
data: ArrayBuffer;
|
|
212
252
|
ts: number;
|
|
253
|
+
} | {
|
|
254
|
+
/**
|
|
255
|
+
* Every source and repair symbol the page fed in one task, in feed
|
|
256
|
+
* order, sharing one transfer list. The client sends symbols this
|
|
257
|
+
* way instead of one message per symbol (BLO-36599); the Worker
|
|
258
|
+
* handles each record exactly like the single-symbol command of the
|
|
259
|
+
* same `type`, and a record that fails does not stop the others.
|
|
260
|
+
*/
|
|
261
|
+
type: "feedSymbols";
|
|
262
|
+
symbols: FecSymbolCommand[];
|
|
213
263
|
} | {
|
|
214
264
|
type: "relayBlockSig";
|
|
215
265
|
sbn: number;
|
|
@@ -217,13 +267,29 @@ export type FecWorkerCommand = {
|
|
|
217
267
|
hash: ArrayBuffer;
|
|
218
268
|
} | {
|
|
219
269
|
type: "cleanup";
|
|
220
|
-
/** Every timed-out block covered by this coalesced queue-drain barrier
|
|
270
|
+
/** Every timed-out block covered by this coalesced queue-drain barrier,
|
|
271
|
+
* by block key (SS_Start). */
|
|
221
272
|
sbns: number[];
|
|
222
273
|
} | {
|
|
223
274
|
type: "reset";
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Ask the Worker to post a blockUpdate on every block transition. Without
|
|
278
|
+
* it the Worker posts none: each one is a structured clone and a task on
|
|
279
|
+
* the page thread, and the player does not consume them (BLO-36599).
|
|
280
|
+
* Sent only to a Worker that announced it in `capabilities`.
|
|
281
|
+
*/
|
|
282
|
+
| {
|
|
283
|
+
type: "subscribeBlockUpdates";
|
|
224
284
|
} | {
|
|
225
285
|
type: "dispose";
|
|
226
286
|
};
|
|
287
|
+
/** One symbol record of a `feedSymbols` batch. */
|
|
288
|
+
export type FecSymbolCommand = Extract<FecWorkerCommand, {
|
|
289
|
+
type: "feedSource";
|
|
290
|
+
} | {
|
|
291
|
+
type: "feedRepair";
|
|
292
|
+
}>;
|
|
227
293
|
/** Discriminated union of all events emitted from Worker to main thread. */
|
|
228
294
|
export type FecWorkerEvent = {
|
|
229
295
|
type: "frame";
|
|
@@ -235,18 +301,26 @@ export type FecWorkerEvent = {
|
|
|
235
301
|
} | {
|
|
236
302
|
type: "blockUpdate";
|
|
237
303
|
block: FecBlockSnapshot;
|
|
238
|
-
} | {
|
|
239
|
-
type: "greenFill";
|
|
240
|
-
sbn: number;
|
|
241
|
-
data: ArrayBuffer;
|
|
242
304
|
} | {
|
|
243
305
|
type: "cleanupComplete";
|
|
244
306
|
sbns: number[];
|
|
245
307
|
} | {
|
|
246
308
|
type: "resetComplete";
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Optional commands this Worker accepts, posted once it is configured.
|
|
312
|
+
* The client uses `feedSymbols` only after the Worker names it, so a page
|
|
313
|
+
* that meets an older cached Worker bundle keeps sending one command per
|
|
314
|
+
* symbol instead of a batch that Worker would reject (BLO-36599).
|
|
315
|
+
*/
|
|
316
|
+
| {
|
|
317
|
+
type: "capabilities";
|
|
318
|
+
commands: FecWorkerOptionalCommand[];
|
|
247
319
|
} | {
|
|
248
320
|
type: "error";
|
|
249
321
|
message: string;
|
|
250
322
|
code?: FecWorkerErrorCode;
|
|
251
323
|
};
|
|
324
|
+
/** Commands a client may send only after the Worker announced them. */
|
|
325
|
+
export type FecWorkerOptionalCommand = "feedSymbols" | "subscribeBlockUpdates";
|
|
252
326
|
//# sourceMappingURL=fec-worker-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fec-worker-types.d.ts","sourceRoot":"","sources":["../src/fec-worker-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC9B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,2CAA2C;IAC3C,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"fec-worker-types.d.ts","sourceRoot":"","sources":["../src/fec-worker-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC;AAE7C,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC9B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,2CAA2C;IAC3C,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,0CAA0C;IAC1C,SAAS,CAAC,EAAE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
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @blockcast/fec-worker — Shared Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Defines the Worker message protocol (commands/events), FecTrackStats shape
|
|
5
|
-
* consumed by fec-panel (Phase 5) and CmcdProducer (Phase 6), and
|
|
6
|
-
*
|
|
5
|
+
* consumed by fec-panel (Phase 5) and CmcdProducer (Phase 6), and the relay
|
|
6
|
+
* block signature stub.
|
|
7
7
|
*
|
|
8
8
|
* Types here are importable from both main thread and Worker contexts.
|
|
9
9
|
*/
|