vibe-haptic 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.
Files changed (47) hide show
  1. package/.claude-plugin/README.md +54 -0
  2. package/.claude-plugin/marketplace.json +24 -0
  3. package/.claude-plugin/plugin.json +13 -0
  4. package/README.md +111 -0
  5. package/dist/bin/haptic-hook.js +11 -0
  6. package/dist/bin/haptic-hook.js.map +10 -0
  7. package/dist/bin/haptic.js +13 -0
  8. package/dist/bin/haptic.js.map +10 -0
  9. package/dist/chunk-7m264p1d.js +57 -0
  10. package/dist/chunk-7m264p1d.js.map +10 -0
  11. package/dist/chunk-bckdz3we.js +26 -0
  12. package/dist/chunk-bckdz3we.js.map +10 -0
  13. package/dist/chunk-vvy5kwnq.js +215 -0
  14. package/dist/chunk-vvy5kwnq.js.map +13 -0
  15. package/dist/claude/index.js +12 -0
  16. package/dist/claude/index.js.map +9 -0
  17. package/dist/index.js +11 -0
  18. package/dist/index.js.map +9 -0
  19. package/dist/opencode/index.js +11 -0
  20. package/dist/opencode/index.js.map +9 -0
  21. package/dist/src/bin/haptic-hook.d.ts +3 -0
  22. package/dist/src/bin/haptic-hook.d.ts.map +1 -0
  23. package/dist/src/bin/haptic.d.ts +3 -0
  24. package/dist/src/bin/haptic.d.ts.map +1 -0
  25. package/dist/src/claude/hook.d.ts +11 -0
  26. package/dist/src/claude/hook.d.ts.map +1 -0
  27. package/dist/src/claude/index.d.ts +2 -0
  28. package/dist/src/claude/index.d.ts.map +1 -0
  29. package/dist/src/config.d.ts +5 -0
  30. package/dist/src/config.d.ts.map +1 -0
  31. package/dist/src/haptic.d.ts +25 -0
  32. package/dist/src/haptic.d.ts.map +1 -0
  33. package/dist/src/index.d.ts +2 -0
  34. package/dist/src/index.d.ts.map +1 -0
  35. package/dist/src/opencode/index.d.ts +2 -0
  36. package/dist/src/opencode/index.d.ts.map +1 -0
  37. package/dist/src/opencode/plugin.d.ts +33 -0
  38. package/dist/src/opencode/plugin.d.ts.map +1 -0
  39. package/dist/src/patterns.d.ts +5 -0
  40. package/dist/src/patterns.d.ts.map +1 -0
  41. package/dist/src/types.d.ts +14 -0
  42. package/dist/src/types.d.ts.map +1 -0
  43. package/hooks/hooks.json +27 -0
  44. package/native/index.d.ts +10 -0
  45. package/native/index.js +10 -0
  46. package/native/vibe-haptic-native.node +0 -0
  47. package/package.json +39 -0
@@ -0,0 +1,54 @@
1
+ # Vibe Haptic - Claude Code Plugin
2
+
3
+ Haptic feedback for Claude Code using macOS Force Touch trackpad.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Add the plugin
9
+ claude plugin add devxoul/vibe-haptic
10
+
11
+ # Install the npm package (required for native module)
12
+ npm install -g vibe-haptic
13
+ ```
14
+
15
+ ## What it does
16
+
17
+ Triggers haptic feedback through your MacBook's Force Touch trackpad when:
18
+
19
+ - **Task completes** (Stop event) → Success pattern (strong click)
20
+ - **User input requested** (UserPromptSubmit event) → Prompt pattern (light tap)
21
+
22
+ ## Requirements
23
+
24
+ - macOS with Force Touch trackpad (MacBook Pro 2015+, MacBook 2015+)
25
+ - Force Click enabled in System Preferences → Trackpad
26
+
27
+ ## Configuration
28
+
29
+ Create `~/.claude/vibe-haptic.json` to customize patterns:
30
+
31
+ ```json
32
+ {
33
+ "events": {
34
+ "taskComplete": {
35
+ "enabled": true,
36
+ "pattern": "success"
37
+ },
38
+ "userInput": {
39
+ "enabled": true,
40
+ "pattern": "prompt"
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## Available Patterns
47
+
48
+ | Pattern | Feel | Use Case |
49
+ |---------|------|----------|
50
+ | `success` | Strong click | Task completed |
51
+ | `error` | Triple burst | Error occurred |
52
+ | `notification` | Medium tap | General notification |
53
+ | `prompt` | Light tap | Input requested |
54
+ | `complete` | Medium tap | Long operation finished |
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3
+ "name": "vibe-haptic",
4
+ "description": "Haptic feedback plugin for Claude Code using macOS Force Touch trackpad",
5
+ "owner": {
6
+ "name": "Jeon Suyeol",
7
+ "url": "https://github.com/devxoul"
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "vibe-haptic",
12
+ "description": "Feel tactile feedback when tasks complete or when input is needed through your MacBook's Force Touch trackpad",
13
+ "version": "0.1.0",
14
+ "author": {
15
+ "name": "Jeon Suyeol",
16
+ "url": "https://github.com/devxoul"
17
+ },
18
+ "source": "./",
19
+ "category": "productivity",
20
+ "homepage": "https://github.com/devxoul/vibe-haptic",
21
+ "keywords": ["haptic", "feedback", "macos", "trackpad", "force-touch", "accessibility"]
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "vibe-haptic",
3
+ "version": "0.1.0",
4
+ "description": "Haptic feedback for Claude Code using macOS Force Touch trackpad. Feel tactile feedback when tasks complete or when input is needed.",
5
+ "author": {
6
+ "name": "Jeon Suyeol",
7
+ "url": "https://github.com/devxoul"
8
+ },
9
+ "license": "MIT",
10
+ "keywords": ["haptic", "feedback", "macos", "trackpad", "force-touch", "accessibility"],
11
+ "homepage": "https://github.com/devxoul/vibe-haptic",
12
+ "repository": "https://github.com/devxoul/vibe-haptic"
13
+ }
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # Vibe Haptic 🫨
2
+
3
+ Haptic feedback from your coding agents.
4
+
5
+ Get tactile feedback when your AI agent completes tasks, encounters errors, or requests input — feel the rhythm of your coding session through your MacBook's trackpad.
6
+
7
+ ## How It Works
8
+
9
+ Modern MacBooks have a Force Touch trackpad that doesn't physically click. Instead, it uses a linear actuator (Taptic Engine) to simulate the sensation of a click through precise vibrations.
10
+
11
+ Vibe Haptic taps into macOS's private `MultitouchSupport.framework` to trigger these haptic actuations programmatically. When your AI agent finishes a task or needs attention, the trackpad vibrates with distinct patterns you can feel under your fingers.
12
+
13
+ ## Installation
14
+
15
+ ### Claude Code
16
+
17
+ ```bash
18
+ claude plugin marketplace add devxoul/vibe-haptic
19
+ claude plugin install vibe-haptic
20
+ ```
21
+
22
+ Or within Claude Code:
23
+
24
+ ```
25
+ /plugin marketplace add devxoul/vibe-haptic
26
+ /plugin install vibe-haptic
27
+ ```
28
+
29
+ ### OpenCode
30
+
31
+ Add to your `opencode.jsonc`:
32
+
33
+ ```jsonc
34
+ {
35
+ "plugins": [
36
+ "vibe-haptic@x.y.z"
37
+ ]
38
+ }
39
+ ```
40
+
41
+ ## Configuration
42
+
43
+ ### Configuration File
44
+
45
+ Create `vibe-haptic.json` in your config directory:
46
+
47
+ - **Claude Code**: `~/.claude/vibe-haptic.json` or `.claude/vibe-haptic.json`
48
+ - **OpenCode**: `~/.config/opencode/vibe-haptic.json` or `.opencode/vibe-haptic.json`
49
+
50
+ ```json
51
+ {
52
+ "patterns": {
53
+ "success": { "beat": "6/1.5 6/0.8 4/0.5" },
54
+ "error": { "beat": "6/2.0 6/2.0 6/2.0" }
55
+ },
56
+ "events": {
57
+ "stop": "dopamine",
58
+ "prompt": "alert"
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### Events
64
+
65
+ Events map agent actions to haptic patterns:
66
+
67
+ | Event | Trigger | Claude Code | OpenCode |
68
+ |-------|---------|-------------|----------|
69
+ | `stop` | Agent finishes and becomes idle | ✓ | ✓ |
70
+ | `prompt` | Agent asks for input (select option, permission, etc.) | ✓ | ✓ |
71
+
72
+ #### Trigger Details
73
+
74
+ **`stop` event** — Fires when the agent completes its work:
75
+ - **Claude Code**: Triggered by the `Stop` hook event when the agent finishes responding
76
+ - **OpenCode**: Triggered when session status changes to `idle`
77
+
78
+ **`prompt` event** — Fires when the agent needs your attention:
79
+ - **Claude Code**: Triggered by `Notification` hook events (permission requests, tool approvals, etc.)
80
+ - **OpenCode**: Triggered by `permission.updated` or `question.asked` events
81
+
82
+ ### Beat Patterns
83
+
84
+ Haptic feedback is defined using a beat notation:
85
+
86
+ ```
87
+ "6/0.8 4/1.0 6/0.5"
88
+ ```
89
+
90
+ - **Digits (3-6)**: Actuation strength — `3` minimal, `4` medium, `5` weak, `6` strong
91
+ - **`/intensity`**: Optional intensity (0.0-2.0) — `6/0.5` = strong actuation at half intensity
92
+ - **Spaces**: Pauses between taps (100ms per space)
93
+
94
+ Examples:
95
+ - `6 6 6` — three strong taps with short pauses
96
+ - `6/2.0 6/0.5` — loud tap followed by soft tap
97
+ - `66` — rapid double tap (no pause)
98
+ - `6 6` — two taps with longer pause
99
+
100
+ ### Built-in Patterns
101
+
102
+ | Pattern | Beat | Description |
103
+ |---------|------|-------------|
104
+ | `vibe` | `6/0.8 3/1.0 6/1.0` | Signature rhythm |
105
+ | `alert` | `6/0.5 6/1.0 6/0.5` | Attention pulse |
106
+ | `dopamine` | `6666666 5/1.0 4/1.0 3/1.0` | Reward cascade |
107
+ | `noise` | `6543654365436543` | Rapid texture |
108
+
109
+ ## License
110
+
111
+ MIT
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ main
4
+ } from "../chunk-7m264p1d.js";
5
+ import"../chunk-vvy5kwnq.js";
6
+
7
+ // src/bin/haptic-hook.ts
8
+ main();
9
+
10
+ //# debugId=BBEAEFE657EF4B3064756E2164756E21
11
+ //# sourceMappingURL=haptic-hook.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/bin/haptic-hook.ts"],
4
+ "sourcesContent": [
5
+ "#!/usr/bin/env node\nimport { main } from '../claude/hook'\n\nmain()\n"
6
+ ],
7
+ "mappings": ";;;;;;;AAGA,KAAK;",
8
+ "debugId": "BBEAEFE657EF4B3064756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bun
2
+ import {
3
+ createHapticEngine
4
+ } from "../chunk-vvy5kwnq.js";
5
+
6
+ // src/bin/haptic.ts
7
+ var patternOrBeat = process.argv[2] || "vibe";
8
+ var engine = createHapticEngine();
9
+ console.log(`\uD83E\uDEE8 ${patternOrBeat}`);
10
+ await engine.trigger(patternOrBeat);
11
+
12
+ //# debugId=AAB54D5DD01EE0A564756E2164756E21
13
+ //# sourceMappingURL=haptic.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/bin/haptic.ts"],
4
+ "sourcesContent": [
5
+ "#!/usr/bin/env bun\nimport { createHapticEngine } from '../haptic'\n\nconst patternOrBeat = process.argv[2] || 'vibe'\nconst engine = createHapticEngine()\n\nconsole.log(`🫨 ${patternOrBeat}`)\nawait engine.trigger(patternOrBeat)\n"
6
+ ],
7
+ "mappings": ";;;;;;AAGA,IAAM,gBAAgB,QAAQ,KAAK,MAAM;AACzC,IAAM,SAAS,mBAAmB;AAElC,QAAQ,IAAI,gBAAK,eAAe;AAChC,MAAM,OAAO,QAAQ,aAAa;",
8
+ "debugId": "AAB54D5DD01EE0A564756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,57 @@
1
+ import {
2
+ createHapticEngine
3
+ } from "./chunk-vvy5kwnq.js";
4
+
5
+ // src/claude/hook.ts
6
+ import { appendFileSync } from "node:fs";
7
+ import { homedir } from "node:os";
8
+ var DEBUG = process.env.VIBE_HAPTIC_DEBUG === "1";
9
+ function debug(message, data) {
10
+ if (!DEBUG)
11
+ return;
12
+ const logPath = `${homedir()}/.vibe-haptic-debug.log`;
13
+ const timestamp = new Date().toISOString();
14
+ const logLine = data ? `[${timestamp}] ${message}: ${JSON.stringify(data, null, 2)}
15
+ ` : `[${timestamp}] ${message}
16
+ `;
17
+ appendFileSync(logPath, logLine);
18
+ }
19
+ async function handleHookEvent(input) {
20
+ debug("handleHookEvent called", input);
21
+ const engine = createHapticEngine("claude");
22
+ if (input.hook_event_name === "Stop") {
23
+ debug("Triggering stop event");
24
+ await engine.triggerForEvent("stop");
25
+ } else if (input.hook_event_name === "Notification") {
26
+ debug("Triggering prompt event for notification", { notification_type: input.notification_type });
27
+ await engine.triggerForEvent("prompt");
28
+ } else {
29
+ debug("Unknown hook event", { hook_event_name: input.hook_event_name });
30
+ }
31
+ }
32
+ async function readStdin() {
33
+ if (typeof Bun !== "undefined") {
34
+ return Bun.stdin.text();
35
+ }
36
+ return new Promise((resolve, reject) => {
37
+ const chunks = [];
38
+ process.stdin.on("data", (chunk) => chunks.push(chunk));
39
+ process.stdin.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8")));
40
+ process.stdin.on("error", reject);
41
+ });
42
+ }
43
+ async function main() {
44
+ try {
45
+ const input = await readStdin();
46
+ const hookInput = JSON.parse(input);
47
+ await handleHookEvent(hookInput);
48
+ process.exit(0);
49
+ } catch {
50
+ process.exit(0);
51
+ }
52
+ }
53
+
54
+ export { handleHookEvent, main };
55
+
56
+ //# debugId=EFA5EE4A014C749B64756E2164756E21
57
+ //# sourceMappingURL=chunk-7m264p1d.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/claude/hook.ts"],
4
+ "sourcesContent": [
5
+ "import { appendFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { createHapticEngine } from '../haptic'\n\nconst DEBUG = process.env.VIBE_HAPTIC_DEBUG === '1'\n\nfunction debug(message: string, data?: unknown) {\n if (!DEBUG) return\n const logPath = `${homedir()}/.vibe-haptic-debug.log`\n const timestamp = new Date().toISOString()\n const logLine = data ? `[${timestamp}] ${message}: ${JSON.stringify(data, null, 2)}\\n` : `[${timestamp}] ${message}\\n`\n appendFileSync(logPath, logLine)\n}\n\ninterface ClaudeHookInput {\n session_id: string\n transcript_path: string\n cwd: string\n hook_event_name: string\n notification_type?: string\n}\n\nexport async function handleHookEvent(input: ClaudeHookInput): Promise<void> {\n debug('handleHookEvent called', input)\n\n const engine = createHapticEngine('claude')\n\n if (input.hook_event_name === 'Stop') {\n debug('Triggering stop event')\n await engine.triggerForEvent('stop')\n } else if (input.hook_event_name === 'Notification') {\n debug('Triggering prompt event for notification', { notification_type: input.notification_type })\n await engine.triggerForEvent('prompt')\n } else {\n debug('Unknown hook event', { hook_event_name: input.hook_event_name })\n }\n}\n\nasync function readStdin(): Promise<string> {\n if (typeof Bun !== 'undefined') {\n return Bun.stdin.text()\n }\n\n return new Promise((resolve, reject) => {\n const chunks: Uint8Array[] = []\n process.stdin.on('data', (chunk: Uint8Array) => chunks.push(chunk))\n process.stdin.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')))\n process.stdin.on('error', reject)\n })\n}\n\nexport async function main() {\n try {\n const input = await readStdin()\n const hookInput = JSON.parse(input) as ClaudeHookInput\n await handleHookEvent(hookInput)\n process.exit(0)\n } catch {\n process.exit(0)\n }\n}\n"
6
+ ],
7
+ "mappings": ";;;;;AAAA;AACA;AAGA,IAAM,QAAQ,QAAQ,IAAI,sBAAsB;AAEhD,SAAS,KAAK,CAAC,SAAiB,MAAgB;AAAA,EAC9C,IAAI,CAAC;AAAA,IAAO;AAAA,EACZ,MAAM,UAAU,GAAG,QAAQ;AAAA,EAC3B,MAAM,YAAY,IAAI,KAAK,EAAE,YAAY;AAAA,EACzC,MAAM,UAAU,OAAO,IAAI,cAAc,YAAY,KAAK,UAAU,MAAM,MAAM,CAAC;AAAA,IAAQ,IAAI,cAAc;AAAA;AAAA,EAC3G,eAAe,SAAS,OAAO;AAAA;AAWjC,eAAsB,eAAe,CAAC,OAAuC;AAAA,EAC3E,MAAM,0BAA0B,KAAK;AAAA,EAErC,MAAM,SAAS,mBAAmB,QAAQ;AAAA,EAE1C,IAAI,MAAM,oBAAoB,QAAQ;AAAA,IACpC,MAAM,uBAAuB;AAAA,IAC7B,MAAM,OAAO,gBAAgB,MAAM;AAAA,EACrC,EAAO,SAAI,MAAM,oBAAoB,gBAAgB;AAAA,IACnD,MAAM,4CAA4C,EAAE,mBAAmB,MAAM,kBAAkB,CAAC;AAAA,IAChG,MAAM,OAAO,gBAAgB,QAAQ;AAAA,EACvC,EAAO;AAAA,IACL,MAAM,sBAAsB,EAAE,iBAAiB,MAAM,gBAAgB,CAAC;AAAA;AAAA;AAI1E,eAAe,SAAS,GAAoB;AAAA,EAC1C,IAAI,OAAO,QAAQ,aAAa;AAAA,IAC9B,OAAO,IAAI,MAAM,KAAK;AAAA,EACxB;AAAA,EAEA,OAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAAA,IACtC,MAAM,SAAuB,CAAC;AAAA,IAC9B,QAAQ,MAAM,GAAG,QAAQ,CAAC,UAAsB,OAAO,KAAK,KAAK,CAAC;AAAA,IAClE,QAAQ,MAAM,GAAG,OAAO,MAAM,QAAQ,OAAO,OAAO,MAAM,EAAE,SAAS,OAAO,CAAC,CAAC;AAAA,IAC9E,QAAQ,MAAM,GAAG,SAAS,MAAM;AAAA,GACjC;AAAA;AAGH,eAAsB,IAAI,GAAG;AAAA,EAC3B,IAAI;AAAA,IACF,MAAM,QAAQ,MAAM,UAAU;AAAA,IAC9B,MAAM,YAAY,KAAK,MAAM,KAAK;AAAA,IAClC,MAAM,gBAAgB,SAAS;AAAA,IAC/B,QAAQ,KAAK,CAAC;AAAA,IACd,MAAM;AAAA,IACN,QAAQ,KAAK,CAAC;AAAA;AAAA;",
8
+ "debugId": "EFA5EE4A014C749B64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,26 @@
1
+ import {
2
+ createHapticEngine
3
+ } from "./chunk-vvy5kwnq.js";
4
+
5
+ // src/opencode/plugin.ts
6
+ var vibeHapticPlugin = async (_ctx) => {
7
+ const engine = createHapticEngine("opencode");
8
+ return {
9
+ event: async (input) => {
10
+ const { event } = input;
11
+ if (event.type === "session.status") {
12
+ const statusObj = event.properties.status;
13
+ if (statusObj.type === "idle") {
14
+ engine.triggerForEvent("stop");
15
+ }
16
+ } else if (event.type === "permission.updated" || event.type === "question.asked") {
17
+ engine.triggerForEvent("prompt");
18
+ }
19
+ }
20
+ };
21
+ };
22
+
23
+ export { vibeHapticPlugin };
24
+
25
+ //# debugId=893E3FE8395299E564756E2164756E21
26
+ //# sourceMappingURL=chunk-bckdz3we.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/opencode/plugin.ts"],
4
+ "sourcesContent": [
5
+ "import { createHapticEngine } from '../haptic'\n\ntype SessionStatusType = 'idle' | 'busy' | 'retry'\n\ntype SessionStatusEvent = {\n type: 'session.status'\n properties: { sessionID: string; status: { type: SessionStatusType } }\n}\n\ntype PermissionUpdatedEvent = {\n type: 'permission.updated'\n properties: Record<string, unknown>\n}\n\ntype OpenCodeEvent = SessionStatusEvent | PermissionUpdatedEvent | { type: string; properties?: unknown }\n\ntype PluginInput = {\n client: unknown\n project: unknown\n directory: string\n worktree: string\n serverUrl: URL\n $: unknown\n}\n\nexport const vibeHapticPlugin = async (_ctx: PluginInput) => {\n const engine = createHapticEngine('opencode')\n\n return {\n event: async (input: { event: OpenCodeEvent }): Promise<void> => {\n const { event } = input\n\n if (event.type === 'session.status') {\n const statusObj = (event as SessionStatusEvent).properties.status\n if (statusObj.type === 'idle') {\n engine.triggerForEvent('stop')\n }\n } else if (event.type === 'permission.updated' || event.type === 'question.asked') {\n engine.triggerForEvent('prompt')\n }\n },\n }\n}\n"
6
+ ],
7
+ "mappings": ";;;;;AAyBO,IAAM,mBAAmB,OAAO,SAAsB;AAAA,EAC3D,MAAM,SAAS,mBAAmB,UAAU;AAAA,EAE5C,OAAO;AAAA,IACL,OAAO,OAAO,UAAmD;AAAA,MAC/D,QAAQ,UAAU;AAAA,MAElB,IAAI,MAAM,SAAS,kBAAkB;AAAA,QACnC,MAAM,YAAa,MAA6B,WAAW;AAAA,QAC3D,IAAI,UAAU,SAAS,QAAQ;AAAA,UAC7B,OAAO,gBAAgB,MAAM;AAAA,QAC/B;AAAA,MACF,EAAO,SAAI,MAAM,SAAS,wBAAwB,MAAM,SAAS,kBAAkB;AAAA,QACjF,OAAO,gBAAgB,QAAQ;AAAA,MACjC;AAAA;AAAA,EAEJ;AAAA;",
8
+ "debugId": "893E3FE8395299E564756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,215 @@
1
+ import { createRequire } from "node:module";
2
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
+
5
+ // native/index.js
6
+ var require_native = __commonJS((exports, module) => {
7
+ var __dirname = "/Users/xoul/workspace/vibe-haptic/native";
8
+ var path = __require("node:path");
9
+ var nativeModule = __require(path.join(__dirname, "vibe-haptic-native.node"));
10
+ module.exports = {
11
+ isSupported: nativeModule.isSupported,
12
+ actuate: nativeModule.actuate,
13
+ click: nativeModule.click,
14
+ weakClick: nativeModule.weakClick,
15
+ strongClick: nativeModule.strongClick
16
+ };
17
+ });
18
+
19
+ // src/config.ts
20
+ import { existsSync, readFileSync } from "node:fs";
21
+ import { homedir } from "node:os";
22
+ import { z } from "zod";
23
+ var PatternConfigSchema = z.union([
24
+ z.string(),
25
+ z.object({
26
+ beat: z.string(),
27
+ intensity: z.number().min(0).max(2).optional()
28
+ })
29
+ ]);
30
+ var HapticConfigSchema = z.object({
31
+ patterns: z.record(z.string(), PatternConfigSchema).optional(),
32
+ events: z.object({
33
+ stop: z.string().optional(),
34
+ prompt: z.string().optional()
35
+ }).optional()
36
+ });
37
+ var DEFAULT_CONFIG = {
38
+ patterns: {},
39
+ events: {
40
+ stop: "vibe",
41
+ prompt: "alert"
42
+ }
43
+ };
44
+ function getConfigPath(agent, scope) {
45
+ const home = homedir();
46
+ if (scope === "global") {
47
+ return agent === "claude" ? `${home}/.claude/vibe-haptic.json` : `${home}/.config/opencode/vibe-haptic.json`;
48
+ }
49
+ return agent === "claude" ? ".claude/vibe-haptic.json" : ".opencode/vibe-haptic.json";
50
+ }
51
+ function mergeConfig(base, override) {
52
+ return {
53
+ patterns: { ...base.patterns, ...override.patterns },
54
+ events: { ...base.events, ...override.events }
55
+ };
56
+ }
57
+ function loadConfig(agent = "claude") {
58
+ let config = { ...DEFAULT_CONFIG };
59
+ const globalPath = getConfigPath(agent, "global");
60
+ if (existsSync(globalPath)) {
61
+ try {
62
+ const globalData = JSON.parse(readFileSync(globalPath, "utf-8"));
63
+ const validated = HapticConfigSchema.parse(globalData);
64
+ config = mergeConfig(config, validated);
65
+ } catch {}
66
+ }
67
+ const localPath = getConfigPath(agent, "local");
68
+ if (existsSync(localPath)) {
69
+ try {
70
+ const localData = JSON.parse(readFileSync(localPath, "utf-8"));
71
+ const validated = HapticConfigSchema.parse(localData);
72
+ config = mergeConfig(config, validated);
73
+ } catch {}
74
+ }
75
+ return config;
76
+ }
77
+
78
+ // src/patterns.ts
79
+ var DEFAULT_INTENSITY = 1;
80
+ var DEFAULT_PATTERNS = {
81
+ vibe: { beat: "6/0.8 3/1.0 6/1.0" },
82
+ alert: { beat: "6/0.5 6/1.0 6/0.5" },
83
+ dopamine: { beat: "6666666 5/1.0 4/1.0 3/1.0", intensity: 0.1 },
84
+ noise: { beat: "6543654365436543" }
85
+ };
86
+ function resolvePattern(nameOrBeat, patterns) {
87
+ const isInlineBeat = /^[3-6/.\s]+$/.test(nameOrBeat);
88
+ if (isInlineBeat) {
89
+ return { beat: nameOrBeat };
90
+ }
91
+ const userPattern = patterns?.[nameOrBeat];
92
+ if (userPattern) {
93
+ if (typeof userPattern === "string") {
94
+ return { beat: userPattern };
95
+ }
96
+ return {
97
+ beat: userPattern.beat,
98
+ intensity: userPattern.intensity
99
+ };
100
+ }
101
+ const defaultPattern = DEFAULT_PATTERNS[nameOrBeat];
102
+ if (defaultPattern) {
103
+ return {
104
+ beat: defaultPattern.beat,
105
+ intensity: defaultPattern.intensity
106
+ };
107
+ }
108
+ return null;
109
+ }
110
+
111
+ // src/haptic.ts
112
+ var PAUSE_DELAY_MS = 100;
113
+ function parseBeat(beat, defaultIntensity) {
114
+ const tokens = [];
115
+ let i = 0;
116
+ while (i < beat.length) {
117
+ const char = beat[i];
118
+ if (char === " ") {
119
+ let pauseCount = 0;
120
+ while (i < beat.length && beat[i] === " ") {
121
+ pauseCount++;
122
+ i++;
123
+ }
124
+ tokens.push({ type: "pause", pauseCount });
125
+ } else if (char >= "3" && char <= "6") {
126
+ const actuation = Number(char);
127
+ i++;
128
+ if (i < beat.length && beat[i] === "/") {
129
+ i++;
130
+ let intensityStr = "";
131
+ while (i < beat.length && beat[i] !== " ") {
132
+ intensityStr += beat[i];
133
+ i++;
134
+ }
135
+ const intensity = intensityStr ? Math.min(2, Math.max(0, parseFloat(intensityStr))) : defaultIntensity;
136
+ tokens.push({ type: "tap", actuation, intensity });
137
+ } else {
138
+ tokens.push({ type: "tap", actuation, intensity: defaultIntensity });
139
+ }
140
+ } else {
141
+ i++;
142
+ }
143
+ }
144
+ return tokens;
145
+ }
146
+
147
+ class HapticEngine {
148
+ config;
149
+ nativeModule = null;
150
+ constructor(config, options) {
151
+ this.config = config;
152
+ if (options?.nativeModule !== undefined) {
153
+ this.nativeModule = options.nativeModule;
154
+ } else {
155
+ this.loadNativeModule();
156
+ }
157
+ }
158
+ loadNativeModule() {
159
+ if (process.platform !== "darwin") {
160
+ return;
161
+ }
162
+ try {
163
+ this.nativeModule = require_native();
164
+ } catch {}
165
+ }
166
+ playBeat(pattern) {
167
+ return new Promise((resolve) => {
168
+ if (!this.nativeModule) {
169
+ resolve();
170
+ return;
171
+ }
172
+ const { beat, intensity } = pattern;
173
+ const tokens = parseBeat(beat, intensity ?? DEFAULT_INTENSITY);
174
+ const module = this.nativeModule;
175
+ let i = 0;
176
+ const playNext = () => {
177
+ if (i >= tokens.length) {
178
+ resolve();
179
+ return;
180
+ }
181
+ const token = tokens[i];
182
+ i++;
183
+ if (token.type === "pause") {
184
+ setTimeout(playNext, (token.pauseCount ?? 1) * PAUSE_DELAY_MS);
185
+ } else {
186
+ module.actuate(token.actuation, token.intensity);
187
+ playNext();
188
+ }
189
+ };
190
+ playNext();
191
+ });
192
+ }
193
+ trigger(patternName) {
194
+ const pattern = resolvePattern(patternName, this.config.patterns);
195
+ if (pattern) {
196
+ return this.playBeat(pattern);
197
+ }
198
+ return Promise.resolve();
199
+ }
200
+ triggerForEvent(event) {
201
+ const patternName = this.config.events?.[event];
202
+ if (patternName) {
203
+ return this.trigger(patternName);
204
+ }
205
+ return Promise.resolve();
206
+ }
207
+ }
208
+ function createHapticEngine(agent) {
209
+ return new HapticEngine(loadConfig(agent));
210
+ }
211
+
212
+ export { createHapticEngine };
213
+
214
+ //# debugId=E8C88875679F6E5664756E2164756E21
215
+ //# sourceMappingURL=chunk-vvy5kwnq.js.map
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../native/index.js", "../src/config.ts", "../src/patterns.ts", "../src/haptic.ts"],
4
+ "sourcesContent": [
5
+ "const path = require('node:path')\nconst nativeModule = require(path.join(__dirname, 'vibe-haptic-native.node'))\n\nmodule.exports = {\n isSupported: nativeModule.isSupported,\n actuate: nativeModule.actuate,\n click: nativeModule.click,\n weakClick: nativeModule.weakClick,\n strongClick: nativeModule.strongClick,\n}\n",
6
+ "import { existsSync, readFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { z } from 'zod'\nimport type { HapticConfig, PatternConfig } from './types'\n\nconst PatternConfigSchema = z.union([\n z.string(),\n z.object({\n beat: z.string(),\n intensity: z.number().min(0).max(2).optional(),\n }),\n])\n\nconst HapticConfigSchema = z.object({\n patterns: z.record(z.string(), PatternConfigSchema).optional(),\n events: z\n .object({\n stop: z.string().optional(),\n prompt: z.string().optional(),\n })\n .optional(),\n})\n\ntype ParsedConfig = z.infer<typeof HapticConfigSchema>\n\nexport const DEFAULT_CONFIG: HapticConfig = {\n patterns: {},\n events: {\n stop: 'vibe',\n prompt: 'alert',\n },\n}\n\nexport function getConfigPath(agent: 'claude' | 'opencode', scope: 'local' | 'global'): string {\n const home = homedir()\n\n if (scope === 'global') {\n return agent === 'claude' ? `${home}/.claude/vibe-haptic.json` : `${home}/.config/opencode/vibe-haptic.json`\n }\n return agent === 'claude' ? '.claude/vibe-haptic.json' : '.opencode/vibe-haptic.json'\n}\n\nfunction mergeConfig(base: HapticConfig, override: ParsedConfig): HapticConfig {\n return {\n patterns: { ...base.patterns, ...(override.patterns as Record<string, string | PatternConfig>) },\n events: { ...base.events, ...override.events },\n }\n}\n\nexport function loadConfig(agent: 'claude' | 'opencode' = 'claude'): HapticConfig {\n let config: HapticConfig = { ...DEFAULT_CONFIG }\n\n const globalPath = getConfigPath(agent, 'global')\n if (existsSync(globalPath)) {\n try {\n const globalData = JSON.parse(readFileSync(globalPath, 'utf-8'))\n const validated = HapticConfigSchema.parse(globalData)\n config = mergeConfig(config, validated)\n } catch {}\n }\n\n const localPath = getConfigPath(agent, 'local')\n if (existsSync(localPath)) {\n try {\n const localData = JSON.parse(readFileSync(localPath, 'utf-8'))\n const validated = HapticConfigSchema.parse(localData)\n config = mergeConfig(config, validated)\n } catch {}\n }\n\n return config\n}\n",
7
+ "import type { PatternConfig, ResolvedPattern } from './types'\n\nexport const DEFAULT_INTENSITY = 1.0\n\nexport const DEFAULT_PATTERNS: Record<string, PatternConfig> = {\n vibe: { beat: '6/0.8 3/1.0 6/1.0' },\n alert: { beat: '6/0.5 6/1.0 6/0.5' },\n dopamine: { beat: '6666666 5/1.0 4/1.0 3/1.0', intensity: 0.1 },\n noise: { beat: '6543654365436543' },\n}\n\nexport function resolvePattern(\n nameOrBeat: string,\n patterns: Record<string, string | PatternConfig> | undefined,\n): ResolvedPattern | null {\n const isInlineBeat = /^[3-6/.\\s]+$/.test(nameOrBeat)\n if (isInlineBeat) {\n return { beat: nameOrBeat }\n }\n\n const userPattern = patterns?.[nameOrBeat]\n if (userPattern) {\n if (typeof userPattern === 'string') {\n return { beat: userPattern }\n }\n return {\n beat: userPattern.beat,\n intensity: userPattern.intensity,\n }\n }\n\n const defaultPattern = DEFAULT_PATTERNS[nameOrBeat]\n if (defaultPattern) {\n return {\n beat: defaultPattern.beat,\n intensity: defaultPattern.intensity,\n }\n }\n\n return null\n}\n",
8
+ "import { loadConfig } from './config'\nimport { DEFAULT_INTENSITY, resolvePattern } from './patterns'\nimport type { HapticConfig, HapticEvent, ResolvedPattern } from './types'\n\nconst PAUSE_DELAY_MS = 100\n\nexport interface BeatToken {\n type: 'tap' | 'pause'\n actuation?: number\n intensity?: number\n pauseCount?: number\n}\nexport function parseBeat(beat: string, defaultIntensity: number): BeatToken[] {\n const tokens: BeatToken[] = []\n let i = 0\n\n while (i < beat.length) {\n const char = beat[i]\n\n if (char === ' ') {\n let pauseCount = 0\n while (i < beat.length && beat[i] === ' ') {\n pauseCount++\n i++\n }\n tokens.push({ type: 'pause', pauseCount })\n } else if (char >= '3' && char <= '6') {\n const actuation = Number(char)\n i++\n\n if (i < beat.length && beat[i] === '/') {\n i++\n let intensityStr = ''\n while (i < beat.length && beat[i] !== ' ') {\n intensityStr += beat[i]\n i++\n }\n const intensity = intensityStr ? Math.min(2, Math.max(0, parseFloat(intensityStr))) : defaultIntensity\n tokens.push({ type: 'tap', actuation, intensity })\n } else {\n tokens.push({ type: 'tap', actuation, intensity: defaultIntensity })\n }\n } else {\n i++\n }\n }\n\n return tokens\n}\n\nexport type NativeModule = { actuate: (actuation: number, intensity: number) => void }\n\nexport interface HapticEngineOptions {\n nativeModule?: NativeModule | null\n}\n\nexport class HapticEngine {\n private config: HapticConfig\n private nativeModule: NativeModule | null = null\n\n constructor(config: HapticConfig, options?: HapticEngineOptions) {\n this.config = config\n if (options?.nativeModule !== undefined) {\n this.nativeModule = options.nativeModule\n } else {\n this.loadNativeModule()\n }\n }\n\n private loadNativeModule() {\n if (process.platform !== 'darwin') {\n return\n }\n\n try {\n this.nativeModule = require('../native')\n } catch {}\n }\n\n playBeat(pattern: ResolvedPattern): Promise<void> {\n return new Promise((resolve) => {\n if (!this.nativeModule) {\n resolve()\n return\n }\n\n const { beat, intensity } = pattern\n const tokens = parseBeat(beat, intensity ?? DEFAULT_INTENSITY)\n const module = this.nativeModule\n let i = 0\n\n const playNext = () => {\n if (i >= tokens.length) {\n resolve()\n return\n }\n\n const token = tokens[i]\n i++\n\n if (token.type === 'pause') {\n setTimeout(playNext, (token.pauseCount ?? 1) * PAUSE_DELAY_MS)\n } else {\n module.actuate(token.actuation!, token.intensity!)\n playNext()\n }\n }\n\n playNext()\n })\n }\n\n trigger(patternName: string): Promise<void> {\n const pattern = resolvePattern(patternName, this.config.patterns)\n\n if (pattern) {\n return this.playBeat(pattern)\n }\n return Promise.resolve()\n }\n\n triggerForEvent(event: HapticEvent): Promise<void> {\n const patternName = this.config.events?.[event]\n if (patternName) {\n return this.trigger(patternName)\n }\n return Promise.resolve()\n }\n}\n\nexport function createHapticEngine(agent?: 'claude' | 'opencode'): HapticEngine {\n return new HapticEngine(loadConfig(agent))\n}\n"
9
+ ],
10
+ "mappings": ";;;;;;;EAAA,IAAM;AAAA,EACN,IAAM,eAAe,UAAQ,KAAK,KAAK,WAAW,yBAAyB,CAAC;AAAA,EAE5E,OAAO,UAAU;AAAA,IACf,aAAa,aAAa;AAAA,IAC1B,SAAS,aAAa;AAAA,IACtB,OAAO,aAAa;AAAA,IACpB,WAAW,aAAa;AAAA,IACxB,aAAa,aAAa;AAAA,EAC5B;AAAA;;;ACTA;AACA;AACA;AAGA,IAAM,sBAAsB,EAAE,MAAM;AAAA,EAClC,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,OAAO;AAAA,IACf,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EAC/C,CAAC;AACH,CAAC;AAED,IAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,mBAAmB,EAAE,SAAS;AAAA,EAC7D,QAAQ,EACL,OAAO;AAAA,IACN,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,IAC1B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,CAAC,EACA,SAAS;AACd,CAAC;AAIM,IAAM,iBAA+B;AAAA,EAC1C,UAAU,CAAC;AAAA,EACX,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AACF;AAEO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AK,cAAc;AAAA,QAC/D,EAAO;AAAA,UACL,OAAO,QAAQ,MAAM,WAAY,MAAM,SAAU;AAAA,UACjD,SAAS;AAAA;AAAA;AAAA,MAIb,SAAS;AAAA,KACV;AAAA;AAAA,EAGH,OAAO,CAAC,aAAoC;AAAA,IAC1C,MAAM,UAAU,eAAe,aAAa,KAAK,OAAO,QAAQ;AAAA,IAEhE,IAAI,SAAS;AAAA,MACX,OAAO,KAAK,SAAS,OAAO;AAAA,IAC9B;AAAA,IACA,OAAO,QAAQ,QAAQ;AAAA;AAAA,EAGzB,eAAe,CAAC,OAAmC;AAAA,IACjD,MAAM,cAAc,KAAK,OAAO,SAAS;AAAA,IACzC,IAAI,aAAa;AAAA,MACf,OAAO,KAAK,QAAQ,WAAW;AAAA,IACjC;AAAA,IACA,OAAO,QAAQ,QAAQ;AAAA;AAE3B;AAEO,SAAS,kBAAkB,CAAC,OAA6C;AAAA,EAC9E,OAAO,IAAI,aAAa,WAAW,KAAK,CAAC;AAAA;",
11
+ "debugId": "E8C88875679F6E5664756E2164756E21",
12
+ "names": []
13
+ }
@@ -0,0 +1,12 @@
1
+ import {
2
+ handleHookEvent,
3
+ main
4
+ } from "../chunk-7m264p1d.js";
5
+ import"../chunk-vvy5kwnq.js";
6
+ export {
7
+ main,
8
+ handleHookEvent
9
+ };
10
+
11
+ //# debugId=28DD7CA32855E10464756E2164756E21
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "28DD7CA32855E10464756E2164756E21",
8
+ "names": []
9
+ }
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import {
2
+ vibeHapticPlugin
3
+ } from "./chunk-bckdz3we.js";
4
+ import"./chunk-vvy5kwnq.js";
5
+ export {
6
+ vibeHapticPlugin as opencode,
7
+ vibeHapticPlugin as default
8
+ };
9
+
10
+ //# debugId=2A9D849D1638F53764756E2164756E21
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "2A9D849D1638F53764756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,11 @@
1
+ import {
2
+ vibeHapticPlugin
3
+ } from "../chunk-bckdz3we.js";
4
+ import"../chunk-vvy5kwnq.js";
5
+ export {
6
+ vibeHapticPlugin,
7
+ vibeHapticPlugin as opencode
8
+ };
9
+
10
+ //# debugId=992FB29D7F35F37864756E2164756E21
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "992FB29D7F35F37864756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=haptic-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"haptic-hook.d.ts","sourceRoot":"","sources":["../../../src/bin/haptic-hook.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export {};
3
+ //# sourceMappingURL=haptic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"haptic.d.ts","sourceRoot":"","sources":["../../../src/bin/haptic.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ interface ClaudeHookInput {
2
+ session_id: string;
3
+ transcript_path: string;
4
+ cwd: string;
5
+ hook_event_name: string;
6
+ notification_type?: string;
7
+ }
8
+ export declare function handleHookEvent(input: ClaudeHookInput): Promise<void>;
9
+ export declare function main(): Promise<void>;
10
+ export {};
11
+ //# sourceMappingURL=hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/claude/hook.ts"],"names":[],"mappings":"AAcA,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAc3E;AAeD,wBAAsB,IAAI,kBASzB"}
@@ -0,0 +1,2 @@
1
+ export { handleHookEvent, main } from './hook';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/claude/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { HapticConfig } from './types';
2
+ export declare const DEFAULT_CONFIG: HapticConfig;
3
+ export declare function getConfigPath(agent: 'claude' | 'opencode', scope: 'local' | 'global'): string;
4
+ export declare function loadConfig(agent?: 'claude' | 'opencode'): HapticConfig;
5
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,SAAS,CAAA;AAsB1D,eAAO,MAAM,cAAc,EAAE,YAM5B,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAO7F;AASD,wBAAgB,UAAU,CAAC,KAAK,GAAE,QAAQ,GAAG,UAAqB,GAAG,YAAY,CAsBhF"}
@@ -0,0 +1,25 @@
1
+ import type { HapticConfig, HapticEvent, ResolvedPattern } from './types';
2
+ export interface BeatToken {
3
+ type: 'tap' | 'pause';
4
+ actuation?: number;
5
+ intensity?: number;
6
+ pauseCount?: number;
7
+ }
8
+ export declare function parseBeat(beat: string, defaultIntensity: number): BeatToken[];
9
+ export type NativeModule = {
10
+ actuate: (actuation: number, intensity: number) => void;
11
+ };
12
+ export interface HapticEngineOptions {
13
+ nativeModule?: NativeModule | null;
14
+ }
15
+ export declare class HapticEngine {
16
+ private config;
17
+ private nativeModule;
18
+ constructor(config: HapticConfig, options?: HapticEngineOptions);
19
+ private loadNativeModule;
20
+ playBeat(pattern: ResolvedPattern): Promise<void>;
21
+ trigger(patternName: string): Promise<void>;
22
+ triggerForEvent(event: HapticEvent): Promise<void>;
23
+ }
24
+ export declare function createHapticEngine(agent?: 'claude' | 'opencode'): HapticEngine;
25
+ //# sourceMappingURL=haptic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"haptic.d.ts","sourceRoot":"","sources":["../../src/haptic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAIzE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,KAAK,GAAG,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AACD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,SAAS,EAAE,CAoC7E;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAAA;AAEtF,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;CACnC;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAA4B;gBAEpC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,mBAAmB;IAS/D,OAAO,CAAC,gBAAgB;IAUxB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCjD,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS3C,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAOnD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,YAAY,CAE9E"}
@@ -0,0 +1,2 @@
1
+ export { vibeHapticPlugin as opencode, vibeHapticPlugin as default } from './opencode/plugin';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,QAAQ,EAAE,gBAAgB,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { vibeHapticPlugin, vibeHapticPlugin as opencode } from './plugin';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/opencode/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,IAAI,QAAQ,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,33 @@
1
+ type SessionStatusType = 'idle' | 'busy' | 'retry';
2
+ type SessionStatusEvent = {
3
+ type: 'session.status';
4
+ properties: {
5
+ sessionID: string;
6
+ status: {
7
+ type: SessionStatusType;
8
+ };
9
+ };
10
+ };
11
+ type PermissionUpdatedEvent = {
12
+ type: 'permission.updated';
13
+ properties: Record<string, unknown>;
14
+ };
15
+ type OpenCodeEvent = SessionStatusEvent | PermissionUpdatedEvent | {
16
+ type: string;
17
+ properties?: unknown;
18
+ };
19
+ type PluginInput = {
20
+ client: unknown;
21
+ project: unknown;
22
+ directory: string;
23
+ worktree: string;
24
+ serverUrl: URL;
25
+ $: unknown;
26
+ };
27
+ export declare const vibeHapticPlugin: (_ctx: PluginInput) => Promise<{
28
+ event: (input: {
29
+ event: OpenCodeEvent;
30
+ }) => Promise<void>;
31
+ }>;
32
+ export {};
33
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/opencode/plugin.ts"],"names":[],"mappings":"AAEA,KAAK,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAElD,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,gBAAgB,CAAA;IACtB,UAAU,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE;YAAE,IAAI,EAAE,iBAAiB,CAAA;SAAE,CAAA;KAAE,CAAA;CACvE,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,IAAI,EAAE,oBAAoB,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC,CAAA;AAED,KAAK,aAAa,GAAG,kBAAkB,GAAG,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAEzG,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,GAAG,CAAA;IACd,CAAC,EAAE,OAAO,CAAA;CACX,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,MAAM,WAAW;mBAI/B;QAAE,KAAK,EAAE,aAAa,CAAA;KAAE,KAAG,OAAO,CAAC,IAAI,CAAC;EAahE,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { PatternConfig, ResolvedPattern } from './types';
2
+ export declare const DEFAULT_INTENSITY = 1;
3
+ export declare const DEFAULT_PATTERNS: Record<string, PatternConfig>;
4
+ export declare function resolvePattern(nameOrBeat: string, patterns: Record<string, string | PatternConfig> | undefined): ResolvedPattern | null;
5
+ //# sourceMappingURL=patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/patterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE7D,eAAO,MAAM,iBAAiB,IAAM,CAAA;AAEpC,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAK1D,CAAA;AAED,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,SAAS,GAC3D,eAAe,GAAG,IAAI,CA0BxB"}
@@ -0,0 +1,14 @@
1
+ export type HapticEvent = 'stop' | 'prompt';
2
+ export interface PatternConfig {
3
+ beat: string;
4
+ intensity?: number;
5
+ }
6
+ export interface HapticConfig {
7
+ patterns?: Record<string, string | PatternConfig>;
8
+ events?: Partial<Record<HapticEvent, string>>;
9
+ }
10
+ export interface ResolvedPattern {
11
+ beat: string;
12
+ intensity?: number;
13
+ }
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAA;AAE3C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,CAAA;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
@@ -0,0 +1,27 @@
1
+ {
2
+ "hooks": {
3
+ "Stop": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/dist/bin/haptic-hook.js",
9
+ "timeout": 5000
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "Notification": [
15
+ {
16
+ "matcher": "permission_prompt|idle_prompt|elicitation_dialog",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/dist/bin/haptic-hook.js",
21
+ "timeout": 5000
22
+ }
23
+ ]
24
+ }
25
+ ]
26
+ }
27
+ }
@@ -0,0 +1,10 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ export declare function isSupported(): boolean
7
+ export declare function actuate(actuationId: number, intensity: number): void
8
+ export declare function click(): void
9
+ export declare function weakClick(): void
10
+ export declare function strongClick(): void
@@ -0,0 +1,10 @@
1
+ const path = require('node:path')
2
+ const nativeModule = require(path.join(__dirname, 'vibe-haptic-native.node'))
3
+
4
+ module.exports = {
5
+ isSupported: nativeModule.isSupported,
6
+ actuate: nativeModule.actuate,
7
+ click: nativeModule.click,
8
+ weakClick: nativeModule.weakClick,
9
+ strongClick: nativeModule.strongClick,
10
+ }
Binary file
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "vibe-haptic",
3
+ "version": "1.0.0",
4
+ "author": "Jeon Suyeol",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "description": "Haptic feedback from your coding agents",
8
+ "files": [
9
+ "dist",
10
+ "native/*.node",
11
+ "native/index.js",
12
+ "native/index.d.ts",
13
+ ".claude-plugin",
14
+ "hooks"
15
+ ],
16
+ "scripts": {
17
+ "clean": "rm -rf dist native/target native/*.node",
18
+ "build": "bun run build:native && bun build.ts",
19
+ "build:native": "bun run --cwd native build",
20
+ "dev:claude": "bun run build && claude --plugin-dir ./",
21
+ "dev:opencode": "bun run build && OPENCODE_CONFIG_CONTENT=\"{\\\"plugin\\\": [\\\"file://$PWD/dist/index.js\\\"]}\" opencode",
22
+ "test": "bun test",
23
+ "typecheck": "tsc --noEmit",
24
+ "lint": "biome check .",
25
+ "lint:fix": "biome check --write .",
26
+ "format": "biome format --write .",
27
+ "play": "bun run src/bin/haptic.ts",
28
+ "prepublishOnly": "bun run build"
29
+ },
30
+ "dependencies": {
31
+ "zod": "^4.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "@biomejs/biome": "2.3.11",
35
+ "@napi-rs/cli": "^2.16",
36
+ "@types/bun": "latest",
37
+ "typescript": "^5.3.0"
38
+ }
39
+ }