@flaxia/node 0.5.0 → 0.6.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 (54) hide show
  1. package/dist/assets/ai-inference.js +288 -86
  2. package/dist/assets/transformers.web.js +2 -2
  3. package/dist/assets/vector-embed.js +1 -1
  4. package/dist/assets/webgpuProbe.js +365 -0
  5. package/dist/client/SignalingClient.d.ts.map +1 -1
  6. package/dist/client/__tests__/light-preloader.test.d.ts +2 -0
  7. package/dist/client/__tests__/light-preloader.test.d.ts.map +1 -0
  8. package/dist/client/__tests__/mobile-lifecycle.test.d.ts +2 -0
  9. package/dist/client/__tests__/mobile-lifecycle.test.d.ts.map +1 -0
  10. package/dist/client/light-preloader.d.ts +47 -0
  11. package/dist/client/light-preloader.d.ts.map +1 -0
  12. package/dist/client/mobile-lifecycle.d.ts +20 -0
  13. package/dist/client/mobile-lifecycle.d.ts.map +1 -0
  14. package/dist/executor/WorkerPool.d.ts +7 -1
  15. package/dist/executor/WorkerPool.d.ts.map +1 -1
  16. package/dist/executor/__tests__/resourceReporter.test.d.ts +2 -0
  17. package/dist/executor/__tests__/resourceReporter.test.d.ts.map +1 -0
  18. package/dist/executor/memoryProbe.d.ts +5 -0
  19. package/dist/executor/memoryProbe.d.ts.map +1 -1
  20. package/dist/executor/resourceReporter.d.ts +15 -0
  21. package/dist/executor/resourceReporter.d.ts.map +1 -0
  22. package/dist/executor/webgpuProbe.d.ts +16 -5
  23. package/dist/executor/webgpuProbe.d.ts.map +1 -1
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1093 -354
  27. package/dist/swarm/__tests__/peer-quality.test.d.ts +2 -0
  28. package/dist/swarm/__tests__/peer-quality.test.d.ts.map +1 -0
  29. package/dist/swarm/__tests__/peer-transport.test.d.ts +2 -0
  30. package/dist/swarm/__tests__/peer-transport.test.d.ts.map +1 -0
  31. package/dist/swarm/adapter.d.ts +1 -1
  32. package/dist/swarm/adapter.d.ts.map +1 -1
  33. package/dist/swarm/controller.d.ts +4 -0
  34. package/dist/swarm/controller.d.ts.map +1 -1
  35. package/dist/swarm/messages.d.ts +2 -2
  36. package/dist/swarm/messages.d.ts.map +1 -1
  37. package/dist/swarm/peer-quality.d.ts +14 -0
  38. package/dist/swarm/peer-quality.d.ts.map +1 -0
  39. package/dist/swarm/peer-transport.d.ts +81 -0
  40. package/dist/swarm/peer-transport.d.ts.map +1 -0
  41. package/dist/swarm/runtime.d.ts +5 -1
  42. package/dist/swarm/runtime.d.ts.map +1 -1
  43. package/dist/swarm-engine.js +39 -20
  44. package/dist/worker.js +317 -185
  45. package/dist/workloads/__tests__/model-pipeline-cache.test.d.ts +2 -0
  46. package/dist/workloads/__tests__/model-pipeline-cache.test.d.ts.map +1 -0
  47. package/dist/workloads/ai-inference.d.ts +27 -0
  48. package/dist/workloads/ai-inference.d.ts.map +1 -1
  49. package/dist/workloads/ai-model-registry.d.ts +6 -0
  50. package/dist/workloads/ai-model-registry.d.ts.map +1 -1
  51. package/dist/workloads/model-pipeline-cache.d.ts +48 -0
  52. package/dist/workloads/model-pipeline-cache.d.ts.map +1 -0
  53. package/package.json +2 -2
  54. package/dist/assets/dist.js +0 -209
@@ -0,0 +1,365 @@
1
+ //#region ../sdk/dist/index.js
2
+ var e = class extends Error {
3
+ constructor(e, t, n) {
4
+ super(e), this.message = e, this.code = t, this.status = n, this.name = "FlaxiaError";
5
+ }
6
+ }, t = class extends e {
7
+ constructor(e = "On-device model not available", t) {
8
+ super(t ? `${e}: ${t}` : e, "ONDEVICE_UNAVAILABLE", 500), t && (this.detail = t);
9
+ }
10
+ }, n = "flaxia-node-v1", r = "bearer.";
11
+ function i(e) {
12
+ return [n, `${r}${e}`];
13
+ }
14
+ function a(e, t, n = {}) {
15
+ let r = e.replace(/\/+$/, "").replace(/^http/, "ws"), i = new URL(`${r}${t.startsWith("/") ? t : `/${t}`}`);
16
+ for (let [e, t] of Object.entries(n)) t !== void 0 && i.searchParams.set(e, String(t));
17
+ return i.toString();
18
+ }
19
+ var o = 6e4;
20
+ function s(e, t) {
21
+ if (t.length === 0) return [];
22
+ if (!Number.isInteger(e) || e < 1) throw Error(`layers must be a positive integer, got ${e}`);
23
+ let n = Math.min(t.length, e), r = t.slice(0, n).map((e) => Number.isFinite(e) && e > 0 ? e : 0), i = r.reduce((e, t) => e + t, 0) || 1, a = r.map((t) => Math.max(1, Math.floor(e * t / i))), o = a.reduce((e, t) => e + t, 0);
24
+ for (; o > e;) {
25
+ let e = 0;
26
+ for (let t = 1; t < n; t++) a[t] > a[e] && (e = t);
27
+ if (a[e] <= 1) break;
28
+ a[e]--, o--;
29
+ }
30
+ let s = r.map((t, n) => ({
31
+ i: n,
32
+ f: e * t / i - Math.floor(e * t / i)
33
+ })).sort((e, t) => t.f - e.f), c = 0;
34
+ for (; o < e;) a[s[c % n].i]++, o++, c++;
35
+ return a;
36
+ }
37
+ function c(e) {
38
+ let t = s(e.layers, e.nodes.map((e) => e.capacity)), n = [], r = 0;
39
+ for (let i = 0; i < t.length; i++) {
40
+ let a = r + t[i], o = i === 0 ? "host" : "worker", s = {
41
+ start: r,
42
+ end: a,
43
+ hasEmbed: i === 0,
44
+ hasHead: i === 0
45
+ };
46
+ n.push({
47
+ nodeId: e.nodes[i].nodeId,
48
+ role: o,
49
+ slice: s
50
+ }), r = a;
51
+ }
52
+ return {
53
+ sessionId: e.sessionId,
54
+ taskId: e.taskId,
55
+ model: e.model,
56
+ layers: e.layers,
57
+ chain: n
58
+ };
59
+ }
60
+ var l = 21335, u = 0, d = 1, f = 8 * 1024 * 1024;
61
+ function p(e, t, n) {
62
+ let r = new TextEncoder().encode(e);
63
+ if (!r.length || r.length > 256) throw Error("swarm session id length is invalid");
64
+ let i = n ?? new Uint8Array();
65
+ if (i.byteLength !== 0 && i.byteLength !== 16) throw Error("swarm envelope MAC length is invalid");
66
+ let a = 4 + r.length + 1 + i.byteLength;
67
+ if (a + t.byteLength > 8388608) throw Error(`swarm envelope exceeds ${f} bytes`);
68
+ let o = new ArrayBuffer(a + t.byteLength), s = new DataView(o);
69
+ return s.setUint32(0, r.length, !0), new Uint8Array(o, 4, r.length).set(r), s.setUint8(4 + r.length, i.byteLength), i.byteLength && new Uint8Array(o, 4 + r.length + 1, i.byteLength).set(i), new Uint8Array(o, a).set(new Uint8Array(t)), o;
70
+ }
71
+ function m(e) {
72
+ if (e.byteLength < 5 || e.byteLength > 8388608) return null;
73
+ let t = new DataView(e), n = t.getUint32(0, !0);
74
+ if (!n || n > 256) return null;
75
+ let r = 4 + n;
76
+ if (e.byteLength < r + 1) return null;
77
+ let i = t.getUint8(r);
78
+ if (i !== 0 && i !== 16) return null;
79
+ let a = r + 1 + i;
80
+ return e.byteLength < a + 16 ? null : {
81
+ sessionId: new TextDecoder().decode(new Uint8Array(e, 4, n)),
82
+ mac: i ? new Uint8Array(e, r + 1, i) : null,
83
+ frame: e.slice(a)
84
+ };
85
+ }
86
+ async function h(e, t, n) {
87
+ let r = await crypto.subtle.importKey("raw", new TextEncoder().encode(e), {
88
+ name: "HMAC",
89
+ hash: "SHA-256"
90
+ }, !1, ["sign"]), i = await crypto.subtle.sign("HMAC", r, p(t, n));
91
+ return new Uint8Array(i).slice(0, 16);
92
+ }
93
+ async function ee(e, t, n) {
94
+ return p(t, n, await h(e, t, n));
95
+ }
96
+ async function g(e, t, n, r) {
97
+ if (r.byteLength !== 16) return !1;
98
+ let i = await h(e, t, n), a = 0;
99
+ for (let e = 0; e < i.byteLength; e++) a |= i[e] ^ r[e];
100
+ return a === 0;
101
+ }
102
+ function _(e, t) {
103
+ let n = new ArrayBuffer(16 + t.byteLength), r = new DataView(n);
104
+ return r.setUint16(0, l, !0), r.setUint8(2, u), r.setUint8(3, 0), r.setUint32(4, e.requestId >>> 0, !0), r.setUint32(8, e.pos >>> 0, !0), r.setUint16(12, e.tokens, !0), r.setUint16(14, 0, !0), new Uint8Array(n, 16).set(t), n;
105
+ }
106
+ function te(e = 0) {
107
+ let t = /* @__PURE__ */ new ArrayBuffer(16), n = new DataView(t);
108
+ return n.setUint16(0, l, !0), n.setUint8(2, d), n.setUint8(3, 0), n.setUint32(4, e >>> 0, !0), t;
109
+ }
110
+ function v(e) {
111
+ if (e.byteLength !== 16) return !1;
112
+ let t = new DataView(e);
113
+ return t.getUint16(0, !0) === 21335 && t.getUint8(2) === d && t.getUint8(3) === 0 && t.getUint32(8, !0) === 0 && t.getUint16(12, !0) === 0 && t.getUint16(14, !0) === 0;
114
+ }
115
+ function ne(e) {
116
+ if (e.byteLength < 16) return null;
117
+ let t = new DataView(e);
118
+ return t.getUint16(0, !0) !== 21335 || t.getUint8(2) !== u ? null : {
119
+ header: {
120
+ requestId: t.getUint32(4, !0),
121
+ pos: t.getUint32(8, !0),
122
+ tokens: t.getUint16(12, !0)
123
+ },
124
+ payload: new Uint8Array(e, 16)
125
+ };
126
+ }
127
+ function re(e) {
128
+ if (!b(e)) return !1;
129
+ if (e.kind === "description") {
130
+ let t = e.description;
131
+ return b(t) && (t.type === "offer" || t.type === "answer") && typeof t.sdp == "string" && t.sdp.length > 0 && t.sdp.length <= 24576;
132
+ }
133
+ if (e.kind === "candidate") {
134
+ let t = e.candidate;
135
+ return t === null ? !0 : b(t) && typeof t.candidate == "string" && t.candidate.length > 0 && t.candidate.length <= 4096 && (t.sdpMid === void 0 || t.sdpMid === null || typeof t.sdpMid == "string" && t.sdpMid.length <= 128) && (t.sdpMLineIndex === void 0 || t.sdpMLineIndex === null || typeof t.sdpMLineIndex == "number" && Number.isInteger(t.sdpMLineIndex) && t.sdpMLineIndex >= 0 && t.sdpMLineIndex <= 255) && (t.usernameFragment === void 0 || t.usernameFragment === null || typeof t.usernameFragment == "string" && t.usernameFragment.length <= 256);
136
+ }
137
+ return !1;
138
+ }
139
+ function y(e) {
140
+ if (!b(e) || e.type !== "swarm-peer-signal" || !re(e.signal)) return !1;
141
+ try {
142
+ if (new TextEncoder().encode(JSON.stringify(e.signal)).byteLength > 32768) return !1;
143
+ } catch {
144
+ return !1;
145
+ }
146
+ return typeof e.taskId == "string" && e.taskId.length > 0 && e.taskId.length <= 128 && typeof e.sessionId == "string" && e.sessionId.length > 0 && e.sessionId.length <= 128 && typeof e.attemptId == "string" && e.attemptId.length > 0 && e.attemptId.length <= 128 && typeof e.toNodeId == "string" && e.toNodeId.length > 0 && e.toNodeId.length <= 128 && (e.fromNodeId === void 0 || typeof e.fromNodeId == "string" && e.fromNodeId.length > 0 && e.fromNodeId.length <= 128);
147
+ }
148
+ function b(e) {
149
+ return typeof e == "object" && !!e;
150
+ }
151
+ function x(e) {
152
+ return typeof e == "number" && Number.isInteger(e) && e >= 0;
153
+ }
154
+ function S(e, t = {}) {
155
+ let n = t.maxLayers ?? 1024, r = t.maxSliceLayers ?? 256;
156
+ return !(!C(e) || !x(e.start) || !x(e.end) || e.end <= e.start || e.end - e.start > r || e.end > n);
157
+ }
158
+ function C(e) {
159
+ return b(e) ? typeof e.start == "number" && typeof e.end == "number" && typeof e.hasEmbed == "boolean" && typeof e.hasHead == "boolean" : !1;
160
+ }
161
+ function ie(e) {
162
+ return b(e) ? typeof e.nodeId == "string" && e.nodeId.length > 0 && typeof e.capacity == "number" : !1;
163
+ }
164
+ function w(e) {
165
+ return e === void 0 || typeof e == "string" && e.length > 0 && e.length <= 128;
166
+ }
167
+ function ae(e) {
168
+ return !b(e) || e.type !== "swarm-init" || typeof e.sessionId != "string" || !e.sessionId || typeof e.taskId != "string" || !e.taskId || typeof e.model != "string" || typeof e.timeoutMs != "number" || !Array.isArray(e.members) || e.members.length === 0 || e.members.length > 16 || typeof e.prompt != "string" && !Array.isArray(e.prompt) ? !1 : e.members.every(ie);
169
+ }
170
+ function oe(e) {
171
+ return !(!b(e) || e.type !== "swarm-slice" || typeof e.sessionId != "string" || !e.sessionId || typeof e.taskId != "string" || !e.taskId || typeof e.model != "string" || !e.model || typeof e.timeoutMs != "number" || !x(e.index) || !x(e.chainLength) || e.chainLength < 1 || e.chainLength > 16 || e.index >= e.chainLength || e.role !== (e.index === 0 ? "host" : "worker") || !S(e.slice) || e.slice.hasEmbed !== (e.index === 0) || e.slice.hasHead !== (e.index === 0) || !w(e.inboundKey) || !w(e.outboundKey) || e.attemptId !== void 0 && (typeof e.attemptId != "string" || !e.attemptId || e.attemptId.length > 128) || e.previousNodeId !== void 0 && (typeof e.previousNodeId != "string" || !e.previousNodeId || e.previousNodeId.length > 128) || e.nextNodeId !== void 0 && (typeof e.nextNodeId != "string" || !e.nextNodeId || e.nextNodeId.length > 128));
172
+ }
173
+ function T(e) {
174
+ return !b(e) || e.type !== "swarm-start" ? !1 : typeof e.sessionId == "string" && !!e.sessionId && typeof e.taskId == "string" && !!e.taskId;
175
+ }
176
+ function E(e) {
177
+ return !b(e) || e.type !== "swarm-transport" ? !1 : typeof e.sessionId == "string" && !!e.sessionId && typeof e.taskId == "string" && !!e.taskId && (e.mode === "peer" || e.mode === "relay");
178
+ }
179
+ function D(e) {
180
+ return !b(e) || e.type !== "swarm-flow" ? !1 : typeof e.sessionId == "string" && !!e.sessionId && typeof e.taskId == "string" && !!e.taskId && typeof e.paused == "boolean" && (e.attemptId === void 0 || typeof e.attemptId == "string" && !!e.attemptId && e.attemptId.length <= 128);
181
+ }
182
+ function O(e) {
183
+ return !b(e) || e.type !== "swarm-error" ? !1 : typeof e.sessionId == "string" && !!e.sessionId && typeof e.taskId == "string" && !!e.taskId && typeof e.error == "string";
184
+ }
185
+ new Set([
186
+ "qwen3.5-2b",
187
+ "qwen3.8-27b",
188
+ "qwen3.6-35b-moe"
189
+ ]);
190
+ var k = new Set([
191
+ "ai-inference",
192
+ "image-process",
193
+ "container",
194
+ "vector-embed",
195
+ "vector-query",
196
+ "nudenet",
197
+ "swarm-inference"
198
+ ]), A = 9e4, j = 600 * 1e3, M = 1440 * 60 * 1e3, N = 6e4;
199
+ function P(e) {
200
+ return typeof e == "object" && !!e && !Array.isArray(e);
201
+ }
202
+ function F(e) {
203
+ if (!P(e) || typeof e.modelId != "string" || !e.modelId || e.modelId.length > 128 || typeof e.revision != "string" || !e.revision || e.revision.length > 128 || typeof e.dtype != "string" || !e.dtype || e.dtype.length > 32 || e.backend !== "wasm" && e.backend !== "cpu" && e.backend !== "webgpu" || e.state !== "loading" && e.state !== "ready" && e.state !== "evicting" && e.state !== "failed" || !Number.isInteger(e.referenceCount) || e.referenceCount < 0 || e.referenceCount > 64) return !1;
204
+ if (e.layerRange === void 0) return !0;
205
+ let t = e.layerRange;
206
+ return Array.isArray(t) && t.length === 2 && Number.isInteger(t[0]) && Number.isInteger(t[1]) && t[0] >= 0 && t[1] > t[0] && t[1] <= 1024;
207
+ }
208
+ function I(e, t = Date.now()) {
209
+ if (!P(e) || e.version !== 1 || !Number.isSafeInteger(e.sampledAt) || !Number.isSafeInteger(e.expiresAt) || !Array.isArray(e.entries) || e.entries.length > 8 || !e.entries.every(F)) return !1;
210
+ let n = e.sampledAt, r = e.expiresAt;
211
+ return n <= t + 5e3 && n >= t - 6e4 && r > t && r > n && r - n <= 6e4;
212
+ }
213
+ //#endregion
214
+ //#region src/executor/memoryProbe.ts
215
+ var L = 2 * 1024 ** 3, R = 65536, z = 16 * 1024 * 1024, B = 4096, V = null, H = 0;
216
+ function U(e, t) {
217
+ let n = Math.ceil(t / R);
218
+ try {
219
+ e.grow(n);
220
+ } catch {
221
+ return !1;
222
+ }
223
+ let r = new Uint8Array(e.buffer);
224
+ for (let e = 0; e < n; e++) r[e * R] = 0;
225
+ return !0;
226
+ }
227
+ function W(e = L, t = z) {
228
+ if (V) return V.bytes;
229
+ H++;
230
+ let n = Date.now(), r;
231
+ try {
232
+ r = new WebAssembly.Memory({ initial: 0 });
233
+ } catch {
234
+ return V = {
235
+ bytes: 0,
236
+ sampledAt: n,
237
+ measured: !1
238
+ }, 0;
239
+ }
240
+ let i = Math.max(0, Math.floor(e)), a = Math.max(R, Math.floor(t)), o = 0, s = 0;
241
+ for (; o < i && s < B;) {
242
+ let e = Math.min(a, i - o);
243
+ if (!U(r, e)) break;
244
+ o += e, s++;
245
+ }
246
+ return r = void 0, V = {
247
+ bytes: o,
248
+ sampledAt: n,
249
+ measured: !0
250
+ }, o;
251
+ }
252
+ function G() {
253
+ return V ? V.bytes : W();
254
+ }
255
+ function K() {
256
+ return V || W(), {
257
+ bytes: V?.measured ? V.bytes : null,
258
+ sampledAt: V?.sampledAt ?? null
259
+ };
260
+ }
261
+ function q() {
262
+ return G() >= L;
263
+ }
264
+ //#endregion
265
+ //#region src/executor/webgpuProbe.ts
266
+ var se = 3, ce = 750, J = 1500, Y = 600 * 1e3;
267
+ async function X(e, t) {
268
+ let n, r = new Promise((e) => {
269
+ n = setTimeout(() => e({
270
+ value: null,
271
+ timedOut: !0
272
+ }), t);
273
+ });
274
+ try {
275
+ return await Promise.race([e.then((e) => ({
276
+ value: e,
277
+ timedOut: !1
278
+ })), r]);
279
+ } finally {
280
+ n !== void 0 && clearTimeout(n);
281
+ }
282
+ }
283
+ function Z(e, t = Date.now()) {
284
+ return {
285
+ capabilities: { webgpu: !1 },
286
+ status: e,
287
+ sampledAt: t,
288
+ expiresAt: t + Y,
289
+ architecture: null,
290
+ maxStorageBufferBindingSize: null,
291
+ computeCompletionMs: null,
292
+ sampleCount: 0
293
+ };
294
+ }
295
+ function Q() {
296
+ return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
297
+ }
298
+ async function le(e) {
299
+ let t, n = new Promise((e) => {
300
+ t = setTimeout(() => e("timeout"), ce);
301
+ }), r = e.queue.onSubmittedWorkDone().then(() => "complete"), i = e.lost.then(() => "lost", () => "lost");
302
+ try {
303
+ return await Promise.race([
304
+ r,
305
+ i,
306
+ n
307
+ ]);
308
+ } finally {
309
+ t !== void 0 && clearTimeout(t);
310
+ }
311
+ }
312
+ async function $() {
313
+ let e = Date.now(), t = navigator.gpu;
314
+ if (!t || typeof t.requestAdapter != "function") return Z("unsupported", e);
315
+ let n = null;
316
+ try {
317
+ let r = await X(t.requestAdapter({ powerPreference: "high-performance" }), J);
318
+ if (r.timedOut) return Z("unavailable", Date.now());
319
+ let i = r.value;
320
+ if (!i) return Z("unsupported", e);
321
+ let a = i.limits?.maxStorageBufferBindingSize, o = [i.info?.vendor, i.info?.architecture].filter((e) => typeof e == "string" && e.trim().length > 0).join(" ").trim().slice(0, 64), s = typeof a == "number" && Number.isFinite(a) && a > 0 ? Math.min(Math.floor(a), 16 * 1024 ** 3) : null, c = i.requestDevice(), l = await X(c, J);
322
+ if (l.timedOut) return c.then((e) => e.destroy()).catch(() => {}), Z("unavailable", Date.now());
323
+ n = l.value;
324
+ let u = n, d = u.createComputePipeline({
325
+ layout: "auto",
326
+ compute: {
327
+ module: u.createShaderModule({ code: "@compute @workgroup_size(1) fn main() {}" }),
328
+ entryPoint: "main"
329
+ }
330
+ }), f = [];
331
+ for (let e = 0; e < se; e++) {
332
+ let e = u.createCommandEncoder(), t = e.beginComputePass();
333
+ t.setPipeline(d), t.dispatchWorkgroups(1), t.end();
334
+ let n = e.finish(), r = Q();
335
+ u.queue.submit([n]);
336
+ let i = await le(u);
337
+ if (i === "lost") return Z("device-lost", Date.now());
338
+ if (i === "timeout") return Z("unavailable", Date.now());
339
+ f.push(Math.max(0, Q() - r));
340
+ }
341
+ f.sort((e, t) => e - t);
342
+ let p = f[Math.floor(f.length / 2)], m = { webgpu: !0 };
343
+ return o && (m.gpuArchitecture = o), s !== null && (m.maxStorageBufferBindingSize = s), {
344
+ capabilities: m,
345
+ status: "available",
346
+ sampledAt: Date.now(),
347
+ expiresAt: Date.now() + Y,
348
+ architecture: o || null,
349
+ maxStorageBufferBindingSize: s,
350
+ computeCompletionMs: p,
351
+ sampleCount: f.length
352
+ };
353
+ } catch {
354
+ return Z("unavailable", Date.now());
355
+ } finally {
356
+ try {
357
+ n?.destroy();
358
+ } catch {}
359
+ }
360
+ }
361
+ async function ue() {
362
+ return (await $()).capabilities;
363
+ }
364
+ //#endregion
365
+ export { i as A, a as C, y as D, t as E, v as F, I as M, o as N, O, te as P, e as S, ee as T, _, q as a, c as b, p as c, ae as d, j as f, M as g, k as h, K as i, m as j, E as k, oe as l, S as m, $ as n, W as o, T as p, L as r, D as s, ue as t, f as u, A as v, g as w, N as x, ne as y };
@@ -1 +1 @@
1
- {"version":3,"file":"SignalingClient.d.ts","sourceRoot":"","sources":["../../src/client/SignalingClient.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAgB,oBAAoB,EAAE,UAAU,EAAyB,YAAY,EAAE,MAAM,aAAa,CAAC;AAmBvH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6nBD,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,KAAG,oBAwDnD,CAAC"}
1
+ {"version":3,"file":"SignalingClient.d.ts","sourceRoot":"","sources":["../../src/client/SignalingClient.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAgB,oBAAoB,EAAE,UAAU,EAAyB,YAAY,EAAE,MAAM,aAAa,CAAC;AAqBvH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAg8BD,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,KAAG,oBAwDnD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=light-preloader.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light-preloader.test.d.ts","sourceRoot":"","sources":["../../../src/client/__tests__/light-preloader.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mobile-lifecycle.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-lifecycle.test.d.ts","sourceRoot":"","sources":["../../../src/client/__tests__/mobile-lifecycle.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ export interface LightPreloaderOptions {
2
+ /** Model id to keep warm. Defaults to the M2M100 translate model. */
3
+ model?: string;
4
+ task?: string;
5
+ dtype?: string;
6
+ onPreloaded?: () => void;
7
+ }
8
+ export type PreloadFn = (request: {
9
+ task: string;
10
+ model: string;
11
+ dtype: string;
12
+ }) => Promise<void>;
13
+ export type IsPreloadedFn = (model: string) => boolean;
14
+ /** Defaults mirror `LIGHT_INFERENCE_TRANSLATE_*` in `ai-inference.ts`. */
15
+ export declare const LIGHT_INFERENCE_TRANSLATE_MODEL = "Xenova/m2m100_418M";
16
+ export declare const LIGHT_INFERENCE_TRANSLATE_TASK = "translation";
17
+ export declare const LIGHT_INFERENCE_TRANSLATE_DTYPE = "q4f16";
18
+ /**
19
+ * Light Inference idle preloader.
20
+ *
21
+ * Keeps one small `ai-inference` model resident so a later `ondeviceOnly`
22
+ * task can serve instantly from this device. Runs only while the device is
23
+ * online and unconstrained (no low battery / Save-Data / slow-2g). Consent
24
+ * is Crowd's consent: when consent is anything other than `granted` the
25
+ * preloader never runs.
26
+ */
27
+ export declare class LightPreloader {
28
+ private readonly getConsentState;
29
+ private readonly options;
30
+ private readonly isPreloaded;
31
+ private readonly preload;
32
+ private timer;
33
+ private idleHandle;
34
+ private preloading;
35
+ private stopped;
36
+ private readonly model;
37
+ private readonly task;
38
+ private readonly dtype;
39
+ constructor(getConsentState: () => string, options?: LightPreloaderOptions, isPreloaded?: IsPreloadedFn, preload?: PreloadFn);
40
+ /** Schedule a preload at the next idle moment (no-op when already ready). */
41
+ start(): void;
42
+ /** Cancel any scheduled preload (e.g. on suspend / consent denial). */
43
+ stop(): void;
44
+ private isUnconstrained;
45
+ private preloadNow;
46
+ }
47
+ //# sourceMappingURL=light-preloader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light-preloader.d.ts","sourceRoot":"","sources":["../../src/client/light-preloader.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACnG,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvD,0EAA0E;AAC1E,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;AACpE,eAAO,MAAM,8BAA8B,gBAAgB,CAAC;AAC5D,eAAO,MAAM,+BAA+B,UAAU,CAAC;AAEvD;;;;;;;;GAQG;AACH,qBAAa,cAAc;IAUvB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAZ1B,OAAO,CAAC,KAAK,CAA8C;IAC3D,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAGZ,eAAe,EAAE,MAAM,MAAM,EAC7B,OAAO,GAAE,qBAA0B,EACnC,WAAW,GAAE,aAA2B,EACxC,OAAO,GAAE,SAA0B;IAOtD,6EAA6E;IAC7E,KAAK,IAAI,IAAI;IAkBb,uEAAuE;IACvE,IAAI,IAAI,IAAI;IAUZ,OAAO,CAAC,eAAe;YAqBT,UAAU;CAezB"}
@@ -0,0 +1,20 @@
1
+ export interface MobileLifecycleSignals {
2
+ hidden: boolean;
3
+ pageHidden: boolean;
4
+ online: boolean;
5
+ batteryLevel?: number;
6
+ batteryCharging?: boolean;
7
+ effectiveType?: string;
8
+ saveData?: boolean;
9
+ }
10
+ export interface MobileLifecycleDecision {
11
+ suspend: boolean;
12
+ constrained: boolean;
13
+ maxCpuLoad?: number;
14
+ }
15
+ /**
16
+ * Convert optional browser lifecycle, network, and battery signals into a
17
+ * bounded execution policy. Missing Battery/Network Information APIs are safe.
18
+ */
19
+ export declare function evaluateMobileLifecycle(signals: MobileLifecycleSignals, configuredMaxCpuLoad?: number): MobileLifecycleDecision;
20
+ //# sourceMappingURL=mobile-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-lifecycle.d.ts","sourceRoot":"","sources":["../../src/client/mobile-lifecycle.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,sBAAsB,EAC/B,oBAAoB,CAAC,EAAE,MAAM,GAC5B,uBAAuB,CAgBzB"}
@@ -1,4 +1,4 @@
1
- import type { WorkloadType } from "@flaxia/sdk";
1
+ import type { NodeModelCacheSnapshot, WorkloadType } from "@flaxia/sdk";
2
2
  /** Swarm tasks exchange control messages and binary frames mid-task. */
3
3
  export interface SwarmCallbacks {
4
4
  onFrame?: (frame: ArrayBuffer) => void;
@@ -25,6 +25,8 @@ export declare class WorkerPool {
25
25
  private pendingControls;
26
26
  private static readonly MAX_PENDING_CONTROLS;
27
27
  private _lastCpuLoad;
28
+ private _hasCpuLoadSample;
29
+ private _modelCacheSnapshot;
28
30
  constructor(workerUrl?: string, timeoutMs?: number);
29
31
  private initWorker;
30
32
  run(id: string, workload: WorkloadType, payload: unknown, timeoutMs?: number, onToken?: (token: string) => void, config?: {
@@ -48,6 +50,8 @@ export declare class WorkerPool {
48
50
  */
49
51
  sendControl(message: unknown, executionId?: string): boolean;
50
52
  sendFrame(frame: ArrayBuffer): boolean;
53
+ /** Pause or resume a normal workload's asynchronous token sink. */
54
+ setTokenFlow(taskId: string, paused: boolean): boolean;
51
55
  /**
52
56
  * The coordinator settled this task elsewhere (timeout, a peer failed, the
53
57
  * plan was rejected): stop it.
@@ -63,5 +67,7 @@ export declare class WorkerPool {
63
67
  terminate(): void;
64
68
  resume(): void;
65
69
  get lastCpuLoad(): number;
70
+ get hasCpuLoadSample(): boolean;
71
+ get modelCacheSnapshot(): NodeModelCacheSnapshot | null;
66
72
  }
67
73
  //# sourceMappingURL=WorkerPool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkerPool.d.ts","sourceRoot":"","sources":["../../src/executor/WorkerPool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAoBhD,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,MAAM,CAA2B;IACzC,yEAAyE;IACzE,OAAO,CAAC,eAAe,CAAmD;IAC1E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAM;IAClD,OAAO,CAAC,YAAY,CAAK;gBAEb,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,SAAS;IAMlD,OAAO,CAAC,UAAU;IAYlB,GAAG,CACD,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACjC,MAAM,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAChG,KAAK,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,OAAO,CAAC;IAgBnB,OAAO,CAAC,OAAO;IA6Ff,+EAA+E;IAC/E,OAAO,CAAC,aAAa;IAOrB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO;IAW5D,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAItC;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAmB1C,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,aAAa;IAQrB,SAAS;IAkBT,MAAM;IAMN,IAAI,WAAW,IAAI,MAAM,CAExB;CACF"}
1
+ {"version":3,"file":"WorkerPool.d.ts","sourceRoot":"","sources":["../../src/executor/WorkerPool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAqBxE,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,MAAM,CAA2B;IACzC,yEAAyE;IACzE,OAAO,CAAC,eAAe,CAAmD;IAC1E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAM;IAClD,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,mBAAmB,CAAuC;gBAEtD,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,SAAS;IAMlD,OAAO,CAAC,UAAU;IAYlB,GAAG,CACD,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACjC,MAAM,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAChG,KAAK,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,OAAO,CAAC;IAgBnB,OAAO,CAAC,OAAO;IAwGf,+EAA+E;IAC/E,OAAO,CAAC,aAAa;IAOrB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO;IAW5D,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAItC,mEAAmE;IACnE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAKtD;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAmB1C,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,aAAa;IASrB,SAAS;IAmBT,MAAM;IAMN,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED,IAAI,kBAAkB,IAAI,sBAAsB,GAAG,IAAI,CAItD;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=resourceReporter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceReporter.test.d.ts","sourceRoot":"","sources":["../../../src/executor/__tests__/resourceReporter.test.ts"],"names":[],"mappings":""}
@@ -13,6 +13,11 @@ export declare function probeMaxWasmMemoryBytes(targetBytes?: number, chunkBytes
13
13
  * capability reporting) should use instead of `probeMaxWasmMemoryBytes()`.
14
14
  */
15
15
  export declare function getWasmMemoryBytes(): number;
16
+ /** The one-shot lower-bound observation, including when the runtime could not create WASM memory. */
17
+ export declare function getWasmMemoryProbeObservation(): {
18
+ bytes: number | null;
19
+ sampledAt: number | null;
20
+ };
16
21
  /**
17
22
  * Whether the device can commit the memory a heavy (multi-GB model) workload
18
23
  * needs. Uses the cached probe, so it never re-allocates.
@@ -1 +1 @@
1
- {"version":3,"file":"memoryProbe.d.ts","sourceRoot":"","sources":["../../src/executor/memoryProbe.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gCAAgC,QAAgB,CAAC;AA4B9D;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,GAAE,MAAyC,EACtD,UAAU,GAAE,MAA0B,GACrC,MAAM,CA4BR;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD;AAED,+DAA+D;AAC/D,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
1
+ {"version":3,"file":"memoryProbe.d.ts","sourceRoot":"","sources":["../../src/executor/memoryProbe.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gCAAgC,QAAgB,CAAC;AA8B9D;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,GAAE,MAAyC,EACtD,UAAU,GAAE,MAA0B,GACrC,MAAM,CA6BR;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C;AAED,qGAAqG;AACrG,wBAAgB,6BAA6B,IAAI;IAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAMlG;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD;AAED,+DAA+D;AAC/D,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
@@ -0,0 +1,15 @@
1
+ import type { NodeResourceReport } from '@flaxia/sdk';
2
+ /**
3
+ * Collect current resource telemetry for an already-consented signaling
4
+ * session. The 2 GiB WASM lower-bound probe remains one-shot; the tiny GPU
5
+ * compute sample refreshes only after its ten minute TTL.
6
+ */
7
+ export declare function collectNodeResourceReport(options: {
8
+ cpuLoad?: number | null;
9
+ deviceMemory?: number;
10
+ probeGpu?: boolean;
11
+ now?: number;
12
+ }): Promise<NodeResourceReport>;
13
+ /** Clear the GPU result cache in isolated probe tests. */
14
+ export declare function resetNodeResourceReportCache(): void;
15
+ //# sourceMappingURL=resourceReporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceReporter.d.ts","sourceRoot":"","sources":["../../src/executor/resourceReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,aAAa,CAAC;AAuCtE;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,EAAE;IACvD,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA2C9B;AAED,0DAA0D;AAC1D,wBAAgB,4BAA4B,IAAI,IAAI,CAGnD"}
@@ -1,9 +1,20 @@
1
- import type { SwarmNodeCapabilities } from '@flaxia/sdk';
1
+ import type { GpuProbeStatus, SwarmNodeCapabilities } from '@flaxia/sdk';
2
+ export interface WebGpuProbeResult {
3
+ capabilities: SwarmNodeCapabilities;
4
+ status: GpuProbeStatus;
5
+ sampledAt: number;
6
+ expiresAt: number;
7
+ architecture: string | null;
8
+ maxStorageBufferBindingSize: number | null;
9
+ computeCompletionMs: number | null;
10
+ sampleCount: number;
11
+ }
2
12
  /**
3
- * Probe WebGPU support so the orchestrator can decide whether a node may take
4
- * part in `swarm-inference`. Never throws: any failure (no `navigator.gpu`,
5
- * adapter request rejected, blocked by permissions policy) is reported as
6
- * `{ webgpu: false }`.
13
+ * Request a device and time three tiny no-buffer compute submissions. This is
14
+ * a scheduling hint, not a benchmark: it allocates no model-sized resources,
15
+ * has a per-sample timeout, and destroys the temporary device in all cases.
7
16
  */
17
+ export declare function probeWebGpuDetailed(): Promise<WebGpuProbeResult>;
18
+ /** Backwards-compatible capability probe; eligibility requires a working device. */
8
19
  export declare function probeWebGpu(): Promise<SwarmNodeCapabilities>;
9
20
  //# sourceMappingURL=webgpuProbe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgpuProbe.d.ts","sourceRoot":"","sources":["../../src/executor/webgpuProbe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAoBzD;;;;;GAKG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,qBAAqB,CAAC,CA6BlE"}
1
+ {"version":3,"file":"webgpuProbe.d.ts","sourceRoot":"","sources":["../../src/executor/webgpuProbe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAkEzE,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,qBAAqB,CAAC;IACpC,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,2BAA2B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;CACrB;AAmCD;;;;GAIG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAqFtE;AAED,oFAAoF;AACpF,wBAAsB,WAAW,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAElE"}
package/dist/index.d.ts CHANGED
@@ -3,5 +3,7 @@ export { getConsentState as getFlaxiaNodeConsentState } from './consent/storage'
3
3
  export { initConsentIntegrity as initFlaxiaNodeConsent } from './consent/storage';
4
4
  export { setHostManagedConsentAllowed as setFlaxiaNodeHostManagedConsent } from './consent/storage';
5
5
  export { initFlaxiaNode };
6
+ export { LIGHT_INFERENCE_TRANSLATE_MODEL, } from './client/light-preloader';
7
+ export { isAiModelPreloaded, preloadAiModel, LIGHT_INFERENCE_TRANSLATE_MODEL as LIGHT_INFERENCE_TRANSLATE_MODEL_ID, LIGHT_INFERENCE_TRANSLATE_TASK, LIGHT_INFERENCE_TRANSLATE_DTYPE, } from './workloads/ai-inference';
6
8
  export type { ConsentControls, ConsentState, FlaxiaNodeController } from '@flaxia/sdk';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D,OAAO,EAAE,eAAe,IAAI,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAGjF,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAIlF,OAAO,EAAE,4BAA4B,IAAI,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D,OAAO,EAAE,eAAe,IAAI,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAGjF,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAIlF,OAAO,EAAE,4BAA4B,IAAI,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EACL,+BAA+B,GAChC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,+BAA+B,IAAI,kCAAkC,EACrE,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}