Skip to content

Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.

feat(optimus): a soft wooden tick-tock while Mercury searches or works (0.4.2)

Salman Qureshic03406194fec
diff --git a/plugins/optimus/companion/Cargo.toml b/plugins/optimus/companion/Cargo.toml
index c44a69a9..99ec2186 100644
--- a/plugins/optimus/companion/Cargo.toml
+++ b/plugins/optimus/companion/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mercury-optimus"
-version = "0.4.1"
+version = "0.4.2"
edition = "2024"
rust-version = "1.94"
description = "Optimus: full computer control for Mercury (screen, mouse, keyboard, apps, voice)"
diff --git a/plugins/optimus/companion/src/audio.rs b/plugins/optimus/companion/src/audio.rs
index 6494e396..d4d9c5f7 100644
--- a/plugins/optimus/companion/src/audio.rs
+++ b/plugins/optimus/companion/src/audio.rs
@@ -66,19 +66,25 @@ impl Output {
}
}
- /// The "still working" tick: two very soft, short clicks, well below speech level.
- pub fn tick(&self) {
+ /// The "still working" sound: a soft wooden knock, alternating two notes
+ /// ("tick… tock") so it reads as a clock, not an alarm. Peaks below the
+ /// level that mutes the mic, so the owner can still say "stop" over it.
+ pub fn tick(&self, tock: bool) {
+ let rate = self.rate as f32;
+ let f = if tock { 690.0f32 } else { 920.0 };
+ let n = (rate * 0.07) as usize;
+ let mut noise = 0x1234_5678u32 ^ (n as u32);
let mut q = self.queue.lock().unwrap();
- for (f, gap) in [(1500.0f32, 0.07f32), (1150.0, 0.0)] {
- let n = (self.rate as f32 * 0.016) as usize;
- for i in 0..n {
- let t = i as f32 / self.rate as f32;
- let env = (1.0 - i as f32 / n as f32).powi(3);
- q.push_back((2.0 * std::f32::consts::PI * f * t).sin() * 0.03 * env);
- }
- for _ in 0..(self.rate as f32 * gap) as usize {
- q.push_back(0.0);
- }
+ for i in 0..n {
+ let t = i as f32 / rate;
+ // A struck wooden bar: the note plus an inharmonic overtone, fading fast.
+ let tone = ((2.0 * std::f32::consts::PI * f * t).sin() * 0.72 + (2.0 * std::f32::consts::PI * f * 2.76 * t).sin() * 0.28) * (-t * 60.0).exp();
+ // A tiny click of "contact" at the start.
+ noise ^= noise << 13;
+ noise ^= noise >> 17;
+ noise ^= noise << 5;
+ let n_v = (noise as f32 / u32::MAX as f32 * 2.0 - 1.0) * (-t * 900.0).exp() * 0.25;
+ q.push_back((tone + n_v) * 0.045);
}
}
diff --git a/plugins/optimus/companion/src/voice.rs b/plugins/optimus/companion/src/voice.rs
index 7220568a..f3919d5b 100644
--- a/plugins/optimus/companion/src/voice.rs
+++ b/plugins/optimus/companion/src/voice.rs
@@ -213,7 +213,8 @@ async fn bridge(
// Live narration: the newest line waits while the voice is speaking; older ones are dropped.
let mut narration: Option<String> = None;
let thinking_sound = settings().get("thinkingSound").and_then(Value::as_bool).unwrap_or(true);
- let mut tick = tokio::time::interval(Duration::from_millis(1100));
+ let mut tick = tokio::time::interval(Duration::from_millis(600));
+ let mut tock = false;
tick.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
let mut last_narrated = Instant::now() - Duration::from_secs(60);
@@ -263,8 +264,11 @@ async fn bridge(
_ = &mut deadline => break Ok(()),
_ = tick.tick() => {
// Soft "still working" tick while Mercury searches or acts and nobody is talking.
- if thinking_sound && !pending.lock().unwrap().is_empty() && !responding && !out.busy() && last_narrated.elapsed() > Duration::from_secs(2) {
- out.tick();
+ if thinking_sound && !pending.lock().unwrap().is_empty() && !responding && !out.busy() && last_narrated.elapsed() > Duration::from_millis(1200) {
+ out.tick(tock);
+ tock = !tock;
+ } else {
+ tock = false;
}
}
c = ctl.recv() => match c {
diff --git a/plugins/optimus/mercury-plugin.template.json b/plugins/optimus/mercury-plugin.template.json
index 95f7dc5a..3a68e531 100644
--- a/plugins/optimus/mercury-plugin.template.json
+++ b/plugins/optimus/mercury-plugin.template.json
@@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "optimus",
"name": "Optimus",
- "version": "0.4.1",
+ "version": "0.4.2",
"description": "Mercury uses your computer like a person: sees the screen, moves the mouse, types and opens apps, by chat or out loud with a talk key. macOS, Windows and Linux. Asks before anything that submits, sends, pays or deletes.",
"kind": "out-of-process",
"author": "Cosmic Stack",
@@ -200,8 +200,8 @@
"thinkingSound": {
"type": "boolean",
"default": true,
- "label": "Soft tick while Mercury works",
- "description": "A very quiet tick about once a second while Mercury searches or works on your screen and nobody is talking, so you know it's still going.",
+ "label": "Soft \"tick… tock\" while Mercury works",
+ "description": "A quiet wooden tick-tock while Mercury searches or works on your screen and nobody is talking, so you know it's still going. It's well below speech level and never mutes your mic.",
"group": "voice",
"when": {
"mode": [