@ouro.bot/cli 0.1.0-alpha.1457 → 0.1.0-alpha.1458

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/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1458",
6
+ "changes": [
7
+ "Voice notes from iMessage, Telegram and Teams are transcribed with whisper.cpp's large-v3-turbo model, using beam search and automatic language detection, in place of the small English-only model. A machine that already has the old model keeps using it while the new one (about 575 MB) downloads in the background. Every sense now labels a voice note \"voice note (machine transcript; may mishear words)\", and the agent is told that voice-note and call transcripts can mishear words: it reads for what the person most likely meant, and checks briefly when a misreading would change what it does."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1457",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1457",
2
+ "runtimeVersion": "0.1.0-alpha.1458",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1457</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1458</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -36,18 +36,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.VOICE_NOTE_TRANSCRIPT_PREFIX = void 0;
37
37
  exports.whisperCppTranscriptText = whisperCppTranscriptText;
38
38
  exports.transcribeAudioFile = transcribeAudioFile;
39
+ exports.voiceNoteWords = voiceNoteWords;
39
40
  exports.voiceNoteLine = voiceNoteLine;
40
41
  const node_child_process_1 = require("node:child_process");
42
+ const node_fs_1 = require("node:fs");
41
43
  const fs = __importStar(require("node:fs/promises"));
42
44
  const os = __importStar(require("node:os"));
43
45
  const path = __importStar(require("node:path"));
46
+ const node_stream_1 = require("node:stream");
47
+ const promises_1 = require("node:stream/promises");
44
48
  const runtime_1 = require("../../nerves/runtime");
45
49
  const identity_1 = require("../identity");
46
50
  // One speech-to-text path for every sense: a voice note from iMessage, Telegram or Teams becomes text the same way.
47
51
  const WHISPER_CPP_FORMULA = "whisper-cpp";
48
- const WHISPER_CPP_MODEL_NAME = "ggml-base.en.bin";
52
+ // large-v3-turbo hears far better than base.en, and it is multilingual. q5_0 keeps it near 575 MB.
53
+ const WHISPER_CPP_MODEL_NAME = "ggml-large-v3-turbo-q5_0.bin";
49
54
  const WHISPER_CPP_MODEL_URL = `https://huggingface.co/ggerganov/whisper.cpp/resolve/main/${WHISPER_CPP_MODEL_NAME}`;
50
- exports.VOICE_NOTE_TRANSCRIPT_PREFIX = "voice note transcript: ";
55
+ // The model earlier versions downloaded. While the stronger one downloads, a machine that has it keeps transcribing with it.
56
+ const WHISPER_CPP_EARLIER_MODEL_NAME = "ggml-base.en.bin";
57
+ const WHISPER_CPP_MODEL_DOWNLOAD_TIMEOUT_MS = 900_000;
58
+ // Beam search over five candidates, keeping the best of five: slower than greedy decoding, and fewer misheard words.
59
+ const WHISPER_CPP_DECODING_ARGS = ["-bs", "5", "-bo", "5"];
60
+ /** How every sense labels a voice note's text, so the agent reads it as a machine transcript that can mishear. */
61
+ exports.VOICE_NOTE_TRANSCRIPT_PREFIX = "voice note (machine transcript; may mishear words): ";
51
62
  /** The text of a whisper.cpp `-oj` transcript, or "" when it holds no speech. */
52
63
  function whisperCppTranscriptText(raw) {
53
64
  const parsed = JSON.parse(raw);
@@ -116,21 +127,56 @@ async function resolveWhisperCppBinary(timeoutMs) {
116
127
  throw new Error("whisper.cpp installed but whisper-cli binary is missing");
117
128
  return candidate;
118
129
  }
130
+ async function downloadWhisperCppModel(modelPath, timeoutMs, fetchImpl) {
131
+ // Written beside the model and renamed into place, so a cut-off download never looks like a model.
132
+ const partialPath = `${modelPath}.partial`;
133
+ try {
134
+ const response = await fetchImpl(WHISPER_CPP_MODEL_URL, {
135
+ method: "GET",
136
+ signal: AbortSignal.timeout(Math.max(timeoutMs, WHISPER_CPP_MODEL_DOWNLOAD_TIMEOUT_MS)),
137
+ });
138
+ if (!response.ok)
139
+ throw new Error(`failed to download whisper.cpp model: HTTP ${response.status}`);
140
+ if (!response.body)
141
+ throw new Error("failed to download whisper.cpp model: the response had no body");
142
+ await (0, promises_1.pipeline)(node_stream_1.Readable.fromWeb(response.body), (0, node_fs_1.createWriteStream)(partialPath));
143
+ await fs.rename(partialPath, modelPath);
144
+ (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.whisper_model_downloaded", message: "whisper.cpp model downloaded", meta: { model: WHISPER_CPP_MODEL_NAME } });
145
+ return modelPath;
146
+ }
147
+ catch (error) {
148
+ await fs.rm(partialPath, { force: true }).catch(() => undefined);
149
+ throw error;
150
+ }
151
+ }
152
+ let pendingModelDownload;
153
+ function downloadWhisperCppModelOnce(modelPath, timeoutMs, fetchImpl) {
154
+ pendingModelDownload ??= downloadWhisperCppModel(modelPath, timeoutMs, fetchImpl).finally(() => {
155
+ pendingModelDownload = undefined;
156
+ });
157
+ return pendingModelDownload;
158
+ }
119
159
  async function ensureWhisperCppModel(timeoutMs, fetchImpl) {
120
160
  // Resolved per call: the tools root needs the agent identity, which is not known at module load.
121
161
  const modelsDir = path.join((0, identity_1.getAgentToolsRoot)(), "whisper-cpp", "models");
122
162
  const modelPath = path.join(modelsDir, WHISPER_CPP_MODEL_NAME);
123
163
  if (await pathExists(modelPath))
124
- return modelPath;
164
+ return { path: modelPath, multilingual: true };
125
165
  await fs.mkdir(modelsDir, { recursive: true });
126
- const response = await fetchImpl(WHISPER_CPP_MODEL_URL, {
127
- method: "GET",
128
- signal: AbortSignal.timeout(Math.max(timeoutMs, 300_000)),
129
- });
130
- if (!response.ok)
131
- throw new Error(`failed to download whisper.cpp model: HTTP ${response.status}`);
132
- await fs.writeFile(modelPath, Buffer.from(await response.arrayBuffer()));
133
- return modelPath;
166
+ const earlierModelPath = path.join(modelsDir, WHISPER_CPP_EARLIER_MODEL_NAME);
167
+ if (await pathExists(earlierModelPath)) {
168
+ downloadWhisperCppModelOnce(modelPath, timeoutMs, fetchImpl).catch((error) => {
169
+ (0, runtime_1.emitNervesEvent)({
170
+ level: "warn",
171
+ component: "senses",
172
+ event: "senses.whisper_model_download_failed",
173
+ message: "whisper.cpp model download failed; voice notes keep using the earlier model",
174
+ meta: { model: WHISPER_CPP_MODEL_NAME, error: error instanceof Error ? error.message : String(error) },
175
+ });
176
+ });
177
+ return { path: earlierModelPath, multilingual: false };
178
+ }
179
+ return { path: await downloadWhisperCppModelOnce(modelPath, timeoutMs, fetchImpl), multilingual: true };
134
180
  }
135
181
  async function convertToWhisperWav(sourcePath, outputPath, timeoutMs) {
136
182
  try {
@@ -152,9 +198,18 @@ async function transcribeAudioFile(audioPath, options) {
152
198
  const outputBase = path.join(workDir, "audio");
153
199
  try {
154
200
  const whisperCliPath = await resolveWhisperCppBinary(options.timeoutMs);
155
- const modelPath = await ensureWhisperCppModel(options.timeoutMs, options.fetchImpl ?? fetch);
201
+ const model = await ensureWhisperCppModel(options.timeoutMs, options.fetchImpl ?? fetch);
156
202
  await convertToWhisperWav(audioPath, wavPath, options.timeoutMs);
157
- await execFileText(whisperCliPath, ["-m", modelPath, "-f", wavPath, "-oj", "-of", outputBase], Math.max(options.timeoutMs, 120_000));
203
+ const prompt = options.prompt?.trim();
204
+ await execFileText(whisperCliPath, [
205
+ "-m", model.path,
206
+ "-f", wavPath,
207
+ "-oj", "-of", outputBase,
208
+ ...WHISPER_CPP_DECODING_ARGS,
209
+ // whisper-cli assumes English unless told; a multilingual model detects the spoken language.
210
+ "-l", model.multilingual ? "auto" : "en",
211
+ ...(prompt ? ["--prompt", prompt] : []),
212
+ ], Math.max(options.timeoutMs, 120_000));
158
213
  const transcript = whisperCppTranscriptText(await fs.readFile(`${outputBase}.json`, "utf8"));
159
214
  (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.audio_transcribed", message: "audio transcribed with whisper.cpp", meta: { characters: transcript.length } });
160
215
  return transcript;
@@ -163,10 +218,14 @@ async function transcribeAudioFile(audioPath, options) {
163
218
  await fs.rm(workDir, { recursive: true, force: true }).catch(() => undefined);
164
219
  }
165
220
  }
166
- /** The line a sense adds to the turn for one voice note, or the notice when it held no speech. */
167
- async function voiceNoteLine(name, audioPath, options) {
168
- const transcript = (await transcribeAudioFile(audioPath, options)).trim();
169
- return transcript
170
- ? { line: `${exports.VOICE_NOTE_TRANSCRIPT_PREFIX}${transcript}` }
221
+ /** The line a sense adds to the turn for one voice note's transcript, or the notice when it held no speech. */
222
+ function voiceNoteWords(name, transcript) {
223
+ const text = transcript.trim();
224
+ return text
225
+ ? { line: `${exports.VOICE_NOTE_TRANSCRIPT_PREFIX}${text}` }
171
226
  : { notice: `attachment hydration failed for ${name}: empty audio transcript` };
172
227
  }
228
+ /** Transcribe one voice note and word it for the turn. */
229
+ async function voiceNoteLine(name, audioPath, options) {
230
+ return voiceNoteWords(name, await transcribeAudioFile(audioPath, options));
231
+ }
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SPEECH_TRANSCRIPT_GUIDANCE = void 0;
36
37
  exports.flattenSystemPrompt = flattenSystemPrompt;
37
38
  exports.loadPsycheAt = loadPsycheAt;
38
39
  exports.resetPsycheCache = resetPsycheCache;
@@ -1256,6 +1257,8 @@ function relationshipFriendContextSection(context) {
1256
1257
  lines.push("", "## presentation preferences", "these preferences affect wording and timing only; they grant no authority.", ...preferences);
1257
1258
  return lines.join("\n");
1258
1259
  }
1260
+ /** One rule for every sense that turns speech into text: voice notes from any chat sense and live voice calls. */
1261
+ exports.SPEECH_TRANSCRIPT_GUIDANCE = "## speech transcripts\nvoice notes and live calls reach me as speech-to-text, which can mishear words. i read a transcript for what the person most likely meant; when a misreading would change what i do, i check briefly instead of acting on the literal words.";
1259
1262
  function metacognitiveFramingSection(channel) {
1260
1263
  if (channel !== "inner")
1261
1264
  return "";
@@ -1415,6 +1418,7 @@ async function buildSystem(channel = "cli", options, context) {
1415
1418
  authorizedPsyche ? houseSection() : "",
1416
1419
  relationshipFriendContextSection(context),
1417
1420
  trustContextSection(context),
1421
+ exports.SPEECH_TRANSCRIPT_GUIDANCE,
1418
1422
  productSection(),
1419
1423
  "# my tools",
1420
1424
  toolsSection(options),
@@ -1452,6 +1456,7 @@ async function buildSystem(channel = "cli", options, context) {
1452
1456
  // Group 4: how i work
1453
1457
  "# how i work",
1454
1458
  "## evidence and freshness\nnames come from explicit introductions, corrections and relationship notes. handles, branch prefixes and filenames are not preferred names; given-name order comes from the confirmed full name, not from them. i use the confirmed full name or preserve uncertainty when identity is unresolved.\noutside work changes while i am not looking. messages, notes and handoffs describe observations at a time, not current status. i re-read the authoritative source before reporting current progress or promising an update. a renamed session, a missing observation or incomplete history invalidates my old attribution; i say what is unverified instead of filling the gap.",
1459
+ exports.SPEECH_TRANSCRIPT_GUIDANCE,
1455
1460
  workspaceDisciplineSection(),
1456
1461
  speakSopsSection(channel),
1457
1462
  toolRestrictionSection(context),
@@ -222,17 +222,16 @@ async function hydrateBlueBubblesAttachments(attachments, config, channelConfig,
222
222
  });
223
223
  continue;
224
224
  }
225
- const transcript = (await transcribeAudio({
225
+ const words = (0, transcribe_audio_1.voiceNoteWords)(name, await transcribeAudio({
226
226
  attachment,
227
227
  buffer: downloaded.buffer,
228
228
  contentType: downloaded.contentType,
229
229
  timeoutMs: channelConfig.requestTimeoutMs,
230
- })).trim();
231
- if (!transcript) {
232
- notices.push(`attachment hydration failed for ${name}: empty audio transcript`);
233
- continue;
234
- }
235
- transcriptAdditions.push(`${transcribe_audio_1.VOICE_NOTE_TRANSCRIPT_PREFIX}${transcript}`);
230
+ }));
231
+ if (words.line)
232
+ transcriptAdditions.push(words.line);
233
+ if (words.notice)
234
+ notices.push(words.notice);
236
235
  continue;
237
236
  }
238
237
  inputParts.push({
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1457",
3
+ "version": "0.1.0-alpha.1458",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1457",
9
+ "version": "0.1.0-alpha.1458",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1457",
3
+ "version": "0.1.0-alpha.1458",
4
4
  "description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
5
5
  "homepage": "https://ouroboros.bot/",
6
6
  "engines": {