通知 — Liu Terminal

Liu Terminalの通知。AIエージェントがタスクを完了すると、設定可能なフックとサウンドアラートで通知を受け取れます。

liu-notifyは任意のスタンドアロンプロセスですが、Liu GUIは同じサーバーをプロセス内でホストできます。ローカルソケットで24バイトのv1ヘッダーまたはオプションのメタデータを持つ現在の28バイトv2ヘッダーを受け取り、トークンバケットで制限し、イベントを重複排除し、(エージェント、イベント)ごとに音声またはサウンドを振り分けます。

実行

# メインアプリと共にビルド
cmake --build build --target liu-notify

# デーモンを起動
./build/liu-notify daemon

# ワンショットイベントを送信
./build/liu-notify send --tool=claude --event=stop

設定ファイルは ~/.config/liu/notify.conf にあり、メインアプリの config.json とは別になっているため、Liu自体が実行されていなくてもデーモンを利用できます。

When Liu is running, its GUI hosts the notification server in-process; the CLI does not need to start a second daemon. If no server is listening, send exits without delivering an event. Use the standalone daemon only when notifications must work without Liu.

対応エージェントフック

Liuはアプリの実行中、以下のエージェントにライフサイクルフックをインストール・削除できます。フックはエージェント自身の設定に書き込まれ、ホストしているインスタンスの終了時にLiuが管理するエントリを削除します。

エージェントフックの場所シグナル注記
Claude Code~/.claude/settings.jsonstart · notify · completeUserPromptSubmit drives the working state; Notification and Stop can alert you.
Codex~/.codex/config.tomlcompleteThe Stop hook reports a completed turn. Run /hooks in Codex once to trust it.
Grok~/.grok/hooks/liu-notify.jsonnotify · completeNotification and top-level Stop events are handled; sub-agent completions stay silent.
OpenCode~/.config/opencode/plugins/liu-notify.jscompleteThe managed plugin listens for top-level session.idle events.
Antigravity~/.gemini/config/hooks.jsoncompleteA named Stop hook reports when the top-level execution loop ends.
Command Code~/.commandcode/settings.jsoncompleteIts Claude-compatible settings schema is wired to the top-level Stop event.

Copilotとcustomは低レベル通知プロトコルとサウンドマトリックスで受け付けられますが、Liuはまだ自動ライフサイクルフックをインストールしません。他のエージェントもLiuのタブで通常どおり動作しますが、自動フック通知は受け取りません。

ツール×イベント行列

任意の組み合わせに対してサウンドルールを設定できます。設定されていないセルはキャッチオールにフォールスローします。

startstopnotifyerrorcomplete
claude·····
copilot·····
codex·····
custom·····

フレーム形式

v1ヘッダーは24バイト、現在のv2ヘッダーはmeta_len追加により28バイトです。完全なフレームは4096バイトに制限されます。tests/fuzz_notify_validate.cのファズテストにより、不正なフレームは安全に拒否されます。

offset  size  field
0       4     magic      ('N','T','F','Y')
4       2     version    (1 or current 2)
6       2     flags      (speak=1, bell=2)
8       1     tool_id    (claude=1, copilot=2, codex=3, custom=255)
9       1     event_id   (start=1, stop=2, notify=3, error=4, complete=5)
10      1     priority   (reserved)
11      1     source     (cli=0, stdin=1, test=2)
12      4     seq        (client nonce — for dedup)
16      4     title_len  (<= 256)
20      4     body_len   (<= 3072)
24      4     meta_len   (v2 only, <= 512)
payload         title, body, then metadata key=value lines
                total frame <= 4096 bytes

v2メタデータセクションには現在cwd=、session=、agent=の行が含まれます。フック送信側はイベントを正しいペインに帰属させるために使い、未知のキーは前方互換性のため無視されます。

プラットフォームバックエンド

同じフレーム、異なるスピーカー。macOSはAVSpeechSynthesizerを使用し、Linuxはnotify-sendにシェルアウトします。各バックエンドは独自のファイル(platform_notify_macos.m、platform_notify_linux.c)に存在するため、入れ替えやスタブ化は単一ファイルの変更で済みます。

次へ 設定 →

ドキュメント

はじめに

ガイド

リファレンス

他の言語

English · Türkçe · 简体中文 · 한국어 · Español · Deutsch · Italiano · Français · العربية