@qvac/audiogen-ggml 0.6.1 → 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/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.0] - 2026-10-14
9
+
10
+ ### Breaking
11
+
12
+ - `binding.js` is now `module.exports = require('#host-addon')`, a specifier
13
+ the Bare module lexer can follow, so `bare-pack` bundles an app that
14
+ requires `@qvac/audiogen-ggml`. `#host-addon` maps each host to its platform
15
+ package alone, with no fallback.
16
+ - The meta package is no longer an addon. Each platform package is an ordinary
17
+ one: its module is built as `qvac__audiogen-ggml-<suffix>` (every iOS host
18
+ shares `ios`) and sits at `prebuilds/<host>/qvac__audiogen-ggml-<suffix>.bare`,
19
+ with its ggml backends in `prebuilds/<host>/qvac__audiogen-ggml-<suffix>/`.
20
+ - The addon finds its ggml backends itself, next to the loaded module. An
21
+ explicit `backendsDir` is now scanned as given rather than as a prebuilds
22
+ root under which `<host>/<module>` is appended. `resolveBackendsDir()` and
23
+ `lib/backends.js` are removed.
24
+ - A source build is loadable once `npm run link:platform` (part of
25
+ `build:native`) stages it as the host's platform package in `node_modules/`.
26
+
8
27
  ## [0.6.1] - 2026-10-13
9
28
 
10
29
  ### Added
package/README.md CHANGED
@@ -66,11 +66,12 @@ platform package selected at install time through `os`/`cpu` filtered
66
66
 
67
67
  Do not depend on desktop platform packages directly. Supported installers are
68
68
  npm 7+, pnpm, bun, and Yarn Berry. Yarn v1 and `--omit=optional` installs skip
69
- the platform package and fail at require time with an error naming the missing
70
- package; a locally built `prebuilds/` directory in the package root always
71
- takes precedence. Use `require('@qvac/audiogen-ggml').resolveBackendsDir()`
72
- to locate the directory holding the host's prebuilt binaries and dynamically
73
- loaded ggml backends.
69
+ the platform package and fail at require time, and at `bare-pack` time, naming
70
+ the missing package. Each platform package is an ordinary Bare addon whose
71
+ `prebuilds/<host>/` holds the native module and, next to it, the dynamically
72
+ loaded ggml backends the module finds on its own. A source build becomes
73
+ loadable once `npm run link:platform` (run by `npm run build:native`) stages it
74
+ as the host's platform package in `node_modules/`.
74
75
 
75
76
  Mobile targets are cross-built, so no install host ever matches their `os`,
76
77
  and `optionalDependencies` filtering can never select them. Mobile
@@ -622,7 +623,7 @@ runnable end-to-end script (`npm run example`).
622
623
  | `cfgScale` | Default MiniMax flow guidance scale; `0` uses the model default. |
623
624
  | `nGpuLayers` | GPU layers to offload when `useGPU` is set (99 = all). |
624
625
  | `threads` | CPU thread count (0 / unset = hardware default). |
625
- | `backendsDir` | Advanced; override the prebuilds root scanned for dlopen'd ggml backend modules. Defaults to `resolveBackendsDir()`: the package's own `prebuilds/` when present, otherwise the installed platform package. Needed on arm64, where the CPU backend is a set of per-microarch module `.so`s. |
626
+ | `backendsDir` | Advanced; directory scanned, as given, for dlopen'd ggml backend modules. Unset scans the addon's own, next to its native module, which is where the platform package and `bare-link` put them. |
626
627
 
627
628
  `logger` — an optional object implementing `error`/`warn`/`info`/`debug`,
628
629
  wrapped by a level-gated `QvacLogger`.
@@ -1,31 +1,15 @@
1
- const { hostPlatformPackage, PREBUILT_HOSTS } = require('./lib/backends.js')
1
+ 'use strict'
2
2
 
3
- const META_PACKAGE = '@qvac/audiogen-ggml'
4
- const UNKNOWN_HOST = 'unknown'
3
+ // "#host-addon" target for hosts with no platform package. Hosts that have one
4
+ // map straight to it with no fallback, so a missing install fails bare-pack (and
5
+ // fails at run time naming the package) instead of producing a bundle that only
6
+ // throws once launched.
7
+ const host = require.addon ? require.addon.host : 'unknown'
5
8
 
6
- throw new Error(buildMessage(currentHost()))
7
-
8
- function currentHost() {
9
- return require.addon ? require.addon.host : null
10
- }
11
-
12
- function buildMessage(host) {
13
- if (!host || !PREBUILT_HOSTS.includes(host)) {
14
- return (
15
- META_PACKAGE +
16
- ' has no prebuilt binaries for host ' +
17
- (host || UNKNOWN_HOST) +
18
- '. Prebuilt hosts: ' +
19
- PREBUILT_HOSTS.join(', ') +
20
- '. Build from source with bare-make.'
21
- )
22
- }
23
- return (
24
- META_PACKAGE +
25
- ' found no native prebuild for ' +
9
+ throw new Error(
10
+ '@qvac/audiogen-ggml has no prebuilt binaries for host ' +
26
11
  host +
27
- ': the platform package ' +
28
- hostPlatformPackage(host) +
29
- ' is not installed. It ships as an os/cpu filtered optional dependency, which Yarn v1 and installs using --omit=optional drop. Reinstall with npm 7+, pnpm, bun, or Yarn Berry, or build from source with bare-make.'
30
- )
31
- }
12
+ '. Platform packages exist for linux-x64, linux-arm64, darwin-arm64, ' +
13
+ 'darwin-x64, win32-x64, android-arm64 and ios (ios-arm64, ' +
14
+ 'ios-arm64-simulator, ios-x64-simulator). Build from source with bare-make.'
15
+ )
package/audiogen.d.ts CHANGED
@@ -14,9 +14,8 @@ export interface AudioGenConfigurationParams {
14
14
  nGpuLayers?: number;
15
15
  threads?: number;
16
16
  /**
17
- * Prebuilds root the native side scans (after appending the per-target
18
- * BACKENDS_SUBDIR) for dlopen'd ggml backend modules. Required on arm64, where
19
- * the CPU backend ships as per-microarch MODULE .so files.
17
+ * Directory the native side scans, as given, for dlopen'd ggml backend
18
+ * modules. Unset scans the addon's own, next to its native module.
20
19
  */
21
20
  backendsDir?: string;
22
21
  }
package/binding.js CHANGED
@@ -1,49 +1 @@
1
- module.exports = loadAddon()
2
-
3
- // The split meta package has no local prebuild. Some runtimes return this
4
- // package's Javascript entry from require.addon() instead of throwing, so
5
- // validate the result before accepting it as the native binding.
6
-
7
- function loadAddon() {
8
- let cause = null
9
-
10
- try {
11
- const addon = require.addon()
12
- if (isNativeBinding(addon)) return addon
13
- cause = new Error(
14
- '@qvac/audiogen-ggml: require.addon() answered with a module that is not the native binding ' +
15
- '(no createInstance function), so the prebuild in this package was treated as absent.'
16
- )
17
- } catch (err) {
18
- cause = err
19
- }
20
-
21
- return loadPlatformPackageAddon(cause)
22
- }
23
-
24
- function loadPlatformPackageAddon(cause) {
25
- let addon
26
-
27
- try {
28
- addon = require('#host-addon')
29
- } catch (err) {
30
- if (err.cause === undefined) err.cause = cause
31
- throw err
32
- }
33
-
34
- if (!isNativeBinding(addon)) {
35
- const err = new Error(
36
- '@qvac/audiogen-ggml resolved #host-addon to a module that is not the native binding: ' +
37
- 'it has no createInstance function. Check that the platform package for this host ' +
38
- 'is installed and is not shadowed by another module of the same name.'
39
- )
40
- err.cause = cause
41
- throw err
42
- }
43
-
44
- return addon
45
- }
46
-
47
- function isNativeBinding(addon) {
48
- return addon !== null && typeof addon === 'object' && typeof addon.createInstance === 'function'
49
- }
1
+ module.exports = require('#host-addon')
package/index.d.ts CHANGED
@@ -52,12 +52,9 @@ export interface AudioGenRuntimeConfig {
52
52
  /** 0 = engine auto-picks. */
53
53
  threads?: number;
54
54
  /**
55
- * Override the prebuilds root the native engine scans for dlopen'd ggml
56
- * backend modules. Defaults to `resolveBackendsDir()`: the package's own
57
- * `prebuilds/` when present, otherwise the installed platform package
58
- * (`@qvac/audiogen-ggml-<platform>-<arch>`). Only set this for a
59
- * non-standard prebuilds layout. Needed on arm64, where the CPU backend is
60
- * a set of per-microarch MODULE .so files.
55
+ * Directory the native engine scans, as given, for dlopen'd ggml backend
56
+ * modules. Unset scans the addon's own, next to its native module, which is
57
+ * where the platform package and bare-link put them.
61
58
  */
62
59
  backendsDir?: string;
63
60
  }
@@ -556,7 +553,6 @@ export { REGISTRY_SOURCE, REGISTRY_PREFIX, FIXED_MODELS, DIT_VARIANTS, DEFAULT_D
556
553
  export type { DitVariant, ModelManifest, ModelSources, ResolveDitModelPathOptions } from './models';
557
554
  export { encodePcm, pcmToWav, SUPPORTED_FORMATS as OUTPUT_FORMATS } from './lib/audio-format';
558
555
  export type { OutputFormat, EncodeOptions, EncodedAudio } from './lib/audio-format';
559
- export { resolveBackendsDir } from './lib/backends';
560
556
  export { assessFit } from './lib/fit';
561
557
  export type { AudiogenFitRequest, AudiogenFitResult, AudiogenFitStatus } from './lib/fit';
562
558
  export { ERR_CODE_RANGE, ERR_CODES, QvacErrorAudioGen } from './error';
package/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  // streams the engine's output (progress ticks + one interleaved-Int16 PCM
12
12
  // chunk) and resolves with the run stats.
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.RepaintMode = exports.AudioEditOperationType = exports.QvacErrorAudioGen = exports.ERR_CODES = exports.ERR_CODE_RANGE = exports.assessFit = exports.resolveBackendsDir = exports.OUTPUT_FORMATS = exports.pcmToWav = exports.encodePcm = exports.allRegistryPaths = exports.resolveDitModelPath = exports.modelSources = exports.modelManifest = exports.modelFilenames = exports.registryPath = exports.ditFilename = exports.ditVariants = exports.DEFAULT_DIT_VARIANT = exports.DIT_VARIANTS = exports.FIXED_MODELS = exports.REGISTRY_PREFIX = exports.REGISTRY_SOURCE = exports.AudioGen = exports.AudioEditSession = exports.AUDIOGEN_GPU_FALLBACK_REASONS = exports.AUDIOGEN_BACKEND_NAMES = exports.MINIMAX_DEFAULT_MAX_FRAMES = exports.MINIMAX_FRAMES_PER_SECOND = exports.ENGINE_MINIMAX = exports.ENGINE_ACESTEP = void 0;
14
+ exports.RepaintMode = exports.AudioEditOperationType = exports.QvacErrorAudioGen = exports.ERR_CODES = exports.ERR_CODE_RANGE = exports.assessFit = exports.OUTPUT_FORMATS = exports.pcmToWav = exports.encodePcm = exports.allRegistryPaths = exports.resolveDitModelPath = exports.modelSources = exports.modelManifest = exports.modelFilenames = exports.registryPath = exports.ditFilename = exports.ditVariants = exports.DEFAULT_DIT_VARIANT = exports.DIT_VARIANTS = exports.FIXED_MODELS = exports.REGISTRY_PREFIX = exports.REGISTRY_SOURCE = exports.AudioGen = exports.AudioEditSession = exports.AUDIOGEN_GPU_FALLBACK_REASONS = exports.AUDIOGEN_BACKEND_NAMES = exports.MINIMAX_DEFAULT_MAX_FRAMES = exports.MINIMAX_FRAMES_PER_SECOND = exports.ENGINE_MINIMAX = exports.ENGINE_ACESTEP = void 0;
15
15
  exports.audiogenBackendName = audiogenBackendName;
16
16
  exports.audiogenGpuFallbackReason = audiogenGpuFallbackReason;
17
17
  exports.detectEngineType = detectEngineType;
@@ -23,7 +23,6 @@ const os = require("bare-os");
23
23
  const audiogen_1 = require("./audiogen");
24
24
  const models_1 = require("./models");
25
25
  const audio_format_1 = require("./lib/audio-format");
26
- const backends_1 = require("./lib/backends");
27
26
  const error_1 = require("./error");
28
27
  exports.ENGINE_ACESTEP = 'acestep';
29
28
  exports.ENGINE_MINIMAX = 'minimax';
@@ -568,7 +567,7 @@ class AudioGen {
568
567
  const files = options.files ?? {};
569
568
  const config = options.config ?? {};
570
569
  this._engineType = detectEngineType(files, options.engine);
571
- const backendsDir = config.backendsDir ?? (0, backends_1.resolveBackendsDir)();
570
+ const backendsDir = config.backendsDir;
572
571
  const threads = requireNonNegativeInt32(config.threads ?? 0, 'threads');
573
572
  this._ditVariant = files.ditVariant;
574
573
  if (this._engineType === exports.ENGINE_MINIMAX) {
@@ -1163,8 +1162,6 @@ var audio_format_2 = require("./lib/audio-format");
1163
1162
  Object.defineProperty(exports, "encodePcm", { enumerable: true, get: function () { return audio_format_2.encodePcm; } });
1164
1163
  Object.defineProperty(exports, "pcmToWav", { enumerable: true, get: function () { return audio_format_2.pcmToWav; } });
1165
1164
  Object.defineProperty(exports, "OUTPUT_FORMATS", { enumerable: true, get: function () { return audio_format_2.SUPPORTED_FORMATS; } });
1166
- var backends_2 = require("./lib/backends");
1167
- Object.defineProperty(exports, "resolveBackendsDir", { enumerable: true, get: function () { return backends_2.resolveBackendsDir; } });
1168
1165
  var fit_1 = require("./lib/fit");
1169
1166
  Object.defineProperty(exports, "assessFit", { enumerable: true, get: function () { return fit_1.assessFit; } });
1170
1167
  var error_2 = require("./error");
package/lib/fit.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict'
2
2
 
3
- const { resolveBackendsDir } = require('./backends')
4
-
5
3
  /**
6
4
  * Projects one model set against the memory free right now, reading GGUF
7
5
  * metadata and never weight data. The registry's weightless copy of each stage
@@ -18,13 +16,7 @@ const { resolveBackendsDir } = require('./backends')
18
16
  function assessFit(request) {
19
17
  const binding = require('../binding.js')
20
18
 
21
- return binding.assessFit({
22
- ...request,
23
- backendsDir:
24
- typeof request.backendsDir === 'string' && request.backendsDir.length > 0
25
- ? request.backendsDir
26
- : resolveBackendsDir()
27
- })
19
+ return binding.assessFit(request)
28
20
  }
29
21
 
30
22
  module.exports = { assessFit }
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@qvac/audiogen-ggml",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "Audio generation (music) addon for qvac",
5
- "addon": true,
6
5
  "qvac": {
7
6
  "ggml-speech": "2026-10-07#1"
8
7
  },
@@ -12,52 +11,32 @@
12
11
  "imports": {
13
12
  "#host-addon": {
14
13
  "linux": {
15
- "x64": [
16
- "@qvac/audiogen-ggml-linux-x64",
17
- "./addon-unavailable.js"
18
- ],
19
- "arm64": [
20
- "@qvac/audiogen-ggml-linux-arm64",
21
- "./addon-unavailable.js"
22
- ],
14
+ "x64": "@qvac/audiogen-ggml-linux-x64",
15
+ "arm64": "@qvac/audiogen-ggml-linux-arm64",
23
16
  "default": "./addon-unavailable.js"
24
17
  },
25
18
  "darwin": {
26
- "arm64": [
27
- "@qvac/audiogen-ggml-darwin-arm64",
28
- "./addon-unavailable.js"
29
- ],
30
- "x64": [
31
- "@qvac/audiogen-ggml-darwin-x64",
32
- "./addon-unavailable.js"
33
- ],
19
+ "arm64": "@qvac/audiogen-ggml-darwin-arm64",
20
+ "x64": "@qvac/audiogen-ggml-darwin-x64",
34
21
  "default": "./addon-unavailable.js"
35
22
  },
36
23
  "win32": {
37
- "x64": [
38
- "@qvac/audiogen-ggml-win32-x64",
39
- "./addon-unavailable.js"
40
- ],
24
+ "x64": "@qvac/audiogen-ggml-win32-x64",
41
25
  "default": "./addon-unavailable.js"
42
26
  },
43
27
  "android": {
44
- "arm64": [
45
- "@qvac/audiogen-ggml-android-arm64",
46
- "./addon-unavailable.js"
47
- ],
28
+ "arm64": "@qvac/audiogen-ggml-android-arm64",
48
29
  "default": "./addon-unavailable.js"
49
30
  },
50
- "ios": [
51
- "@qvac/audiogen-ggml-ios",
52
- "./addon-unavailable.js"
53
- ],
31
+ "ios": "@qvac/audiogen-ggml-ios",
54
32
  "default": "./addon-unavailable.js"
55
33
  }
56
34
  },
57
35
  "scripts": {
58
36
  "build": "npm run build:ts && npm run build:native",
59
- "build:native": "bare-make generate && bare-make build && bare-make install",
60
- "build:native:cuda": "bare-make generate -D ENABLE_CUDA=ON && bare-make build && bare-make install",
37
+ "build:native": "bare-make generate && bare-make build && bare-make install && npm run link:platform",
38
+ "build:native:cuda": "bare-make generate -D ENABLE_CUDA=ON && bare-make build && bare-make install && npm run link:platform",
39
+ "link:platform": "node ../../scripts/ci/slice-platform-packages.mjs --link-local --workdir .",
61
40
  "build:cuda": "npm run build:ts && npm run build:native:cuda",
62
41
  "build:ts": "tsc -p tsconfig.build.json",
63
42
  "build:pack": "npm run build:ts && mkdir -p dist && npm pack --pack-destination dist",
@@ -171,15 +150,27 @@
171
150
  "bare-path": "^3.0.0",
172
151
  "bare-process": "^4.2.2"
173
152
  },
153
+ "optionalDependencies": {
154
+ "@qvac/audiogen-ggml-linux-x64": "0.7.0",
155
+ "@qvac/audiogen-ggml-linux-arm64": "0.7.0",
156
+ "@qvac/audiogen-ggml-darwin-arm64": "0.7.0",
157
+ "@qvac/audiogen-ggml-darwin-x64": "0.7.0",
158
+ "@qvac/audiogen-ggml-win32-x64": "0.7.0"
159
+ },
174
160
  "overrides": {
175
161
  "bare-module-lexer": "1.6.3"
176
162
  },
177
163
  "types": "index.d.ts",
178
- "optionalDependencies": {
179
- "@qvac/audiogen-ggml-linux-x64": "0.6.1",
180
- "@qvac/audiogen-ggml-linux-arm64": "0.6.1",
181
- "@qvac/audiogen-ggml-darwin-arm64": "0.6.1",
182
- "@qvac/audiogen-ggml-darwin-x64": "0.6.1",
183
- "@qvac/audiogen-ggml-win32-x64": "0.6.1"
164
+ "peerDependencies": {
165
+ "@qvac/audiogen-ggml-android-arm64": "0.7.0",
166
+ "@qvac/audiogen-ggml-ios": "0.7.0"
167
+ },
168
+ "peerDependenciesMeta": {
169
+ "@qvac/audiogen-ggml-android-arm64": {
170
+ "optional": true
171
+ },
172
+ "@qvac/audiogen-ggml-ios": {
173
+ "optional": true
174
+ }
184
175
  }
185
176
  }
package/lib/backends.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export interface BackendsDirSources {
2
- localPrebuildsDir: string
3
- host: string | null
4
- directoryExists: (dir: string) => boolean
5
- resolveManifest: (specifier: string) => string | null
6
- }
7
-
8
- export const PREBUILT_HOSTS: string[]
9
- export function hostPlatformPackage(host: string): string
10
- export function resolveBackendsDirFrom(sources: BackendsDirSources): string
11
- export function resolveBackendsDir(): string
package/lib/backends.js DELETED
@@ -1,86 +0,0 @@
1
- 'use strict'
2
-
3
- const fs = require('bare-fs')
4
- const path = require('bare-path')
5
-
6
- const PACKAGE_ROOT = path.join(__dirname, '..')
7
- const PREBUILDS_DIR_NAME = 'prebuilds'
8
- const PLATFORM_ADDON_DIR_NAME = 'addon'
9
- const PLATFORM_PACKAGE_PREFIX = '@qvac/audiogen-ggml-'
10
- const PLATFORM_MANIFEST_SUBPATH = '/package'
11
- const IOS_PLATFORM = 'ios'
12
- const HOST_SEPARATOR = '-'
13
-
14
- const PREBUILT_HOSTS = [
15
- 'linux-x64',
16
- 'linux-arm64',
17
- 'darwin-arm64',
18
- 'darwin-x64',
19
- 'win32-x64',
20
- 'android-arm64',
21
- 'ios-arm64',
22
- 'ios-arm64-simulator',
23
- 'ios-x64-simulator'
24
- ]
25
-
26
- function hostPlatformPackage(host) {
27
- const platform = host.split(HOST_SEPARATOR)[0]
28
- const suffix = platform === IOS_PLATFORM ? IOS_PLATFORM : host
29
- return PLATFORM_PACKAGE_PREFIX + suffix
30
- }
31
-
32
- function resolveBackendsDirFrom(sources) {
33
- if (sources.directoryExists(sources.localPrebuildsDir)) {
34
- return sources.localPrebuildsDir
35
- }
36
- return platformPackagePrebuildsDir(sources) ?? sources.localPrebuildsDir
37
- }
38
-
39
- function platformPackagePrebuildsDir(sources) {
40
- if (!sources.host) {
41
- return null
42
- }
43
- const manifestPath = sources.resolveManifest(
44
- hostPlatformPackage(sources.host) + PLATFORM_MANIFEST_SUBPATH
45
- )
46
- if (!manifestPath) {
47
- return null
48
- }
49
- return path.join(path.dirname(manifestPath), PLATFORM_ADDON_DIR_NAME, PREBUILDS_DIR_NAME)
50
- }
51
-
52
- function resolveBackendsDir() {
53
- return resolveBackendsDirFrom({
54
- localPrebuildsDir: path.join(PACKAGE_ROOT, PREBUILDS_DIR_NAME),
55
- host: currentHost(),
56
- directoryExists: safeDirectoryExists,
57
- resolveManifest: safeResolveManifest
58
- })
59
- }
60
-
61
- function currentHost() {
62
- return require.addon ? require.addon.host : null
63
- }
64
-
65
- function safeDirectoryExists(dir) {
66
- try {
67
- return fs.existsSync(dir)
68
- } catch {
69
- return false
70
- }
71
- }
72
-
73
- function safeResolveManifest(specifier) {
74
- try {
75
- return require.resolve(specifier)
76
- } catch {
77
- return null
78
- }
79
- }
80
-
81
- module.exports = {
82
- PREBUILT_HOSTS,
83
- hostPlatformPackage,
84
- resolveBackendsDirFrom,
85
- resolveBackendsDir
86
- }