feat(memos-local-plugin): TCP-first bridge transport#1606
Open
Starfie1d1272 wants to merge 1 commit intoMemTensor:mainfrom
Open
feat(memos-local-plugin): TCP-first bridge transport#1606Starfie1d1272 wants to merge 1 commit intoMemTensor:mainfrom
Starfie1d1272 wants to merge 1 commit intoMemTensor:mainfrom
Conversation
Add TCP transport layer for daemon bridge mode: - bridge/tcp.ts: new TCP JSON-RPC server for daemon mode - bridge.cts: --daemon and --tcp=<port> flags, skip stdio in daemon mode, re-entrancy guard during shutdown, read version from package.json - bridge_client.py: prefer_tcp=True by default, try TCP connect first, fall back to spawning stdio subprocess on failure - daemon_manager.py: PID file management, kill stale bridges, macOS process detection via ps(1), register_bridge lifecycle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add TCP transport layer for daemon bridge mode. The bridge can now run as a persistent daemon with a TCP JSON-RPC server, and the Python client connects via TCP-first with automatic fallback to stdio.
Changes
bridge/tcp.ts(new) — TCP JSON-RPC server that accepts connections from remote clients and dispatches through the sameDispatcheras stdio. Broadcasts events/logs to all connected clients.bridge.cts—--daemonand--tcp=<port>flags. In daemon mode the stdio server is skipped (stdin is /dev/null). Reads version frompackage.jsoninstead of hardcoding.bridge_client.py—prefer_tcp=True(new default): try TCP connect first at127.0.0.1:18911, fall back to spawning a stdio subprocess on failure. Transparent to existing callers.daemon_manager.py— PID file management underMEMOS_HOME, kill stale bridges before spawning new ones, macOS process detection viaps(1)fallback when/procis absent.Backward compatibility
prefer_tcp=Truefalls back transparentlyMemosBridgeClient(prefer_tcp=False)forces stdio mode🤖 Generated with Claude Code