opencode-enhancer 1.0.8 → 1.2.0

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 (43) hide show
  1. package/README.md +94 -2
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +539 -305
  5. package/dist/index.js.map +1 -1
  6. package/dist/providers/auth.d.ts +1 -1
  7. package/dist/providers/auth.d.ts.map +1 -1
  8. package/dist/providers/auth.js +133 -48
  9. package/dist/providers/auth.js.map +1 -1
  10. package/dist/providers/chutes.d.ts +1 -1
  11. package/dist/providers/chutes.d.ts.map +1 -1
  12. package/dist/providers/chutes.js +19 -16
  13. package/dist/providers/chutes.js.map +1 -1
  14. package/dist/providers/codex.d.ts +1 -1
  15. package/dist/providers/codex.d.ts.map +1 -1
  16. package/dist/providers/codex.js +54 -35
  17. package/dist/providers/codex.js.map +1 -1
  18. package/dist/providers/copilot.d.ts +1 -1
  19. package/dist/providers/copilot.d.ts.map +1 -1
  20. package/dist/providers/copilot.js +92 -60
  21. package/dist/providers/copilot.js.map +1 -1
  22. package/dist/providers/types.d.ts +8 -4
  23. package/dist/providers/types.d.ts.map +1 -1
  24. package/dist/providers/types.js.map +1 -1
  25. package/dist/providers/zai.d.ts +1 -1
  26. package/dist/providers/zai.d.ts.map +1 -1
  27. package/dist/providers/zai.js +29 -21
  28. package/dist/providers/zai.js.map +1 -1
  29. package/dist/settings.d.ts +1 -0
  30. package/dist/settings.d.ts.map +1 -1
  31. package/dist/settings.js +45 -19
  32. package/dist/settings.js.map +1 -1
  33. package/dist/store.d.ts.map +1 -1
  34. package/dist/store.js +76 -27
  35. package/dist/store.js.map +1 -1
  36. package/dist/types.d.ts +10 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js +110 -5
  39. package/dist/types.js.map +1 -1
  40. package/dist/usage-command.d.ts.map +1 -1
  41. package/dist/usage-command.js +390 -112
  42. package/dist/usage-command.js.map +1 -1
  43. package/package.json +2 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # opencode-enhancer
2
2
 
3
- OpenCode enhancer for Codex accounts, usage tracking, plugin updates, and future automation.
3
+ OpenCode enhancer for Codex accounts, usage tracking, plugin updates.
4
4
 
5
5
  ## What It Does
6
6
 
@@ -68,7 +68,7 @@ opencode-enhancer plugins update --dry-run
68
68
 
69
69
  Default paths:
70
70
 
71
- - store: `~/.config/opencode-enhancer/accounts.json`
71
+ - store: `~/.config/opencode-enhancer/settings.json`
72
72
  - logs: `~/.config/opencode-enhancer/logs/codex-soft.log`
73
73
  - usage cache: `~/.cache/opencode-enhancer/usage-cache.json`
74
74
 
@@ -91,3 +91,95 @@ Examples:
91
91
  - `OPENCODE_ENHANCER_DEBUG`
92
92
  - `OPENCODE_ENHANCER_USAGE_BASE_URL`
93
93
  - `OPENCODE_ENHANCER_REFRESH_QUEUE_CONCURRENCY`
94
+
95
+ Notification-specific examples:
96
+
97
+ - `OPENCODE_ENHANCER_NOTIFY=1`
98
+ - `OPENCODE_ENHANCER_NOTIFY_BACKEND=auto`
99
+ - `OPENCODE_ENHANCER_NOTIFY_BACKEND=terminal`
100
+ - `OPENCODE_ENHANCER_NOTIFY_BACKEND=system`
101
+ - `OPENCODE_ENHANCER_NOTIFY_NTFY_URL=...`
102
+
103
+ ## Notification Settings JSON
104
+
105
+ Per-event notification toggles live in the persisted store JSON (`~/.config/opencode-enhancer/settings.json`, key `settings.notifications`).
106
+
107
+ Default values:
108
+
109
+ ```json
110
+ {
111
+ "settings": {
112
+ "notifications": {
113
+ "permissionRequest": true,
114
+ "taskComplete": true,
115
+ "error": true,
116
+ "question": true
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ These toggles control notifications when the agent:
123
+
124
+ - asks for permissions
125
+ - finishes a task
126
+ - emits an error
127
+ - asks the user a question
128
+
129
+ ## Terminal-native Notifications
130
+
131
+ `opencode-enhancer` can now prefer terminal-native desktop notifications emitted through OSC escape sequences instead of AppleScript-style macOS notifications.
132
+
133
+ Backend selection is controlled with:
134
+
135
+ ```bash
136
+ OPENCODE_ENHANCER_NOTIFY_BACKEND=auto
137
+ ```
138
+
139
+ Supported values:
140
+
141
+ - `auto` - prefer terminal-native notifications when running in a supported terminal with access to a real TTY; otherwise fall back to the existing system backend
142
+ - `terminal` - use terminal-native notifications only; do not fall back to the system backend
143
+ - `system` - always use the existing system backend (`osascript` / `terminal-notifier` on macOS)
144
+
145
+ Current terminal-native target matrix:
146
+
147
+ - Ghostty - supported via `OSC 9`
148
+ - iTerm2 - supported via `OSC 9`
149
+ - kitty - supported via legacy `OSC 9`
150
+ - WezTerm - supported via `OSC 9` (visibility depends on WezTerm notification settings)
151
+
152
+ Notes and limitations:
153
+
154
+ - Terminal-native notifications require the plugin process to reach the controlling terminal. The implementation first tries `/dev/tty`, then falls back to a TTY stderr/stdout stream.
155
+ - `tmux`, `screen`, and `zellij` are not supported in this first slice; they may intercept OSC unless passthrough is configured.
156
+ - On macOS/Linux, the terminal app itself must be allowed to show notifications by the OS.
157
+ - In WezTerm, `notification_handling` must not be set to `NeverShow`.
158
+ - Terminal-native notifications intentionally use a compact single-line payload. Click-to-open URLs are still only available through the existing system backend.
159
+
160
+ Quick manual checks:
161
+
162
+ ```bash
163
+ # Ghostty / iTerm2 / kitty / WezTerm
164
+ printf '\e]9;OpenCode test notification\e\\'
165
+ ```
166
+
167
+ Repo helper for a quick smoke test:
168
+
169
+ ```bash
170
+ npm run notify:smoke
171
+ npm run notify:smoke -- --check
172
+ npm run notify:smoke -- --title "OpenCode smoke" --message "Ghostty/iTerm2/kitty/WezTerm"
173
+ ```
174
+
175
+ What it does:
176
+
177
+ - detects whether the current terminal matches the same support heuristic used by the plugin
178
+ - prints TTY diagnostics (`/dev/tty`, `stderr.isTTY`, `stdout.isTTY`)
179
+ - sends a single `OSC 9` notification when supported
180
+
181
+ If you want the old behavior regardless of terminal support:
182
+
183
+ ```bash
184
+ OPENCODE_ENHANCER_NOTIFY_BACKEND=system
185
+ ```
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Plugin } from '@opencode-ai/plugin';
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
2
  /**
3
3
  * Multi-account OAuth plugin for OpenCode
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAqQ9D;;;;GAIG;AACH,QAAA,MAAM,eAAe,EAAE,MAy4BtB,CAAA;AAED,eAAe,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAkR/D;;;;GAIG;AACH,QAAA,MAAM,eAAe,EAAE,MA2tCtB,CAAC;AAEF,eAAe,eAAe,CAAC"}