Skip to content

Commit df006c8

Browse files
committed
defaults
1 parent 6ff93c2 commit df006c8

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

packages/opencode/src/cli/cmd/tui/attention.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import type {
1212
} from "@opencode-ai/plugin/tui"
1313
import stripAnsi from "strip-ansi"
1414
import type { TuiConfig } from "./config/tui"
15-
import defaultSoundPath from "@opencode-ai/ui/audio/alert-01.mp3" with { type: "file" }
16-
import questionSoundPath from "@opencode-ai/ui/audio/alert-02.mp3" with { type: "file" }
17-
import permissionSoundPath from "@opencode-ai/ui/audio/alert-03.mp3" with { type: "file" }
18-
import errorSoundPath from "@opencode-ai/ui/audio/nope-01.mp3" with { type: "file" }
19-
import doneSoundPath from "@opencode-ai/ui/audio/yup-01.mp3" with { type: "file" }
15+
import defaultSoundPath from "@opencode-ai/ui/audio/bip-bop-01.mp3" with { type: "file" }
16+
import questionSoundPath from "@opencode-ai/ui/audio/bip-bop-03.mp3" with { type: "file" }
17+
import permissionSoundPath from "@opencode-ai/ui/audio/staplebops-06.mp3" with { type: "file" }
18+
import errorSoundPath from "@opencode-ai/ui/audio/nope-03.mp3" with { type: "file" }
19+
import doneSoundPath from "@opencode-ai/ui/audio/bip-bop-01.mp3" with { type: "file" }
2020
import * as Log from "@opencode-ai/core/util/log"
2121

2222
type FocusState = "unknown" | "focused" | "blurred"
@@ -57,7 +57,13 @@ const DEFAULT_PACK_ID = "opencode.default"
5757
const KV_SOUND_PACK = "attention_sound_pack"
5858
const TITLE_LIMIT = 80
5959
const MESSAGE_LIMIT = 240
60-
const SOUND_NAMES = ["default", "question", "permission", "error", "done"] as const satisfies readonly TuiAttentionSoundName[]
60+
const SOUND_NAMES = [
61+
"default",
62+
"question",
63+
"permission",
64+
"error",
65+
"done",
66+
] as const satisfies readonly TuiAttentionSoundName[]
6167
const BUILTIN_PACK: RegisteredSoundPack = {
6268
id: DEFAULT_PACK_ID,
6369
name: "OpenCode Default",
@@ -103,7 +109,8 @@ function soundVolume(input: TuiAttentionNotifyInput, config: Pick<TuiConfig.Reso
103109
}
104110

105111
function soundName(input: TuiAttentionNotifyInput): TuiAttentionSoundName {
106-
if (typeof input.sound === "object") return input.sound.name && isSoundName(input.sound.name) ? input.sound.name : "default"
112+
if (typeof input.sound === "object")
113+
return input.sound.name && isSoundName(input.sound.name) ? input.sound.name : "default"
107114
return "default"
108115
}
109116

@@ -134,8 +141,9 @@ function normalizePack(pack: TuiAttentionSoundPack): RegisteredSoundPack | undef
134141
name: pack.name?.trim() || undefined,
135142
builtin: false,
136143
sounds: Object.fromEntries(
137-
Object.entries(pack.sounds).filter((item): item is [TuiAttentionSoundName, string] =>
138-
isSoundName(item[0]) && typeof item[1] === "string" && item[1].trim().length > 0,
144+
Object.entries(pack.sounds).filter(
145+
(item): item is [TuiAttentionSoundName, string] =>
146+
isSoundName(item[0]) && typeof item[1] === "string" && item[1].trim().length > 0,
139147
),
140148
),
141149
}
@@ -245,7 +253,10 @@ export function createTuiAttention(input: {
245253
const notification = shouldNotify
246254
? (() => {
247255
try {
248-
return input.renderer.triggerNotification(message, normalizeText(request.title, DEFAULT_TITLE, TITLE_LIMIT))
256+
return input.renderer.triggerNotification(
257+
message,
258+
normalizeText(request.title, DEFAULT_TITLE, TITLE_LIMIT),
259+
)
249260
} catch (error) {
250261
log.debug("failed to trigger attention notification", { error })
251262
return false

0 commit comments

Comments
 (0)