Skip to content

feat(jsonrpc): add stdio server for orchestrators#3251

Open
lucas-p-costa wants to merge 1 commit into
tailcallhq:mainfrom
lucas-p-costa:local/jsonrpc-stdio-pr-clean
Open

feat(jsonrpc): add stdio server for orchestrators#3251
lucas-p-costa wants to merge 1 commit into
tailcallhq:mainfrom
lucas-p-costa:local/jsonrpc-stdio-pr-clean

Conversation

@lucas-p-costa
Copy link
Copy Markdown

@lucas-p-costa lucas-p-costa commented May 4, 2026

Summary

Adds a JSON-RPC server over stdio as a subcommand of the main Forge binary:

forge json-rpc --directory <workdir>

This provides a structured integration surface for external orchestrators without requiring them to parse human-readable terminal output.

This PR builds on the direction explored in #2896, but was implemented as a clean port on top of current main, keeping JSON-RPC as a subcommand of the main forge binary.

What changed

  • Adds forge_jsonrpc crate.

  • Adds forge json-rpc --directory <workdir>.

  • Adds discovery methods:

    • rpc.methods
    • rpc.discover
    • get_methods
  • Adds conversation.create.

  • Adds chat.stream subscription.

  • Invalid/missing/malformed conversation IDs return JSON-RPC errors immediately instead of hanging.

  • Adds include_reasoning?: boolean, defaulting to false.

  • Emits explicit stream completion as {"type":"complete"}.

  • Keeps normal CLI behavior unchanged.

  • Does not touch provider/model code.

Validation

  • cargo build

  • cargo test -p forge_jsonrpc

  • ./target/debug/forge json-rpc --help

  • Normal CLI smoke:

    • ./target/debug/forge -C /tmp/forge-multica-smoke-2 -p "Reply with exactly: cli-still-ok"
  • JSON-RPC smoke:

    • conversation.create returns a UUID
    • chat.stream emits message chunks and complete
    • default chat.stream emits 0 reasoning events
    • include_reasoning: true emits reasoning events
    • invalid conversation ID returns JSON-RPC error without timeout

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 4, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label May 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions Bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label May 9, 2026
@lucas-p-costa
Copy link
Copy Markdown
Author

Thanks for the reminder. This PR is still active and ready for review.

I opened it as a clean follow-up to the earlier JSON-RPC stdio direction in #2896, but adjusted it to keep JSON-RPC as a forge json-rpc subcommand of the main binary rather than adding a second binary.

A few implementation notes:

  • no provider/model code is touched;
  • normal CLI behavior is unchanged;
  • conversation.create and chat.stream are exposed through JSON-RPC;
  • invalid/missing/malformed conversation IDs return JSON-RPC errors instead of hanging;
  • include_reasoning defaults to false;
  • stream completion is emitted explicitly as {"type":"complete"};
  • cargo build and cargo test -p forge_jsonrpc pass locally.

Happy to split this into smaller PRs or adjust the API shape if there is a preferred direction.

@github-actions github-actions Bot removed the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label May 19, 2026
@github-actions
Copy link
Copy Markdown

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions Bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants