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",