RAM2118 commited on
Commit
0cf3d62
·
verified ·
1 Parent(s): df8bc97

update SYNC.md — grant full debug/fix permission for GUI issue

Browse files
Files changed (1) hide show
  1. SYNC.md +91 -47
SYNC.md CHANGED
@@ -1,64 +1,108 @@
1
  # PluginBridge — Sync File
2
- > HF Claude builds. Claude Code: pull → build → paste error (if any). That's it.
3
 
4
  ---
5
 
6
- ## Claude Code Rules (TOKEN EFFICIENT MODE)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- **Your ENTIRE job is these commands:**
9
- ```bash
10
- cd ~/pluginbridge && git pull
11
- rm -rf build && mkdir build && cd build
12
- cmake .. -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_CXX_COMPILER=/usr/bin/c++
13
- cmake --build . --config Release 2>&1 | tail -40
14
  ```
 
 
 
 
 
 
15
 
16
- NOTE: Full clean rebuild needed — architecture changed from v0.3 (in-process) to v0.4 (out-of-process with CARemoteLayerServer).
 
 
 
 
 
17
 
18
- **If build succeeds:** Reply "✅ build ok" — nothing else.
19
 
20
- **If build fails:** Reply with ONLY the first 3 errors:
21
  ```
22
- ❌ [filename]:[line] — [one-line error message]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  ```
24
 
25
- ## DO NOT:
26
- - Explain errors
27
- - Suggest fixes
28
- - Write code
29
- - Add commentary
30
 
31
- ## Architecture (v0.4 — CARemoteLayerServer)
 
 
 
32
 
 
 
 
33
  ```
34
- PluginBridge.vst3 (inside Ableton):
35
- ├── PluginBridgeProcessor (audio via shared memory)
36
- ├── PluginBridgeEditor.mm (displays CARemoteLayerClient layer — plugin GUI inside Ableton window)
37
- ├── HelperConnection (spawns helper, IPC, shared mem)
38
- ├── McpServer (port 16620)
39
- └── Blocklist (~/Library/PluginBridge/blocklist.txt)
40
-
41
- PluginBridgeHelper.app (separate process, crash-safe):
42
- ├── main.cpp (JUCE app, --pid argument)
43
- ├── HelperPluginHost.mm (loads plugin, audio, CARemoteLayerServer for GUI)
44
- ├── HelperIPC.cpp (commands + mouse/key event forwarding)
45
- └── SharedAudioBuffer.h (shared memory audio bridge)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  ```
47
 
48
- **How GUI works:**
49
- 1. Helper loads plugin → creates editor → renders into CARemoteLayerServer
50
- 2. Helper registers Mach port via NSMachBootstrapServer (named per PID)
51
- 3. Helper sends "gui_ready" notification with port name + size to host
52
- 4. PluginBridge.vst3 looks up Mach port → creates CARemoteLayerClient
53
- 5. Adds client.layer as sublayer of JUCE editor's NSView
54
- 6. Plugin GUI appears INSIDE Ableton's plugin window (no separate window)
55
- 7. Mouse/keyboard events forwarded from host → helper via IPC
56
-
57
- **Crash safety:** Plugin crashes kill only the Helper. Ableton survives.
58
- **Fullscreen:** CALayer is part of the view hierarchy — follows into fullscreen.
59
-
60
- ## Status
61
- **Last push:** 2026-05-17 — v0.4 complete rewrite (CARemoteLayerServer architecture)
62
- **Build:** Needs clean rebuild (rm -rf build)
63
- **Test:** Restart Ableton → load PluginBridge → select Pro-Q 4 → GUI should appear inside PluginBridge's editor (no floating window). Then test Kickstart 2 → should NOT crash Ableton (Helper crashes, gets blocklisted).
64
- **Also clear blocklist:** `rm -f ~/Library/PluginBridge/blocklist.txt`
 
1
  # PluginBridge — Sync File
 
2
 
3
  ---
4
 
5
+ ## MODE: FULL DEBUG (active until GUI works)
6
+
7
+ You have FULL permission to:
8
+ - Read all source files
9
+ - Add DBG prints
10
+ - Write code
11
+ - Fix bugs
12
+ - Push to this HF repo
13
+
14
+ **Do NOT just build. Debug and fix.**
15
+
16
+ ---
17
+
18
+ ## THE PROBLEM
19
+
20
+ Plugin loads successfully (name + param count shows in top bar) but **GUI does not appear** inside PluginBridge's editor.
21
+
22
+ ## ARCHITECTURE (v0.4)
23
 
 
 
 
 
 
 
24
  ```
25
+ PluginBridge.vst3 (inside Ableton)
26
+ ├── PluginBridgeProcessor.cpp — spawns Helper, shared memory audio, IPC
27
+ ├── PluginBridgeEditor.mm — should display CARemoteLayerClient layer
28
+ ├── HelperConnection.cpp — Unix socket IPC to Helper
29
+ ├── McpServer.cpp — HTTP MCP on port 16620
30
+ └── Blocklist.h — persistent blocklist
31
 
32
+ PluginBridgeHelper.app (separate crash-safe process)
33
+ ├── main.cpp — JUCE app, --pid argument
34
+ ├── HelperPluginHost.mm — loads plugin, audio, CARemoteLayerServer GUI
35
+ ├── HelperIPC.cpp — receives commands, sends notifications
36
+ └── SharedAudioBuffer.h — shared memory
37
+ ```
38
 
39
+ ## THE CHAIN THAT SHOULD HAPPEN
40
 
 
41
  ```
42
+ 1. User selects plugin → Processor::loadPlugin() → Helper loads it ✅ WORKS
43
+ 2. Processor::onPluginLoaded fires → Editor calls showPluginGui()
44
+ 3. showPluginGui() → sends {"cmd":"show_gui"} to Helper
45
+ 4. Helper HelperPluginHost::showGui() →
46
+ - Creates plugin editor (NSView)
47
+ - Creates hidden NSWindow (layer-backed)
48
+ - Sets up CARemoteLayerServer
49
+ - Registers Mach port via NSMachBootstrapServer
50
+ - Calls onGuiCreated callback
51
+ 5. onGuiCreated → HelperIPC::sendGuiReady(portName, width, height)
52
+ 6. HelperConnection receives {"notify":"gui_ready",...} → calls onGuiReady
53
+ 7. Processor stores remoteLayerPortName + size → triggers Editor onGuiReady
54
+ 8. Editor::connectRemoteLayer() →
55
+ - Looks up Mach port via NSMachBootstrapServer
56
+ - Creates CARemoteLayerClient with port
57
+ - Adds client.layer to JUCE NSView
58
+ - Resizes editor to fit
59
  ```
60
 
61
+ **Something in steps 2-8 is failing silently.**
62
+
63
+ ## HOW TO DEBUG
 
 
64
 
65
+ 1. Check Ableton log:
66
+ ```bash
67
+ grep -i "pluginbridge\|helper\|GUI\|layer\|port\|gui_ready" ~/Library/Preferences/Ableton/Live\ 12.4/Log.txt | tail -50
68
+ ```
69
 
70
+ 2. Check if Helper process is running:
71
+ ```bash
72
+ ps aux | grep PluginBridgeHelper
73
  ```
74
+
75
+ 3. Add DBG() prints at each step in the chain to find where it breaks.
76
+
77
+ 4. Possible failure points:
78
+ - `showPluginGui()` never called (step 2)
79
+ - `show_gui` command never reaches Helper (step 3)
80
+ - `showGui()` fails silently — editor not created, or CARemoteLayerServer init fails (step 4)
81
+ - Mach port registration fails (NSMachBootstrapServer may be deprecated/broken on modern macOS)
82
+ - `gui_ready` notification never sent or never received (steps 5-6)
83
+ - `connectRemoteLayer()` fails — port lookup returns nil (step 8)
84
+ - `CARemoteLayerClient initWithServerPort:` fails or layer is empty
85
+
86
+ 5. **Key question:** Does `CARemoteLayerServer` / `CARemoteLayerClient` actually work on macOS 14+ Sonoma/Sequoia? The API exists but may not function as documented for cross-process layer sharing without App Groups or XPC. If it doesn't work, we need a different approach (IOSurface or pixel copy).
87
+
88
+ ## KEY FILES
89
+
90
+ | File | Role |
91
+ |---|---|
92
+ | `Source/Plugin/PluginBridgeEditor.mm` | `connectRemoteLayer()` — CARemoteLayerClient side |
93
+ | `Source/Helper/HelperPluginHost.mm` | `showGui()` — CARemoteLayerServer side |
94
+ | `Source/Helper/HelperIPC.cpp` | Wires `onGuiCreated` → `sendGuiReady()` |
95
+ | `Source/Plugin/HelperConnection.cpp` | `handleNotification()` receives `gui_ready` |
96
+ | `Source/Plugin/PluginBridgeProcessor.cpp` | `onGuiReady` callback stores port name |
97
+
98
+ ## BUILD
99
+
100
+ ```bash
101
+ cd ~/pluginbridge && git pull
102
+ cd build && cmake --build . --config Release 2>&1 | tail -30
103
  ```
104
 
105
+ ## AFTER FIXING
106
+
107
+ Push all changes to: https://huggingface.co/RAM2118/pluginbridge
108
+ Update this SYNC.md with what you fixed and current status.