opencode-zellij 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,29 @@
1
1
  # opencode-zellij
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/opencode-zellij.svg)](https://www.npmjs.com/package/opencode-zellij)
4
+ [![CI](https://github.com/maou-shonen/opencode-zellij/actions/workflows/ci.yml/badge.svg)](https://github.com/maou-shonen/opencode-zellij/actions/workflows/ci.yml)
5
+
3
6
  [正體中文](README.zh.md)
4
7
 
5
8
  Give OpenCode a way to use visible Zellij panes for work that should not disappear into a one-shot tool call.
6
9
 
7
10
  Use OpenCode's built-in `bash` for normal commands. Use this plugin when the process should stay alive, remain visible, or need later input.
8
11
 
12
+ ## Installation
13
+
14
+ Add the npm package name to your OpenCode config:
15
+
16
+ ```json
17
+ {
18
+ "$schema": "https://opencode.ai/config.json",
19
+ "plugin": [
20
+ "opencode-zellij"
21
+ ]
22
+ }
23
+ ```
24
+
25
+ OpenCode installs npm plugins automatically at startup. Zellij must also be installed and available on your `PATH`.
26
+
9
27
  ## Good fits
10
28
 
11
29
  - dev servers and watchers
@@ -45,11 +63,29 @@ Close the dev server pane.
45
63
  | `zellij_pty_write` | Send input to an interactive pane. |
46
64
  | `zellij_pty_list` | Show panes known to the plugin. |
47
65
  | `zellij_pty_kill` | Close a pane created by the plugin. |
48
- | `request_sudo` | Ask the user to review and run privileged commands in Zellij. |
66
+ | `zellij_pty_request_sudo` | Ask the user to review and run privileged commands in Zellij. |
49
67
 
50
68
  ## Human-only work
51
69
 
52
- `request_sudo` opens a review pane, shows what will run, and waits for the user to type `YES`. The agent cannot type into that pane, so passwords and credentials stay in Zellij instead of entering prompts or tool arguments.
70
+ `zellij_pty_request_sudo` opens a review pane, shows what will run, and waits for the user to type `YES`. The agent cannot type into that pane, so passwords and credentials stay in Zellij instead of entering prompts or tool arguments.
71
+
72
+ ## Dynamic tab title
73
+
74
+ When OpenCode runs inside Zellij, the plugin updates the current tab title to show the project, branch, and current OpenCode state:
75
+
76
+ ```text
77
+ 🟢 opencode-zellij 🌱 main # ready
78
+ ⚡ opencode-zellij 🌱 main # agent running
79
+ 💬 opencode-zellij 🌱 main # waiting for user input
80
+ ```
81
+
82
+ The title is updated best-effort from OpenCode session, question, permission, and branch events.
83
+
84
+ ## Pane cleanup watchdog
85
+
86
+ When the plugin creates a pane, it also starts a small detached Node.js watchdog process for that OpenCode plugin instance. The watchdog keeps a per-instance registry under `$XDG_RUNTIME_DIR/opencode-zellij-*` (or the system temp directory), watches the owning OpenCode process, and closes plugin-created panes if OpenCode exits before normal plugin cleanup can run, such as when leaving with Ctrl-D.
87
+
88
+ The watchdog exits automatically after the owner process exits and cleanup is complete. Registries are isolated per OpenCode process and plugin instance.
53
89
 
54
90
  ## Notes
55
91
 
@@ -57,3 +93,4 @@ Close the dev server pane.
57
93
  - Session records are in-memory only; restarting OpenCode loses them.
58
94
  - Output is rendered Zellij output, not raw PTY bytes.
59
95
  - Exit code capture is best-effort for commands started by the plugin.
96
+ - When dynamic tab title is enabled, it may overwrite manual Zellij tab renames on the next OpenCode state change.
package/README.zh.md CHANGED
@@ -1,11 +1,29 @@
1
1
  # opencode-zellij
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/opencode-zellij.svg)](https://www.npmjs.com/package/opencode-zellij)
4
+ [![CI](https://github.com/maou-shonen/opencode-zellij/actions/workflows/ci.yml/badge.svg)](https://github.com/maou-shonen/opencode-zellij/actions/workflows/ci.yml)
5
+
3
6
  [English](README.md)
4
7
 
5
8
  讓 OpenCode 可以使用可見的 Zellij panes,處理不適合消失在一次性 tool call 裡的工作。
6
9
 
7
10
  一般 commands 請使用 OpenCode 內建的 `bash`。當 process 應該持續存在、保持可見,或需要後續輸入時,才使用這個 plugin。
8
11
 
12
+ ## 安裝
13
+
14
+ 把 npm package name 加到 OpenCode config:
15
+
16
+ ```json
17
+ {
18
+ "$schema": "https://opencode.ai/config.json",
19
+ "plugin": [
20
+ "opencode-zellij"
21
+ ]
22
+ }
23
+ ```
24
+
25
+ OpenCode 會在啟動時自動安裝 npm plugins。Zellij 也必須已安裝,且可在 `PATH` 中使用。
26
+
9
27
  ## 適合情境
10
28
 
11
29
  - dev servers 與 watchers
@@ -45,11 +63,29 @@
45
63
  | `zellij_pty_write` | 對互動式 pane 送出 input。 |
46
64
  | `zellij_pty_list` | 顯示 plugin 已知的 panes。 |
47
65
  | `zellij_pty_kill` | 關閉 plugin 建立的 pane。 |
48
- | `request_sudo` | 請使用者在 Zellij 中審核並執行 privileged commands。 |
66
+ | `zellij_pty_request_sudo` | 請使用者在 Zellij 中審核並執行 privileged commands。 |
49
67
 
50
68
  ## Human-only work
51
69
 
52
- `request_sudo` 會開啟 review pane、顯示即將執行的內容,並等待使用者輸入 `YES`。Agent 不能在該 pane 中輸入,因此 passwords 與 credentials 會留在 Zellij,而不是進入 prompts 或 tool arguments。
70
+ `zellij_pty_request_sudo` 會開啟 review pane、顯示即將執行的內容,並等待使用者輸入 `YES`。Agent 不能在該 pane 中輸入,因此 passwords 與 credentials 會留在 Zellij,而不是進入 prompts 或 tool arguments。
71
+
72
+ ## 動態 tab title
73
+
74
+ 當 OpenCode 在 Zellij 中執行時,plugin 會更新目前 tab title,顯示 project、branch 與目前 OpenCode 狀態:
75
+
76
+ ```text
77
+ 🟢 opencode-zellij 🌱 main # ready
78
+ ⚡ opencode-zellij 🌱 main # agent running
79
+ 💬 opencode-zellij 🌱 main # waiting for user input
80
+ ```
81
+
82
+ Title 會 best-effort 根據 OpenCode session、question、permission 與 branch events 更新。
83
+
84
+ ## Pane cleanup watchdog
85
+
86
+ 當 plugin 建立 pane 時,也會為該 OpenCode plugin instance 啟動一個小型 detached Node.js watchdog process。watchdog 會把 per-instance registry 放在 `$XDG_RUNTIME_DIR/opencode-zellij-*`(或系統 temp directory),監控擁有該 registry 的 OpenCode process,並在 OpenCode 還沒來得及執行正常 plugin cleanup 就退出時關閉 plugin 建立的 panes,例如使用 Ctrl-D 離開。
87
+
88
+ owner process 結束且 cleanup 完成後,watchdog 會自動退出。Registry 會依 OpenCode process 與 plugin instance 隔離。
53
89
 
54
90
  ## 注意事項
55
91
 
@@ -57,3 +93,4 @@
57
93
  - Session records 只存在於 memory;重啟 OpenCode 後會遺失。
58
94
  - Output 是 rendered Zellij output,不是 raw PTY bytes。
59
95
  - 由 plugin 啟動的 commands 會 best-effort 捕捉 exit code。
96
+ - 動態 tab title 啟用時,下一次 OpenCode 狀態變更可能會覆蓋手動修改的 Zellij tab title。