transcribe-cpp 0.5.1 → 0.5.2

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 CHANGED
@@ -251,6 +251,10 @@ if (!cpu) throw new Error("CPU device is not registered");
251
251
  const exact = await TranscribeModel.load("model.gguf", { device: cpu });
252
252
  ```
253
253
 
254
+ Device objects are process-local. To find a device again in another process,
255
+ save its `deviceUuid` when it has one (Vulkan, CUDA), else its `deviceId` (the PCI bus
256
+ id), not its index.
257
+
254
258
  `backend` defaults to `"auto"` (best accelerator, else CPU). A missing Vulkan
255
259
  loader/driver degrades silently to CPU; an explicit backend that cannot be
256
260
  satisfied raises a `BackendError`.
@@ -1,4 +1,4 @@
1
- export declare const PUBLIC_HEADER_HASH = "4393f89c866cc70d";
1
+ export declare const PUBLIC_HEADER_HASH = "d550d6960224e260";
2
2
  export declare const TRANSCRIBE_OK = 0;
3
3
  export declare const TRANSCRIBE_ERR_INVALID_ARG = 1;
4
4
  export declare const TRANSCRIBE_ERR_NOT_IMPLEMENTED = 2;
@@ -10,7 +10,7 @@
10
10
  // Stable digest of the ABI surface (structs, enums, macros, layout,
11
11
  // prototypes), computed by the Python oracle and pinned here so a header
12
12
  // ABI change turns this binding's drift check red for conscious review.
13
- export const PUBLIC_HEADER_HASH = "4393f89c866cc70d";
13
+ export const PUBLIC_HEADER_HASH = "d550d6960224e260";
14
14
  // === enum constants ===
15
15
  export const TRANSCRIBE_OK = 0;
16
16
  export const TRANSCRIBE_ERR_INVALID_ARG = 1;
@@ -153,7 +153,7 @@ export const TRANSCRIBE_EXT_KIND_WHISPER_RUN = 1314015319;
153
153
  export const STRUCT_LAYOUT = {
154
154
  'transcribe_ext': { size: 16, align: 8, offsets: { 'size': 0, 'kind': 8 } },
155
155
  'transcribe_backend_init_params': { size: 24, align: 8, offsets: { 'struct_size': 0, 'artifact_dir': 8, 'allowed_backends': 16 } },
156
- 'transcribe_device_info': { size: 64, align: 8, offsets: { 'struct_size': 0, 'name': 8, 'description': 16, 'kind': 24, 'device_id': 32, 'memory_total': 40, 'memory_free': 48, 'device_type': 56 } },
156
+ 'transcribe_device_info': { size: 72, align: 8, offsets: { 'struct_size': 0, 'name': 8, 'description': 16, 'kind': 24, 'device_id': 32, 'memory_total': 40, 'memory_free': 48, 'device_type': 56, 'device_uuid': 64 } },
157
157
  'transcribe_model_load_params': { size: 32, align: 8, offsets: { 'struct_size': 0, 'backend': 8, 'device': 16, 'no_mmap': 24 } },
158
158
  'transcribe_session_params': { size: 24, align: 8, offsets: { 'struct_size': 0, 'n_threads': 8, 'kv_type': 12, 'n_ctx': 16 } },
159
159
  'transcribe_run_params': { size: 104, align: 8, offsets: { 'struct_size': 0, 'task': 8, 'timestamps': 12, 'pnc': 16, 'itn': 20, 'diarize': 24, 'language': 32, 'target_language': 40, 'keep_special_tags': 48, 'family': 56, 'spec_k_drafts': 64, 'vocabulary': 72, 'n_vocabulary': 80, 'prompt': 88, 'prefix': 96 } },
@@ -232,7 +232,7 @@ export function defineTypes(koffi) {
232
232
  const T = {};
233
233
  T['transcribe_ext'] = koffi.struct({ size: 'uint64_t', kind: 'uint32_t' });
234
234
  T['transcribe_backend_init_params'] = koffi.struct({ struct_size: 'uint64_t', artifact_dir: 'char *', allowed_backends: 'uint32_t' });
235
- T['transcribe_device_info'] = koffi.struct({ struct_size: 'uint64_t', name: 'char *', description: 'char *', kind: 'char *', device_id: 'char *', memory_total: 'uint64_t', memory_free: 'uint64_t', device_type: 'int' });
235
+ T['transcribe_device_info'] = koffi.struct({ struct_size: 'uint64_t', name: 'char *', description: 'char *', kind: 'char *', device_id: 'char *', memory_total: 'uint64_t', memory_free: 'uint64_t', device_type: 'int', device_uuid: 'char *' });
236
236
  T['transcribe_model_load_params'] = koffi.struct({ struct_size: 'uint64_t', backend: 'int', device: 'void *', no_mmap: 'bool' });
237
237
  T['transcribe_session_params'] = koffi.struct({ struct_size: 'uint64_t', n_threads: 'int', kv_type: 'int', n_ctx: 'int32_t' });
238
238
  T['transcribe_run_params'] = koffi.struct({ struct_size: 'uint64_t', task: 'int', timestamps: 'int', pnc: 'int', itn: 'int', diarize: 'int', language: 'char *', target_language: 'char *', keep_special_tags: 'bool', family: 'void *', spec_k_drafts: 'int32_t', vocabulary: 'void *', n_vocabulary: 'int32_t', prompt: 'char *', prefix: 'char *' });
package/dist/index.js CHANGED
@@ -282,6 +282,7 @@ function deviceFromRaw(dev, handle, index = null) {
282
282
  kind: dev.kind ?? "",
283
283
  deviceType: DEVICE_TYPE_NAMES[dev.device_type] ?? "unknown",
284
284
  deviceId: dev.device_id ?? null,
285
+ deviceUuid: dev.device_uuid ?? null,
285
286
  memoryTotal: num(dev.memory_total),
286
287
  memoryFree: num(dev.memory_free),
287
288
  index,
package/dist/types.d.ts CHANGED
@@ -91,7 +91,8 @@ export interface TranscriptionResult extends Transcript {
91
91
  }
92
92
  /** Vendor-agnostic device class, orthogonal to {@link BackendInfo.kind}.
93
93
  * `"unknown"` is reported for a device-type value newer than this binding —
94
- * distinguish such devices by {@link BackendInfo.deviceId} / name, not this axis. */
94
+ * distinguish such devices by {@link BackendInfo.deviceUuid} /
95
+ * {@link BackendInfo.deviceId} / name, not this axis. */
95
96
  export type DeviceType = "cpu" | "gpu" | "igpu" | "accel" | "unknown";
96
97
  export interface BackendInfo {
97
98
  name: string;
@@ -102,6 +103,9 @@ export interface BackendInfo {
102
103
  /** Stable hardware id (PCI bus id) when the backend reports one, else null
103
104
  * (e.g. Metal). */
104
105
  deviceId: string | null;
106
+ /** Device UUID (lower-case 8-4-4-4-12 hex), else null (Vulkan and CUDA
107
+ * report one). Not guaranteed unique. */
108
+ deviceUuid: string | null;
105
109
  /** Reported device memory capacity in bytes, or 0 if unreported. */
106
110
  memoryTotal: number;
107
111
  /** Available device memory in bytes — a snapshot at query time, or 0 if
@@ -109,8 +113,8 @@ export interface BackendInfo {
109
113
  * to refresh; backend-defined and not comparable across device kinds. */
110
114
  memoryFree: number;
111
115
  /** Process-local registry index for display. Pass this object via
112
- * {@link ModelOptions.device} for exact selection; persist `deviceId`, not
113
- * the index. */
116
+ * {@link ModelOptions.device} for exact selection; persist `deviceUuid` or
117
+ * `deviceId`, not the index. */
114
118
  index: number | null;
115
119
  }
116
120
  export interface ModelOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transcribe-cpp",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "TypeScript/Node.js bindings for transcribe.cpp — a C/C++ speech-to-text library built on ggml",
5
5
  "type": "module",
6
6
  "exports": {
@@ -51,11 +51,11 @@
51
51
  "koffi": "^3.0.2"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@transcribe-cpp/darwin-arm64-metal": "0.5.1",
55
- "@transcribe-cpp/darwin-x64-cpu": "0.5.1",
56
- "@transcribe-cpp/linux-x64-cpu-vulkan": "0.5.1",
57
- "@transcribe-cpp/linux-arm64-cpu-vulkan": "0.5.1",
58
- "@transcribe-cpp/win32-x64-cpu-vulkan": "0.5.1"
54
+ "@transcribe-cpp/darwin-arm64-metal": "0.5.2",
55
+ "@transcribe-cpp/darwin-x64-cpu": "0.5.2",
56
+ "@transcribe-cpp/linux-x64-cpu-vulkan": "0.5.2",
57
+ "@transcribe-cpp/linux-arm64-cpu-vulkan": "0.5.2",
58
+ "@transcribe-cpp/win32-x64-cpu-vulkan": "0.5.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/node": "^22.0.0",