transcribe-cpp 0.0.10 → 0.0.11

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.
@@ -1,4 +1,4 @@
1
- export declare const PUBLIC_HEADER_HASH = "ebe6a6816e34a24e";
1
+ export declare const PUBLIC_HEADER_HASH = "86b16dd97ad1cb58";
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 = "ebe6a6816e34a24e";
13
+ export const PUBLIC_HEADER_HASH = "86b16dd97ad1cb58";
14
14
  // === enum constants ===
15
15
  export const TRANSCRIBE_OK = 0;
16
16
  export const TRANSCRIBE_ERR_INVALID_ARG = 1;
@@ -106,7 +106,7 @@ export const STRUCT_LAYOUT = {
106
106
  'transcribe_model_load_params': { size: 16, align: 8, offsets: { 'struct_size': 0, 'backend': 8, 'gpu_device': 12 } },
107
107
  'transcribe_session_params': { size: 24, align: 8, offsets: { 'struct_size': 0, 'n_threads': 8, 'kv_type': 12, 'n_ctx': 16 } },
108
108
  'transcribe_run_params': { size: 64, align: 8, offsets: { 'struct_size': 0, 'task': 8, 'timestamps': 12, 'pnc': 16, 'itn': 20, 'language': 24, 'target_language': 32, 'keep_special_tags': 40, 'family': 48, 'spec_k_drafts': 56 } },
109
- 'transcribe_capabilities': { size: 40, align: 8, offsets: { 'struct_size': 0, 'native_sample_rate': 8, 'n_languages': 12, 'languages': 16, 'max_timestamp_kind': 24, 'supports_language_detect': 28, 'supports_translate': 29, 'supports_streaming': 30, 'supports_spec_decode': 31, 'max_audio_ms': 32 } },
109
+ 'transcribe_capabilities': { size: 56, align: 8, offsets: { 'struct_size': 0, 'native_sample_rate': 8, 'n_languages': 12, 'languages': 16, 'max_timestamp_kind': 24, 'supports_language_detect': 28, 'supports_translate': 29, 'supports_streaming': 30, 'supports_spec_decode': 31, 'max_audio_ms': 32, 'n_translate_target_languages': 40, 'translate_target_languages': 48 } },
110
110
  'transcribe_session_limits': { size: 32, align: 8, offsets: { 'struct_size': 0, 'effective_n_ctx': 8, 'effective_max_audio_ms': 16, 'max_kv_bytes': 24 } },
111
111
  'transcribe_stream_params': { size: 24, align: 8, offsets: { 'struct_size': 0, 'family': 8, 'commit_policy': 16, 'stable_prefix_agreement_n': 20 } },
112
112
  'transcribe_stream_update': { size: 48, align: 8, offsets: { 'struct_size': 0, 'result_changed': 8, 'is_final': 9, 'revision': 12, 'input_received_ms': 16, 'audio_committed_ms': 24, 'buffered_ms': 32, 'committed_changed': 40, 'tentative_changed': 41 } },
@@ -146,7 +146,7 @@ export function defineTypes(koffi) {
146
146
  T['transcribe_model_load_params'] = koffi.struct({ struct_size: 'uint64_t', backend: 'int', gpu_device: 'int' });
147
147
  T['transcribe_session_params'] = koffi.struct({ struct_size: 'uint64_t', n_threads: 'int', kv_type: 'int', n_ctx: 'int32_t' });
148
148
  T['transcribe_run_params'] = koffi.struct({ struct_size: 'uint64_t', task: 'int', timestamps: 'int', pnc: 'int', itn: 'int', language: 'char *', target_language: 'char *', keep_special_tags: 'bool', family: 'void *', spec_k_drafts: 'int32_t' });
149
- T['transcribe_capabilities'] = koffi.struct({ struct_size: 'uint64_t', native_sample_rate: 'int32_t', n_languages: 'int', languages: 'void *', max_timestamp_kind: 'int', supports_language_detect: 'bool', supports_translate: 'bool', supports_streaming: 'bool', supports_spec_decode: 'bool', max_audio_ms: 'int64_t' });
149
+ T['transcribe_capabilities'] = koffi.struct({ struct_size: 'uint64_t', native_sample_rate: 'int32_t', n_languages: 'int', languages: 'void *', max_timestamp_kind: 'int', supports_language_detect: 'bool', supports_translate: 'bool', supports_streaming: 'bool', supports_spec_decode: 'bool', max_audio_ms: 'int64_t', n_translate_target_languages: 'int', translate_target_languages: 'void *' });
150
150
  T['transcribe_session_limits'] = koffi.struct({ struct_size: 'uint64_t', effective_n_ctx: 'int32_t', effective_max_audio_ms: 'int64_t', max_kv_bytes: 'int64_t' });
151
151
  T['transcribe_stream_params'] = koffi.struct({ struct_size: 'uint64_t', family: 'void *', commit_policy: 'int', stable_prefix_agreement_n: 'uint32_t' });
152
152
  T['transcribe_stream_update'] = koffi.struct({ struct_size: 'uint64_t', result_changed: 'bool', is_final: 'bool', revision: 'int32_t', input_received_ms: 'int64_t', audio_committed_ms: 'int64_t', buffered_ms: 'int64_t', committed_changed: 'bool', tentative_changed: 'bool' });
@@ -205,6 +205,7 @@ export const FUNCTION_SIGNATURES = {
205
205
  'transcribe_model_get_device': { ret: 'transcribe_status', args: ['const struct transcribe_model *', 'struct transcribe_backend_device *'] },
206
206
  'transcribe_model_load_file': { ret: 'transcribe_status', args: ['const char *', 'const struct transcribe_model_load_params *', 'struct transcribe_model **'] },
207
207
  'transcribe_model_load_params_init': { ret: 'void', args: ['struct transcribe_model_load_params *'] },
208
+ 'transcribe_model_meta_val_str': { ret: 'const char *', args: ['const struct transcribe_model *', 'const char *'] },
208
209
  'transcribe_model_supports': { ret: '_Bool', args: ['const struct transcribe_model *', 'transcribe_feature'] },
209
210
  'transcribe_model_variant_string': { ret: 'const char *', args: ['const struct transcribe_model *'] },
210
211
  'transcribe_moonshine_streaming_stream_ext_init': { ret: 'void', args: ['struct transcribe_moonshine_streaming_stream_ext *'] },
package/dist/index.js CHANGED
@@ -1055,6 +1055,7 @@ export class TranscribeModel {
1055
1055
  n.F.capabilitiesInit(c);
1056
1056
  check(n, n.F.modelGetCapabilities(this.handle, c), "reading capabilities");
1057
1057
  let languages = [];
1058
+ let translateTargetLanguages = [];
1058
1059
  try {
1059
1060
  if (c.languages && c.n_languages > 0) {
1060
1061
  languages = n.koffi.decode(c.languages, "char *", c.n_languages);
@@ -1063,9 +1064,18 @@ export class TranscribeModel {
1063
1064
  catch {
1064
1065
  languages = [];
1065
1066
  }
1067
+ try {
1068
+ if (c.translate_target_languages && c.n_translate_target_languages > 0) {
1069
+ translateTargetLanguages = n.koffi.decode(c.translate_target_languages, "char *", c.n_translate_target_languages);
1070
+ }
1071
+ }
1072
+ catch {
1073
+ translateTargetLanguages = [];
1074
+ }
1066
1075
  return {
1067
1076
  nativeSampleRate: c.native_sample_rate,
1068
1077
  languages,
1078
+ translateTargetLanguages,
1069
1079
  maxTimestampKind: TIMESTAMP_NAMES[c.max_timestamp_kind] ?? "none",
1070
1080
  supportsLanguageDetect: c.supports_language_detect,
1071
1081
  supportsTranslate: c.supports_translate,
package/dist/types.d.ts CHANGED
@@ -42,6 +42,7 @@ export interface Timings {
42
42
  export interface Capabilities {
43
43
  nativeSampleRate: number;
44
44
  languages: string[];
45
+ translateTargetLanguages: string[];
45
46
  maxTimestampKind: TimestampKind;
46
47
  supportsLanguageDetect: boolean;
47
48
  supportsTranslate: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transcribe-cpp",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
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.0.10",
55
- "@transcribe-cpp/darwin-x64-cpu": "0.0.10",
56
- "@transcribe-cpp/linux-x64-cpu-vulkan": "0.0.10",
57
- "@transcribe-cpp/linux-arm64-cpu-vulkan": "0.0.10",
58
- "@transcribe-cpp/win32-x64-cpu-vulkan": "0.0.10"
54
+ "@transcribe-cpp/darwin-arm64-metal": "0.0.11",
55
+ "@transcribe-cpp/darwin-x64-cpu": "0.0.11",
56
+ "@transcribe-cpp/linux-x64-cpu-vulkan": "0.0.11",
57
+ "@transcribe-cpp/linux-arm64-cpu-vulkan": "0.0.11",
58
+ "@transcribe-cpp/win32-x64-cpu-vulkan": "0.0.11"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/node": "^22.0.0",