Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
02ea9a4
fix(opencode): migrate adapter to the OpenCode v2 plugin API
Sep 25, 2026
fc08679
feat(opencode): add Windows adapter and fix headless audio playback
rafaelsnv Oct 2, 2026
bf53b7f
fix(opencode): use XDG-style paths for OpenCode CLI compatibility
rafaelsnv Oct 3, 2026
651eb96
style: clarify comment about native Windows playback scope in win-pla…
rafaelsnv Oct 3, 2026
66365ca
fix(opencode): spawn PowerShell directly on Windows to remove bash de…
rafaelsnv Oct 4, 2026
6145abb
fix(opencode): use jsdelivr CDN to avoid GitHub raw URL cache
rafaelsnv Oct 4, 2026
342d60d
fix(opencode): fetch plugin from PeonPing/peon-ping upstream CDN
rafaelsnv Oct 4, 2026
d0ab8c1
fix(opencode): keep raw.githubusercontent.com URL for minimal change
rafaelsnv Oct 4, 2026
c2571cd
fix(opencode): point installer at fork to test bash-free Windows path
rafaelsnv Oct 4, 2026
219d07a
Integrate OpenCode v2 API migration for triage
garysheng Oct 4, 2026
1a65654
refactor(opencode): collapse script lookup, drop dead peon.sh wrapper
rafaelsnv Oct 4, 2026
4b272ac
Reconcile OpenCode v2 and native Windows adapters with Kilo compatibi…
garysheng Oct 4, 2026
d10c42c
Merge branch 'opencode-windows-adapter' of https://github.com/rafaels…
rafaelsnv Oct 4, 2026
067e3f8
Integrate latest OpenCode contributor head with official download source
garysheng Oct 4, 2026
0ee21f5
Revert "Merge branch 'opencode-windows-adapter' of https://github.com…
rafaelsnv Oct 4, 2026
da2135c
Reconcile latest native Windows revision with OpenCode v2 integration
garysheng Oct 4, 2026
d79c847
docs: sync OpenCode v2 and Kilo compatibility guidance
garysheng Oct 4, 2026
c0bd897
Route OpenCode global events by physical project and isolate installe…
garysheng Oct 4, 2026
9f10ee9
Clarify dedicated Kilo adapter installation and active configuration
garysheng Oct 4, 2026
0364ed2
fix(kilo): preserve native session identities across events
garysheng Oct 4, 2026
f26b58e
Document native Kilo session pack identities
garysheng Oct 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/test-opencode-adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,33 @@ on:
branches: [main]
paths:
- 'adapters/opencode/**'
- 'tests/opencode-peon-ping-internals.test.ts'
- 'adapters/opencode.sh'
- 'adapters/opencode.ps1'
- 'adapters/kilo/**'
- 'adapters/kilo.sh'
- 'adapters/kilo.ps1'
- 'tests/opencode-*.test.ts'
- 'tests/kilo-compatibility.test.ts'
- '.github/workflows/test-opencode-adapter.yml'
push:
branches: [main]
paths:
- 'adapters/opencode/**'
- 'tests/opencode-peon-ping-internals.test.ts'
- 'adapters/opencode.sh'
- 'adapters/opencode.ps1'
- 'adapters/kilo/**'
- 'adapters/kilo.sh'
- 'adapters/kilo.ps1'
- 'tests/opencode-*.test.ts'
- 'tests/kilo-compatibility.test.ts'
- '.github/workflows/test-opencode-adapter.yml'

jobs:
vitest:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: adapters/opencode
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -912,20 +912,22 @@ Add additional events from the table above as desired. The adapter translates Co

### OpenCode setup

A native TypeScript plugin for [OpenCode](https://opencode.ai/) with full [CESP v1.0](https://github.com/PeonPing/openpeon) conformance.
A thin TypeScript adapter for [OpenCode v2](https://opencode.ai/v2/docs/build/plugins) that routes events through the installed peon-ping hook. Install peon-ping first using the platform installer above.

**Quick install:**

```bash
curl -fsSL https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/opencode.sh | bash
```

The installer copies `peon-ping.ts` to `~/.config/opencode/plugins/` and creates a config at `~/.config/opencode/peon-ping/config.json`. Packs are stored at the shared CESP path (`~/.openpeon/packs/`).
The installer copies `peon-ping.ts` to `~/.config/opencode/plugins/`, respecting `XDG_CONFIG_HOME`. On native Windows, run `powershell -NoProfile -File adapters/opencode.ps1` from a clone after installing peon-ping. The Windows adapter uses the same OpenCode discovery directory and invokes the installed `peon.ps1` directly, without Git Bash. Config, packs and playback are handled by the main peon-ping installation; use `peon config` and `peon packs` to manage them. `CLAUDE_PEON_DIR` selects a custom hook installation.

This adapter requires OpenCode v2. See [the event mapping and compatibility notes](docs/opencode-v2-events.md) for its API contract and validation requirements.

**Features:**

- **Sound playback** via `afplay` (macOS), `pw-play`/`paplay`/`ffplay` (Linux) — same priority chain as the shell hook
- **CESP event mapping** — `session.created` / `session.idle` / `session.error` / `permission.asked` / rapid prompt detection all map to standard CESP categories
- **CESP event mapping**: execution start, success and failure, permission requests and input forms map to standard CESP categories
- **Desktop notifications** — large overlay banners by default (JXA Cocoa, visible on all screens), or standard notifications via [`terminal-notifier`](https://github.com/julienXX/terminal-notifier) / `osascript`. Fires only when the terminal is not focused.
- **Terminal focus detection** — checks if your terminal app (Terminal, iTerm2, Warp, Alacritty, kitty, WezTerm, ghostty, Hyper) is frontmost via AppleScript before sending notifications
- **Tab titles** — updates the terminal tab to show task status (`● project: working...` / `✓ project: done` / `✗ project: error`)
Expand Down Expand Up @@ -965,15 +967,15 @@ The script auto-finds the peon icon (Homebrew libexec, OpenCode config, or Claud

### Kilo CLI setup

A native TypeScript plugin for [Kilo CLI](https://github.com/kilocode/cli) with full [CESP v1.0](https://github.com/PeonPing/openpeon) conformance. Kilo CLI is a fork of OpenCode and uses the same plugin system — this installer downloads the OpenCode plugin and patches it for Kilo.
A dedicated v1 TypeScript adapter for [Kilo CLI](https://github.com/kilocode/cli) with full [CESP v1.0](https://github.com/PeonPing/openpeon) conformance. It routes events through the installed peon-ping hook. Install peon-ping first using the platform installer above.

**Quick install:**

```bash
curl -fsSL https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/kilo.sh | bash
```

The installer copies `peon-ping.ts` to `~/.config/kilo/plugins/` and creates a config at `~/.config/kilo/peon-ping/config.json`. Packs are stored at the shared CESP path (`~/.openpeon/packs/`).
The installer downloads the dedicated Kilo plugin to `~/.config/kilo/plugins/`, respecting `XDG_CONFIG_HOME`. Playback uses the main peon-ping installation and its configuration. Use `peon config` and `peon packs` to manage settings and packs. Native Kilo session IDs keep independent sessions separate and retain the same pack identity across later events and plugin reloads.

**Features:** Same as the [OpenCode adapter](#opencode-setup) — sound playback, CESP event mapping, desktop notifications, terminal focus detection, tab titles, pack switching, no-repeat logic, and spam detection.

Expand Down
10 changes: 5 additions & 5 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,20 +768,20 @@ peon-ping は `hooks.json` を作成せず、inline hooks を `~/.codex/config.t

### OpenCode セットアップ

[OpenCode](https://opencode.ai/) 用のネイティブ TypeScript プラグイン。[CESP v1.0](https://github.com/PeonPing/openpeon) に完全準拠。
[OpenCode v2](https://opencode.ai/v2/docs/build/plugins) 用の薄い TypeScript アダプター。イベントをインストール済みの peon-ping フックに転送します。先にプラットフォーム用の peon-ping インストーラーを実行してください。

**クイックインストール:**

```bash
curl -fsSL https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/opencode.sh | bash
```

インストーラーは `peon-ping.ts` を `~/.config/opencode/plugins/` にコピーし、`~/.config/opencode/peon-ping/config.json` に設定を作成します。パックは共有 CESP パス(`~/.openpeon/packs/`)に保存されます。
インストーラーは `XDG_CONFIG_HOME` に従って `peon-ping.ts` を `~/.config/opencode/plugins/` にコピーします。Windows ではクローンから `powershell -NoProfile -File adapters/opencode.ps1` を実行。`peon.ps1` を直接呼び出すため Git Bash は不要です。設定、パック、再生はメインの peon-ping フックが処理します。

**機能:**

- **サウンド再生** — `afplay`(macOS)、`pw-play`/`paplay`/`ffplay`(Linux)経由 — シェルフックと同じ優先チェーン
- **CESP イベントマッピング** — `session.created` / `session.idle` / `session.error` / `permission.asked` / 高速プロンプト検出がすべて標準 CESP カテゴリにマッピング
- **CESP イベントマッピング** — v2 の `session.created`、`session.execution`、`form.created`、`permission.asked` をフックイベントにマッピング
- **デスクトップ通知** — デフォルトで大型オーバーレイバナー(JXA Cocoa、全画面で表示)、または [`terminal-notifier`](https://github.com/julienXX/terminal-notifier) / `osascript` 経由の標準通知。ターミナルがフォーカスされていない場合のみ発火
- **ターミナルフォーカス検出** — AppleScript でターミナルアプリ(Terminal、iTerm2、Warp、Alacritty、kitty、WezTerm、ghostty、Hyper)が最前面かどうかを確認
- **タブタイトル** — ターミナルタブにタスクステータスを表示(`● project: working...` / `✓ project: done` / `✗ project: error`)
Expand Down Expand Up @@ -821,15 +821,15 @@ bash ~/.claude/hooks/peon-ping/adapters/opencode/setup-icon.sh

### Kilo CLI セットアップ

[Kilo CLI](https://github.com/kilocode/cli) 用のネイティブ TypeScript プラグイン。[CESP v1.0](https://github.com/PeonPing/openpeon) に完全準拠。Kilo CLI は OpenCode のフォークで同じプラグインシステムを使用 — このインストーラーは OpenCode プラグインをダウンロードして Kilo 用にパッチします。
[Kilo CLI](https://github.com/kilocode/cli) 用のネイティブ TypeScript プラグイン。[CESP v1.0](https://github.com/PeonPing/openpeon) に完全準拠。Kilo の v1 プラグイン形式を維持する専用アダプターで、イベントをインストール済みの peon-ping フックに転送します。先にプラットフォーム用の peon-ping インストーラーを実行してください。

**クイックインストール:**

```bash
curl -fsSL https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/kilo.sh | bash
```

インストーラーは `peon-ping.ts` を `~/.config/kilo/plugins/` にコピーし、`~/.config/kilo/peon-ping/config.json` に設定を作成します。パックは共有 CESP パス(`~/.openpeon/packs/`)に保存されます。
インストーラーは `XDG_CONFIG_HOME` に従って専用の Kilo プラグインを `~/.config/kilo/plugins/` にコピーします。再生にはメインの peon-ping インストールとその設定を使用します。設定とパックは `peon config`、`peon packs` で管理してください。Kilo のネイティブセッション ID を使用するため、独立したセッションは区別され、後続イベントやプラグインの再読み込みでもパックの識別情報が維持されます。

**機能:** [OpenCode アダプター](#opencode-セットアップ)と同じ — サウンド再生、CESP イベントマッピング、デスクトップ通知、ターミナルフォーカス検出、タブタイトル、パック切り替え、リピート防止ロジック、スパム検出。

Expand Down
10 changes: 5 additions & 5 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -795,20 +795,20 @@ powershell -NoProfile -Command "Set-ExecutionPolicy -Scope CurrentUser -Executio

### OpenCode 设置

[OpenCode](https://opencode.ai/) 的原生 TypeScript 插件,完全符合 [CESP v1.0](https://github.com/PeonPing/openpeon) 规范。
[OpenCode v2](https://opencode.ai/v2/docs/build/plugins) 的轻量 TypeScript 适配器,将事件转发给已安装的 peon-ping 钩子。请先使用平台安装程序安装 peon-ping。

**快速安装:**

```bash
curl -fsSL https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/opencode.sh | bash
```

安装程序将 `peon-ping.ts` 复制到 `~/.config/opencode/plugins/` 并在 `~/.config/opencode/peon-ping/config.json` 创建配置。语音包存储在共享 CESP 路径(`~/.openpeon/packs/`)。
安装程序遵循 `XDG_CONFIG_HOME`,将 `peon-ping.ts` 复制到 `~/.config/opencode/plugins/`。Windows 用户安装 peon-ping 后,从克隆目录运行 `powershell -NoProfile -File adapters/opencode.ps1`。适配器直接调用 `peon.ps1`,无需 Git Bash。配置、语音包和播放由主 peon-ping 钩子处理。

**功能:**

- **声音播放** — 通过 `afplay`(macOS)、`pw-play`/`paplay`/`ffplay`(Linux)— 与 shell 钩子相同的优先级链
- **CESP 事件映射** — `session.created` / `session.idle` / `session.error` / `permission.asked` / 快速提示检测都映射到标准 CESP 分类
- **CESP 事件映射** — 将 v2 的 `session.created`、`session.execution`、`form.created`、`permission.asked` 映射为钩子事件
- **桌面通知** — 通过 [`terminal-notifier`](https://github.com/julienXX/terminal-notifier) 提供丰富通知(副标题、按项目分组),回退到 `osascript`。仅在终端未获得焦点时触发
- **终端焦点检测** — 通过 AppleScript 检测你的终端应用(Terminal、iTerm2、Warp、Alacritty、kitty、WezTerm、ghostty、Hyper)是否在最前端
- **标签页标题** — 更新终端标签页显示任务状态(`● 项目: 工作中...` / `✓ 项目: 完成` / `✗ 项目: 错误`)
Expand Down Expand Up @@ -848,15 +848,15 @@ bash ~/.claude/hooks/peon-ping/adapters/opencode/setup-icon.sh

### Kilo CLI 设置

[Kilo CLI](https://github.com/kilocode/cli) 的原生 TypeScript 插件,完全符合 [CESP v1.0](https://github.com/PeonPing/openpeon) 规范。Kilo CLI 是 OpenCode 的分支,使用相同的插件系统 — 此安装程序下载 OpenCode 插件并为 Kilo 打补丁。
[Kilo CLI](https://github.com/kilocode/cli) 的原生 TypeScript 插件,完全符合 [CESP v1.0](https://github.com/PeonPing/openpeon) 规范。专用适配器保留 Kilo v1 插件接口,将事件转发给已安装的 peon-ping 钩子。请先使用平台安装程序安装 peon-ping。

**快速安装:**

```bash
curl -fsSL https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/kilo.sh | bash
```

安装程序将 `peon-ping.ts` 复制到 `~/.config/kilo/plugins/` 并在 `~/.config/kilo/peon-ping/config.json` 创建配置。语音包存储在共享 CESP 路径(`~/.openpeon/packs/`)。
安装程序遵循 `XDG_CONFIG_HOME`,将专用 Kilo 插件复制到 `~/.config/kilo/plugins/`。播放使用主 peon-ping 安装及其配置。请用 `peon config` 和 `peon packs` 管理设置和语音包。原生 Kilo 会话 ID 会区分独立会话,并在后续事件和插件重新加载时保留相同的语音包身份。

**功能:** 与 [OpenCode 适配器](#opencode-设置)相同 — 声音播放、CESP 事件映射、桌面通知、终端焦点检测、标签页标题、语音包切换、不重复逻辑和刷屏检测。

Expand Down
23 changes: 4 additions & 19 deletions adapters/kilo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# Installs the peon-ping CESP v1.0 TypeScript plugin for Kilo CLI
#
# Kilo CLI is a fork of OpenCode and uses the same TypeScript plugin system.
# This installer downloads the OpenCode plugin and patches the import path
# and config directories for Kilo.
# This installer downloads the dedicated Kilo v1 server plugin.
#
# Install:
# powershell -NoProfile -File adapters/kilo.ps1
Expand All @@ -18,7 +17,7 @@ param(
$ErrorActionPreference = "Stop"

# --- Config ---
$PluginUrl = "https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/opencode/peon-ping.ts"
$PluginUrl = "https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/kilo/peon-ping.ts"
$RegistryUrl = "https://peonping.github.io/registry/index.json"
$DefaultPack = "peon"

Expand Down Expand Up @@ -46,26 +45,12 @@ if ($Uninstall) {
# --- Install ---
Write-Host "> Installing peon-ping for Kilo CLI..."

# Install plugin — download OpenCode plugin and patch for Kilo
# Install the dedicated Kilo v1 server plugin
New-Item -ItemType Directory -Path $PluginsDir -Force | Out-Null

Write-Host "> Downloading OpenCode plugin and patching for Kilo CLI..."
Write-Host "> Downloading Kilo CLI plugin..."
$pluginContent = (Invoke-WebRequest -Uri $PluginUrl -UseBasicParsing).Content

# Apply string replacements (matching kilo.sh sed commands)
$pluginContent = $pluginContent -replace '"@opencode-ai/plugin"', '"@kilocode/plugin"'
$pluginContent = $pluginContent -replace '".config", "opencode", "peon-ping"', '".config", "kilo", "peon-ping"'
$pluginContent = $pluginContent -replace '`oc-\$\{Date\.now\(\)\}`', '`kilo-${Date.now()}`'
$pluginContent = $pluginContent -replace '\) \|\| "opencode"', ') || "kilo"'
$pluginContent = $pluginContent -replace 'peon-ping for OpenCode', 'peon-ping for Kilo CLI'
$pluginContent = $pluginContent -replace 'A CESP.*?player for OpenCode\.', 'A CESP (Coding Event Sound Pack Specification) player for Kilo CLI.'
$pluginContent = $pluginContent -replace 'Maps OpenCode events', 'Maps Kilo events'
$pluginContent = $pluginContent -replace '~/.config/opencode/plugins/peon-ping\.ts', '~/.config/kilo/plugins/peon-ping.ts'
$pluginContent = $pluginContent -replace 'Restart OpenCode', 'Restart Kilo CLI'
$pluginContent = $pluginContent -replace 'OpenCode Event', 'Kilo Event'
$pluginContent = $pluginContent -replace 'OpenCode -> CESP', 'Kilo CLI -> CESP'
$pluginContent = $pluginContent -replace 'Return OpenCode event hooks', 'Return Kilo event hooks'

$pluginPath = Join-Path $PluginsDir "peon-ping.ts"
# UTF-8 without a BOM: Set-Content -Encoding UTF8 writes one on Windows PowerShell
# 5.1, and a BOM trips strict parsers reading these files back.
Expand Down
23 changes: 4 additions & 19 deletions adapters/kilo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# Installs the peon-ping CESP v1.0 TypeScript plugin for Kilo CLI
#
# Kilo CLI is a fork of OpenCode and uses the same TypeScript plugin system.
# This installer downloads the OpenCode plugin and patches the import path
# and config directories for Kilo.
# This installer downloads the dedicated Kilo v1 server plugin.
#
# Install:
# bash adapters/kilo.sh
Expand All @@ -18,7 +17,7 @@
set -euo pipefail

# --- Config ---
PLUGIN_URL="https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/opencode/peon-ping.ts"
PLUGIN_URL="https://raw.githubusercontent.com/PeonPing/peon-ping/main/adapters/kilo/peon-ping.ts"
REGISTRY_URL="https://peonping.github.io/registry/index.json"
DEFAULT_PACK="peon"

Expand Down Expand Up @@ -90,22 +89,8 @@ esac
# --- Install plugin ---
mkdir -p "$KILO_PLUGINS_DIR"

info "Downloading OpenCode plugin and patching for Kilo CLI..."
curl -fsSL "$PLUGIN_URL" \
| sed \
-e 's|"@opencode-ai/plugin"|"@kilocode/plugin"|g' \
-e 's|".config", "opencode", "peon-ping"|".config", "kilo", "peon-ping"|g' \
-e 's|`oc-\${Date.now()}`|`kilo-${Date.now()}`|g' \
-e 's|) || "opencode"|) || "kilo"|g' \
-e 's|peon-ping for OpenCode|peon-ping for Kilo CLI|g' \
-e 's|A CESP.*player for OpenCode\.|A CESP (Coding Event Sound Pack Specification) player for Kilo CLI.|g' \
-e 's|Maps OpenCode events|Maps Kilo events|g' \
-e 's|~/.config/opencode/plugins/peon-ping.ts|~/.config/kilo/plugins/peon-ping.ts|g' \
-e 's|Restart OpenCode|Restart Kilo CLI|g' \
-e 's|OpenCode Event|Kilo Event|g' \
-e 's|OpenCode -> CESP|Kilo CLI -> CESP|g' \
-e 's|Return OpenCode event hooks|Return Kilo event hooks|g' \
> "$KILO_PLUGINS_DIR/peon-ping.ts"
info "Downloading Kilo CLI plugin..."
curl -fsSL "$PLUGIN_URL" -o "$KILO_PLUGINS_DIR/peon-ping.ts"
info "Plugin installed to $KILO_PLUGINS_DIR/peon-ping.ts"

# --- Create default config ---
Expand Down
Loading
Loading