@qvac/sdk 0.19.1 → 0.20.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/NOTICE +18 -0
- package/dist/examples/abot-world.js +3 -3
- package/dist/examples/advisory-model-fit.d.ts +59 -0
- package/dist/examples/advisory-model-fit.js +156 -0
- package/dist/examples/asr/parakeet-nemotron-filesystem.d.ts +2 -0
- package/dist/examples/asr/parakeet-nemotron-filesystem.js +170 -0
- package/dist/examples/audiogen/edit-music.d.ts +2 -0
- package/dist/examples/audiogen/edit-music.js +121 -0
- package/dist/examples/audiogen/understand-music.d.ts +2 -0
- package/dist/examples/audiogen/understand-music.js +73 -0
- package/dist/examples/diffusion-ic-lora-ltx.js +3 -3
- package/dist/examples/diffusion-img2vid.js +1 -1
- package/dist/examples/diffusion-txt2vid-minimax-h3.d.ts +2 -0
- package/dist/examples/diffusion-txt2vid-minimax-h3.js +64 -0
- package/dist/examples/diffusion-txt2vid.js +1 -1
- package/dist/examples/rag/rag-turbovec.d.ts +2 -0
- package/dist/examples/rag/rag-turbovec.js +58 -0
- package/dist/examples/tts/audio8.js +5 -5
- package/dist/examples/tts/chatterbox-enhanced.js +4 -5
- package/dist/examples/tts/chatterbox-multilingual.js +5 -5
- package/dist/examples/tts/chatterbox.js +5 -5
- package/dist/examples/tts/cosyvoice3.js +5 -5
- package/dist/examples/tts/llm-to-tts-streaming.js +12 -2
- package/dist/examples/tts/parler.js +5 -5
- package/dist/examples/tts/supertonic-enhanced.js +4 -5
- package/dist/examples/tts/supertonic-multilingual.js +5 -5
- package/dist/examples/tts/supertonic.js +5 -5
- package/dist/scripts/contract/build-contract.d.ts +1 -1
- package/dist/scripts/contract/constants-registry.d.ts +31 -0
- package/dist/scripts/contract/constants-registry.js +13 -2
- package/dist/scripts/contract/method-shapes.d.ts +3 -0
- package/dist/scripts/contract/method-shapes.js +3 -0
- package/dist/src/client/api/audio-edit.d.ts +36 -0
- package/dist/src/client/api/audio-edit.js +38 -0
- package/dist/src/client/api/audio-gen-result.d.ts +5 -1
- package/dist/src/client/api/audio-gen-result.js +105 -52
- package/dist/src/client/api/audio-gen.d.ts +38 -1
- package/dist/src/client/api/audio-gen.js +38 -1
- package/dist/src/client/api/audio-understand.d.ts +25 -0
- package/dist/src/client/api/audio-understand.js +27 -0
- package/dist/src/client/api/index.d.ts +3 -0
- package/dist/src/client/api/index.js +3 -0
- package/dist/src/client/api/text-to-speech.d.ts +31 -4
- package/dist/src/client/api/text-to-speech.js +118 -21
- package/dist/src/client/api/vector-index.d.ts +143 -0
- package/dist/src/client/api/vector-index.js +168 -0
- package/dist/src/client/api/world.d.ts +2 -2
- package/dist/src/commands/bundle/manifest.d.ts +2 -0
- package/dist/src/commands/verify/addon-source.d.ts +6 -0
- package/dist/src/commands/verify/bundle-source.d.ts +2 -0
- package/dist/src/commands/verify/bundle-source.js +155 -1
- package/dist/src/commands/verify/index.js +1 -0
- package/dist/src/commands/verify/prebuilds.d.ts +23 -0
- package/dist/src/commands/verify/prebuilds.js +129 -13
- package/dist/src/commands/verify/resource-collectors.js +2 -1
- package/dist/src/expo/plugins/patches/qvac-platform-addons.d.ts +23 -0
- package/dist/src/expo/plugins/patches/qvac-platform-addons.js +94 -0
- package/dist/src/expo/plugins/withMobileBundle.d.ts +9 -6
- package/dist/src/expo/plugins/withMobileBundle.js +54 -34
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +7 -3
- package/dist/src/schemas/sdk-errors-server.d.ts +4 -0
- package/dist/src/schemas/sdk-errors-server.js +22 -0
- package/dist/src/utils/aggregate-events.d.ts +3 -1
- package/dist/src/utils/aggregate-events.js +7 -1
- package/dist/src/utils/errors-server.d.ts +12 -0
- package/dist/src/utils/errors-server.js +21 -0
- package/package.json +22 -15
- package/src/electron-forge/index.cjs +86 -14
- package/src/expo/plugins/patches/android-link.mjs +18 -9
- package/src/expo/plugins/patches/ios-link.mjs +18 -9
- package/src/expo/plugins/patches/qvac-platform-addons.ts +124 -0
|
@@ -5,12 +5,15 @@
|
|
|
5
5
|
* Otherwise, falls back to linking all installed addons.
|
|
6
6
|
*
|
|
7
7
|
* This file is copied over react-native-bare-kit/android/link.mjs
|
|
8
|
-
* by withMobileBundle.ts during expo prebuild.
|
|
8
|
+
* by withMobileBundle.ts during expo prebuild. The resolver it imports is
|
|
9
|
+
* compiled from qvac-platform-addons.ts and installed beside this file as
|
|
10
|
+
* qvac-platform-addons.mjs.
|
|
9
11
|
*/
|
|
10
12
|
import fs from 'fs'
|
|
11
13
|
import path from 'path'
|
|
12
14
|
import { fileURLToPath } from 'url'
|
|
13
15
|
import link from 'bare-link'
|
|
16
|
+
import { resolvePlatformAddonRoots } from './qvac-platform-addons.mjs'
|
|
14
17
|
|
|
15
18
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
16
19
|
const projectRoot = path.join(__dirname, '..', '..', '..')
|
|
@@ -24,10 +27,12 @@ if (fs.existsSync(addonsDir)) {
|
|
|
24
27
|
const manifestPath = path.join(projectRoot, 'qvac', 'addons.manifest.json')
|
|
25
28
|
|
|
26
29
|
let pkg = null
|
|
30
|
+
let addonNames = []
|
|
27
31
|
if (fs.existsSync(manifestPath)) {
|
|
28
32
|
try {
|
|
29
33
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
|
30
34
|
const addons = Array.isArray(manifest.addons) ? manifest.addons : []
|
|
35
|
+
addonNames = addons
|
|
31
36
|
|
|
32
37
|
if (addons.length > 0) {
|
|
33
38
|
console.log(`[QVAC] Using addons manifest (${addons.length} addons): ${addons.join(', ')}`)
|
|
@@ -46,13 +51,17 @@ if (fs.existsSync(manifestPath)) {
|
|
|
46
51
|
console.log('[QVAC] No addons manifest found, linking all addons')
|
|
47
52
|
}
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
hosts: ['android-arm64', 'android-arm', 'android-ia32', 'android-x64'],
|
|
53
|
-
out: addonsDir
|
|
54
|
-
},
|
|
55
|
-
pkg
|
|
56
|
-
)) {
|
|
54
|
+
const hosts = ['android-arm64', 'android-arm', 'android-ia32', 'android-x64']
|
|
55
|
+
|
|
56
|
+
for await (const resource of link(projectRoot, { hosts, out: addonsDir }, pkg)) {
|
|
57
57
|
console.log('Wrote', resource)
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
// Split addons keep their binaries in a per-platform package; bare-link only
|
|
61
|
+
// reaches the meta, which has shipped no prebuilds/ since the split.
|
|
62
|
+
for (const addon of resolvePlatformAddonRoots(projectRoot, addonNames, 'android')) {
|
|
63
|
+
console.log(`[QVAC] Linking split addon ${addon.pkg.name} from its platform package`)
|
|
64
|
+
for await (const resource of link(addon.dir, { hosts, out: addonsDir }, addon.pkg)) {
|
|
65
|
+
console.log('Wrote', resource)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -5,12 +5,15 @@
|
|
|
5
5
|
* Otherwise, falls back to linking all installed addons.
|
|
6
6
|
*
|
|
7
7
|
* This file is copied over react-native-bare-kit/ios/link.mjs
|
|
8
|
-
* by withMobileBundle.ts during expo prebuild.
|
|
8
|
+
* by withMobileBundle.ts during expo prebuild. The resolver it imports is
|
|
9
|
+
* compiled from qvac-platform-addons.ts and installed beside this file as
|
|
10
|
+
* qvac-platform-addons.mjs.
|
|
9
11
|
*/
|
|
10
12
|
import fs from 'fs'
|
|
11
13
|
import path from 'path'
|
|
12
14
|
import { fileURLToPath } from 'url'
|
|
13
15
|
import link from 'bare-link'
|
|
16
|
+
import { resolvePlatformAddonRoots } from './qvac-platform-addons.mjs'
|
|
14
17
|
|
|
15
18
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
16
19
|
const projectRoot = path.join(__dirname, '..', '..', '..')
|
|
@@ -24,10 +27,12 @@ if (fs.existsSync(addonsDir)) {
|
|
|
24
27
|
const manifestPath = path.join(projectRoot, 'qvac', 'addons.manifest.json')
|
|
25
28
|
|
|
26
29
|
let pkg = null
|
|
30
|
+
let addonNames = []
|
|
27
31
|
if (fs.existsSync(manifestPath)) {
|
|
28
32
|
try {
|
|
29
33
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
|
30
34
|
const addons = Array.isArray(manifest.addons) ? manifest.addons : []
|
|
35
|
+
addonNames = addons
|
|
31
36
|
|
|
32
37
|
if (addons.length > 0) {
|
|
33
38
|
console.log(`[QVAC] Using addons manifest (${addons.length} addons): ${addons.join(', ')}`)
|
|
@@ -46,13 +51,17 @@ if (fs.existsSync(manifestPath)) {
|
|
|
46
51
|
console.log('[QVAC] No addons manifest found, linking all addons')
|
|
47
52
|
}
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
hosts: ['ios-arm64', 'ios-arm64-simulator', 'ios-x64-simulator'],
|
|
53
|
-
out: addonsDir
|
|
54
|
-
},
|
|
55
|
-
pkg
|
|
56
|
-
)) {
|
|
54
|
+
const hosts = ['ios-arm64', 'ios-arm64-simulator', 'ios-x64-simulator']
|
|
55
|
+
|
|
56
|
+
for await (const resource of link(projectRoot, { hosts, out: addonsDir }, pkg)) {
|
|
57
57
|
console.log('Wrote', resource)
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
// Split addons keep their binaries in a per-platform package; bare-link only
|
|
61
|
+
// reaches the meta, which has shipped no prebuilds/ since the split.
|
|
62
|
+
for (const addon of resolvePlatformAddonRoots(projectRoot, addonNames, 'ios')) {
|
|
63
|
+
console.log(`[QVAC] Linking split addon ${addon.pkg.name} from its platform package`)
|
|
64
|
+
for await (const resource of link(addon.dir, { hosts, out: addonsDir }, addon.pkg)) {
|
|
65
|
+
console.log('Wrote', resource)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves split-addon platform packages from the meta package's `#host-addon`
|
|
3
|
+
* map. Linker, verify, and the missing-prebuild error all call this module so
|
|
4
|
+
* the slice name cannot drift from what the addon actually imports.
|
|
5
|
+
*
|
|
6
|
+
* Keep this file free of `@/` imports: the compiled JS is copied next to the
|
|
7
|
+
* patched `link.mjs` as `qvac-platform-addons.mjs`.
|
|
8
|
+
*/
|
|
9
|
+
import * as fs from 'fs'
|
|
10
|
+
import * as path from 'path'
|
|
11
|
+
|
|
12
|
+
export const HOST_ADDON_IMPORT = '#host-addon'
|
|
13
|
+
|
|
14
|
+
const DEFAULT_ANDROID_CPU = 'arm64'
|
|
15
|
+
|
|
16
|
+
export interface PlatformAddonRoot {
|
|
17
|
+
dir: string
|
|
18
|
+
pkg: { name?: string; version?: string; addon?: boolean }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function resolvePlatformAddonRoots(
|
|
22
|
+
projectRoot: string,
|
|
23
|
+
addonNames: string[],
|
|
24
|
+
platform: string
|
|
25
|
+
): PlatformAddonRoot[] {
|
|
26
|
+
const roots: PlatformAddonRoot[] = []
|
|
27
|
+
for (const name of addonNames) {
|
|
28
|
+
const root = resolvePlatformAddonRoot(projectRoot, name, platform)
|
|
29
|
+
if (root !== null) roots.push(root)
|
|
30
|
+
}
|
|
31
|
+
return roots
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function resolvePlatformAddonRoot(
|
|
35
|
+
projectRoot: string,
|
|
36
|
+
metaName: string,
|
|
37
|
+
platform: string
|
|
38
|
+
): PlatformAddonRoot | null {
|
|
39
|
+
const metaManifest = readManifest(packageDir(projectRoot, metaName))
|
|
40
|
+
if (metaManifest === null) return null
|
|
41
|
+
|
|
42
|
+
const platformPackage = resolveAddonPlatformPackage(
|
|
43
|
+
metaName,
|
|
44
|
+
metaManifest.imports?.[HOST_ADDON_IMPORT],
|
|
45
|
+
platform
|
|
46
|
+
)
|
|
47
|
+
if (platformPackage === null) return null
|
|
48
|
+
|
|
49
|
+
const addonDir = path.join(packageDir(projectRoot, platformPackage), 'addon')
|
|
50
|
+
const addonManifest = readManifest(addonDir)
|
|
51
|
+
if (addonManifest === null || addonManifest.addon !== true) return null
|
|
52
|
+
if (!fs.existsSync(path.join(addonDir, 'prebuilds'))) return null
|
|
53
|
+
|
|
54
|
+
return { dir: addonDir, pkg: addonManifest }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function packageDir(projectRoot: string, packageName: string): string {
|
|
58
|
+
return path.join(projectRoot, 'node_modules', ...packageName.split('/'))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface AddonManifest {
|
|
62
|
+
name?: string
|
|
63
|
+
version?: string
|
|
64
|
+
addon?: boolean
|
|
65
|
+
imports?: Record<string, unknown>
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function readManifest(dir: string): AddonManifest | null {
|
|
69
|
+
try {
|
|
70
|
+
const parsed: unknown = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'))
|
|
71
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null
|
|
72
|
+
return parsed as AddonManifest
|
|
73
|
+
} catch {
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Package `#host-addon` names for `host`, if that name belongs to `metaName`.
|
|
80
|
+
* `host` is a Bare host (`android-arm64`, `ios-arm64-simulator`, `darwin-arm64`)
|
|
81
|
+
* or a mobile build target (`android`, `ios`).
|
|
82
|
+
*/
|
|
83
|
+
export function resolveAddonPlatformPackage(
|
|
84
|
+
metaName: string,
|
|
85
|
+
hostAddon: unknown,
|
|
86
|
+
host: string
|
|
87
|
+
): string | null {
|
|
88
|
+
const name = resolvePlatformPackageName(hostAddon, host)
|
|
89
|
+
if (name === null) return null
|
|
90
|
+
if (!name.startsWith(`${metaName}-`)) return null
|
|
91
|
+
return name
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* First package name a `#host-addon` map points at for `host`.
|
|
96
|
+
* Android nests the package under its architecture; iOS is a flat list.
|
|
97
|
+
* A platform-only `android` target uses arm64, matching the current mobile host.
|
|
98
|
+
*/
|
|
99
|
+
export function resolvePlatformPackageName(hostAddon: unknown, host: string): string | null {
|
|
100
|
+
if (typeof host !== 'string' || host.length === 0) return null
|
|
101
|
+
|
|
102
|
+
const separator = host.indexOf('-')
|
|
103
|
+
const platform = separator === -1 ? host : host.slice(0, separator)
|
|
104
|
+
const cpu = separator === -1 ? '' : host.slice(separator + 1)
|
|
105
|
+
|
|
106
|
+
const branch = readBranch(hostAddon, platform)
|
|
107
|
+
const direct = packageName(branch)
|
|
108
|
+
if (direct !== null) return direct
|
|
109
|
+
|
|
110
|
+
const cpuKey = cpu.length > 0 ? cpu : DEFAULT_ANDROID_CPU
|
|
111
|
+
return packageName(readBranch(branch, cpuKey))
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function packageName(candidate: unknown): string | null {
|
|
115
|
+
const name = Array.isArray(candidate) ? candidate[0] : candidate
|
|
116
|
+
if (typeof name !== 'string' || name.startsWith('.')) return null
|
|
117
|
+
return name
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function readBranch(value: unknown, key: string): unknown {
|
|
121
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined
|
|
122
|
+
if (!Object.hasOwn(value, key)) return undefined
|
|
123
|
+
return (value as Record<string, unknown>)[key]
|
|
124
|
+
}
|