@flaxia/node 0.6.0 → 0.7.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/README.md +2 -0
- package/dist/assets/ai-inference.js +83 -175
- package/dist/assets/ai-model-registry.js +127 -0
- package/dist/assets/cc-extract.js +5166 -0
- package/dist/assets/decision.js +142 -0
- package/dist/assets/embed-gemma.js +97 -0
- package/dist/assets/transformers.web.js +2 -2
- package/dist/assets/vector-embed.js +136 -26
- package/dist/assets/webgpuProbe.js +83 -66
- package/dist/client/SignalingClient.d.ts.map +1 -1
- package/dist/client/light-preloader.d.ts +19 -5
- package/dist/client/light-preloader.d.ts.map +1 -1
- package/dist/consent/notice.d.ts +3 -1
- package/dist/consent/notice.d.ts.map +1 -1
- package/dist/executor/WorkerPool.d.ts +1 -0
- package/dist/executor/WorkerPool.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +392 -365
- package/dist/worker.js +130 -121
- package/dist/workloads/__tests__/ai-model-registry.test.d.ts +2 -0
- package/dist/workloads/__tests__/ai-model-registry.test.d.ts.map +1 -0
- package/dist/workloads/__tests__/cc-extract.test.d.ts +2 -0
- package/dist/workloads/__tests__/cc-extract.test.d.ts.map +1 -0
- package/dist/workloads/__tests__/decision.test.d.ts +2 -0
- package/dist/workloads/__tests__/decision.test.d.ts.map +1 -0
- package/dist/workloads/__tests__/embed-gemma.test.d.ts +2 -0
- package/dist/workloads/__tests__/embed-gemma.test.d.ts.map +1 -0
- package/dist/workloads/__tests__/wasm-threads.test.d.ts.map +1 -1
- package/dist/workloads/ai-inference.d.ts +30 -2
- package/dist/workloads/ai-inference.d.ts.map +1 -1
- package/dist/workloads/ai-model-registry.d.ts.map +1 -1
- package/dist/workloads/cc-extract.d.ts +11 -0
- package/dist/workloads/cc-extract.d.ts.map +1 -0
- package/dist/workloads/decision.d.ts +21 -0
- package/dist/workloads/decision.d.ts.map +1 -0
- package/dist/workloads/embed-gemma.d.ts +8 -0
- package/dist/workloads/embed-gemma.d.ts.map +1 -0
- package/dist/workloads/vector-embed.d.ts +10 -0
- package/dist/workloads/vector-embed.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -93,26 +93,26 @@ async function h(e, t, n) {
|
|
|
93
93
|
async function ee(e, t, n) {
|
|
94
94
|
return p(t, n, await h(e, t, n));
|
|
95
95
|
}
|
|
96
|
-
async function
|
|
96
|
+
async function te(e, t, n, r) {
|
|
97
97
|
if (r.byteLength !== 16) return !1;
|
|
98
98
|
let i = await h(e, t, n), a = 0;
|
|
99
99
|
for (let e = 0; e < i.byteLength; e++) a |= i[e] ^ r[e];
|
|
100
100
|
return a === 0;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function ne(e, t) {
|
|
103
103
|
let n = new ArrayBuffer(16 + t.byteLength), r = new DataView(n);
|
|
104
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
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function re(e = 0) {
|
|
107
107
|
let t = /* @__PURE__ */ new ArrayBuffer(16), n = new DataView(t);
|
|
108
108
|
return n.setUint16(0, l, !0), n.setUint8(2, d), n.setUint8(3, 0), n.setUint32(4, e >>> 0, !0), t;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function g(e) {
|
|
111
111
|
if (e.byteLength !== 16) return !1;
|
|
112
112
|
let t = new DataView(e);
|
|
113
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
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function ie(e) {
|
|
116
116
|
if (e.byteLength < 16) return null;
|
|
117
117
|
let t = new DataView(e);
|
|
118
118
|
return t.getUint16(0, !0) !== 21335 || t.getUint8(2) !== u ? null : {
|
|
@@ -124,20 +124,20 @@ function ne(e) {
|
|
|
124
124
|
payload: new Uint8Array(e, 16)
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
if (!
|
|
127
|
+
function ae(e) {
|
|
128
|
+
if (!_(e)) return !1;
|
|
129
129
|
if (e.kind === "description") {
|
|
130
130
|
let t = e.description;
|
|
131
|
-
return
|
|
131
|
+
return _(t) && (t.type === "offer" || t.type === "answer") && typeof t.sdp == "string" && t.sdp.length > 0 && t.sdp.length <= 24576;
|
|
132
132
|
}
|
|
133
133
|
if (e.kind === "candidate") {
|
|
134
134
|
let t = e.candidate;
|
|
135
|
-
return t === null ? !0 :
|
|
135
|
+
return t === null ? !0 : _(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
136
|
}
|
|
137
137
|
return !1;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
if (!
|
|
139
|
+
function oe(e) {
|
|
140
|
+
if (!_(e) || e.type !== "swarm-peer-signal" || !ae(e.signal)) return !1;
|
|
141
141
|
try {
|
|
142
142
|
if (new TextEncoder().encode(JSON.stringify(e.signal)).byteLength > 32768) return !1;
|
|
143
143
|
} catch {
|
|
@@ -145,125 +145,142 @@ function y(e) {
|
|
|
145
145
|
}
|
|
146
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
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function _(e) {
|
|
149
149
|
return typeof e == "object" && !!e;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function v(e) {
|
|
152
152
|
return typeof e == "number" && Number.isInteger(e) && e >= 0;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function y(e, t = {}) {
|
|
155
155
|
let n = t.maxLayers ?? 1024, r = t.maxSliceLayers ?? 256;
|
|
156
|
-
return !(!
|
|
156
|
+
return !(!se(e) || !v(e.start) || !v(e.end) || e.end <= e.start || e.end - e.start > r || e.end > n);
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
return
|
|
158
|
+
function se(e) {
|
|
159
|
+
return _(e) ? typeof e.start == "number" && typeof e.end == "number" && typeof e.hasEmbed == "boolean" && typeof e.hasHead == "boolean" : !1;
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
return
|
|
161
|
+
function ce(e) {
|
|
162
|
+
return _(e) ? typeof e.nodeId == "string" && e.nodeId.length > 0 && typeof e.capacity == "number" : !1;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function b(e) {
|
|
165
165
|
return e === void 0 || typeof e == "string" && e.length > 0 && e.length <= 128;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return !
|
|
167
|
+
function le(e) {
|
|
168
|
+
return !_(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(ce);
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
return !(!
|
|
170
|
+
function ue(e) {
|
|
171
|
+
return !(!_(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" || !v(e.index) || !v(e.chainLength) || e.chainLength < 1 || e.chainLength > 16 || e.index >= e.chainLength || e.role !== (e.index === 0 ? "host" : "worker") || !y(e.slice) || e.slice.hasEmbed !== (e.index === 0) || e.slice.hasHead !== (e.index === 0) || !b(e.inboundKey) || !b(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
172
|
}
|
|
173
|
-
function
|
|
174
|
-
return !
|
|
173
|
+
function de(e) {
|
|
174
|
+
return !_(e) || e.type !== "swarm-start" ? !1 : typeof e.sessionId == "string" && !!e.sessionId && typeof e.taskId == "string" && !!e.taskId;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
return !
|
|
176
|
+
function fe(e) {
|
|
177
|
+
return !_(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
178
|
}
|
|
179
|
-
function
|
|
180
|
-
return !
|
|
179
|
+
function x(e) {
|
|
180
|
+
return !_(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
181
|
}
|
|
182
|
-
function
|
|
183
|
-
return !
|
|
182
|
+
function S(e) {
|
|
183
|
+
return !_(e) || e.type !== "swarm-error" ? !1 : typeof e.sessionId == "string" && !!e.sessionId && typeof e.taskId == "string" && !!e.taskId && typeof e.error == "string";
|
|
184
184
|
}
|
|
185
185
|
new Set([
|
|
186
186
|
"qwen3.5-2b",
|
|
187
187
|
"qwen3.8-27b",
|
|
188
188
|
"qwen3.6-35b-moe"
|
|
189
189
|
]);
|
|
190
|
-
var
|
|
190
|
+
var C = new Set([
|
|
191
191
|
"ai-inference",
|
|
192
192
|
"image-process",
|
|
193
193
|
"container",
|
|
194
194
|
"vector-embed",
|
|
195
195
|
"vector-query",
|
|
196
196
|
"nudenet",
|
|
197
|
-
"swarm-inference"
|
|
198
|
-
|
|
197
|
+
"swarm-inference",
|
|
198
|
+
"embed-gemma"
|
|
199
|
+
]), w = "data.commoncrawl.org", T = 2 * 1024 * 1024, E = 4 * 1024 * 1024, D = 16e3, O = 3e4, k = 6e4, A = 2048, j = 4096, M = /^CC-MAIN-\d{4}-\d{2}$/, N = /^crawl-data\/CC-MAIN-\d{4}-\d{2}\/segments\/(?!\.{1,2}\/)[A-Za-z0-9._-]+\/warc\/(?!\.{1,2}\/)[A-Za-z0-9._-]+\.warc\.gz$/;
|
|
199
200
|
function P(e) {
|
|
201
|
+
return typeof e == "string" && N.test(e);
|
|
202
|
+
}
|
|
203
|
+
function F(e, t) {
|
|
204
|
+
return typeof t == "string" && M.test(t) && P(e) && e.startsWith(`crawl-data/${t}/`);
|
|
205
|
+
}
|
|
206
|
+
var I = "onnx-community/embeddinggemma-2-ONNX", L = "google/embeddinggemma-2", R = 1e5, z = 4e3, B = [
|
|
207
|
+
768,
|
|
208
|
+
512,
|
|
209
|
+
256,
|
|
210
|
+
128
|
|
211
|
+
];
|
|
212
|
+
function V(e) {
|
|
213
|
+
return typeof e == "number" && B.includes(e);
|
|
214
|
+
}
|
|
215
|
+
var pe = 9e4, me = 600 * 1e3, he = 1440 * 60 * 1e3, ge = 6e4;
|
|
216
|
+
function H(e) {
|
|
200
217
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
201
218
|
}
|
|
202
|
-
function
|
|
203
|
-
if (!
|
|
219
|
+
function _e(e) {
|
|
220
|
+
if (!H(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
221
|
if (e.layerRange === void 0) return !0;
|
|
205
222
|
let t = e.layerRange;
|
|
206
223
|
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
224
|
}
|
|
208
|
-
function
|
|
209
|
-
if (!
|
|
225
|
+
function ve(e, t = Date.now()) {
|
|
226
|
+
if (!H(e) || e.version !== 1 || !Number.isSafeInteger(e.sampledAt) || !Number.isSafeInteger(e.expiresAt) || !Array.isArray(e.entries) || e.entries.length > 8 || !e.entries.every(_e)) return !1;
|
|
210
227
|
let n = e.sampledAt, r = e.expiresAt;
|
|
211
228
|
return n <= t + 5e3 && n >= t - 6e4 && r > t && r > n && r - n <= 6e4;
|
|
212
229
|
}
|
|
213
230
|
//#endregion
|
|
214
231
|
//#region src/executor/memoryProbe.ts
|
|
215
|
-
var
|
|
216
|
-
function
|
|
217
|
-
let n = Math.ceil(t /
|
|
232
|
+
var U = 2 * 1024 ** 3, W = 65536, ye = 16 * 1024 * 1024, be = 4096, G = null, xe = 0;
|
|
233
|
+
function Se(e, t) {
|
|
234
|
+
let n = Math.ceil(t / W);
|
|
218
235
|
try {
|
|
219
236
|
e.grow(n);
|
|
220
237
|
} catch {
|
|
221
238
|
return !1;
|
|
222
239
|
}
|
|
223
240
|
let r = new Uint8Array(e.buffer);
|
|
224
|
-
for (let e = 0; e < n; e++) r[e *
|
|
241
|
+
for (let e = 0; e < n; e++) r[e * W] = 0;
|
|
225
242
|
return !0;
|
|
226
243
|
}
|
|
227
|
-
function
|
|
228
|
-
if (
|
|
229
|
-
|
|
244
|
+
function K(e = U, t = ye) {
|
|
245
|
+
if (G) return G.bytes;
|
|
246
|
+
xe++;
|
|
230
247
|
let n = Date.now(), r;
|
|
231
248
|
try {
|
|
232
249
|
r = new WebAssembly.Memory({ initial: 0 });
|
|
233
250
|
} catch {
|
|
234
|
-
return
|
|
251
|
+
return G = {
|
|
235
252
|
bytes: 0,
|
|
236
253
|
sampledAt: n,
|
|
237
254
|
measured: !1
|
|
238
255
|
}, 0;
|
|
239
256
|
}
|
|
240
|
-
let i = Math.max(0, Math.floor(e)), a = Math.max(
|
|
241
|
-
for (; o < i && s <
|
|
257
|
+
let i = Math.max(0, Math.floor(e)), a = Math.max(W, Math.floor(t)), o = 0, s = 0;
|
|
258
|
+
for (; o < i && s < be;) {
|
|
242
259
|
let e = Math.min(a, i - o);
|
|
243
|
-
if (!
|
|
260
|
+
if (!Se(r, e)) break;
|
|
244
261
|
o += e, s++;
|
|
245
262
|
}
|
|
246
|
-
return r = void 0,
|
|
263
|
+
return r = void 0, G = {
|
|
247
264
|
bytes: o,
|
|
248
265
|
sampledAt: n,
|
|
249
266
|
measured: !0
|
|
250
267
|
}, o;
|
|
251
268
|
}
|
|
252
|
-
function
|
|
253
|
-
return
|
|
269
|
+
function Ce() {
|
|
270
|
+
return G ? G.bytes : K();
|
|
254
271
|
}
|
|
255
|
-
function
|
|
256
|
-
return
|
|
257
|
-
bytes:
|
|
258
|
-
sampledAt:
|
|
272
|
+
function we() {
|
|
273
|
+
return G || K(), {
|
|
274
|
+
bytes: G?.measured ? G.bytes : null,
|
|
275
|
+
sampledAt: G?.sampledAt ?? null
|
|
259
276
|
};
|
|
260
277
|
}
|
|
261
|
-
function
|
|
262
|
-
return
|
|
278
|
+
function Te() {
|
|
279
|
+
return Ce() >= U;
|
|
263
280
|
}
|
|
264
281
|
//#endregion
|
|
265
282
|
//#region src/executor/webgpuProbe.ts
|
|
266
|
-
var
|
|
283
|
+
var Ee = 3, q = 750, J = 1500, Y = 600 * 1e3;
|
|
267
284
|
async function X(e, t) {
|
|
268
285
|
let n, r = new Promise((e) => {
|
|
269
286
|
n = setTimeout(() => e({
|
|
@@ -295,9 +312,9 @@ function Z(e, t = Date.now()) {
|
|
|
295
312
|
function Q() {
|
|
296
313
|
return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
|
|
297
314
|
}
|
|
298
|
-
async function
|
|
315
|
+
async function De(e) {
|
|
299
316
|
let t, n = new Promise((e) => {
|
|
300
|
-
t = setTimeout(() => e("timeout"),
|
|
317
|
+
t = setTimeout(() => e("timeout"), q);
|
|
301
318
|
}), r = e.queue.onSubmittedWorkDone().then(() => "complete"), i = e.lost.then(() => "lost", () => "lost");
|
|
302
319
|
try {
|
|
303
320
|
return await Promise.race([
|
|
@@ -328,12 +345,12 @@ async function $() {
|
|
|
328
345
|
entryPoint: "main"
|
|
329
346
|
}
|
|
330
347
|
}), f = [];
|
|
331
|
-
for (let e = 0; e <
|
|
348
|
+
for (let e = 0; e < Ee; e++) {
|
|
332
349
|
let e = u.createCommandEncoder(), t = e.beginComputePass();
|
|
333
350
|
t.setPipeline(d), t.dispatchWorkgroups(1), t.end();
|
|
334
351
|
let n = e.finish(), r = Q();
|
|
335
352
|
u.queue.submit([n]);
|
|
336
|
-
let i = await
|
|
353
|
+
let i = await De(u);
|
|
337
354
|
if (i === "lost") return Z("device-lost", Date.now());
|
|
338
355
|
if (i === "timeout") return Z("unavailable", Date.now());
|
|
339
356
|
f.push(Math.max(0, Q() - r));
|
|
@@ -358,8 +375,8 @@ async function $() {
|
|
|
358
375
|
} catch {}
|
|
359
376
|
}
|
|
360
377
|
}
|
|
361
|
-
async function
|
|
378
|
+
async function Oe() {
|
|
362
379
|
return (await $()).capabilities;
|
|
363
380
|
}
|
|
364
381
|
//#endregion
|
|
365
|
-
export {
|
|
382
|
+
export { g as A, i as B, f as C, T as D, me as E, ee as F, R as G, V as H, m as I, ne as J, o as K, t as L, e as M, A as N, D as O, a as P, L as R, O as S, E as T, F as U, c as V, I as W, re as X, ie as Y, w as _, Te as a, de as b, y as c, p as d, pe as f, S as g, C as h, we as i, z as j, te as k, P as l, ve as m, $ as n, K as o, x as p, j as q, U as r, k as s, Oe as t, oe as u, ue as v, he as w, fe as x, ge as y, le as z };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignalingClient.d.ts","sourceRoot":"","sources":["../../src/client/SignalingClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignalingClient.d.ts","sourceRoot":"","sources":["../../src/client/SignalingClient.ts"],"names":[],"mappings":"AAqCA,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;AAg+BD,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,KAAG,oBAwDnD,CAAC"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
export interface LightPreloaderTarget {
|
|
2
|
+
model: string;
|
|
3
|
+
task: string;
|
|
4
|
+
dtype: string;
|
|
5
|
+
}
|
|
1
6
|
export interface LightPreloaderOptions {
|
|
2
7
|
/** Model id to keep warm. Defaults to the M2M100 translate model. */
|
|
3
8
|
model?: string;
|
|
4
9
|
task?: string;
|
|
5
10
|
dtype?: string;
|
|
11
|
+
/** Full list of models to keep warm; wins over `model`/`task`/`dtype`. */
|
|
12
|
+
targets?: LightPreloaderTarget[];
|
|
6
13
|
onPreloaded?: () => void;
|
|
7
14
|
}
|
|
8
15
|
export type PreloadFn = (request: {
|
|
@@ -10,15 +17,24 @@ export type PreloadFn = (request: {
|
|
|
10
17
|
model: string;
|
|
11
18
|
dtype: string;
|
|
12
19
|
}) => Promise<void>;
|
|
13
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Check whether one preloader target is already resident. Must compare the
|
|
22
|
+
* full cache identity (model + dtype), not just the model id: the same repo
|
|
23
|
+
* preloaded as int8 does not satisfy a q4f16 ondeviceOnly task.
|
|
24
|
+
*/
|
|
25
|
+
export type IsPreloadedFn = (target: LightPreloaderTarget) => boolean;
|
|
14
26
|
/** Defaults mirror `LIGHT_INFERENCE_TRANSLATE_*` in `ai-inference.ts`. */
|
|
15
27
|
export declare const LIGHT_INFERENCE_TRANSLATE_MODEL = "Xenova/m2m100_418M";
|
|
16
28
|
export declare const LIGHT_INFERENCE_TRANSLATE_TASK = "translation";
|
|
17
29
|
export declare const LIGHT_INFERENCE_TRANSLATE_DTYPE = "q4f16";
|
|
30
|
+
/** Flaxia's default translate model, mirroring `LIGHT_INFERENCE_PLAMO_*`. */
|
|
31
|
+
export declare const LIGHT_INFERENCE_PLAMO_TRANSLATE_MODEL = "TeamFlaxia/plamo-3-translate-0.8b-onnx";
|
|
32
|
+
export declare const LIGHT_INFERENCE_PLAMO_TRANSLATE_TASK = "text-generation";
|
|
33
|
+
export declare const LIGHT_INFERENCE_PLAMO_TRANSLATE_DTYPE = "q4f16";
|
|
18
34
|
/**
|
|
19
35
|
* Light Inference idle preloader.
|
|
20
36
|
*
|
|
21
|
-
* Keeps
|
|
37
|
+
* Keeps the translate `ai-inference` models resident so a later `ondeviceOnly`
|
|
22
38
|
* task can serve instantly from this device. Runs only while the device is
|
|
23
39
|
* online and unconstrained (no low battery / Save-Data / slow-2g). Consent
|
|
24
40
|
* is Crowd's consent: when consent is anything other than `granted` the
|
|
@@ -33,9 +49,7 @@ export declare class LightPreloader {
|
|
|
33
49
|
private idleHandle;
|
|
34
50
|
private preloading;
|
|
35
51
|
private stopped;
|
|
36
|
-
private readonly
|
|
37
|
-
private readonly task;
|
|
38
|
-
private readonly dtype;
|
|
52
|
+
private readonly targets;
|
|
39
53
|
constructor(getConsentState: () => string, options?: LightPreloaderOptions, isPreloaded?: IsPreloadedFn, preload?: PreloadFn);
|
|
40
54
|
/** Schedule a preload at the next idle moment (no-op when already ready). */
|
|
41
55
|
start(): void;
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"light-preloader.d.ts","sourceRoot":"","sources":["../../src/client/light-preloader.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,OAAO,CAAC,EAAE,oBA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ts
CHANGED
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
* disclosed what actually runs on the device.
|
|
12
12
|
* - v2: the informed-consent copy below (third-party workloads, orchestrator
|
|
13
13
|
* registration, persistent connection, resource usage).
|
|
14
|
+
* - v3: adds public-web-archive fetching and text extraction (`cc-extract`),
|
|
15
|
+
* including that the destination site sees the device's IP address.
|
|
14
16
|
*/
|
|
15
|
-
export declare const CONSENT_NOTICE_VERSION =
|
|
17
|
+
export declare const CONSENT_NOTICE_VERSION = 3;
|
|
16
18
|
/**
|
|
17
19
|
* The disclosure shown in the built-in banner. Deliberately static: hosts may
|
|
18
20
|
* style the banner but must not be able to weaken the wording, otherwise the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice.d.ts","sourceRoot":"","sources":["../../src/consent/notice.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notice.d.ts","sourceRoot":"","sources":["../../src/consent/notice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;IAS7B,0EAA0E;;;;CAKlE,CAAC"}
|
|
@@ -33,6 +33,7 @@ export declare class WorkerPool {
|
|
|
33
33
|
maxCpuLoad?: number;
|
|
34
34
|
fileSourceOrigins?: string[];
|
|
35
35
|
containerImageOrigins?: string[];
|
|
36
|
+
ccRangeOrigins?: string[];
|
|
36
37
|
}, swarm?: SwarmCallbacks): Promise<unknown>;
|
|
37
38
|
private execute;
|
|
38
39
|
/** Hand over the control messages that were waiting for this task to start. */
|
|
@@ -1 +1 @@
|
|
|
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;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,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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +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
|
+
export { LIGHT_INFERENCE_TRANSLATE_MODEL, LIGHT_INFERENCE_PLAMO_TRANSLATE_MODEL, LIGHT_INFERENCE_PLAMO_TRANSLATE_TASK, LIGHT_INFERENCE_PLAMO_TRANSLATE_DTYPE, } 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, LIGHT_INFERENCE_PLAMO_TRANSLATE_MODEL as LIGHT_INFERENCE_PLAMO_TRANSLATE_MODEL_ID, LIGHT_INFERENCE_PLAMO_TRANSLATE_TASK as LIGHT_INFERENCE_PLAMO_TRANSLATE_TASK_ID, LIGHT_INFERENCE_PLAMO_TRANSLATE_DTYPE as LIGHT_INFERENCE_PLAMO_TRANSLATE_DTYPE_ID, } from './workloads/ai-inference';
|
|
8
8
|
export type { ConsentControls, ConsentState, FlaxiaNodeController } from '@flaxia/sdk';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,OAAO,EACL,+BAA+B,
|
|
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,EAC/B,qCAAqC,EACrC,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,+BAA+B,IAAI,kCAAkC,EACrE,8BAA8B,EAC9B,+BAA+B,EAC/B,qCAAqC,IAAI,wCAAwC,EACjF,oCAAoC,IAAI,uCAAuC,EAC/E,qCAAqC,IAAI,wCAAwC,GAClF,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|