ContextWithSessionID returns a new context carrying the given session ID. When set, [userAgentTransport.RoundTrip] forwards it as the `X-Cagent-Session-Id` header — but only on gateway-bound requests (those already carrying `X-Cagent-Forward`), to keep the identifier out of direct provider calls and
(ctx context.Context, id string)
| 10 | // (those already carrying `X-Cagent-Forward`), to keep the identifier |
| 11 | // out of direct provider calls and unrelated outbound HTTP. |
| 12 | func ContextWithSessionID(ctx context.Context, id string) context.Context { |
| 13 | return context.WithValue(ctx, sessionIDKey{}, id) |
| 14 | } |
| 15 | |
| 16 | // SessionIDFromContext returns the session ID stored on ctx by |
| 17 | // [ContextWithSessionID], or the empty string if none is set. |
no outgoing calls