@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
14 lines • 919 B
JavaScript
/**
* The `mcp_presenter_context` reply. `controlEndpoint` is added only on an explicit `discover: true` and only when an
* account-enrolling control is advertised; otherwise the reply keeps the shape strict clients decode.
*/
export function presenterContextReply(authority, sender, request, advertised) {
const sessionId = "sessionId" in request && typeof request.sessionId === "string" ? request.sessionId : undefined;
const context = sender && sessionId !== undefined ? authority?.connectionContext(sender, sessionId) : undefined;
if (!context)
return { error: "presenter_not_authorized" };
const discover = "discover" in request && request.discover === true;
const controlEndpoint = discover ? advertised : undefined;
return { ok: true, context: controlEndpoint === undefined ? context : { ...context, controlEndpoint } };
}
//# sourceMappingURL=mcp-presenter-host-surface.js.map