From 249b9f80f94b8f9ebd81ecf26249d2812aad4f61 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 31 Jul 2026 11:18:53 +0200 Subject: [PATCH] ollie-remote: wire streaming output to JSON-RPC notifications ExecuteInSandbox uses StreamFunc(ctx) to emit partial output. The context passed to it lacked a WithOutputStream callback, so no output was ever streamed back to the client. Fix: wrap ctx with WithOutputStream that encodes output as JSON-RPC notifications (id=0, result={data:...}). The client side already handles these via the outputNotification path in CallTool. --- cmd/ollie-remote/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/ollie-remote/main.go b/cmd/ollie-remote/main.go index be9155c..6eae78b 100644 --- a/cmd/ollie-remote/main.go +++ b/cmd/ollie-remote/main.go @@ -122,6 +122,10 @@ type shellParams struct { Stdin string `json:"stdin,omitempty"` } +type outputNotif struct { + Data string `json:"data"` +} + func serveRPC(ctx context.Context, srv *toolsrv.Server, in io.Reader, out io.Writer) { dec := json.NewDecoder(in) enc := json.NewEncoder(out) @@ -151,7 +155,14 @@ func serveRPC(ctx context.Context, srv *toolsrv.Server, in io.Reader, out io.Wri }) continue } - result, err := srv.ExecuteInSandbox(ctx, params.Command, params.Language, params.Timeout, "default", false, params.Stdin, false) + // Wire streaming output to JSON-RPC notifications. + streamCtx := toolsrv.WithOutputStream(ctx, func(data string) { + enc.Encode(rpcResponse{ + JSONRPC: "2.0", + Result: outputNotif{Data: data}, + }) + }) + result, err := srv.ExecuteInSandbox(streamCtx, params.Command, params.Language, params.Timeout, "default", false, params.Stdin, false) if err != nil { enc.Encode(rpcResponse{ JSONRPC: "2.0",