@adea-ai/voice 0.0.0-stage → 0.4.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.
Files changed (60) hide show
  1. package/README.md +136 -2
  2. package/dist/cli/helpers-cli.d.ts +2 -0
  3. package/dist/cli/helpers-cli.js +117 -0
  4. package/dist/contract/contract.d.ts +157 -0
  5. package/dist/contract/errors.d.ts +26 -0
  6. package/dist/contract/index.d.ts +10 -0
  7. package/dist/contract/index.js +64 -0
  8. package/dist/contract/session.d.ts +71 -0
  9. package/dist/contract/turns.d.ts +91 -0
  10. package/dist/contract/wire.d.ts +279 -0
  11. package/dist/desktop/conversation.d.ts +86 -0
  12. package/dist/desktop/desktop-voice.d.ts +212 -0
  13. package/dist/desktop/helper-lock.d.ts +121 -0
  14. package/dist/desktop/helper-process.d.ts +96 -0
  15. package/dist/desktop/index.d.ts +9 -0
  16. package/dist/desktop/index.js +1454 -0
  17. package/dist/desktop/macho-digest.d.ts +9 -0
  18. package/dist/index-7n7epq1a.js +47 -0
  19. package/dist/index-a7d617zr.js +295 -0
  20. package/dist/index-ght8wwpd.js +156 -0
  21. package/dist/index-m4g2tpeq.js +522 -0
  22. package/dist/index-r4hz8gk0.js +10 -0
  23. package/dist/index-tvz9s9nz.js +77 -0
  24. package/dist/index.d.ts +7 -0
  25. package/dist/index.js +96 -0
  26. package/dist/settings/index.d.ts +5 -0
  27. package/dist/settings/index.js +34 -0
  28. package/dist/settings/settings.d.ts +163 -0
  29. package/dist/web/index.d.ts +16 -0
  30. package/dist/web/index.js +1697 -0
  31. package/dist/web/stt/speech-recognition.d.ts +226 -0
  32. package/dist/web/tts/locale-match.d.ts +40 -0
  33. package/dist/web/tts/phonon.d.ts +139 -0
  34. package/dist/web/tts/player.d.ts +115 -0
  35. package/dist/web/tts/system-voices.d.ts +162 -0
  36. package/dist/web/turns.d.ts +91 -0
  37. package/package.json +68 -4
  38. package/src/cli/helpers-cli.ts +135 -0
  39. package/src/contract/contract.ts +393 -0
  40. package/src/contract/errors.ts +98 -0
  41. package/src/contract/index.ts +10 -0
  42. package/src/contract/session.ts +77 -0
  43. package/src/contract/turns.ts +48 -0
  44. package/src/contract/wire.ts +384 -0
  45. package/src/desktop/conversation.ts +347 -0
  46. package/src/desktop/desktop-voice.ts +1129 -0
  47. package/src/desktop/helper-lock.ts +550 -0
  48. package/src/desktop/helper-process.ts +408 -0
  49. package/src/desktop/index.ts +18 -0
  50. package/src/desktop/macho-digest.ts +135 -0
  51. package/src/index.ts +7 -0
  52. package/src/settings/index.ts +5 -0
  53. package/src/settings/settings.ts +478 -0
  54. package/src/web/index.ts +16 -0
  55. package/src/web/stt/speech-recognition.ts +1013 -0
  56. package/src/web/tts/locale-match.ts +131 -0
  57. package/src/web/tts/phonon.ts +386 -0
  58. package/src/web/tts/player.ts +271 -0
  59. package/src/web/tts/system-voices.ts +510 -0
  60. package/src/web/turns.ts +235 -0
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Platform voices as the browser's fallback for languages Phonon cannot ship (issue #36).
3
+ *
4
+ * `speechSynthesis` is not uniformly offline: the voices a browser exposes can be local
5
+ * (`localService === true`) or remote, and the two are indistinguishable to a person unless the
6
+ * app says so. This provider is therefore **local-voice only** by default: a locale with no local
7
+ * voice reports `networkRequired`, not "available", and a remote voice is only used when the host
8
+ * passes `allowNetwork: true` after a privacy notice.
9
+ *
10
+ * Phonon stays the English default; this provider answers for ES-419 and for English devices where
11
+ * the person declines the model download.
12
+ */
13
+ import { type VoiceLocaleMatch, type VoiceProvider, type VoiceProviderAvailability, type VoiceProviderDescriptor } from "../../contract/contract";
14
+ import { VoiceError } from "../../contract/errors";
15
+ export interface SynthesisVoiceLike {
16
+ readonly name: string;
17
+ readonly lang: string;
18
+ readonly localService?: boolean;
19
+ readonly default?: boolean;
20
+ readonly voiceURI?: string;
21
+ }
22
+ export interface SynthesisUtteranceLike {
23
+ text: string;
24
+ lang: string;
25
+ voice: SynthesisVoiceLike | null;
26
+ rate: number;
27
+ pitch: number;
28
+ volume: number;
29
+ onstart: (() => void) | null;
30
+ onend: (() => void) | null;
31
+ onerror: ((event: {
32
+ error: string;
33
+ }) => void) | null;
34
+ }
35
+ export interface SpeechSynthesisLike {
36
+ getVoices(): SynthesisVoiceLike[];
37
+ speak(utterance: SynthesisUtteranceLike): void;
38
+ cancel(): void;
39
+ pause?(): void;
40
+ resume?(): void;
41
+ readonly speaking?: boolean;
42
+ readonly pending?: boolean;
43
+ /** `voiceschanged` fires when the browser finished loading its voice list (Chrome loads late). */
44
+ addEventListener?(type: "voiceschanged", listener: () => void): void;
45
+ removeEventListener?(type: "voiceschanged", listener: () => void): void;
46
+ }
47
+ /** A timer handle; only passed back to `clearTimeout`. */
48
+ export type TimerHandle = unknown;
49
+ export interface SystemVoicesEnvironment {
50
+ readonly speechSynthesis?: SpeechSynthesisLike;
51
+ readonly Utterance?: new (text: string) => SynthesisUtteranceLike;
52
+ /** The browser's own constructor name; used when `Utterance` is not injected. */
53
+ readonly SpeechSynthesisUtterance?: new (text: string) => SynthesisUtteranceLike;
54
+ readonly now?: () => number;
55
+ /** Timers for the voice-list wait and the speech watchdog. Default: the global timers. */
56
+ readonly setTimeout?: (callback: () => void, milliseconds: number) => TimerHandle;
57
+ readonly clearTimeout?: (handle: TimerHandle) => void;
58
+ /** How long the first probe waits for `voiceschanged` when the list is empty. Default 1500 ms. */
59
+ readonly voicesTimeoutMs?: number;
60
+ }
61
+ export interface SpeakWithPlatformVoiceOptions {
62
+ /** A BCP-47 tag. Selects a local voice of this language and sets the utterance language. */
63
+ readonly locale?: string;
64
+ /** An exact voice name; wins over `locale` when both are given. */
65
+ readonly voiceName?: string;
66
+ readonly rate?: number;
67
+ readonly pitch?: number;
68
+ readonly volume?: number;
69
+ /** Whether the host has consent for a remote voice. Default false. */
70
+ readonly allowNetwork?: boolean;
71
+ /** Called when the audio starts, with the voice that speaks (also on `handle.voice`). */
72
+ readonly onStart?: (voice: ChosenVoice | undefined) => void;
73
+ readonly onEnd?: () => void;
74
+ /**
75
+ * Reject with `failed` if the browser never reports an end (Chrome can drop `end` events).
76
+ * Default: 15 s plus 200 ms per character, scaled by `rate`.
77
+ */
78
+ readonly timeoutMs?: number;
79
+ }
80
+ /**
81
+ * How a voice was chosen:
82
+ * - `exact` / `region` / `language`: matched against `locale` (see `VoiceLocaleMatch`);
83
+ * - `named`: the host named it with `voiceName` and gave no locale to compare with;
84
+ * - `default`: no locale and no name, so the browser's default local voice.
85
+ */
86
+ export type VoiceSelectionMatch = VoiceLocaleMatch | "named" | "default";
87
+ /** The voice a request speaks with, for a host to show ("Paulina, Spanish (Mexico), on device"). */
88
+ export interface ChosenVoice {
89
+ readonly name: string;
90
+ readonly voiceURI?: string;
91
+ readonly lang: string;
92
+ /** Whether the voice runs on the device. A remote voice is only chosen with `allowNetwork`. */
93
+ readonly localService: boolean;
94
+ readonly match: VoiceSelectionMatch;
95
+ /**
96
+ * True when the requested locale names a region and the only usable voice is from another region
97
+ * of the language (`es-ES` for `es-419`). The host should say so rather than imply a match.
98
+ */
99
+ readonly offRegion: boolean;
100
+ }
101
+ export interface PlatformSpeechHandle {
102
+ readonly done: Promise<void>;
103
+ /** The voice that speaks this request; undefined when the request was refused before speaking. */
104
+ readonly voice?: ChosenVoice;
105
+ cancel(): void;
106
+ }
107
+ export declare const SYSTEM_VOICES_ID = "web.system-voices";
108
+ export declare class SystemVoiceProvider implements VoiceProvider {
109
+ readonly descriptor: VoiceProviderDescriptor;
110
+ private readonly environment;
111
+ /** Requests in browser queue order that have not settled. */
112
+ private inFlight;
113
+ private voicesReady;
114
+ constructor(environment?: SystemVoicesEnvironment);
115
+ private get Utterance();
116
+ /**
117
+ * Voices the browser exposes for a locale's language, split by where they run, each list in
118
+ * preference order: exact tag, then the requested region group (for `es-419`: es-MX, es-US,
119
+ * es-AR, other Latin-American regions), then the rest of the language (`es-ES` last).
120
+ */
121
+ voices(locale: string): {
122
+ local: SynthesisVoiceLike[];
123
+ remote: SynthesisVoiceLike[];
124
+ };
125
+ /** Every voice of the locale's language with its match quality, best first. */
126
+ rankVoices(locale: string): Array<{
127
+ voice: SynthesisVoiceLike;
128
+ match: VoiceLocaleMatch;
129
+ }>;
130
+ /**
131
+ * The voice `speak()` would use for these options, without speaking: lets a host show the voice
132
+ * (and an off-region warning) before the first utterance. A `VoiceError` when it would refuse.
133
+ */
134
+ chooseVoice(options?: SpeakWithPlatformVoiceOptions): ChosenVoice | undefined | VoiceError;
135
+ /**
136
+ * Resolves once the browser has a voice list, or after `voicesTimeoutMs`. Chrome returns an empty
137
+ * list until `voiceschanged`, which would otherwise read as "no voice installed".
138
+ */
139
+ waitForVoices(): Promise<void>;
140
+ availability(locale: string): Promise<VoiceProviderAvailability>;
141
+ /**
142
+ * Speaks with a platform voice. Local voices only unless `allowNetwork` is set. With `locale`,
143
+ * the voice is the best local voice of that language: exact tag, then the region group, then
144
+ * another region (flagged `offRegion` on `handle.voice`).
145
+ */
146
+ speak(text: string, options?: SpeakWithPlatformVoiceOptions): PlatformSpeechHandle;
147
+ /** Whether a synthesis request is in flight. */
148
+ get isSpeaking(): boolean;
149
+ private selectVoice;
150
+ /** Wires one utterance object's events to its request. A rebuilt utterance is wired again. */
151
+ private bind;
152
+ /**
153
+ * Ends one request early (cancel or watchdog) without touching the others' promises. The browser
154
+ * can only cancel its whole queue, so the other unstarted requests are re-queued afterwards.
155
+ */
156
+ private abandon;
157
+ /** Cancels the browser queue and re-queues every unsettled request that had not started. */
158
+ private purge;
159
+ private settle;
160
+ private setTimer;
161
+ private clearTimer;
162
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * The browser side of the engine-agnostic voice turn manager (#34).
3
+ *
4
+ * A turn is one person→assistant exchange: the person speaks, they get a transcript, the assistant
5
+ * answers, and the person can talk over it. The manager owns exactly that state machine and nothing
6
+ * engine-specific: dictation arrives through the shared `TranscriptionSession` contract, speech
7
+ * leaves through a `SpeechSink` the host provides (Phonon, a platform voice, anything), and
8
+ * barge-in arrives through `notifySpeechDetected()` — from the microphone's voice detector, a
9
+ * key press, or the start of a new recognition session.
10
+ *
11
+ * The rule that matters: **barge-in stops speech with a request cancel, not a mute**, and a turn
12
+ * always ends in exactly one terminal event. Starting a new turn while the assistant is still
13
+ * talking is the common case on a page, so it is the default, not an option.
14
+ */
15
+ import type { TranscriptionProvider } from "./stt/speech-recognition";
16
+ import type { TurnEvent } from "../contract/turns";
17
+ /** What the assistant does with its answer. The manager never knows which engine is behind it. */
18
+ export interface SpeechSink {
19
+ speak(text: string, options?: {
20
+ signal?: AbortSignal;
21
+ }): {
22
+ done: Promise<unknown>;
23
+ cancel(): void;
24
+ };
25
+ }
26
+ /** The shared turn vocabulary (`@adea-ai/voice/contract`), re-exported for existing imports. */
27
+ export type { TurnEvent } from "../contract/turns";
28
+ export interface TurnManagerOptions {
29
+ readonly transcription: TranscriptionProvider;
30
+ readonly synthesis: SpeechSink;
31
+ /** Locale for every session this manager starts. */
32
+ readonly locale: string;
33
+ /** Whether the host has consented to the browser's service recognizer. */
34
+ readonly allowNetwork?: boolean;
35
+ /** Stop the assistant's speech when the person starts talking. Default true. */
36
+ readonly bargeInOnSpeech?: boolean;
37
+ /** Receives an error thrown by an event listener. Default: `console.error`. */
38
+ readonly onListenerError?: (error: unknown) => void;
39
+ }
40
+ /**
41
+ * One conversation's turns. `startListening()` and `speak()` are the two entry points a page
42
+ * needs; `events()` is one ordered stream for the UI.
43
+ */
44
+ export declare class VoiceTurnManager {
45
+ private readonly options;
46
+ private readonly listeners;
47
+ private session;
48
+ private speech;
49
+ /** Bumped by every `startListening()` and by `cancel()`: an older start that resumes is stale. */
50
+ private generation;
51
+ private finished;
52
+ constructor(options: TurnManagerOptions);
53
+ /** Subscribes to turn events. Returns an unsubscribe function. */
54
+ onEvent(listener: (event: TurnEvent) => void): () => void;
55
+ /**
56
+ * Starts a dictation turn. If the assistant is speaking, that speech is cancelled first and a
57
+ * `barge-in` event is emitted — the person talking over the assistant always wins.
58
+ */
59
+ startListening(): Promise<void>;
60
+ /** Stops needing audio: the session finalizes with what it heard. */
61
+ stopListening(): Promise<void>;
62
+ /** Speaks an answer. A previous answer is cancelled first; the sink decides how it plays. */
63
+ speak(text: string): {
64
+ done: Promise<unknown>;
65
+ cancel(): void;
66
+ };
67
+ /** The person started talking (voice detector, key press, or a new session). */
68
+ notifySpeechDetected(): void;
69
+ /** Tears both halves down. Idempotent; emits one terminal event. */
70
+ cancel(): Promise<void>;
71
+ /**
72
+ * `barge-in`: the person talked over the answer (`barge-in` + `speech-cancelled`).
73
+ * `replaced`: a newer answer or the host stopped it (`speech-cancelled`).
74
+ * `cancel`: the manager is tearing down; its own `cancelled` is the terminal event.
75
+ */
76
+ private stopSpeech;
77
+ private consume;
78
+ private forward;
79
+ private emit;
80
+ }
81
+ /**
82
+ * For hosts that create recognition sessions themselves: spread into the session options so the
83
+ * recognizer's speech start stops the manager's answer (`notifySpeechDetected()`).
84
+ *
85
+ * ```ts
86
+ * const session = await provider.createSession({ locale, allowNetwork: false, ...bargeInOnSpeechStart(turns) });
87
+ * ```
88
+ */
89
+ export declare function bargeInOnSpeechStart(manager: Pick<VoiceTurnManager, "notifySpeechDetected">): {
90
+ readonly onSpeechStart: () => void;
91
+ };
package/package.json CHANGED
@@ -1,6 +1,70 @@
1
1
  {
2
2
  "name": "@adea-ai/voice",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "The Adea Voice SDK: the shared speech provider contract, unified per-device voice settings, the desktop client for the pinned Apple/transcribe.cpp/audio.cpp helpers, and the browser providers.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://gitlab.com/adea-ai/misc/voice.git",
9
+ "directory": "packages/voice-sdk"
10
+ },
11
+ "type": "module",
12
+ "sideEffects": false,
13
+ "files": [
14
+ "dist",
15
+ "src",
16
+ "README.md"
17
+ ],
18
+ "main": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "bun": "./src/index.ts",
24
+ "import": "./dist/index.js"
25
+ },
26
+ "./contract": {
27
+ "types": "./dist/contract/index.d.ts",
28
+ "bun": "./src/contract/index.ts",
29
+ "import": "./dist/contract/index.js"
30
+ },
31
+ "./settings": {
32
+ "types": "./dist/settings/index.d.ts",
33
+ "bun": "./src/settings/index.ts",
34
+ "import": "./dist/settings/index.js"
35
+ },
36
+ "./web": {
37
+ "types": "./dist/web/index.d.ts",
38
+ "bun": "./src/web/index.ts",
39
+ "import": "./dist/web/index.js"
40
+ },
41
+ "./desktop": {
42
+ "types": "./dist/desktop/index.d.ts",
43
+ "bun": "./src/desktop/index.ts",
44
+ "import": "./dist/desktop/index.js"
45
+ },
46
+ "./package.json": "./package.json"
47
+ },
48
+ "bin": {
49
+ "adea-voice-helpers": "./dist/cli/helpers-cli.js"
50
+ },
51
+ "scripts": {
52
+ "build": "rm -rf dist && bun build src/index.ts src/contract/index.ts src/settings/index.ts src/web/index.ts src/desktop/index.ts src/cli/helpers-cli.ts --outdir dist --root src --target node --format esm --splitting --packages external && tsc -p tsconfig.build.json",
53
+ "test": "bun test",
54
+ "typecheck": "tsc --noEmit"
55
+ },
56
+ "dependencies": {
57
+ "phonon-tts": "0.7.1"
58
+ },
59
+ "devDependencies": {
60
+ "bun-types": "1.4.4",
61
+ "typescript": "5.9.3"
62
+ },
63
+ "engines": {
64
+ "bun": ">=1.2",
65
+ "node": ">=22"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public"
69
+ }
70
+ }
@@ -0,0 +1,135 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * adea-voice-helpers: stage and verify the pinned desktop speech helpers.
4
+ *
5
+ * adea-voice-helpers stage --lock <lock.json> --out <dir> [--helpers a,b] [--target t]
6
+ * [--cache <dir>] [--local <dir>] [--no-handshake]
7
+ * adea-voice-helpers verify --lock <lock.json> --dir <dir> [--helpers a,b] [--target t]
8
+ * adea-voice-helpers url --lock <lock.json> --helper <name> [--target t]
9
+ * adea-voice-helpers pin --lock <lock.json> --version <x.y.z> [--base <url>]
10
+ * adea-voice-helpers digest <file>…
11
+ *
12
+ * `stage` fails (exit 1) when an artifact is missing or does not match its pins and leaves no
13
+ * half-staged directory. `verify` is the release gate: the packaged directory must hold exactly the
14
+ * pinned helpers (by code digest once the app has signed them again), never a local build, and each
15
+ * must start and report the pinned release. `digest` prints a file's signature-independent code
16
+ * digest (the lock's `codeSha256`). Exit 2 is a usage error.
17
+ */
18
+ import { existsSync, writeFileSync } from "node:fs";
19
+ import {
20
+ HELPER_NAMES,
21
+ HELPER_TARGETS,
22
+ HelperLockError,
23
+ currentHelperTarget,
24
+ helperArtifactUrl,
25
+ readHelperLock,
26
+ validateHelperLock,
27
+ stageVoiceHelpers,
28
+ verifyStagedVoiceHelpers,
29
+ type HelperName,
30
+ type HelperTarget,
31
+ } from "../desktop/helper-lock";
32
+ import { machoCodeDigestFile } from "../desktop/macho-digest";
33
+
34
+ const [command, ...rest] = process.argv.slice(2);
35
+
36
+ function flag(name: string): string | undefined {
37
+ const index = rest.indexOf(`--${name}`);
38
+ return index >= 0 ? rest[index + 1] : undefined;
39
+ }
40
+
41
+ function usage(message: string): never {
42
+ console.error(`adea-voice-helpers: ${message}`);
43
+ console.error("usage: adea-voice-helpers stage|verify|url --lock <lock.json> …");
44
+ process.exit(2);
45
+ }
46
+
47
+ function target(): HelperTarget {
48
+ const value = flag("target") ?? currentHelperTarget();
49
+ if (!value || !(HELPER_TARGETS as readonly string[]).includes(value)) usage(`no helper target for this machine; pass --target`);
50
+ return value as HelperTarget;
51
+ }
52
+
53
+ function helpers(lockHelpers: readonly string[]): HelperName[] {
54
+ const value = flag("helpers");
55
+ const names = value ? value.split(",").map((name) => name.trim()).filter(Boolean) : lockHelpers;
56
+ for (const name of names) {
57
+ if (!(HELPER_NAMES as readonly string[]).includes(name)) usage(`unknown helper ${name}`);
58
+ }
59
+ return names as HelperName[];
60
+ }
61
+
62
+ /** `pin`: replace the lock with the published lock of another release (the bump an app makes). */
63
+ async function pin(lockPath: string): Promise<void> {
64
+ const version = flag("version") ?? usage("pin needs --version");
65
+ const base = flag("base") ?? "https://adea.dev/releases/voice/";
66
+ const url = `${base}voice-helpers-${version}.lock.json`;
67
+ const response = await fetch(url);
68
+ if (!response.ok) throw new HelperLockError(`GET ${url} answered ${response.status}: is ${version} released?`);
69
+ const lock = validateHelperLock(await response.json());
70
+ if (lock.version !== version) throw new HelperLockError(`${url} pins ${lock.version}, not ${version}`);
71
+ writeFileSync(lockPath, `${JSON.stringify(lock, null, 2)}\n`);
72
+ console.log(`voice helpers: ${lockPath} now pins ${version}`);
73
+ }
74
+
75
+ /** `digest`: one `<digest> <file>` line per file; a file that is not Mach-O is an error. */
76
+ function digest(files: readonly string[]): void {
77
+ if (files.length === 0) usage("digest needs a file");
78
+ for (const file of files) {
79
+ if (!existsSync(file)) throw new HelperLockError(`${file} does not exist`);
80
+ const code = machoCodeDigestFile(file);
81
+ if (!code) throw new HelperLockError(`${file} is not a Mach-O file this can digest`);
82
+ console.log(`${code} ${file}`);
83
+ }
84
+ }
85
+
86
+ async function main(): Promise<void> {
87
+ if (command === "digest") return digest(rest);
88
+ const lockPath = flag("lock");
89
+ if (!command || !lockPath) usage("missing command or --lock");
90
+ if (command === "pin") return await pin(lockPath);
91
+ const lock = readHelperLock(lockPath);
92
+ const selectedTarget = target();
93
+ const pinned = Object.entries(lock.helpers)
94
+ .filter(([, targets]) => targets?.[selectedTarget])
95
+ .map(([name]) => name);
96
+ switch (command) {
97
+ case "stage": {
98
+ const out = flag("out") ?? usage("stage needs --out");
99
+ const record = await stageVoiceHelpers({
100
+ lock,
101
+ target: selectedTarget,
102
+ outDir: out,
103
+ helpers: helpers(pinned),
104
+ cacheDir: flag("cache"),
105
+ localDir: flag("local"),
106
+ handshake: rest.includes("--no-handshake") ? false : undefined,
107
+ log: (message) => console.log(`voice helpers: ${message}`),
108
+ });
109
+ console.log(`voice helpers: staged ${Object.keys(record.helpers).join(", ")} ${record.version} for ${record.target}`);
110
+ return;
111
+ }
112
+ case "verify": {
113
+ const dir = flag("dir") ?? usage("verify needs --dir");
114
+ verifyStagedVoiceHelpers({ lock, target: selectedTarget, dir, helpers: helpers(pinned) });
115
+ console.log(`voice helpers: ${dir} holds the pinned ${lock.version} helpers for ${selectedTarget}`);
116
+ return;
117
+ }
118
+ case "url": {
119
+ const helper = flag("helper") ?? usage("url needs --helper");
120
+ console.log(helperArtifactUrl(lock, helpers([helper])[0]!, selectedTarget));
121
+ return;
122
+ }
123
+ default:
124
+ usage(`unknown command ${command}`);
125
+ }
126
+ }
127
+
128
+ main().catch((error: unknown) => {
129
+ if (error instanceof HelperLockError) {
130
+ console.error(`adea-voice-helpers: ${error.message}`);
131
+ process.exit(1);
132
+ }
133
+ console.error(error);
134
+ process.exit(1);
135
+ });