an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
fix(realtime): rt-5 live-bug instrumentation + graceful preload guard (Realtime Michael P2)
Chaitanya Giri6c711abb46a8
diff --git a/src/main/realtimeActions.ts b/src/main/realtimeActions.tsindex 0ab782f2..b07a396e 100644--- a/src/main/realtimeActions.ts+++ b/src/main/realtimeActions.ts@@ -463,6 +463,26 @@ function runAction(deps: RealtimeActionDeps, verb: string, a: Record<string, unk// ─── IPC registration ───────────────────────────────────────────────────────+/** rt-5 live-bug instrumentation: write the REAL error + stack to the console AND+ * the hive log so the NEXT voice repro is self-diagnosing (the model only ever sees+ * a friendly 'spoken' string, which hides the true failure). Best-effort. */+function logActionFailure(deps: RealtimeActionDeps, channel: string, verb: string, e: unknown): void {+ const err = e instanceof Error ? e : new Error(String(e));+ console.error(`[realtime-action] ${channel} verb=${verb} FAILED:`, err.stack || err.message);+ try {+ deps.hiveLog({+ kind: 'voice_action_error',+ actor: VOICE_ACTOR,+ channel,+ verb,+ error: err.message,+ stack: (err.stack || '').slice(0, 800)+ });+ } catch {+ /* never let logging throw into the handler */+ }+}+/*** Wire the voice-action IPC. Called once from index.ts with the existing main fns.* Channels:@@ -477,8 +497,13 @@ export function registerRealtimeActionIpc(deps: RealtimeActionDeps): void {const p = (payload ?? {}) as Record<string, unknown>;const verb = norm(str(p.verb)).replace(/\s+/g, '_');try {- return runAction(deps, verb, p);+ const res = runAction(deps, verb, p);+ // A non-ok result is an EXPECTED friendly rejection (bad target, hive off, etc.) —+ // log it quietly so a live repro can still be correlated, but it is not an error.+ if (!res.ok) console.warn(`[realtime-action] verb=${verb} rejected: ${res.spoken}`);+ return res;} catch (e) {+ logActionFailure(deps, 'realtime:action', verb, e);const msg = e instanceof Error ? e.message : 'unknown error';return { ok: false, spoken: `That action failed: ${msg}.` } satisfies ActionResult;}@@ -496,11 +521,13 @@ export function registerRealtimeActionIpc(deps: RealtimeActionDeps): void {} satisfies ActionResult;}const commit = cur.commit;+ const verb = cur.verb;pending = null; // consume before running so a failure can't be re-confirmedtry {const spoken = await commit();return { ok: true, spoken } satisfies ActionResult;} catch (e) {+ logActionFailure(deps, 'realtime:action:confirm', verb, e);const msg = e instanceof Error ? e.message : 'unknown error';return { ok: false, spoken: `That action failed: ${msg}.` } satisfies ActionResult;}diff --git a/src/renderer/src/realtime/actions.ts b/src/renderer/src/realtime/actions.tsindex 0ad3e32d..ee8fb8cc 100644--- a/src/renderer/src/realtime/actions.ts+++ b/src/renderer/src/realtime/actions.ts@@ -25,12 +25,22 @@ const obj = (x: unknown): Record<string, unknown> =>x && typeof x === 'object' ? (x as Record<string, unknown>) : {};const str = (x: unknown): string => (typeof x === 'string' ? x : '');-/** Forward a verb + args to the main action spine and return its spoken result. */+/** Forward a verb + args to the main action spine and return its spoken result.+ * Instrumented for the rt-5 live-bug: any failure is logged to the (human-visible)+ * renderer console with the verb + raw args so the next repro is self-diagnosing. */async function act(verb: string, input: unknown): Promise<string> {+ // Graceful guard: if the preload bridge is missing (e.g. a dev hot-reload left the+ // renderer ahead of a stale preload), say so instead of throwing an opaque error.+ if (typeof window.cth?.realtimeAction !== 'function') {+ console.error('[realtime-action] window.cth.realtimeAction is not available — restart the app to load the rt-5 preload.', { verb });+ return 'Voice actions are not available in this build yet — try restarting the app.';+ }try {const res = await window.cth.realtimeAction({ verb, ...obj(input) });+ if (!res?.ok) console.warn('[realtime-action] verb=%s rejected: %s', verb, res?.spoken, { input });return res?.spoken || 'Done.';} catch (e) {+ console.error('[realtime-action] verb=%s threw:', verb, e, { input });const msg = e instanceof Error ? e.message : 'an unknown error';return `I couldn't do that (${msg}).`;}@@ -218,10 +228,16 @@ export function realtimeActionTools(): ReturnType<typeof tool>[] {additionalProperties: false},execute: async (input) => {+ if (typeof window.cth?.realtimeActionConfirm !== 'function') {+ console.error('[realtime-action] window.cth.realtimeActionConfirm is not available — restart the app.');+ return 'Voice actions are not available in this build yet — try restarting the app.';+ }try {const res = await window.cth.realtimeActionConfirm({ phrase: str(obj(input).phrase) });+ if (!res?.ok) console.warn('[realtime-action] confirm rejected: %s', res?.spoken, { input });return res?.spoken || 'Done.';} catch (e) {+ console.error('[realtime-action] confirm threw:', e, { input });const msg = e instanceof Error ? e.message : 'an unknown error';return `I couldn't confirm that (${msg}).`;}@@ -233,9 +249,10 @@ export function realtimeActionTools(): ReturnType<typeof tool>[] {parameters: { type: 'object', properties: {}, required: [], additionalProperties: false },execute: async () => {try {- const res = await window.cth.realtimeActionCancel();+ const res = await window.cth?.realtimeActionCancel?.();return res?.spoken || 'Cancelled.';- } catch {+ } catch (e) {+ console.error('[realtime-action] cancel threw:', e);return 'Cancelled.';}}