arcane-os 0.7.3 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0
4
+
5
+ - Add `removeBrowserSpeechModelCache()` to remove an explicitly retired Hugging
6
+ Face speech model from the current browser origin's upstream cache. Preserve
7
+ other models, voices, runtimes, DBOPFS artifacts, and preferences; report each
8
+ completed removal and surface cancellation or partial failure.
9
+ - Keep model retirement policy in consuming applications. The operation starts
10
+ no model download or inference and leaves NPU, GPU, and CPU selection unchanged.
11
+
3
12
  ## 0.7.3
4
13
 
5
14
  - Correct public development serving for OPFS/DBOPFS and other browser APIs
package/README.md CHANGED
@@ -19,7 +19,7 @@ version-locked SDK runtime, while an integrated Arcane checkout uses its live
19
19
  `arcane/` runtime. Both profiles preserve the same app URLs, theme, packaging,
20
20
  event, cancellation, and browser run contracts.
21
21
 
22
- This checkout defines the `0.7.3` SDK contract. Applications pin one exact npm
22
+ This checkout defines the `0.8.0` SDK contract. Applications pin one exact npm
23
23
  version and lockfile; registry state is deliberately not baked into application
24
24
  artifacts.
25
25
 
@@ -35,7 +35,7 @@ Create one browser application, install its pinned SDK, and start its source
35
35
  server:
36
36
 
37
37
  ```bash
38
- npx arcane-os@0.7.3 new hello-speech --path ./hello-speech --target browser
38
+ npx arcane-os@0.8.0 new hello-speech --path ./hello-speech --target browser
39
39
  cd hello-speech
40
40
  npm install
41
41
  npm run dev
@@ -386,7 +386,7 @@ uses the same controller for automatic memory extraction.
386
386
  Create a new repository-shaped Arcane application with the exact stable SDK:
387
387
 
388
388
  ```bash
389
- npx arcane-os@0.7.3 new my-app --path ./my-app --target portable --git
389
+ npx arcane-os@0.8.0 new my-app --path ./my-app --target portable --git
390
390
  cd my-app
391
391
  npm install
392
392
  npm run dev
@@ -396,7 +396,7 @@ To enroll an existing repository, install the exact SDK and initialize only
396
396
  missing Arcane files:
397
397
 
398
398
  ```bash
399
- npm install --save-dev --save-exact arcane-os@0.7.3
399
+ npm install --save-dev --save-exact arcane-os@0.8.0
400
400
  npm exec -- arcane init my-app --target portable
401
401
  ```
402
402
 
@@ -412,7 +412,7 @@ npm exec -- arcane-os targets
412
412
  No global SDK install or standalone Arcane CLI is required. The application
413
413
  repository's exact npm dependency and lockfile own the CLI and toolchain version.
414
414
 
415
- Use `npx arcane-os@0.7.3` for the initial bootstrap because it names this npm
415
+ Use `npx arcane-os@0.8.0` for the initial bootstrap because it names this npm
416
416
  package explicitly; bare `npx arcane` outside an installed project could resolve
417
417
  a different package. Both installed commands invoke the same headless toolchain.
418
418
  Project-local npm scripts use the SDK pinned by that app's `package-lock.json`,
@@ -432,7 +432,7 @@ node ./bin/arcane.mjs new local-app --path ../local-app --target portable --git
432
432
 
433
433
  # From the generated app repository
434
434
  cd ../local-app
435
- npm install --save-dev --save-exact ../arcane-os-sdk/arcane-os-0.7.3.tgz
435
+ npm install --save-dev --save-exact ../arcane-os-sdk/arcane-os-0.8.0.tgz
436
436
  npm ci
437
437
  ```
438
438
 
@@ -441,7 +441,7 @@ same location. The lockfile retains the selected package dependency while
441
441
  Arcane uses the installed package name and version. Local directory `file:` dependencies are not
442
442
  accepted because npm may install them as links; use a packed `.tgz`. A GitHub
443
443
  runner also needs that tarball at the locked path. After publication, replace
444
- the local declaration with the exact `arcane-os@0.7.3` registry package and
444
+ the local declaration with the exact `arcane-os@0.8.0` registry package and
445
445
  commit the regenerated lock.
446
446
 
447
447
  Generated repositories use `npm ci --ignore-scripts` in CI. Run dependency
@@ -580,7 +580,7 @@ package installation, or assertions.
580
580
 
581
581
  ## Current target support
582
582
 
583
- Version `0.7.3` exposes one browser target and five explicitly paired
583
+ Version `0.8.0` exposes one browser target and five explicitly paired
584
584
  native development targets: a non-runnable portable directory, a
585
585
  Windows x64 unsigned-local-test EXE bundle, Linux x64 and Linux ARM64
586
586
  unsigned-local-test DEBs, and an Android development-signed APK. The
@@ -2331,6 +2331,53 @@ export function createDbopfsSpeechArtifactStore({
2331
2331
  return store;
2332
2332
  }
2333
2333
 
2334
+ export async function removeBrowserSpeechModelCache(
2335
+ {repository, cacheStorage = globalThis.caches, signal} = {}
2336
+ ) {
2337
+ const selectedRepository = requiredText(repository, 'repository');
2338
+ const removed = [];
2339
+ const result = {repository: selectedRepository, removed};
2340
+ const modelPath = `/${selectedRepository.split('/').map(encodeURIComponent).join('/')}/resolve/`;
2341
+
2342
+ try {
2343
+ throwIfAborted(signal);
2344
+ if (!is.function(cacheStorage?.has) || !is.function(cacheStorage?.open)) {
2345
+ throw speechError(
2346
+ 'ARCANE_AI_STORAGE_UNAVAILABLE',
2347
+ 'Browser model cache storage is unavailable.',
2348
+ undefined,
2349
+ 'browser-speech-model-cache-unavailable'
2350
+ );
2351
+ }
2352
+ const cached = await cacheStorage.has('transformers-cache');
2353
+ throwIfAborted(signal);
2354
+ if (!cached) return result;
2355
+ const cache = await cacheStorage.open('transformers-cache');
2356
+ const requests = await cache.keys();
2357
+ for (const request of requests) {
2358
+ throwIfAborted(signal);
2359
+ const url = new URL(request.url);
2360
+ if (url.origin !== 'https://huggingface.co' || !url.pathname.startsWith(modelPath)) {
2361
+ continue;
2362
+ }
2363
+ if (await cache.delete(request)) removed.push(request.url);
2364
+ }
2365
+ throwIfAborted(signal);
2366
+ return result;
2367
+ } catch (cause) {
2368
+ const error = cause?.name === 'AbortError' || isBrowserSpeechArtifactError(cause)
2369
+ ? cause
2370
+ : speechError(
2371
+ 'ARCANE_AI_STORAGE_DELETE_FAILED',
2372
+ 'Unable to remove the selected browser speech model download.',
2373
+ cause,
2374
+ 'browser-speech-model-cache-delete-rejected'
2375
+ );
2376
+ error.removed = removed;
2377
+ throw error;
2378
+ }
2379
+ }
2380
+
2334
2381
  export function isBrowserSpeechAuthority(value) {
2335
2382
  return AUTHORITIES.has(value);
2336
2383
  }
@@ -4,6 +4,7 @@ export {
4
4
  createBrowserSpeechArtifactGraph,
5
5
  createBrowserSpeechAuthority,
6
6
  createDbopfsSpeechArtifactStore,
7
+ removeBrowserSpeechModelCache,
7
8
  } from "./browser-speech-artifacts.mjs";
8
9
  export {
9
10
  createBrowserKokoroProvider,
@@ -289,7 +289,7 @@ paths are withheld from the native provider. The provider copies the complete
289
289
  selected release rather than accepting an unrelated source path. Verification
290
290
  is a separate explicit operation for a selected release artifact.
291
291
 
292
- The SDK `0.7.3` runtime requires Arcane `0.8.12` or newer. Compatibility
292
+ The SDK `0.8.0` runtime requires Arcane `0.8.12` or newer. Compatibility
293
293
  is contractual rather than exact-version pinning: the prepared Core must meet
294
294
  the highest minimum declared by the runtime, selected app, and bundled app
295
295
  dependencies; keep each app's Arcane protocol generation; and provide every
@@ -1027,6 +1027,33 @@ forward a security payload to the Worker and performs no security work. Passing
1027
1027
  `{secure:true}` does not activate hardening. Any future hardening stage requires
1028
1028
  a separate user review and an explicit implementation change before it may execute.
1029
1029
 
1030
+ ## `removeBrowserSpeechModelCache()`
1031
+
1032
+ ```javascript
1033
+ const removal = await removeBrowserSpeechModelCache(
1034
+ {repository: 'Xenova/whisper-small', signal}
1035
+ );
1036
+ ```
1037
+
1038
+ Exported by `arcane-os/ai/browser-speech`. This explicit operation removes all
1039
+ cached revisions of the exact selected Hugging Face model from the current
1040
+ origin's existing `transformers-cache`. It returns `{repository,removed}`,
1041
+ where `removed` contains the complete URLs actually deleted. An absent cache or
1042
+ model returns an empty list. Other models, runtime files, the Kokoro voice
1043
+ cache, DBOPFS files, and preferences remain untouched. No model is loaded or
1044
+ downloaded and no inference is started.
1045
+
1046
+ The caller owns model retirement policy and must stop using the retired model
1047
+ before removal so a live provider cannot download it again. This operation is
1048
+ separate from `store.remove(authority)`, which removes declared DBOPFS files.
1049
+ `cacheStorage` may explicitly supply a CacheStorage implementation; it defaults
1050
+ to `globalThis.caches`. Missing storage rejects with
1051
+ `ARCANE_AI_STORAGE_UNAVAILABLE`; cache failures reject with
1052
+ `ARCANE_AI_STORAGE_DELETE_FAILED`. An aborted `signal` stops further removals
1053
+ with `AbortError`. Deletions already completed are retained in `error.removed`;
1054
+ removal is repeatable and does not claim transactional rollback. The operation
1055
+ enumerates one cache once and awaits each matching deletion in order.
1056
+
1030
1057
  ## Ordinary module routing
1031
1058
 
1032
1059
  Artifact-graph preparation reads each stored JavaScript module, discovers
@@ -125,6 +125,7 @@ browser map are cataloged separately in [Runtime modules](runtime-modules.md).
125
125
  | `createCanonicalUstarHeader()` | function | `arcane-os` | Packaging and release bundles | Node |
126
126
  | `createDbopfsModelStore()` | function | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser with a ready DBOPFS instance and OPFS |
127
127
  | `createDbopfsSpeechArtifactStore()` | function | `arcane-os/ai/browser-speech` | Browser speech providers | Browser with ready DBOPFS, Web Locks, Fetch, File/Blob, and object URLs |
128
+ | `removeBrowserSpeechModelCache()` | function | `arcane-os/ai/browser-speech` | Browser speech providers | Browser CacheStorage; explicit removal of one selected upstream model |
128
129
  | `createNativeBuildPlan()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
129
130
  | `createNativeTargetAdapter()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
130
131
  | `createReporter()` | function | `arcane-os` | Events, processes, and testing | Node |
@@ -6396,6 +6397,24 @@ const authority = createBrowserSpeechAuthority({
6396
6397
  });
6397
6398
  ```
6398
6399
 
6400
+ ## removeBrowserSpeechModelCache()
6401
+
6402
+ ```text
6403
+ removeBrowserSpeechModelCache({ repository, cacheStorage=globalThis.caches, signal }={})
6404
+ ```
6405
+
6406
+ Removes cached Hugging Face resources for the exact selected repository, across
6407
+ all revisions, from the current origin's existing `transformers-cache`.
6408
+ Returns `{repository,removed}`, including each complete URL actually deleted.
6409
+ An absent model or cache returns an empty list. The caller must stop using the
6410
+ retired model first; this operation does not unload providers or start inference.
6411
+ Other models, runtime resources, voice caches, declared DBOPFS artifacts, and
6412
+ preferences are preserved. Use `store.remove(authority)` separately for declared
6413
+ DBOPFS artifacts. Missing storage and cache failures surface
6414
+ `ARCANE_AI_STORAGE_UNAVAILABLE` and `ARCANE_AI_STORAGE_DELETE_FAILED`.
6415
+ Cancellation stops subsequent deletions with `AbortError`; `error.removed`
6416
+ retains the complete list of deletions already completed.
6417
+
6399
6418
  ## createDbopfsSpeechArtifactStore()
6400
6419
 
6401
6420
  ### Overview
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcane-os",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "description": "Arcane OS JavaScript SDK, project-local CLI, browser runtime, and repository-portable application packager.",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",