BYPASS SHELL BY ./RAZORGANZ
Server: nginx/1.20.1
System: Linux iZdzfnv9mwfppeZ 5.10.134-19.2.al8.x86_64 #1 SMP Wed Oct 29 22:47:09 CST 2025 x86_64
User: apache (48)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //lib/node_modules/openclaw/dist/audio-preflight-DmSGfZue.js
import "./agent-scope-PyLC-ZZu.js";
import "./paths-C9do7WCN.js";
import { J as logVerbose, Z as shouldLogVerbose } from "./subsystem-9nuH7eAI.js";
import "./workspace-CxArQZC-.js";
import "./model-selection-C6wZ4s0z.js";
import "./github-copilot-token-BkwQAVvU.js";
import "./env-BCSW4P-L.js";
import "./boolean-mcn6kL0s.js";
import "./plugins-D93Gl3vX.js";
import "./accounts-C2p3gWX0.js";
import "./bindings-XIxTfg76.js";
import "./accounts-DTMKYA1I.js";
import "./image-ops-D_zTmnMF.js";
import "./pi-model-discovery-C-yOXpma.js";
import "./message-channel-DSGEYImB.js";
import "./pi-embedded-helpers-BWNHLmOk.js";
import "./config-8KUmruTM.js";
import "./manifest-registry-BoNM8D8y.js";
import "./dock-BQZ3dOVS.js";
import "./chrome-B_oaL_VN.js";
import "./ssrf-BnuIFCPj.js";
import "./frontmatter-rZSrGiqd.js";
import "./skills-BmmA4kHX.js";
import "./redact-Dhp4XjZk.js";
import "./errors-oW2IM9f0.js";
import "./store-D1p2WpL_.js";
import "./sessions-BJ6QL7GG.js";
import "./accounts-CcUE2V_t.js";
import "./paths-CLWDvYDE.js";
import "./tool-images-BYjb6VbO.js";
import "./thinking-CJoHneR6.js";
import "./image-DIjIaXgj.js";
import "./gemini-auth-iOIz_-mf.js";
import "./fetch-guard-Py2e9YaA.js";
import "./local-roots-BL_0qvcy.js";
import { a as resolveMediaAttachmentLocalRoots, n as createMediaAttachmentCache, o as runCapability, r as normalizeMediaAttachments, t as buildProviderRegistry, u as isAudioAttachment } from "./runner-BS2WkEnz.js";

//#region src/media-understanding/audio-preflight.ts
/**
* Transcribes the first audio attachment BEFORE mention checking.
* This allows voice notes to be processed in group chats with requireMention: true.
* Returns the transcript or undefined if transcription fails or no audio is found.
*/
async function transcribeFirstAudio(params) {
	const { ctx, cfg } = params;
	const audioConfig = cfg.tools?.media?.audio;
	if (!audioConfig || audioConfig.enabled === false) return;
	const attachments = normalizeMediaAttachments(ctx);
	if (!attachments || attachments.length === 0) return;
	const firstAudio = attachments.find((att) => att && isAudioAttachment(att) && !att.alreadyTranscribed);
	if (!firstAudio) return;
	if (shouldLogVerbose()) logVerbose(`audio-preflight: transcribing attachment ${firstAudio.index} for mention check`);
	const providerRegistry = buildProviderRegistry(params.providers);
	const cache = createMediaAttachmentCache(attachments, { localPathRoots: resolveMediaAttachmentLocalRoots({
		cfg,
		ctx
	}) });
	try {
		const result = await runCapability({
			capability: "audio",
			cfg,
			ctx,
			attachments: cache,
			media: attachments,
			agentDir: params.agentDir,
			providerRegistry,
			config: audioConfig,
			activeModel: params.activeModel
		});
		if (!result || result.outputs.length === 0) return;
		const audioOutput = result.outputs.find((output) => output.kind === "audio.transcription");
		if (!audioOutput || !audioOutput.text) return;
		firstAudio.alreadyTranscribed = true;
		if (shouldLogVerbose()) logVerbose(`audio-preflight: transcribed ${audioOutput.text.length} chars from attachment ${firstAudio.index}`);
		return audioOutput.text;
	} catch (err) {
		if (shouldLogVerbose()) logVerbose(`audio-preflight: transcription failed: ${String(err)}`);
		return;
	} finally {
		await cache.cleanup();
	}
}

//#endregion
export { transcribeFirstAudio };