diff --git a/src/OpenCode.Sdk/Events/Internal/EventsRawClient.cs b/src/OpenCode.Sdk/Events/Internal/EventsRawClient.cs
index 76cd522a..b2530be0 100644
--- a/src/OpenCode.Sdk/Events/Internal/EventsRawClient.cs
+++ b/src/OpenCode.Sdk/Events/Internal/EventsRawClient.cs
@@ -21,7 +21,7 @@ internal EventsRawClient(Pipeline pipeline)
/// Subscribe to events. Subscribe to native events and plugin RPC events across all server locations. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed.
///
/// The request shaping the query.
- /// The per-call options; NoThrow is refused. NetworkTimeout bounds only the opening and is refused for reconnecting streams, including Timeout.InfiniteTimeSpan.
+ /// The per-call options; the family's hand-written owner decides which apply.
/// The cancellation token.
/// The 'IEvent' stream.
/// The API returned a declared error status (declared: 400, 401); streaming API errors always throw.
diff --git a/tests/OpenCode.Sdk.Tools.Tests/Generator/Emission/StreamOperationEmissionTests.cs b/tests/OpenCode.Sdk.Tools.Tests/Generator/Emission/StreamOperationEmissionTests.cs
index c3fde3e0..5ef48cfe 100644
--- a/tests/OpenCode.Sdk.Tools.Tests/Generator/Emission/StreamOperationEmissionTests.cs
+++ b/tests/OpenCode.Sdk.Tools.Tests/Generator/Emission/StreamOperationEmissionTests.cs
@@ -1,3 +1,4 @@
+using OpenCode.Sdk.Tools.Generator.Binding.Models;
using OpenCode.Sdk.Tools.Generator.Emission;
using OpenCode.Sdk.Tools.Tests.Generator.Emission.Support;
using OpenCode.Sdk.Tools.Tests.Support;
@@ -86,4 +87,20 @@ await Assert
var diagnostics = await GeneratedSourceCompiler.CompileWithSdkCoreAsync(sources);
await Assert.That(diagnostics).IsEmpty();
}
+
+ [Test]
+ [Arguments(false, "The per-call options; NoThrow is refused. NetworkTimeout bounds only the opening and is refused for reconnecting streams, including Timeout.InfiniteTimeSpan.")]
+ [Arguments(true, "The per-call options; the family's hand-written owner decides which apply.")]
+ public async Task Emit_Should_Document_Stream_Request_Options_By_Family_Emission(bool internalRaw, string expected)
+ {
+ var plan = await EmitterPlanFixture.CreateStreamPlanAsync();
+ var operation = plan.Clients.SelectMany(static client => client.Operations).Single();
+
+ var xml = OperationMethodEmitter
+ .Emit(operation, internalRaw ? EmissionMode.InternalRaw : EmissionMode.Public)
+ .GetLeadingTrivia()
+ .ToFullString();
+
+ await Assert.That(xml).Contains($"/// {expected}");
+ }
}
diff --git a/tools/OpenCode.Sdk.Tools/Generator/Emission/OperationMethodEmitter.cs b/tools/OpenCode.Sdk.Tools/Generator/Emission/OperationMethodEmitter.cs
index fed441e8..c833b683 100644
--- a/tools/OpenCode.Sdk.Tools/Generator/Emission/OperationMethodEmitter.cs
+++ b/tools/OpenCode.Sdk.Tools/Generator/Emission/OperationMethodEmitter.cs
@@ -53,7 +53,7 @@ public static MethodDeclarationSyntax Emit(OperationPlan operation, EmissionMode
.AddAttributeLists(ExperimentalAttributeSyntax.Emit(emission is EmissionMode.Public && !classMarked ? operation.ExperimentalDiagnostic : null))
.WithParameterList(SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList(EmitParameters(operation, methodParameters))))
.WithBody(SyntaxFactory.Block(statements))
- .WithLeadingTrivia(EmitDocumentation(operation, methodParameters));
+ .WithLeadingTrivia(EmitDocumentation(operation, emission, methodParameters));
}
///
@@ -252,7 +252,20 @@ private static ExpressionSyntax EmitRoute(OperationPlan operation)
return EmissionSyntax.Invocation(member, [.. arguments]);
}
- private static SyntaxTriviaList EmitDocumentation(OperationPlan operation, IReadOnlyList methodParameters)
+ ///
+ /// Describes the per-call options. An internal-raw stream's family has a hand-written owner that
+ /// decides which per-call options apply, so the caller-facing stream rules do not describe it.
+ ///
+ private static string RequestOptionsDocumentation(OperationPlan operation, EmissionMode emission) =>
+ (operation.Stream, emission) switch
+ {
+ (null, _) => "The per-call options.",
+ (_, EmissionMode.InternalRaw) => "The per-call options; the family's hand-written owner decides which apply.",
+ _ => "The per-call options; NoThrow is refused. NetworkTimeout bounds only the opening and is refused for reconnecting streams, including Timeout.InfiniteTimeSpan.",
+ };
+
+ private static SyntaxTriviaList EmitDocumentation(OperationPlan operation, EmissionMode emission,
+ IReadOnlyList methodParameters)
{
var parameters = new List();
parameters.AddRange(methodParameters.Select(static parameter =>
@@ -285,9 +298,7 @@ private static SyntaxTriviaList EmitDocumentation(OperationPlan operation, IRead
parameters.AddRange(operation.DeclaredHeaders.Select(static header =>
new DocumentedParameter(header.Name, $"The '{header.WireName}' request header; omitted when null.")));
- parameters.Add(new DocumentedParameter(ReservedNamePolicy.RequestOptionsParameter, operation.Stream is null
- ? "The per-call options."
- : "The per-call options; NoThrow is refused. NetworkTimeout bounds only the opening and is refused for reconnecting streams, including Timeout.InfiniteTimeSpan."));
+ parameters.Add(new DocumentedParameter(ReservedNamePolicy.RequestOptionsParameter, RequestOptionsDocumentation(operation, emission)));
parameters.Add(new DocumentedParameter(ReservedNamePolicy.CancellationTokenParameter, "The cancellation token."));