Skip to content

feat(sessions): play a custom sound file on run settle - #4

Closed
Direct-Launch wants to merge 1 commit into
integrate/sidebar-2026-10-01from
feat/run-cue-sound-file
Closed

Direct-Launch wants to merge 1 commit into
integrate/sidebar-2026-10-01from
feat/run-cue-sound-file

Conversation

@Direct-Launch

@Direct-Launch Direct-Launch commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

What

Adds optional custom sound-file paths to the run-settle cue. Two settings, runSuccessSoundPath and runFailureSoundPath, take absolute OS paths; the file is read from disk and decoded at play time, falling back to the built-in 880/320 Hz tone when the path is empty, the file is missing, or it decodes to nothing. cueForOutcome stays pure, so the decision is testable without an AudioContext.

How I tested it

Real vault, Obsidian 1.13.7, desktop (Windows). Set an absolute success path in Agents settings, started a run from a gesture (send/Enter, which is what unlocks audio), and confirmed the configured file plays when the run settles — the built-in tone is not used. The change is additive: with no path set, the existing tone still plays.

Unit level: 13 targeted tests, and the two new file-branch tests were falsified first — forcing the branch to null turned exactly those two red and left the other eleven green.

The failure-path file was not separately exercised; it shares the same code path as success.

AI assistance: drafted by an AI agent (Smart Second Brain); reviewed and tested live by me.

Design

  • cueForOutcome returns { kind: "default", frequency } | { kind: "file", path } | null — pure, so no AudioContext in tests.
  • Decoded buffers and in-flight decodes are cached per path, so a repeated cue does not re-read from disk.
  • Desktop only: readFileBytes returns null where there is no require, and the fields sit inside the existing isMobileUI guard.
  • A missing or undecodable file degrades to the built-in tone — it never throws into the run bookkeeping.

Checklist

  • check / format / lint pass locally — run via the npm equivalents (npx biome format, npx biome lint exit 0 across ./src ./test ./integration; svelte-check 0 errors / 0 warnings on both configs). bun is not available on the machine this was prepared on.
  • test — all 13 new tests pass. The suite reports one failure, test/skills/shippedSkillHistory.test.ts, which is pre-existing and Windows-clone-only (core.autocrlf=true, no .gitattributes): it fails identically with this change reverted, and CI checks out LF.
  • Tried the change in a real Obsidian vault (see above)
  • I read CONTRIBUTING.md
  • No provider, bundled skill or built-in tool added, and manifest.json is unchanged, so the docs site needs no update

Stacked on

Base is integrate/sidebar-2026-10-01, which carries the settle-cue fixes, so this diff is the sound-file change alone. CONTRIBUTING asks for PRs against main; this one is deliberately stacked, consistent with the existing #1 / #2 chain.

A settlement cue could only be the built-in 880/320 Hz tone. Users who
want their own sound had no way to supply one.

Add optional success/failure sound-file paths, read from disk at play
time and falling back to the built-in tone when the file is missing or
undecodable. Desktop-only: the fields are hidden on mobile, and the
reader returns null where there is no filesystem.

The decision stays pure (cueForOutcome) so it is testable without an
AudioContext; only emission touches the filesystem. Decoded buffers and
in-flight decodes are cached per path so a settle does not re-read the
same file.
@Direct-Launch

Copy link
Copy Markdown
Owner Author

Consolidated into #1. Every commit here is included in feat/session-sidebar, which now targets main and carries the whole stack plus its real-vault test evidence. Closing this so there is one review surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant