nixamp 0.22.0 → 0.22.1

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/dist/server.js CHANGED
@@ -4582,8 +4582,7 @@ export async function serve(argv, version = "0.1.0") {
4582
4582
  const speech = accounts && process.env["NIXAMP_STT"] !== "off" ? new Speech() : undefined;
4583
4583
  if (speech) {
4584
4584
  void speech.warm().then((ready) => {
4585
- if (ready)
4586
- console.error(`nixamp: hearing with ${speech.model}`);
4585
+ console.error(ready ? `nixamp: hearing with ${speech.model}` : `nixamp: not hearing: ${speech.lastFailure}`);
4587
4586
  });
4588
4587
  }
4589
4588
  // nixamp as an OAuth 2.1 authorization server, and the watch parties a
package/dist/speech.d.ts CHANGED
@@ -83,6 +83,8 @@ export declare class Speech {
83
83
  * waits for the download. Says whether it could; never throws.
84
84
  */
85
85
  warm(): Promise<boolean>;
86
+ /** Why the last warm() could not load the ear, for the boot log. */
87
+ lastFailure: string;
86
88
  /** Whether this account may have this much heard now, and the bookkeeping if so. */
87
89
  allow(accountId: string, seconds: number): void;
88
90
  /**
package/dist/speech.js CHANGED
@@ -204,8 +204,12 @@ async function loadWhisper(model, cacheDir) {
204
204
  try {
205
205
  transformers = (await import(__rewriteRelativeImportExtension(name)));
206
206
  }
207
- catch {
208
- throw new SpeechError("this nixamp cannot hear: @huggingface/transformers is not installed here. nixamp.com can.", 503);
207
+ catch (error) {
208
+ // The reason travels with the refusal: "not installed" and "installed
209
+ // but its native runtime would not load" need different fixes, and the
210
+ // one place this is read is a deployment's log.
211
+ const why = String(error.message ?? error).split("\n")[0] ?? "";
212
+ throw new SpeechError(`this nixamp cannot hear: @huggingface/transformers did not load here (${why}). nixamp.com can.`, 503);
209
213
  }
210
214
  transformers.env.cacheDir = cacheDir;
211
215
  const recognize = await transformers.pipeline("automatic-speech-recognition", model, { dtype: "q8" });
@@ -252,10 +256,13 @@ export class Speech {
252
256
  await this.ear();
253
257
  return true;
254
258
  }
255
- catch {
259
+ catch (error) {
260
+ this.lastFailure = error.message;
256
261
  return false;
257
262
  }
258
263
  }
264
+ /** Why the last warm() could not load the ear, for the boot log. */
265
+ lastFailure = "";
259
266
  /** Whether this account may have this much heard now, and the bookkeeping if so. */
260
267
  allow(accountId, seconds) {
261
268
  const minute = Math.floor(this.now() / 60_000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nixamp",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "It really whips the terminal's ass. A Winamp-shaped audio player for your terminal.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/server.ts CHANGED
@@ -5186,7 +5186,7 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
5186
5186
  const speech = accounts && process.env["NIXAMP_STT"] !== "off" ? new Speech() : undefined;
5187
5187
  if (speech) {
5188
5188
  void speech.warm().then((ready) => {
5189
- if (ready) console.error(`nixamp: hearing with ${speech.model}`);
5189
+ console.error(ready ? `nixamp: hearing with ${speech.model}` : `nixamp: not hearing: ${speech.lastFailure}`);
5190
5190
  });
5191
5191
  }
5192
5192
 
package/src/speech.ts CHANGED
@@ -220,8 +220,12 @@ async function loadWhisper(model: string, cacheDir: string): Promise<Recognizer>
220
220
  let transformers: Transformers;
221
221
  try {
222
222
  transformers = (await import(name)) as Transformers;
223
- } catch {
224
- throw new SpeechError("this nixamp cannot hear: @huggingface/transformers is not installed here. nixamp.com can.", 503);
223
+ } catch (error) {
224
+ // The reason travels with the refusal: "not installed" and "installed
225
+ // but its native runtime would not load" need different fixes, and the
226
+ // one place this is read is a deployment's log.
227
+ const why = String((error as Error).message ?? error).split("\n")[0] ?? "";
228
+ throw new SpeechError(`this nixamp cannot hear: @huggingface/transformers did not load here (${why}). nixamp.com can.`, 503);
225
229
  }
226
230
  transformers.env.cacheDir = cacheDir;
227
231
  const recognize = await transformers.pipeline("automatic-speech-recognition", model, { dtype: "q8" });
@@ -271,11 +275,15 @@ export class Speech {
271
275
  try {
272
276
  await this.ear();
273
277
  return true;
274
- } catch {
278
+ } catch (error) {
279
+ this.lastFailure = (error as Error).message;
275
280
  return false;
276
281
  }
277
282
  }
278
283
 
284
+ /** Why the last warm() could not load the ear, for the boot log. */
285
+ lastFailure = "";
286
+
279
287
  /** Whether this account may have this much heard now, and the bookkeeping if so. */
280
288
  allow(accountId: string, seconds: number): void {
281
289
  const minute = Math.floor(this.now() / 60_000);
package/web/dist/sw.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* nixamp service worker — generated, do not edit */
2
- const CACHE = "nixamp-1789264533383";
2
+ const CACHE = "nixamp-1789264893886";
3
3
  const PRECACHE = [
4
4
  "/",
5
5
  "/.well-known/openaccess.json",