21 lines
693 B
C#
21 lines
693 B
C#
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace ClaudeDo.Worker.Runner;
|
|
|
|
// Per-request caller identity for the task-run MCP surface, populated by the auth
|
|
// middleware from the run's token (mirrors PlanningMcpContext).
|
|
public sealed class TaskRunMcpContext
|
|
{
|
|
public required string CallerTaskId { get; init; }
|
|
}
|
|
|
|
public sealed class TaskRunMcpContextAccessor
|
|
{
|
|
private readonly IHttpContextAccessor _http;
|
|
public TaskRunMcpContextAccessor(IHttpContextAccessor http) => _http = http;
|
|
|
|
public TaskRunMcpContext Current =>
|
|
(_http.HttpContext?.Items["TaskRunContext"] as TaskRunMcpContext)
|
|
?? throw new InvalidOperationException("No task-run context on request.");
|
|
}
|