A launcher for local coding-agent clients like Pi, Opencode, Copilot#147
A launcher for local coding-agent clients like Pi, Opencode, Copilot#147Chida82 wants to merge 1 commit into
Conversation
|
Nice idea in principle, but let's think about it, maybe ./ds4 --agent pi, but I'm starting to consider the idea of having also a C coded minimal and functional coding agent with Chrome integration for searches that is also part of the project. |
|
The goal is to simplify usage and configuration by leveraging some existing agents. I initially tried with Claude, but it didn’t work well, while these three—especially PI—perform adequately. |
I have the feeling that, for agent, you are taking inspiration from pi-agent. Over time, the agent might develop additional needs, such as having a to-do capability. I think we should allow at least some room for expansion. That expansion could happen by writing additional code, or maybe through CLI-based extensions. For example, how could a To-do CLI interact with the main agent? What do @antirez think about putting more emphasis on CLIs rather than MCP-based systems? |
ds4-launchis a small C launcher for local coding-agent clients that shouldtalk to
ds4-server. It supports:ds4-launch pids4-launch copilotds4-launch opencodeds4-launch open-codeds4-launch open_codetop point:
./ds4-launchas a convenience entry point for Pi, Copilot CLI, andOpenCode against local
ds4-server.lsoflistener discoveryinstead of failing on the single-instance guard.
ds4-serverflags passed after thetool name.
./ds4_test --launchfor launcher parser and pid/port extraction logic.User Behavior
Arguments after the tool name are treated as
ds4-serverstartup options.The launcher parses only the options it needs for client configuration:
--host--port-c/--ctx-n/--tokensKnown value-taking server options are skipped so later options are read
correctly. Unknown options are left delegated to
ds4-serverby not trying tointerpret them in the launcher.
If no DS4 process is running,
ds4-launchstartsds4-serverin a detachedbackground session, writes server stdout/stderr to
/tmp/ds4-launch-server-*.log,waits for the TCP port to become reachable, then execs the selected client.
After
exec, the terminal belongs to the client tool.If a DS4 process is already running, the engine lock prevents a second server
from starting. The launcher handles this before or after a failed startup by:
lsof -Pan -p PID -iTCP -sTCP:LISTEN.This keeps accidental second model loads from happening while still making the
common workflow pleasant: start or reuse the local server, then hand over the
terminal to the requested tool.
Client Wiring
All clients use the display/model string:
Code Shape
The file follows the style of the rest of the C binaries in the repository:
stderrdiagnostics;system tools on macOS (
lsoffor pid-to-port discovery).The unit tests are embedded in
ds4_launch.cbehindDS4_LAUNCH_TEST, but thenormal binary compiles without the test entry point. The test object is linked
into
ds4_test, which exposes the narrow check as:Test Coverage
The launch test group covers:
lsofoutput.These tests avoid starting a real
ds4-server, loading a GGUF, or executing anyagent client. That keeps them fast and appropriate for the normal C unit-test
runner.