UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

60 lines • 2.58 kB
import { hostInstanceId } from "./protocol-identity.js"; import { mcpFormClock } from "./mcp-form-dialog.js"; import * as presenterBindings from "./mcp-presenter-bindings.js"; import * as presenterForms from "./mcp-presenter-forms.js"; import * as presenterGrants from "./mcp-presenter-grants.js"; /** Host-owned only. No public session command can call enrollment or install a registration. */ export class McpPresenterAuthority { constructor(options = {}) { /** The host process this authority belongs to: its protocol `instanceId`, so a launcher can name the host it replaces. */ this.instance = hostInstanceId(); this.state = { instance: this.instance, clock: options.clock ?? mcpFormClock, connections: new Map(), bindings: new Map(), registrations: new Map(), }; } dispose() { presenterBindings.dispose(this.state); } connect(id, send) { return presenterBindings.connect(this.state, id, send); } attach(sender, handle) { presenterBindings.attach(this.state, sender, handle); } connectionContext(sender, sessionId) { return presenterBindings.connectionContext(this.state, sender, sessionId); } detach(sender, handle) { presenterBindings.detach(this.state, sender, handle); } withdraw(sender) { presenterBindings.withdraw(this.state, sender); } bind(sessionId, durableId, admit) { return presenterBindings.bind(this.state, sessionId, durableId, admit); } /** Called only after the protected bootstrap has pinned and authenticated its launch principal. */ enroll(principal, identity) { return presenterGrants.enroll(this.state, principal, identity); } /** Whether a current account-principal grant on the binding negotiated `secret_input_v1` (D11 secret phase 3.2). */ secretInputHeld(handle) { return presenterGrants.secretInputHeld(this.state, handle); } /** The current account-principal grants with `secret_input_v1` on the binding (D11 secret phase 5.1). */ secretCandidates(handle) { return presenterGrants.secretCandidates(this.state, handle); } /** Whether a grant is still current: its registration, binding, connection and attachment epoch all hold. */ isCurrent(grant) { return presenterGrants.current(this.state, grant); } receive(sender, value) { return presenterForms.receive(this.state, sender, value); } } //# sourceMappingURL=mcp-presenter-authority.js.map