opencode-vibe-webhook 1.0.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.
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # opencode-vibe-webhook
2
+
3
+ OpenCode native plugin for VibeControls notifications. **Companion plugin to [@burdenoff/vibe-plugin-notify](../vibe-plugin-notify/)**.
4
+
5
+ Runs **inside OpenCode** for 100% reliable event detection and sends events to VibeControls Agent for webhook delivery.
6
+
7
+ ## Architecture
8
+
9
+ ```
10
+ ┌─────────────────────────────┐ ┌─────────────────────────────────┐
11
+ │ OpenCode │ │ VibeControls Agent │
12
+ │ │ │ │
13
+ │ opencode-vibe-webhook │────────>│ vibe-plugin-notify │
14
+ │ (this plugin) │ POST │ │
15
+ │ │ │ Configured Webhooks: │
16
+ │ - Native event detection │ │ ├── Slack │
17
+ │ - 100% reliable │ │ ├── Discord │
18
+ │ - Zero latency │ │ └── Custom │
19
+ └─────────────────────────────┘ └─────────────────────────────────┘
20
+ ```
21
+
22
+ ## Quick Start
23
+
24
+ ### 1. Install vibe-plugin-notify in VibeControls
25
+
26
+ ```bash
27
+ vibe plugin install @burdenoff/vibe-plugin-notify
28
+ ```
29
+
30
+ ### 2. Add webhooks via VibeControls CLI
31
+
32
+ ```bash
33
+ vibe notify add https://hooks.slack.com/services/xxx
34
+ ```
35
+
36
+ ### 3. Add this plugin to OpenCode
37
+
38
+ In `~/.config/opencode/opencode.jsonc`:
39
+
40
+ ```json
41
+ {
42
+ "plugin": ["opencode-vibe-webhook"]
43
+ }
44
+ ```
45
+
46
+ Or with full path:
47
+
48
+ ```json
49
+ {
50
+ "plugin": ["/path/to/opencode-vibe-webhook/dist/index.js"]
51
+ }
52
+ ```
53
+
54
+ ### 4. Done!
55
+
56
+ Events from OpenCode automatically flow to VibeControls, which delivers to your webhooks.
57
+
58
+ ## Commands
59
+
60
+ Use `/vibehook` in OpenCode to manage settings:
61
+
62
+ | Command | Description |
63
+ | ------------------------ | ---------------------------------- |
64
+ | `/vibehook status` | Show current configuration |
65
+ | `/vibehook test` | Test VibeControls connection |
66
+ | `/vibehook add <url>` | Add direct webhook (bypass Vibe) |
67
+ | `/vibehook list` | List direct webhooks |
68
+ | `/vibehook remove <id>` | Remove a direct webhook |
69
+ | `/vibehook events` | Show event presets |
70
+ | `/vibehook vibe-enable` | Enable VibeControls notifications |
71
+ | `/vibehook vibe-disable` | Disable VibeControls notifications |
72
+
73
+ ### Examples
74
+
75
+ ```
76
+ /vibehook status
77
+ /vibehook test
78
+ /vibehook add https://hooks.slack.com/services/xxx "Backup Slack"
79
+ ```
80
+
81
+ ## Configuration
82
+
83
+ Config is stored at `~/.config/opencode/vibe-webhook.json`:
84
+
85
+ ```json
86
+ {
87
+ "webhooks": [],
88
+ "vibeAgentUrl": "http://localhost:3005",
89
+ "vibeNotifyEnabled": true,
90
+ "vibeNotifyEvents": ["default"],
91
+ "notifyChildSessions": false,
92
+ "debug": false,
93
+ "logFile": null
94
+ }
95
+ ```
96
+
97
+ ### Pre-configured
98
+
99
+ - **VibeControls notifications enabled by default** - No setup needed
100
+ - Events flow to `http://localhost:3005/api/notify/hook`
101
+ - Manage webhooks centrally via `vibe notify` CLI
102
+
103
+ ### Direct Webhooks (Optional)
104
+
105
+ Add direct webhooks for backup or custom routing:
106
+
107
+ ```
108
+ /vibehook add https://hooks.slack.com/services/xxx
109
+ ```
110
+
111
+ These bypass VibeControls and deliver directly.
112
+
113
+ ## Supported Events
114
+
115
+ | Event | Description | Notification |
116
+ | -------------------- | ----------------------- | ---------------------- |
117
+ | `session.idle` | Task completed | ✅ Task Completed |
118
+ | `session.error` | Task failed | ❌ Task Failed |
119
+ | `question.asked` | AI asks user a question | ❓ Question Asked |
120
+ | `permission.updated` | Permission requested | 🔔 Permission Required |
121
+ | `session.created` | New session started | 🚀 Session Started |
122
+ | `session.status` | Working/retrying | ⏳ Working... |
123
+ | `file.edited` | File modified | ✏️ File Edited |
124
+ | `command.executed` | Command run | 💻 Command Executed |
125
+
126
+ ### Event Presets
127
+
128
+ | Preset | Events |
129
+ | ---------- | ----------------------------------------------------------------------- |
130
+ | `minimal` | `session.idle` |
131
+ | `default` | `session.idle`, `session.error`, `question.asked`, `permission.updated` |
132
+ | `standard` | Above + `session.created` |
133
+ | `verbose` | Above + `session.status`, `file.edited`, `command.executed` |
134
+ | `all` | All events |
135
+
136
+ ## Why This Architecture?
137
+
138
+ | Approach | Where Webhooks Live | Pros |
139
+ | --------------- | ------------------- | -------------------------------- |
140
+ | **This plugin** | VibeControls Agent | Central management, CLI, retries |
141
+ | Direct webhooks | OpenCode config | Simple, no agent needed |
142
+ | Both | Both | Redundancy, flexibility |
143
+
144
+ **Recommended**: Use VibeControls Agent for webhook management. Add direct webhooks only for backup or special cases.
145
+
146
+ ## Troubleshooting
147
+
148
+ ### Test VibeControls connection
149
+
150
+ ```
151
+ /vibehook test
152
+ ```
153
+
154
+ ### Enable debug logging
155
+
156
+ Edit `~/.config/opencode/vibe-webhook.json`:
157
+
158
+ ```json
159
+ {
160
+ "debug": true,
161
+ "logFile": "/tmp/vibe-webhook.log"
162
+ }
163
+ ```
164
+
165
+ Watch logs: `tail -f /tmp/vibe-webhook.log`
166
+
167
+ ### Common issues
168
+
169
+ | Issue | Solution |
170
+ | -------------------------- | ------------------------------------------- |
171
+ | VibeControls not reachable | Start VibeControls Agent with notify plugin |
172
+ | No notifications | Run `/vibehook status` to check config |
173
+ | Wrong events | Edit `vibeNotifyEvents` in config file |
174
+
175
+ ## Related Packages
176
+
177
+ - [@burdenoff/vibe-plugin-notify](../vibe-plugin-notify/) - VibeControls webhook management plugin
178
+ - [VibeControls Agent](https://github.com/algoshred/vibecontrols) - AI coding assistant orchestration
179
+
180
+ ## License
181
+
182
+ MIT
@@ -0,0 +1,58 @@
1
+ /**
2
+ * opencode-vibe-webhook
3
+ *
4
+ * OpenCode native plugin for VibeControls webhook notifications.
5
+ * Companion plugin for @burdenoff/vibe-plugin-notify.
6
+ *
7
+ * Runs INSIDE OpenCode process for 100% reliable event detection.
8
+ *
9
+ * Features:
10
+ * - Pre-configured to send events to VibeControls Agent (vibe-plugin-notify)
11
+ * - Native event hook (no polling, no SSE)
12
+ * - Interactive setup via /vibehook command
13
+ * - Additional webhooks for Slack, Discord, custom endpoints
14
+ *
15
+ * Setup:
16
+ * 1. Install vibe-plugin-notify in VibeControls Agent
17
+ * 2. Add this plugin to opencode.jsonc
18
+ * 3. Events automatically flow to VibeControls for webhook delivery
19
+ * 4. Optionally add direct webhooks: /vibehook add <url>
20
+ */
21
+ import { tool } from "@opencode-ai/plugin/tool";
22
+ interface OpenCodeEvent {
23
+ type: string;
24
+ properties?: Record<string, unknown>;
25
+ }
26
+ interface PluginContext {
27
+ project?: {
28
+ name?: string;
29
+ path?: string;
30
+ };
31
+ client?: {
32
+ session?: {
33
+ get: (opts: {
34
+ path: {
35
+ id: string;
36
+ };
37
+ }) => Promise<{
38
+ data?: SessionData;
39
+ }>;
40
+ };
41
+ };
42
+ directory?: string;
43
+ worktree?: string;
44
+ }
45
+ interface SessionData {
46
+ id?: string;
47
+ title?: string;
48
+ parentID?: string;
49
+ }
50
+ type Plugin = (ctx: PluginContext) => Promise<{
51
+ event?: (args: {
52
+ event: OpenCodeEvent;
53
+ }) => Promise<void>;
54
+ tool?: Record<string, ReturnType<typeof tool>>;
55
+ }>;
56
+ export declare const VibeWebhookPlugin: Plugin;
57
+ export default VibeWebhookPlugin;
58
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAiBhD,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,UAAU,aAAa;IAC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