opencode-permission-notify 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +44 -31
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # opencode-permission-notify
2
2
 
3
- 把 OpenCode 的授权请求变成 macOS 屏幕右上角的原生浮窗,带 **允许一次 / 总是允许 / 拒绝** 三个按钮——
4
- 不用切回 OpenCode 窗口就能批复。
3
+ Approval prompts from OpenCode, as a native macOS floating panel in the top-right
4
+ corner of your screen — with **Allow once / Always / Reject** buttons, so you never
5
+ have to switch back to the OpenCode window to answer.
5
6
 
6
- - **非抢焦**:浮窗是 `NSWindowStyleMaskNonactivatingPanel`,点按钮不会把 OpenCode 顶到前台,也不会打断你正在读的东西
7
- - **该静就静**:OpenCode 已经在前台时直接不弹(窗口里的提示本来就看得见)
8
- - **不丢请求**:浮窗点完即时回写;超时 5 分钟自动收起,交还给窗口内的原提示
9
- - **零依赖**:不装 terminal-notifier,不需要通知权限,二进制随包分发
7
+ - **Non-activating** — the panel is an `NSWindowStyleMaskNonactivatingPanel`; clicking a button does not bring OpenCode forward or interrupt what you are doing
8
+ - **Quiet when it should be** — if OpenCode is already frontmost, nothing pops up
9
+ - **Never lost** — answers are written back immediately; after 5 minutes the panel closes and hands the request back to the in-window prompt
10
+ - **No dependencies** — no terminal-notifier, no notification permission; the helper binary ships with the package
10
11
 
11
- ## 安装
12
+ ## Install
12
13
 
13
14
  ```jsonc
14
15
  // ~/.config/opencode/opencode.jsonc
@@ -17,7 +18,7 @@
17
18
  }
18
19
  ```
19
20
 
20
- 或者在本地开发时指向目录:
21
+ Or point at a local checkout while developing:
21
22
 
22
23
  ```jsonc
23
24
  {
@@ -25,47 +26,59 @@
25
26
  }
26
27
  ```
27
28
 
28
- 首次加载时会把内置的通用二进制(arm64 + x86_64)释放到
29
- `~/Library/Application Support/opencode/permission-notify/bin/notify-request`。
29
+ On first load the bundled universal binary (arm64 + x86_64) is extracted to
30
+ `~/Library/Application Support/opencode/permission-notify/bin/notify-request`.
30
31
 
31
- **要求**:macOS、OpenCode V2(桌面版或 TUI 均可,插件跑在服务端)。
32
+ **Requirements**: macOS, OpenCode V2 (desktop or TUI — the plugin runs in the
33
+ server).
32
34
 
33
- ## 工作方式
35
+ ## How it works
34
36
 
35
37
  ```
36
- OpenCode 服务端发出 permission.asked
37
- ↓ 插件按 location 过滤(只有会话所属目录的实例处理)
38
- 执行 notify-request:
39
- 前台是 OpenCode → 直接退出,不打扰
40
- 否则在右上角画浮窗,等你点按钮
41
- ↓ stdout 返回按钮序号
38
+ OpenCode server emits permission.asked
39
+ ↓ the plugin filters by location (only the instance owning the session's
40
+ directory handles it)
41
+ notify-request:
42
+ OpenCode is frontmost → exit quietly
43
+ otherwise draw a panel in the top-right corner and wait for a click
44
+ ↓ stdout: index of the chosen button
42
45
  ctx.permission.reply({ sessionID, requestID, decision })
43
46
  ```
44
47
 
45
- 按钮对应 `once` / `always` / `reject` 三种 decision。
48
+ The three buttons map to the `once` / `always` / `reject` decisions.
46
49
 
47
- ## 配置
50
+ ## Configuration
48
51
 
49
- | 环境变量 | 说明 |
52
+ | Environment variable | Description |
50
53
  | --- | --- |
51
- | `PERMISSION_NOTIFY_HELPER` | 覆盖助手路径(一般不用) |
54
+ | `PERMISSION_NOTIFY_HELPER` | Override the helper path (rarely needed) |
52
55
 
53
- 日志:`~/Library/Application Support/opencode/permission-notify/notify.log`
56
+ Log file: `~/Library/Application Support/opencode/permission-notify/notify.log`
54
57
 
55
- ## 从源码构建
58
+ ## Build from source
56
59
 
57
- 需要 Xcode Command Line Tools:
60
+ Requires Xcode Command Line Tools:
58
61
 
59
62
  ```sh
60
- ./build.sh # 编译通用二进制到 bin/notify-request
63
+ ./build.sh # builds bin/notify-request (universal)
61
64
  ```
62
65
 
63
- ## 已知限制
66
+ ## Limitations
64
67
 
65
- - 仅 macOS
66
- - 浮窗按请求堆叠(最多 5 个槽位);同一时刻大量请求会略微重叠
67
- - 拒绝时不会附带理由文本(OpenCode 支持带反馈的拒绝,这里暂时只回 `reject`)
68
+ - macOS only
69
+ - Panels stack by request (up to five slots); many simultaneous requests overlap slightly
70
+ - Rejections do not carry feedback text yet (OpenCode supports reject-with-reason; this only sends `reject`)
68
71
 
69
- ## 许可
72
+ ## License
70
73
 
71
74
  MIT
75
+
76
+ ---
77
+
78
+ ## 中文说明
79
+
80
+ 把 OpenCode 的授权请求变成屏幕右上角的 macOS 原生浮窗,带「允许一次 / 总是允许 / 拒绝」
81
+ 三个按钮,不抢焦点、不用切回窗口;OpenCode 已在前台时不弹。通用二进制助手随包分发。
82
+
83
+ 安装:在 `~/.config/opencode/opencode.jsonc` 的 `plugins` 中加 `"opencode-permission-notify"`。
84
+ 仅支持 macOS + OpenCode V2。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-permission-notify",
3
- "version": "0.1.0",
4
- "description": "macOS 原生浮窗,把 OpenCode 的授权请求变成右上角带按钮的通知:允许一次 / 总是允许 / 拒绝,不用切回窗口。",
3
+ "version": "0.1.1",
4
+ "description": "Approval prompts from OpenCode as a native macOS floating panel in the top-right corner, with Allow once / Always / Reject buttons. 把 OpenCode 的授权请求变成右上角带按钮的原生浮窗。",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Mingpei Wang",
@@ -24,4 +24,4 @@
24
24
  "os": [
25
25
  "darwin"
26
26
  ]
27
- }
27
+ }