@zerogpu/browser-extension-sdk 0.2.3 → 0.2.4
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/bin/zerogpu.mjs +171 -29
- package/dist/assets/zerogpu-assets.json +2 -2
- package/dist/extension/zerogpu-background.js +17 -1
- package/dist/extension/zerogpu-background.js.map +1 -1
- package/dist/extension/zerogpu-offscreen.js +11 -2
- package/dist/extension/zerogpu-offscreen.js.map +1 -1
- package/dist/extension/zerogpu-settings-link.js +9 -0
- package/dist/extension/zerogpu-settings-link.js.map +1 -1
- package/dist/manifest.json +5 -5
- package/dist/types/extension/consent.d.ts +0 -5
- package/dist/v/{zerogpu-browser-sdk.85b3f7e3cc11.umd.js → zerogpu-browser-sdk.a6e1d6604337.umd.js} +3 -3
- package/dist/v/{zerogpu-browser-sdk.85b3f7e3cc11.umd.js.map → zerogpu-browser-sdk.a6e1d6604337.umd.js.map} +1 -1
- package/dist/zerogpu-browser-sdk.cjs +2 -2
- package/dist/zerogpu-browser-sdk.esm.js +2 -2
- package/dist/zerogpu-browser-sdk.umd.js +2 -2
- package/docs/extension-developer-guide.md +45 -2
- package/package.json +1 -1
package/bin/zerogpu.mjs
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* zerogpu — CLI for integrating the ZeroGPU SDK into a Chrome (MV3) extension.
|
|
4
4
|
*
|
|
5
5
|
* npx zerogpu vendor [outDir] Copy the SDK + model runtimes into the extension
|
|
6
|
-
* (default: vendor/zerogpu)
|
|
6
|
+
* (default: vendor/zerogpu), and add the opt-out
|
|
7
|
+
* origin to manifest.json if it is missing.
|
|
8
|
+
* Run this in your build.
|
|
7
9
|
* npx zerogpu init [--dir .] Vendor + scaffold offscreen/background glue and
|
|
8
10
|
* patch manifest.json. For a brand-new extension.
|
|
9
11
|
* npx zerogpu doctor [--dir .] Check manifest + that vendored assets are in sync.
|
|
@@ -85,9 +87,100 @@ const ensureDistPresent = () => {
|
|
|
85
87
|
}
|
|
86
88
|
};
|
|
87
89
|
|
|
90
|
+
// --- manifest helpers (shared by vendor + init) -------------------------------
|
|
91
|
+
|
|
92
|
+
const uniqueMerge = (existing, additions) => {
|
|
93
|
+
const out = Array.isArray(existing) ? [...existing] : [];
|
|
94
|
+
for (const item of additions) {
|
|
95
|
+
if (!out.includes(item)) out.push(item);
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Merge the ZeroGPU settings-page origin into `externally_connectable.matches`.
|
|
102
|
+
* Merged, never replaced — a host may already allow its own site, and its `ids`
|
|
103
|
+
* entry is left alone. Returns whether anything actually changed, so a caller
|
|
104
|
+
* that runs on every build can leave a correct manifest untouched.
|
|
105
|
+
*
|
|
106
|
+
* Creating the key is not a neutral act. Chrome reads an absent
|
|
107
|
+
* `externally_connectable` as "every extension may connect, no web page may";
|
|
108
|
+
* once the key exists, an unspecified `ids` means "no extension may". So adding
|
|
109
|
+
* only `matches` to a manifest that had no key would quietly revoke
|
|
110
|
+
* extension-to-extension messaging the host still has today. `ids: ["*"]`
|
|
111
|
+
* records what was already in force rather than granting anything new.
|
|
112
|
+
*
|
|
113
|
+
* A host that declared the key itself has already made that choice — even as an
|
|
114
|
+
* empty object — so `ids` is never added to one that exists.
|
|
115
|
+
*/
|
|
116
|
+
const ensureExternallyConnectable = (manifest) => {
|
|
117
|
+
const declared = manifest.externally_connectable;
|
|
118
|
+
const existing = declared?.matches;
|
|
119
|
+
const merged = uniqueMerge(existing, EXTERNALLY_CONNECTABLE_MATCHES);
|
|
120
|
+
if (Array.isArray(existing) && merged.length === existing.length) return false;
|
|
121
|
+
if (!declared) {
|
|
122
|
+
manifest.externally_connectable = { matches: merged, ids: ['*'] };
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
declared.matches = merged;
|
|
126
|
+
return true;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The file's own indentation, so rewriting it produces a one-line diff instead
|
|
131
|
+
* of reformatting a manifest the host may keep at 4 spaces or tabs.
|
|
132
|
+
*/
|
|
133
|
+
const detectIndent = (raw) => {
|
|
134
|
+
const match = raw.match(/\n([ \t]+)"/);
|
|
135
|
+
if (!match) return 2;
|
|
136
|
+
return match[1].includes('\t') ? '\t' : match[1].length;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The file's own line ending, for the same reason as the indentation: a manifest
|
|
141
|
+
* kept at CRLF must come back CRLF, or the one-key diff becomes a whole-file one.
|
|
142
|
+
* `JSON.stringify` only ever emits `\n`, and a newline inside a JSON string is
|
|
143
|
+
* escaped rather than literal, so rewriting every `\n` is safe.
|
|
144
|
+
*/
|
|
145
|
+
const detectEol = (raw) => (raw.includes('\r\n') ? '\r\n' : '\n');
|
|
146
|
+
|
|
88
147
|
// --- vendor ------------------------------------------------------------------
|
|
89
148
|
|
|
90
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Add the settings-page origin to the extension's manifest if it is missing.
|
|
151
|
+
*
|
|
152
|
+
* `vendor` is a build step, so this writes only when the entry is actually
|
|
153
|
+
* absent: once added, every later build is a no-op that never touches the file.
|
|
154
|
+
* It is here rather than in `init` alone because `init` runs once, at scaffold
|
|
155
|
+
* time — every extension integrated before the opt-out shipped would otherwise
|
|
156
|
+
* keep a manifest that silently makes the opt-out link a dead end.
|
|
157
|
+
*/
|
|
158
|
+
const patchExternallyConnectable = (root) => {
|
|
159
|
+
const file = path.join(root, 'manifest.json');
|
|
160
|
+
// Vendoring from a build directory is legitimate, and there is no way to guess
|
|
161
|
+
// where the real manifest lives. `doctor` is what reports the gap in that case.
|
|
162
|
+
if (!existsSync(file)) return;
|
|
163
|
+
|
|
164
|
+
const raw = readFileSync(file, 'utf8');
|
|
165
|
+
let manifest;
|
|
166
|
+
try {
|
|
167
|
+
manifest = JSON.parse(raw);
|
|
168
|
+
} catch {
|
|
169
|
+
log(c.warn('! manifest.json is not valid JSON — left unchanged.'));
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!ensureExternallyConnectable(manifest)) return;
|
|
174
|
+
|
|
175
|
+
const eol = detectEol(raw);
|
|
176
|
+
const body = JSON.stringify(manifest, null, detectIndent(raw)).replace(/\n/g, eol);
|
|
177
|
+
writeFileSync(file, body + (raw.endsWith('\n') ? eol : ''));
|
|
178
|
+
log(c.ok(`✓ Added ${EXTERNALLY_CONNECTABLE_MATCHES.join(', ')} to manifest.json`));
|
|
179
|
+
log(c.dim(' externally_connectable — without it the ZeroGPU settings page cannot'));
|
|
180
|
+
log(c.dim(' reach this extension, so end users have no way to opt out.'));
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const vendor = (outDir, manifestRoot = process.cwd()) => {
|
|
91
184
|
ensureDistPresent();
|
|
92
185
|
const target = path.resolve(process.cwd(), outDir || path.join('vendor', 'zerogpu'));
|
|
93
186
|
mkdirSync(target, { recursive: true });
|
|
@@ -100,6 +193,8 @@ const vendor = (outDir) => {
|
|
|
100
193
|
// All pinned runtime assets (transformers + ONNX wasm, wllama + wasm, manifest).
|
|
101
194
|
cpSync(distAssets, target, { recursive: true });
|
|
102
195
|
|
|
196
|
+
patchExternallyConnectable(manifestRoot);
|
|
197
|
+
|
|
103
198
|
const manifest = readAssetsManifest(target);
|
|
104
199
|
const rel = path.relative(process.cwd(), target) || '.';
|
|
105
200
|
log(c.ok(`✓ Vendored ZeroGPU runtime into ${rel}`));
|
|
@@ -172,6 +267,7 @@ const OPTIONS_HTML = `<!DOCTYPE html>
|
|
|
172
267
|
body { font-family: system-ui, sans-serif; margin: 2rem; max-width: 34rem; line-height: 1.5; }
|
|
173
268
|
.row { display: flex; align-items: flex-start; gap: .75rem; margin-top: 1.5rem; }
|
|
174
269
|
.muted { color: #666; font-size: .875rem; }
|
|
270
|
+
.error { color: #b3261e; font-weight: 500; }
|
|
175
271
|
</style>
|
|
176
272
|
</head>
|
|
177
273
|
<body>
|
|
@@ -195,35 +291,85 @@ const OPTIONS_JS = `// Reads and writes the ZeroGPU consent flag through the ser
|
|
|
195
291
|
const box = document.getElementById("zerogpu-opt-in");
|
|
196
292
|
const status = document.getElementById("zerogpu-status");
|
|
197
293
|
|
|
294
|
+
// The last state the service worker confirmed, and which request confirmed it.
|
|
295
|
+
// A failed write puts the box back to this, instead of leaving the user's click
|
|
296
|
+
// standing as though it had saved.
|
|
297
|
+
let stored = null;
|
|
298
|
+
let storedSeq = 0;
|
|
299
|
+
|
|
300
|
+
// The bridge answers each request on its own: a read is a storage lookup, a
|
|
301
|
+
// write also waits for the offscreen document to start or stop. So the initial
|
|
302
|
+
// read can land after a write the user has already made. Only the newest
|
|
303
|
+
// request is allowed to paint; an older answer is stale by definition.
|
|
304
|
+
let latest = 0;
|
|
305
|
+
|
|
306
|
+
const request = (message, done) => {
|
|
307
|
+
const seq = ++latest;
|
|
308
|
+
chrome.runtime.sendMessage(message, (res) => {
|
|
309
|
+
// Read lastError either way — left unread, Chrome logs it as unchecked. It
|
|
310
|
+
// is also the only signal when the service worker never answers at all.
|
|
311
|
+
const error = chrome.runtime.lastError?.message;
|
|
312
|
+
// Too stale to paint is not too stale to be true. A write that landed while
|
|
313
|
+
// a newer one was in flight is still the freshest word on what is actually
|
|
314
|
+
// stored, and dropping it would leave a later failure restoring the box to
|
|
315
|
+
// a state two toggles old. Only an older answer than the one already
|
|
316
|
+
// recorded is discarded.
|
|
317
|
+
if (res?.ok && seq > storedSeq) {
|
|
318
|
+
stored = res.consent;
|
|
319
|
+
storedSeq = seq;
|
|
320
|
+
}
|
|
321
|
+
if (seq === latest) done(res, error);
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const setStatus = (text, isError) => {
|
|
326
|
+
status.textContent = text;
|
|
327
|
+
status.classList.toggle("error", !!isError);
|
|
328
|
+
};
|
|
329
|
+
|
|
198
330
|
const render = (consent) => {
|
|
331
|
+
box.indeterminate = false;
|
|
199
332
|
box.checked = !!consent?.optedIn;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
333
|
+
setStatus(
|
|
334
|
+
consent?.updatedAt
|
|
335
|
+
? \`Last changed \${new Date(consent.updatedAt).toLocaleString()}.\`
|
|
336
|
+
: "",
|
|
337
|
+
false
|
|
338
|
+
);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
// Nothing was stored, so the SDK is still doing whatever it was doing before the
|
|
342
|
+
// click. Show that, and never a bare unchecked box — that would claim sharing is
|
|
343
|
+
// off while it is running.
|
|
344
|
+
const restore = (message) => {
|
|
345
|
+
if (stored) {
|
|
346
|
+
box.indeterminate = false;
|
|
347
|
+
box.checked = !!stored.optedIn;
|
|
348
|
+
} else {
|
|
349
|
+
box.indeterminate = true;
|
|
350
|
+
}
|
|
351
|
+
setStatus(message, true);
|
|
203
352
|
};
|
|
204
353
|
|
|
205
|
-
|
|
206
|
-
if (res?.ok)
|
|
354
|
+
request({ type: "zerogpu:getConsent" }, (res, error) => {
|
|
355
|
+
if (res?.ok) {
|
|
356
|
+
render(res.consent);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
restore(error || res?.error || "Could not read your current setting.");
|
|
207
360
|
});
|
|
208
361
|
|
|
209
362
|
box.addEventListener("change", () => {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
363
|
+
request({ type: "zerogpu:setConsent", optedIn: box.checked }, (res, error) => {
|
|
364
|
+
if (res?.ok) {
|
|
365
|
+
render(res.consent);
|
|
366
|
+
return;
|
|
214
367
|
}
|
|
215
|
-
|
|
368
|
+
restore(error || res?.error || "Could not save your choice — sharing is unchanged.");
|
|
369
|
+
});
|
|
216
370
|
});
|
|
217
371
|
`;
|
|
218
372
|
|
|
219
|
-
const uniqueMerge = (existing, additions) => {
|
|
220
|
-
const out = Array.isArray(existing) ? [...existing] : [];
|
|
221
|
-
for (const item of additions) {
|
|
222
|
-
if (!out.includes(item)) out.push(item);
|
|
223
|
-
}
|
|
224
|
-
return out;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
373
|
const patchManifest = (dir) => {
|
|
228
374
|
const file = path.join(dir, 'manifest.json');
|
|
229
375
|
if (!existsSync(file)) {
|
|
@@ -241,13 +387,8 @@ const patchManifest = (dir) => {
|
|
|
241
387
|
manifest.background = { service_worker: 'background.js' };
|
|
242
388
|
}
|
|
243
389
|
// Lets the ZeroGPU-hosted settings page message this extension so an end user
|
|
244
|
-
// can turn sharing off.
|
|
245
|
-
|
|
246
|
-
manifest.externally_connectable = manifest.externally_connectable || {};
|
|
247
|
-
manifest.externally_connectable.matches = uniqueMerge(
|
|
248
|
-
manifest.externally_connectable.matches,
|
|
249
|
-
EXTERNALLY_CONNECTABLE_MATCHES
|
|
250
|
-
);
|
|
390
|
+
// can turn sharing off. No content script and no extra host permission needed.
|
|
391
|
+
ensureExternallyConnectable(manifest);
|
|
251
392
|
if (!manifest.options_page && !manifest.options_ui) {
|
|
252
393
|
manifest.options_ui = { page: 'options.html', open_in_tab: true };
|
|
253
394
|
}
|
|
@@ -268,7 +409,7 @@ const scaffoldFile = (dir, name, contents) => {
|
|
|
268
409
|
const init = (dir) => {
|
|
269
410
|
const root = path.resolve(process.cwd(), dir || '.');
|
|
270
411
|
if (!existsSync(root)) die(`Directory not found: ${root}`);
|
|
271
|
-
vendor(path.join(root, 'vendor', 'zerogpu'));
|
|
412
|
+
vendor(path.join(root, 'vendor', 'zerogpu'), root);
|
|
272
413
|
scaffoldFile(root, 'offscreen.html', OFFSCREEN_HTML);
|
|
273
414
|
scaffoldFile(root, 'offscreen.js', OFFSCREEN_JS);
|
|
274
415
|
scaffoldFile(root, 'background.js', BACKGROUND_JS);
|
|
@@ -423,7 +564,8 @@ const main = () => {
|
|
|
423
564
|
|
|
424
565
|
Usage:
|
|
425
566
|
npx zerogpu vendor [outDir] Copy SDK + model runtimes into the extension
|
|
426
|
-
(default: vendor/zerogpu)
|
|
567
|
+
(default: vendor/zerogpu) + add the opt-out origin
|
|
568
|
+
to manifest.json. Run this in your build.
|
|
427
569
|
npx zerogpu init [--dir .] Vendor + scaffold offscreen/background + patch manifest
|
|
428
570
|
npx zerogpu doctor [--dir .] Verify the integration is wired and in sync
|
|
429
571
|
`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sdkVersion": "0.2.
|
|
2
|
+
"sdkVersion": "0.2.4+81d7c7a",
|
|
3
3
|
"channel": "official",
|
|
4
4
|
"transformersVersion": "2.17.2",
|
|
5
5
|
"wllamaVersion": "2.3.5",
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"wllama/single-thread/wllama.wasm",
|
|
17
17
|
"wllama/multi-thread/wllama.wasm"
|
|
18
18
|
],
|
|
19
|
-
"builtAt": "2026-
|
|
19
|
+
"builtAt": "2026-09-04T16:24:56.225Z"
|
|
20
20
|
}
|
|
@@ -67,7 +67,7 @@ var ZeroGpuBackground = (function (exports) {
|
|
|
67
67
|
* bridge listens on `chrome.storage.onChanged` and starts or stops the SDK in
|
|
68
68
|
* response, so no caller needs to do both.
|
|
69
69
|
*/
|
|
70
|
-
const
|
|
70
|
+
const writeZeroGpuConsent = async (optedIn, source) => {
|
|
71
71
|
const next = { optedIn, updatedAt: new Date().toISOString(), source };
|
|
72
72
|
const area = getLocalStorageArea();
|
|
73
73
|
// Deliberately not symmetric with the read above. A read fails open so the SDK
|
|
@@ -80,6 +80,22 @@ var ZeroGpuBackground = (function (exports) {
|
|
|
80
80
|
await area.set({ [ZEROGPU_CONSENT_KEY]: next });
|
|
81
81
|
return next;
|
|
82
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* Serialises writes, for the same reason the bridge serialises applies. Toggling
|
|
85
|
+
* twice in quick succession is two concurrent calls — each bridge message is
|
|
86
|
+
* handled independently — and `storage.local` promises no ordering between
|
|
87
|
+
* them, so the earlier decision could be the one that lands last and persists
|
|
88
|
+
* while the user is looking at the later one. Queueing also keeps `updatedAt`
|
|
89
|
+
* in step with what actually got stored.
|
|
90
|
+
*/
|
|
91
|
+
let writeQueue = Promise.resolve();
|
|
92
|
+
const setZeroGpuConsent = (optedIn, source = 'extension') => {
|
|
93
|
+
const write = writeQueue.then(() => writeZeroGpuConsent(optedIn, source),
|
|
94
|
+
// A rejected write must not poison the queue for every later call.
|
|
95
|
+
() => writeZeroGpuConsent(optedIn, source));
|
|
96
|
+
writeQueue = write.catch(() => undefined);
|
|
97
|
+
return write;
|
|
98
|
+
};
|
|
83
99
|
/**
|
|
84
100
|
* Subscribe to consent changes from any extension context (the hosted settings
|
|
85
101
|
* page writing through the service worker, the options page, another window).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zerogpu-background.js","sources":["../../../src/extension/consent.ts","../../../src/extension/background.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;IAAA;;;;;;;;;;;IAWG;IAEH;AACO,UAAM,mBAAmB,GAAG;IAYnC;;;;IAIG;AACI,UAAM,eAAe,GAAmB;IAC7C,IAAA,OAAO,EAAE,IAAI;IACb,IAAA,SAAS,EAAE,IAAI;IACf,IAAA,MAAM,EAAE;;IAyBV,MAAM,mBAAmB,GAAG,MAC1B,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,SAAS;IAEpE;;;;;IAKG;IACH,MAAM,SAAS,GAAG,CAAC,GAAY,KAAoB;IACjD,IAAA,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;IAAE,QAAA,OAAO,eAAe;QAC3D,MAAM,KAAK,GAAG,GAA8B;IAC5C,IAAA,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS;IAAE,QAAA,OAAO,eAAe;QAC9D,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO;IACtB,QAAA,SAAS,EAAE,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,GAAG,KAAK,CAAC,SAAS,GAAG,IAAI;IACvE,QAAA,MAAM,EACJ,KAAK,CAAC,MAAM,KAAK,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,eAAe,IAAI,KAAK,CAAC,MAAM,KAAK;kBACjF,KAAK,CAAC;IACR,cAAE;SACP;IACH,CAAC;IAED;AACO,UAAM,iBAAiB,GAAG,YAAoC;IACnE,IAAA,MAAM,IAAI,GAAG,mBAAmB,EAAE;IAClC,IAAA,IAAI,CAAC,IAAI;IAAE,QAAA,OAAO,eAAe;IACjC,IAAA,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC;YAClD,OAAO,SAAS,CAAC,MAAM,GAAG,mBAAmB,CAAC,CAAC;QACjD;IAAE,IAAA,MAAM;;IAEN,QAAA,OAAO,eAAe;QACxB;IACF;IAEA;AACO,UAAM,gBAAgB,GAAG,YAA8B,CAAC,MAAM,iBAAiB,EAAE,EAAE;IAE1F;;;;IAIG;
|
|
1
|
+
{"version":3,"file":"zerogpu-background.js","sources":["../../../src/extension/consent.ts","../../../src/extension/background.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;IAAA;;;;;;;;;;;IAWG;IAEH;AACO,UAAM,mBAAmB,GAAG;IAYnC;;;;IAIG;AACI,UAAM,eAAe,GAAmB;IAC7C,IAAA,OAAO,EAAE,IAAI;IACb,IAAA,SAAS,EAAE,IAAI;IACf,IAAA,MAAM,EAAE;;IAyBV,MAAM,mBAAmB,GAAG,MAC1B,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,SAAS;IAEpE;;;;;IAKG;IACH,MAAM,SAAS,GAAG,CAAC,GAAY,KAAoB;IACjD,IAAA,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;IAAE,QAAA,OAAO,eAAe;QAC3D,MAAM,KAAK,GAAG,GAA8B;IAC5C,IAAA,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS;IAAE,QAAA,OAAO,eAAe;QAC9D,OAAO;YAC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AAO,CAAC;IAC5C,IAAA,CAAC,CAAC;;IAGF,IAAA,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,MAAK;IACpC,QAAA,KAAK,uBAAuB,CAAC,OAAO,CAAC;IACvC,IAAA,CAAC,CAAC;IACF,IAAA,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,MAAK;IAClC,QAAA,KAAK,uBAAuB,CAAC,OAAO,CAAC;IACvC,IAAA,CAAC,CAAC;IACJ;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const SDK_VERSION = typeof "0.2.
|
|
2
|
-
? "0.2.
|
|
1
|
+
const SDK_VERSION = typeof "0.2.4+81d7c7a" === 'string' && "0.2.4+81d7c7a".length > 0
|
|
2
|
+
? "0.2.4+81d7c7a"
|
|
3
3
|
: '0.0.0-dev';
|
|
4
4
|
|
|
5
5
|
const ORCHESTRATOR_BASE_URL = typeof "https://devices.zerogpu.ai" === 'string' && "https://devices.zerogpu.ai".length > 0
|
|
@@ -5304,6 +5304,15 @@ const getZeroGpuConsent = async () => {
|
|
|
5304
5304
|
return DEFAULT_CONSENT;
|
|
5305
5305
|
}
|
|
5306
5306
|
};
|
|
5307
|
+
/**
|
|
5308
|
+
* Serialises writes, for the same reason the bridge serialises applies. Toggling
|
|
5309
|
+
* twice in quick succession is two concurrent calls — each bridge message is
|
|
5310
|
+
* handled independently — and `storage.local` promises no ordering between
|
|
5311
|
+
* them, so the earlier decision could be the one that lands last and persists
|
|
5312
|
+
* while the user is looking at the later one. Queueing also keeps `updatedAt`
|
|
5313
|
+
* in step with what actually got stored.
|
|
5314
|
+
*/
|
|
5315
|
+
Promise.resolve();
|
|
5307
5316
|
/**
|
|
5308
5317
|
* Subscribe to consent changes from any extension context (the hosted settings
|
|
5309
5318
|
* page writing through the service worker, the options page, another window).
|