omnirush 0.8.5 → 0.9.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.
- package/assets/CHANGELOG.md +85 -0
- package/assets/collect-once.ts +6 -5
- package/assets/extensions/omnirush/agents-lib.ts +196 -12
- package/assets/extensions/omnirush/agents.ts +97 -105
- package/assets/extensions/omnirush/auth.js +399 -115
- package/assets/extensions/omnirush/bgshell-lib.ts +400 -0
- package/assets/extensions/omnirush/bgshell.ts +392 -0
- package/assets/extensions/omnirush/collector.ts +103 -16
- package/assets/extensions/omnirush/commands.ts +14 -15
- package/assets/extensions/omnirush/deliveries.ts +145 -0
- package/assets/extensions/omnirush/guard/UPSTREAM +2 -0
- package/assets/extensions/omnirush/guard/git-command-policy.ts +885 -0
- package/assets/extensions/omnirush/guard-lib.ts +230 -0
- package/assets/extensions/omnirush/guard.ts +340 -0
- package/assets/extensions/omnirush/index.ts +12 -0
- package/assets/extensions/omnirush/pi-engine.ts +65 -1
- package/assets/extensions/omnirush/sota.ts +104 -47
- package/assets/extensions/omnirush/status-lib.ts +3 -0
- package/assets/extensions/omnirush/subagents-lib.ts +623 -0
- package/assets/extensions/omnirush/subagents.ts +305 -0
- package/assets/extensions/omnirush/swarm-lib.ts +142 -0
- package/assets/extensions/omnirush/swarm.ts +95 -0
- package/assets/extensions/omnirush/voice/capture.ts +502 -0
- package/assets/extensions/omnirush/voice/core/UPSTREAM +16 -0
- package/assets/extensions/omnirush/voice/core/file-source.ts +70 -0
- package/assets/extensions/omnirush/voice/core/index.ts +21 -0
- package/assets/extensions/omnirush/voice/core/keyterms.ts +117 -0
- package/assets/extensions/omnirush/voice/core/resample.ts +63 -0
- package/assets/extensions/omnirush/voice/core/segmenter.ts +231 -0
- package/assets/extensions/omnirush/voice/core/session.ts +403 -0
- package/assets/extensions/omnirush/voice/core/text.ts +81 -0
- package/assets/extensions/omnirush/voice/core/transcriber.ts +135 -0
- package/assets/extensions/omnirush/voice/core/types.ts +102 -0
- package/assets/extensions/omnirush/voice/core/wav.ts +95 -0
- package/assets/extensions/omnirush/voice/keys.ts +435 -0
- package/assets/extensions/omnirush/voice/kitty.ts +64 -0
- package/assets/extensions/omnirush/voice/pvrecorder-worker.cjs +43 -0
- package/assets/extensions/omnirush/voice/settings.ts +67 -0
- package/assets/extensions/omnirush/voice.ts +838 -0
- package/assets/extensions/omnirush/yolo-lib.ts +80 -0
- package/assets/extensions/omnirush/yolo.ts +85 -0
- package/package.json +6 -2
- package/scripts/brand-engine.js +526 -0
- package/scripts/build-all-packages.py +29 -1
- package/scripts/smoke-packages.py +32 -1
- package/src/bin.js +252 -53
- package/src/compat.js +272 -0
- package/src/lib.js +64 -0
- package/scripts/patch-pi-branding.js +0 -251
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Worker thread for @picovoice/pvrecorder-node (see capture.ts NativeSource).
|
|
2
|
+
// PvRecorder.read() blocks until a 32 ms frame is ready, so it runs here and
|
|
3
|
+
// posts each frame (16 kHz mono int16) to the main thread. Nothing is
|
|
4
|
+
// written to disk; frames are transferred, not kept.
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
const { parentPort, workerData } = require("node:worker_threads");
|
|
8
|
+
|
|
9
|
+
let running = true;
|
|
10
|
+
parentPort.on("message", (message) => {
|
|
11
|
+
if (message === "stop") running = false;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
(async () => {
|
|
15
|
+
let recorder = null;
|
|
16
|
+
try {
|
|
17
|
+
const { PvRecorder } = require(workerData.modulePath);
|
|
18
|
+
recorder = new PvRecorder(512, workerData.deviceIndex ?? -1);
|
|
19
|
+
recorder.start();
|
|
20
|
+
parentPort.postMessage({ type: "started", device: safe(() => recorder.getSelectedDevice()) });
|
|
21
|
+
while (running) {
|
|
22
|
+
const frame = await recorder.read();
|
|
23
|
+
if (!running) break;
|
|
24
|
+
parentPort.postMessage({ type: "pcm", pcm: frame.buffer }, [frame.buffer]);
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
parentPort.postMessage({ type: "error", message: String((error && error.message) || error) });
|
|
28
|
+
} finally {
|
|
29
|
+
if (recorder) {
|
|
30
|
+
safe(() => recorder.stop());
|
|
31
|
+
safe(() => recorder.release());
|
|
32
|
+
}
|
|
33
|
+
parentPort.close();
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
36
|
+
|
|
37
|
+
function safe(fn) {
|
|
38
|
+
try {
|
|
39
|
+
return fn();
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice settings, persisted under "voice" in <state dir>/settings.json
|
|
3
|
+
* (~/.omnirush/settings.json). Other keys in the file are preserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import type { VoiceMode } from "./keys";
|
|
9
|
+
|
|
10
|
+
export interface VoiceSettings {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
mode: VoiceMode;
|
|
13
|
+
/** Send the prompt on release when the dictation has at least 3 words. */
|
|
14
|
+
autoSubmit: boolean;
|
|
15
|
+
/** Push-to-talk key: "space" or a modifier combo like "alt+m". */
|
|
16
|
+
key: string;
|
|
17
|
+
/** Language hint ("auto" lets the provider detect it). */
|
|
18
|
+
language: string;
|
|
19
|
+
/** The one-time cloud transcription notice was shown. */
|
|
20
|
+
noticeShown: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const DEFAULT_VOICE_SETTINGS: VoiceSettings = {
|
|
24
|
+
enabled: false,
|
|
25
|
+
mode: "hold",
|
|
26
|
+
autoSubmit: false,
|
|
27
|
+
key: "space",
|
|
28
|
+
language: "auto",
|
|
29
|
+
noticeShown: false,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const SETTINGS_FILE = "settings.json";
|
|
33
|
+
|
|
34
|
+
function readAll(dir: string): Record<string, any> {
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(fs.readFileSync(path.join(dir, SETTINGS_FILE), "utf8"));
|
|
37
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
38
|
+
} catch {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function normalizeVoiceSettings(raw: unknown): VoiceSettings {
|
|
44
|
+
const v = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
|
|
45
|
+
return {
|
|
46
|
+
enabled: v.enabled === true,
|
|
47
|
+
mode: v.mode === "tap" ? "tap" : "hold",
|
|
48
|
+
autoSubmit: v.autoSubmit === true,
|
|
49
|
+
key: typeof v.key === "string" && v.key.trim() ? v.key.trim().toLowerCase() : DEFAULT_VOICE_SETTINGS.key,
|
|
50
|
+
language: typeof v.language === "string" && v.language.trim() ? v.language.trim() : DEFAULT_VOICE_SETTINGS.language,
|
|
51
|
+
noticeShown: v.noticeShown === true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function loadVoiceSettings(dir: string): VoiceSettings {
|
|
56
|
+
return normalizeVoiceSettings(readAll(dir).voice);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function saveVoiceSettings(dir: string, settings: VoiceSettings): void {
|
|
60
|
+
const all = readAll(dir);
|
|
61
|
+
all.voice = { ...settings };
|
|
62
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
63
|
+
const file = path.join(dir, SETTINGS_FILE);
|
|
64
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
65
|
+
fs.writeFileSync(tmp, JSON.stringify(all, null, 2) + "\n", { mode: 0o600 });
|
|
66
|
+
fs.renameSync(tmp, file);
|
|
67
|
+
}
|