vibe-haptic 1.0.5 → 1.1.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-haptic",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "Haptic feedback for Claude Code using macOS Force Touch trackpad. Feel tactile feedback when tasks complete or when input is needed.",
5
5
  "author": {
6
6
  "name": "Jeon Suyeol",
package/README.md CHANGED
@@ -6,6 +6,16 @@ Haptic feedback from your coding agents.
6
6
 
7
7
  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.
8
8
 
9
+ ## Why?
10
+
11
+ "Why not just use system notifications?"
12
+
13
+ I tried that. Banners popping up, sounds dinging — it felt noisy and annoying. Every notification pulled my eyes away from what I was doing, broke my flow, and honestly just became another thing to dismiss.
14
+
15
+ I wanted something quieter. A subtle nudge that says "hey, I'm done" without screaming for attention. Something I could feel without having to look. (I'm the kind of person who always has Do Not Disturb on.)
16
+
17
+ That's what haptic feedback does — it's silent, ambient, and stays out of your way until you need it.
18
+
9
19
  ## How It Works
10
20
 
11
21
  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.
@@ -35,13 +45,15 @@ Add to your `opencode.jsonc`:
35
45
  ```jsonc
36
46
  {
37
47
  "plugins": [
38
- "vibe-haptic@1.0.5"
48
+ "vibe-haptic@1.1.0"
39
49
  ]
40
50
  }
41
51
  ```
42
52
 
43
53
  ## Configuration
44
54
 
55
+ Everything works out of the box — just install and go. But if you want to tweak the patterns or map different events, here's how.
56
+
45
57
  ### Configuration File
46
58
 
47
59
  Create `vibe-haptic.json` in your config directory:
@@ -103,8 +115,8 @@ Examples:
103
115
 
104
116
  | Pattern | Beat | Description |
105
117
  |---------|------|-------------|
106
- | `vibe` | `6/0.8 3/1.0 6/1.0` | Signature rhythm |
107
- | `alert` | `6/0.5 6/1.0 6/0.5` | Attention pulse |
118
+ | `vibe` | `6/0.8 3/1.0 6/1.0` | Signature rhythm (default for stop event) |
119
+ | `alert` | `6/0.5 6/1.0 6/0.5` | Attention pulse (default for prompt event) |
108
120
  | `dopamine` | `6666666 5/1.0 4/1.0 3/1.0` | Reward cascade |
109
121
  | `noise` | `6543654365436543` | Rapid texture |
110
122
 
@@ -0,0 +1,47 @@
1
+ import {
2
+ createHapticEngine
3
+ } from "./chunk-cx3pfsgs.js";
4
+
5
+ // src/opencode/plugin.ts
6
+ var vibeHapticPlugin = async (ctx) => {
7
+ const engine = createHapticEngine("opencode");
8
+ const subprocessCache = new Map;
9
+ async function isSubprocess(sessionID) {
10
+ const cached = subprocessCache.get(sessionID);
11
+ if (cached !== undefined)
12
+ return cached;
13
+ try {
14
+ const response = await ctx.client.session.get({ path: { id: sessionID } });
15
+ const result = response.data?.parentID != null;
16
+ subprocessCache.set(sessionID, result);
17
+ return result;
18
+ } catch {
19
+ return false;
20
+ }
21
+ }
22
+ function getSessionID(event) {
23
+ const props = event.properties;
24
+ if (props && typeof props === "object" && "sessionID" in props) {
25
+ return props.sessionID;
26
+ }
27
+ return;
28
+ }
29
+ return {
30
+ event: async (input) => {
31
+ const { event } = input;
32
+ const sessionID = getSessionID(event);
33
+ if (sessionID && await isSubprocess(sessionID))
34
+ return;
35
+ if (event.type === "session.idle") {
36
+ engine.triggerForEvent("stop");
37
+ } else if (event.type === "permission.updated" || event.type === "question.asked") {
38
+ engine.triggerForEvent("prompt");
39
+ }
40
+ }
41
+ };
42
+ };
43
+
44
+ export { vibeHapticPlugin };
45
+
46
+ //# debugId=0A0D21C1F9789EA464756E2164756E21
47
+ //# sourceMappingURL=chunk-kzfsbam3.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: { sessionID: string; [key: string]: unknown }\n}\n\ntype QuestionAskedEvent = {\n type: 'question.asked'\n properties: { sessionID: string; [key: string]: unknown }\n}\n\ntype OpenCodeEvent =\n | SessionStatusEvent\n | PermissionUpdatedEvent\n | QuestionAskedEvent\n | { type: string; properties?: Record<string, unknown> }\n\ntype OpenCodeClient = {\n session: {\n get(options: { path: { id: string } }): Promise<{ data?: { parentID?: string } }>\n }\n}\n\ntype PluginInput = {\n client: OpenCodeClient\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 const subprocessCache = new Map<string, boolean>()\n\n async function isSubprocess(sessionID: string): Promise<boolean> {\n const cached = subprocessCache.get(sessionID)\n if (cached !== undefined) return cached\n\n try {\n const response = await ctx.client.session.get({ path: { id: sessionID } })\n const result = response.data?.parentID != null\n subprocessCache.set(sessionID, result)\n return result\n } catch {\n return false\n }\n }\n\n function getSessionID(event: OpenCodeEvent): string | undefined {\n const props = event.properties\n if (props && typeof props === 'object' && 'sessionID' in props) {\n return props.sessionID as string\n }\n return undefined\n }\n\n return {\n event: async (input: { event: OpenCodeEvent }): Promise<void> => {\n const { event } = input\n\n const sessionID = getSessionID(event)\n if (sessionID && (await isSubprocess(sessionID))) return\n\n if (event.type === 'session.idle') {\n engine.triggerForEvent('stop')\n } else if (event.type === 'permission.updated' || event.type === 'question.asked') {\n engine.triggerForEvent('prompt')\n }\n },\n }\n}\n"
6
+ ],
7
+ "mappings": ";;;;;AAwCO,IAAM,mBAAmB,OAAO,QAAqB;AAAA,EAC1D,MAAM,SAAS,mBAAmB,UAAU;AAAA,EAC5C,MAAM,kBAAkB,IAAI;AAAA,EAE5B,eAAe,YAAY,CAAC,WAAqC;AAAA,IAC/D,MAAM,SAAS,gBAAgB,IAAI,SAAS;AAAA,IAC5C,IAAI,WAAW;AAAA,MAAW,OAAO;AAAA,IAEjC,IAAI;AAAA,MACF,MAAM,WAAW,MAAM,IAAI,OAAO,QAAQ,IAAI,EAAE,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;AAAA,MACzE,MAAM,SAAS,SAAS,MAAM,YAAY;AAAA,MAC1C,gBAAgB,IAAI,WAAW,MAAM;AAAA,MACrC,OAAO;AAAA,MACP,MAAM;AAAA,MACN,OAAO;AAAA;AAAA;AAAA,EAIX,SAAS,YAAY,CAAC,OAA0C;AAAA,IAC9D,MAAM,QAAQ,MAAM;AAAA,IACpB,IAAI,SAAS,OAAO,UAAU,YAAY,eAAe,OAAO;AAAA,MAC9D,OAAO,MAAM;AAAA,IACf;AAAA,IACA;AAAA;AAAA,EAGF,OAAO;AAAA,IACL,OAAO,OAAO,UAAmD;AAAA,MAC/D,QAAQ,UAAU;AAAA,MAElB,MAAM,YAAY,aAAa,KAAK;AAAA,MACpC,IAAI,aAAc,MAAM,aAAa,SAAS;AAAA,QAAI;AAAA,MAElD,IAAI,MAAM,SAAS,gBAAgB;AAAA,QACjC,OAAO,gBAAgB,MAAM;AAAA,MAC/B,EAAO,SAAI,MAAM,SAAS,wBAAwB,MAAM,SAAS,kBAAkB;AAAA,QACjF,OAAO,gBAAgB,QAAQ;AAAA,MACjC;AAAA;AAAA,EAEJ;AAAA;",
8
+ "debugId": "0A0D21C1F9789EA464756E2164756E21",
9
+ "names": []
10
+ }
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  vibeHapticPlugin
3
- } from "./chunk-ccfmhx0q.js";
3
+ } from "./chunk-kzfsbam3.js";
4
4
  import"./chunk-cx3pfsgs.js";
5
5
  export {
6
6
  vibeHapticPlugin as opencode,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  vibeHapticPlugin
3
- } from "../chunk-ccfmhx0q.js";
3
+ } from "../chunk-kzfsbam3.js";
4
4
  import"../chunk-cx3pfsgs.js";
5
5
  export {
6
6
  vibeHapticPlugin,
@@ -10,21 +10,44 @@ type SessionStatusEvent = {
10
10
  };
11
11
  type PermissionUpdatedEvent = {
12
12
  type: 'permission.updated';
13
- properties: Record<string, unknown>;
13
+ properties: {
14
+ sessionID: string;
15
+ [key: string]: unknown;
16
+ };
14
17
  };
15
- type OpenCodeEvent = SessionStatusEvent | PermissionUpdatedEvent | {
18
+ type QuestionAskedEvent = {
19
+ type: 'question.asked';
20
+ properties: {
21
+ sessionID: string;
22
+ [key: string]: unknown;
23
+ };
24
+ };
25
+ type OpenCodeEvent = SessionStatusEvent | PermissionUpdatedEvent | QuestionAskedEvent | {
16
26
  type: string;
17
- properties?: unknown;
27
+ properties?: Record<string, unknown>;
28
+ };
29
+ type OpenCodeClient = {
30
+ session: {
31
+ get(options: {
32
+ path: {
33
+ id: string;
34
+ };
35
+ }): Promise<{
36
+ data?: {
37
+ parentID?: string;
38
+ };
39
+ }>;
40
+ };
18
41
  };
19
42
  type PluginInput = {
20
- client: unknown;
43
+ client: OpenCodeClient;
21
44
  project: unknown;
22
45
  directory: string;
23
46
  worktree: string;
24
47
  serverUrl: URL;
25
48
  $: unknown;
26
49
  };
27
- export declare const vibeHapticPlugin: (_ctx: PluginInput) => Promise<{
50
+ export declare const vibeHapticPlugin: (ctx: PluginInput) => Promise<{
28
51
  event: (input: {
29
52
  event: OpenCodeEvent;
30
53
  }) => Promise<void>;
@@ -1 +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,CAA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U,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CAC1D,CAAA;AAED,KAAK,aAAa,GACd,kBAAkB,GAClB,sBAAsB,GACtB,kBAAkB,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAA;AAE1D,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE;QACP,GAAG,CAAC,OAAO,EAAE;YAAE,IAAI,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,GAAG,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE;gBAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAC,CAAA;KAClF,CAAA;CACF,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,cAAc,CAAA;IACtB,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,KAAK,WAAW;mBA2B9B;QAAE,KAAK,EAAE,aAAa,CAAA;KAAE,KAAG,OAAO,CAAC,IAAI,CAAC;EAahE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-haptic",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "author": "Jeon Suyeol",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,23 +0,0 @@
1
- import {
2
- createHapticEngine
3
- } from "./chunk-cx3pfsgs.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.idle") {
12
- engine.triggerForEvent("stop");
13
- } else if (event.type === "permission.updated" || event.type === "question.asked") {
14
- engine.triggerForEvent("prompt");
15
- }
16
- }
17
- };
18
- };
19
-
20
- export { vibeHapticPlugin };
21
-
22
- //# debugId=5070A55685361DD164756E2164756E21
23
- //# sourceMappingURL=chunk-ccfmhx0q.js.map
@@ -1,10 +0,0 @@
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.idle') {\n engine.triggerForEvent('stop')\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,gBAAgB;AAAA,QACjC,OAAO,gBAAgB,MAAM;AAAA,MAC/B,EAAO,SAAI,MAAM,SAAS,wBAAwB,MAAM,SAAS,kBAAkB;AAAA,QACjF,OAAO,gBAAgB,QAAQ;AAAA,MACjC;AAAA;AAAA,EAEJ;AAAA;",
8
- "debugId": "5070A55685361DD164756E2164756E21",
9
- "names": []
10
- }