ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 lamberttraccard

jinglebox

一个 Claude Code 插件,当工作阶段发生事件时,从 Jinglebox 工作区播放声音。

lamberttraccard@lamberttraccard

lamberttraccard/jinglebox-marketplace/tree/main/plugins/jinglebox

已翻译

关于这个 mod

Claude Code 的 Jinglebox

一个 Claude Code 插件,当工作阶段发生事件时,从 Jinglebox 工作区播放声音。

| 事件 | 播放时机 | |---|---| | turn-done | Claude 已完成,答案正在等待你查看 | | needs-answer | Claude 正在等待你:问题、待批准的计划、权限提示,或以问题结尾的答案 | | long-turn | 一次超过 60 s 的回合完成时(替代 turn-done) | | tests-passed / tests-failed | Claude 运行的测试命令通过或失败(artisan test、pest、phpunit、pytest、jest、vitest、go test、cargo test、npm test……) | | pr-created | glab mr create 或 gh pr create 执行成功 |

开箱即用时,每个事件都会播放工作区中的随机短声音;使用 /jinglebox set 可设定自己的声音。

插件不附带音频。每台机器通过自己的 Jinglebox MCP 连接、使用自己的账号下载声音,并在本地缓存(最多 40 个声音)。

安装

  1. 连接 Jinglebox MCP 服务器(每台机器一次):

    claude mcp add --transport http --scope user jinglebox https://jinglebox.app/mcp
    

    然后在交互式 claude 终端运行 /mcp,选择 jinglebox 并完成身份验证。

  2. 允许其只读工具,这样插件调用在自动模式下不会被拒绝。在 ~/.claude/settings.json 中:

    "permissions": {
      "allow": [
        "mcp__jinglebox__get-sound",
        "mcp__jinglebox__search-sounds",
        "mcp__jinglebox__get-workspace",
        "mcp__jinglebox__list-workspaces"
      ]
    }
    
  3. 安装插件:

    claude plugin marketplace add lamberttraccard/jinglebox-marketplace
    claude plugin install jinglebox@jinglebox
    

    或者不安装直接试用:claude --plugin-dir ./plugins/jinglebox。

  4. 启动新的工作阶段。如果账号有多个工作区,使用 /jinglebox workspace <slug> 选择一个。

命令

/jinglebox                                       current sounds
/jinglebox workspace [slug]                      list or pick the workspace
/jinglebox set <event> 329 | #329 | <sound URL>  a fixed sound
/jinglebox set <event> 21,349,336                random among these
/jinglebox set <event> random [tag]              random short sound of the workspace, or of one tag
/jinglebox set <event> default                   back to the default (random from the workspace)
/jinglebox search <words>                        find sounds and their IDs
/jinglebox test <event>                          play an event's sound now
/jinglebox mute | unmute
/jinglebox export                                your setup as one /jinglebox import line
/jinglebox import <workspace> <event>=<choice>…  apply a shared setup
/jinglebox debug                                 check the MCP call, the playback and the cache

选择会按机器、按工作区保存,并跨工作阶段保留。随机选择不会连续两次播放同一个声音,而且会提前下载下一个声音,让它立即开始播放。提示消息会显示每个已播放声音的名称,因此喜欢某个随机声音时,可以用 /jinglebox set 将它固定下来。

分享设置

/jinglebox export 会将你的设置打印为一行,例如:

/jinglebox import my-team turn-done=random:fun needs-answer=177 long-turn=339 tests-passed=325 tests-failed=329 pr-created=344

将它粘贴到团队交流的任意位置;运行它的人会得到相同的工作区和声音,之后可以使用 /jinglebox set 修改任意设置。选项可以是声音 ID(177)、供选择的列表(21,349,336)、random 或 random:<tag>。不会托管任何内容:这行文字就是设置本身。

在拥有多个工作区的账号上选择(或导入)工作区之前,不会播放声音;插件会在提示消息中说明这一点,每 10 分钟最多一次,与其他故障相同。

设置

| 设置 | 默认值 | 含义 | |---|---|---| | workspace | empty | 工作区 slug;留空即可使用 /jinglebox workspace 选择 | | mcp_server | jinglebox | Jinglebox MCP 服务器的名称,与 /mcp 列出的名称一致 | | long_turn_seconds | 60 | 超过此时长的回合会播放 long-turn | | random_max_seconds | 4 | 随机选择只会使用不超过此时长的声音 |

工作原理

这是 Claude Code 的函数钩子插件(plugins/jinglebox/hooks/register.ts),属于早期访问 API,需要使用支持它的 Claude Code 构建版本。

  • turn.complete:主循环回合结束时,如果答案的最后一段提出问题则为 needs-answer,否则为 long-turn 或 turn-done。
  • classic.PermissionRequest,以及 AskUserQuestion 和 ExitPlanMode 上的 tool.call:触发 needs-answer,每 3 s 最多一次。
  • Bash 上的 tool.call:触发 tests-passed、tests-failed、pr-created。
  • 插件在清单中声明 Jinglebox MCP 服务器,并在第一次调用前通过 $.mcp.connect 连接它,因此即使工作阶段尚未加载服务器工具也能正常工作;当工作阶段已经运行同一个服务器(步骤 1)时,会复用该连接。
  • 声音来自 MCP 的 get-sound,会缓存到插件存储中,并通过 $.audio.play 播放。随机选择来自 search-sounds,每天刷新一次。

故障排查

/jinglebox debug 会运行每个步骤,并指出失败的位置。

  • 「MCP server is not connected」:插件无法连接 Jinglebox MCP 服务器(网络问题,或服务器启动时超时)。运行 /mcp,重新连接 jinglebox,然后重试。
  • 「call refused」:缺少步骤 2 中的权限。

许可证

MIT,参见 LICENSE。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add lamberttraccard/jinglebox-marketplace
claude plugin install jinglebox
原文 / README

Jinglebox for Claude Code

A Claude Code plugin that plays sounds from your Jinglebox workspace when something happens in a session.

| Event | When it plays | |---|---| | turn-done | Claude finished and its answer waits for you | | needs-answer | Claude waits on you: a question, a plan to approve, a permission prompt, or an answer that ends on a question | | long-turn | a turn longer than 60 s finished (instead of turn-done) | | tests-passed / tests-failed | a test command run by Claude passed or failed (artisan test, pest, phpunit, pytest, jest, vitest, go test, cargo test, npm test…) | | pr-created | glab mr create or gh pr create succeeded |

Out of the box every event plays a random short sound of your workspace; set your own with /jinglebox set.

The plugin ships no audio. Each machine downloads its sounds through its own Jinglebox MCP connection, with its own account, and caches them locally (40 sounds at most).

Install

  1. Connect the Jinglebox MCP server (once per machine):

    claude mcp add --transport http --scope user jinglebox https://jinglebox.app/mcp
    

    then run /mcp in an interactive claude terminal, pick jinglebox and authenticate.

  2. Allow its read-only tools, so the plugin's calls are not refused in auto mode. In ~/.claude/settings.json:

    "permissions": {
      "allow": [
        "mcp__jinglebox__get-sound",
        "mcp__jinglebox__search-sounds",
        "mcp__jinglebox__get-workspace",
        "mcp__jinglebox__list-workspaces"
      ]
    }
    
  3. Install the plugin:

    claude plugin marketplace add lamberttraccard/jinglebox-marketplace
    claude plugin install jinglebox@jinglebox
    

    Or try it without installing: claude --plugin-dir ./plugins/jinglebox.

  4. Start a new session. If your account has several workspaces, pick one with /jinglebox workspace <slug>.

Commands

/jinglebox                                       current sounds
/jinglebox workspace [slug]                      list or pick the workspace
/jinglebox set <event> 329 | #329 | <sound URL>  a fixed sound
/jinglebox set <event> 21,349,336                random among these
/jinglebox set <event> random [tag]              random short sound of the workspace, or of one tag
/jinglebox set <event> default                   back to the default (random from the workspace)
/jinglebox search <words>                        find sounds and their IDs
/jinglebox test <event>                          play an event's sound now
/jinglebox mute | unmute
/jinglebox export                                your setup as one /jinglebox import line
/jinglebox import <workspace> <event>=<choice>…  apply a shared setup
/jinglebox debug                                 check the MCP call, the playback and the cache

Choices are kept per machine and per workspace, across sessions. A random pick never plays the same sound twice in a row, and the next sound is downloaded ahead so it starts at once. The toast names each sound played, so a random one you like can be pinned with /jinglebox set.

Share a setup

/jinglebox export prints your setup as a single line, for instance:

/jinglebox import my-team turn-done=random:fun needs-answer=177 long-turn=339 tests-passed=325 tests-failed=329 pr-created=344

Paste it wherever your team talks; whoever runs it gets the same workspace and sounds, then can change any of them with /jinglebox set. A choice is a sound ID (177), a list to pick from (21,349,336), random, or random:<tag>. Nothing is hosted: the line is the setup.

Until a workspace is picked (or imported) on an account with several, no sound plays; the plugin says so in a toast, at most once every 10 minutes, like any other failure.

Settings

| Setting | Default | Meaning | |---|---|---| | workspace | empty | the workspace slug; empty to pick it with /jinglebox workspace | | mcp_server | jinglebox | the Jinglebox MCP server's name, as /mcp lists it | | long_turn_seconds | 60 | a turn longer than this plays long-turn | | random_max_seconds | 4 | a random pick only takes sounds this short |

How it works

It is a plugin of Claude Code function hooks (plugins/jinglebox/hooks/register.ts), an early-access API: it needs a Claude Code build that supports it.

  • turn.complete, at the end of a main-loop turn: needs-answer when the answer's last paragraph asks a question, else long-turn or turn-done.
  • classic.PermissionRequest, and tool.call on AskUserQuestion and ExitPlanMode: needs-answer, at most once every 3 s.
  • tool.call on Bash: tests-passed, tests-failed, pr-created.
  • The plugin declares the Jinglebox MCP server in its manifest and connects it with $.mcp.connect before its first call, so it works even when the session has not loaded the server's tools yet; when the session already runs the same server (step 1), that connection is reused.
  • Sounds come from the MCP's get-sound, are cached in the plugin's store and played with $.audio.play. Random picks draw from search-sounds, refreshed once a day.

Troubleshooting

/jinglebox debug runs each step and says which one fails.

  • "MCP server is not connected": the plugin could not connect the Jinglebox MCP server (network, or the server timed out at startup). Run /mcp, reconnect jinglebox, and try again.
  • "call refused": the permissions of step 2 are missing.

License

MIT, see LICENSE.

更多类似作品