| 1 | package sidecar |
| 2 | |
| 3 | import ( |
| 4 | "reasonix/internal/extension/protocol" |
| 5 | ) |
| 6 | |
| 7 | // NewProbeClient is a host-test seam: non-process Client with declared |
| 8 | // providers for stage/commit router-identity checks. Not a production path |
| 9 | // (use StartClient / StartPackagesWithPlan; real streams use process fakes). |
| 10 | func NewProbeClient(pluginID string, providers []protocol.ProviderDescriptor, router StreamRouter) *Client { |
| 11 | if router == nil { |
| 12 | router = dropStreamRouter{pluginID: pluginID} |
| 13 | } |
| 14 | return &Client{ |
| 15 | pluginID: pluginID, |
| 16 | initResult: protocol.InitializeResult{ |
| 17 | ProtocolVersion: protocol.ProtocolVersion, |
| 18 | Name: pluginID, |
| 19 | Version: "0.0.0-probe", |
| 20 | Providers: append([]protocol.ProviderDescriptor(nil), providers...), |
| 21 | StateSchemaVersion: 0, |
| 22 | }, |
| 23 | streams: router, |
| 24 | serveExited: make(chan struct{}), |
| 25 | state: handshakeReady, |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | // StreamRouter returns the installed provider stream router (test identity only). |
| 30 | func (c *Client) StreamRouter() StreamRouter { |
| 31 | if c == nil { |
| 32 | return nil |
| 33 | } |
| 34 | return c.streamRouter() |
| 35 | } |
| 36 |