Skip to content

fix(#13): use realpath for main module detection - #15

Closed
athal7 wants to merge 9 commits into
mainfrom
issue-13
Closed

fix(#13): use realpath for main module detection#15
athal7 wants to merge 9 commits into
mainfrom
issue-13

Conversation

@athal7

@athal7 athal7 commented Jan 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix brew services not starting by using realpath comparison for main module detection
  • The simple string comparison of import.meta.url vs process.argv[1] fails on macOS due to symlink resolution differences (/tmp vs /private/tmp, /opt/homebrew/opt vs /opt/homebrew/Cellar)

athal7 added 9 commits January 1, 2026 17:22
- HTTP callback server for ntfy action buttons
- Unix socket IPC for plugin communication
- Nonce management for permission requests
- Session registration and response forwarding
- Label: io.opencode.ntfy
- Runs server.js via node
- KeepAlive and RunAtLoad enabled
- Logs to /usr/local/var/log/opencode-ntfy.log
- Connect/disconnect to callback service via Unix socket
- Session registration with service
- Nonce request/response handling
- Permission response callback forwarding
- Graceful degradation when service not running
…sions

- Connect to callback service on startup when callbackHost configured
- Handle permission.updated events by sending notifications
- Request nonces from service for each permission notification
- Forward permission responses to OpenCode client
- Add shutdown handler to disconnect from service
- Add service client tests to plugin test suite
- Install service files to ~/.local/share/opencode-ntfy
- Generate LaunchAgent plist with correct paths
- Include service-client.js and config.js in plugin files
- Add launchctl commands for service management
- Add section for starting/stopping the callback service
- Include launchctl commands and log location
- Clarify that service must be running for interactive permissions
- Fix launchctl command in plugin log message
- Improve node path detection for Apple Silicon Macs
- Make createNonce internal in server.js (was exported but unused)
- Use isConnected() instead of potentially stale serviceConnected flag
- Add defensive validation for permission.id
Recommend brew services for Homebrew installs, keep launchctl
instructions for manual installs.
The simple string comparison of import.meta.url vs process.argv[1]
fails on macOS due to symlink resolution differences:
- /tmp vs /private/tmp
- /opt/homebrew/opt vs /opt/homebrew/Cellar

This caused brew services to fail because launchd runs the script
via the symlinked path but import.meta.url resolves to the real path.
@athal7

athal7 commented Jan 2, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #16

@athal7 athal7 closed this Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant