@maskera/mcp 0.4.6 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { NerRecognizer, NerOptions, RedactionProfile, RedactResult, Detector } f
2
2
  import { ServerResponse, Server, IncomingMessage } from 'node:http';
3
3
 
4
4
  type ApprovalMode = "automatic" | "browser" | "native";
5
- type ApprovalStatus = "pending" | "approved" | "declined" | "expired" | "completed";
5
+ type ApprovalStatus = "pending" | "approved" | "executing" | "declined" | "expired" | "completed" | "failed";
6
6
  interface ApprovalSummary {
7
7
  id: string;
8
8
  tool: string;
@@ -13,13 +13,18 @@ interface ApprovalSummary {
13
13
  createdAt: string;
14
14
  expiresAt: string;
15
15
  decidedAt: string | null;
16
+ error?: string;
16
17
  }
17
18
  type ApprovalResumeResult = {
18
19
  status: "completed";
19
20
  result: Record<string, unknown>;
20
21
  summary: ApprovalSummary;
21
22
  } | {
22
- status: "pending" | "declined" | "expired" | "not_found";
23
+ status: "failed";
24
+ error: string;
25
+ summary: ApprovalSummary;
26
+ } | {
27
+ status: "pending" | "executing" | "declined" | "expired" | "already_completed" | "not_found";
23
28
  summary?: ApprovalSummary;
24
29
  };
25
30
  /**
@@ -51,6 +56,7 @@ declare class ApprovalBroker {
51
56
  }
52
57
 
53
58
  type MaskMode = "auto" | "rules";
59
+ type NerPhase = "idle" | "loading" | "ready" | "failed";
54
60
  interface ModelLoadEvent {
55
61
  phase: "loading" | "ready" | "error";
56
62
  model: string;
@@ -98,6 +104,7 @@ interface MaskeraEngine {
98
104
  defaultMode: MaskMode;
99
105
  model: string;
100
106
  revision: string;
107
+ nerPhase: NerPhase;
101
108
  nerLoaded: boolean;
102
109
  nerError: string | null;
103
110
  cacheSize: number;
@@ -604,8 +611,18 @@ interface MaskeraMcpOptions extends MaskeraMcpPolicy {
604
611
  requestElicitation?: (req: ElicitationRequest) => Promise<ElicitationResponse>;
605
612
  onToolCall?: (event: ToolCallTelemetry) => void;
606
613
  }
614
+ type ClientHandshakeState = {
615
+ status: "uninitialized";
616
+ } | {
617
+ status: "initialized";
618
+ protocolVersion: string;
619
+ supportsElicitation: boolean;
620
+ };
607
621
  interface MaskeraMcpServer {
608
622
  handleMessage(raw: unknown, policyOverride?: MaskeraMcpPolicy): Promise<JsonRpcResponse | null>;
623
+ getClientState(owner?: string): ClientHandshakeState;
624
+ clearOwner(owner: string): void;
625
+ clearAllOwners(): void;
609
626
  readonly vault: SessionVault;
610
627
  }
611
628
  declare function createMaskeraMcpServer(options?: MaskeraMcpOptions): MaskeraMcpServer;
@@ -690,6 +707,29 @@ declare function renderMaskeraPrompt(name: string, args: Record<string, unknown>
690
707
  }>;
691
708
  } | null;
692
709
 
710
+ type StdioTransportPhase = "open" | "closed";
711
+ interface StdioMcpTransportOptions {
712
+ writeStdout: (line: string) => void;
713
+ writeStderr: (line: string) => void;
714
+ }
715
+ interface StdioMcpTransport {
716
+ readonly phase: StdioTransportPhase;
717
+ requestElicitation(req: ElicitationRequest): Promise<ElicitationResponse>;
718
+ handleLine(line: string, handleMessage: (raw: unknown) => Promise<JsonRpcResponse | null>): void;
719
+ close(): void;
720
+ whenIdle(): Promise<void>;
721
+ }
722
+ /**
723
+ * Explicit open/closed state machine for stdio JSON-RPC framing with
724
+ * bidirectional server-initiated `elicitation/create` requests.
725
+ *
726
+ * Responses to server-initiated elicitations resolve outside the sequential
727
+ * request chain so in-flight tool calls never deadlock, and closing stdin
728
+ * cancels both pending and any subsequent elicitation requests immediately
729
+ * instead of hanging the process.
730
+ */
731
+ declare function createStdioMcpTransport(options: StdioMcpTransportOptions): StdioMcpTransport;
732
+
693
733
  interface WrapOptions {
694
734
  command: string;
695
735
  args: readonly string[];
@@ -747,4 +787,4 @@ declare function openUrlInBrowser(url: string, platform?: NodeJS.Platform): bool
747
787
  */
748
788
  declare function runWrap(options: WrapOptions): Promise<WrapResult>;
749
789
 
750
- export { ApprovalBroker, type ApprovalMode, type ApprovalResumeResult, type ApprovalStatus, type ApprovalSummary, type CommandRunner, type DoctorCheck, type DoctorCheckStatus, type DoctorReport, type DoctorSampleProof, type ElicitationRequest, type ElicitationResponse, type EngineOptions, type FileGuard, type GuardResult, type InspectedRequest, type InstallClient, type InstallOptions, type InstallResult, type InstallTransport, type JsonRpcResponse, LAUNCHD_LABEL, type ListedFile, MASKERA_PROMPTS, MASKERA_SKILL_MARKDOWN, MASKERA_SKILL_URI, MASKERA_STATUS_URI, type MaskMode, type MaskeraEngine, type MaskeraMcpOptions, type MaskeraMcpPolicy, type MaskeraMcpServer, type McpPromptDefinition, type ModelLoadEvent, ProxyInspector, type ProxyOptions, type ProxyStats, type RedactFieldKind, type RedactInputOptions, type RunningMaskeraProxy, SERVER_NAME, SERVER_VERSION, SUPPORTED_CLIENTS, SYSTEMD_UNIT, type SearchMatch, type ServiceAction, type ServiceOptions, type ServiceResult, type SessionSummary, SessionVault, StreamingRestorer, type ToolCallTelemetry, type WrapOptions, type WrapReceipt, type WrapResult, buildCustomTermsDetector, createFileGuard, createMaskeraEngine, createMaskeraMcpServer, createModelProgressLogger, createSseRestorer, deriveProxySessionId, detectInstalledClients, extractGuardText, formatDoctorReport, isInstallClient, isLikelyEnglishSystemPrompt, normalizeMixedScriptHomoglyphs, openUrlInBrowser, redactLlmRequestBody, renderInspectorHtml, renderLaunchdPlist, renderMaskeraPrompt, renderSystemdUnit, restoreLlmResponseBody, runDoctor, runGuard, runGuardViaWarmProxy, runInstall, runService, runWrap, startMaskeraProxy, writeDoctorReceipt };
790
+ export { ApprovalBroker, type ApprovalMode, type ApprovalResumeResult, type ApprovalStatus, type ApprovalSummary, type ClientHandshakeState, type CommandRunner, type DoctorCheck, type DoctorCheckStatus, type DoctorReport, type DoctorSampleProof, type ElicitationRequest, type ElicitationResponse, type EngineOptions, type FileGuard, type GuardResult, type InspectedRequest, type InstallClient, type InstallOptions, type InstallResult, type InstallTransport, type JsonRpcResponse, LAUNCHD_LABEL, type ListedFile, MASKERA_PROMPTS, MASKERA_SKILL_MARKDOWN, MASKERA_SKILL_URI, MASKERA_STATUS_URI, type MaskMode, type MaskeraEngine, type MaskeraMcpOptions, type MaskeraMcpPolicy, type MaskeraMcpServer, type McpPromptDefinition, type ModelLoadEvent, type NerPhase, ProxyInspector, type ProxyOptions, type ProxyStats, type RedactFieldKind, type RedactInputOptions, type RunningMaskeraProxy, SERVER_NAME, SERVER_VERSION, SUPPORTED_CLIENTS, SYSTEMD_UNIT, type SearchMatch, type ServiceAction, type ServiceOptions, type ServiceResult, type SessionSummary, SessionVault, type StdioMcpTransport, type StdioMcpTransportOptions, type StdioTransportPhase, StreamingRestorer, type ToolCallTelemetry, type WrapOptions, type WrapReceipt, type WrapResult, buildCustomTermsDetector, createFileGuard, createMaskeraEngine, createMaskeraMcpServer, createModelProgressLogger, createSseRestorer, createStdioMcpTransport, deriveProxySessionId, detectInstalledClients, extractGuardText, formatDoctorReport, isInstallClient, isLikelyEnglishSystemPrompt, normalizeMixedScriptHomoglyphs, openUrlInBrowser, redactLlmRequestBody, renderInspectorHtml, renderLaunchdPlist, renderMaskeraPrompt, renderSystemdUnit, restoreLlmResponseBody, runDoctor, runGuard, runGuardViaWarmProxy, runInstall, runService, runWrap, startMaskeraProxy, writeDoctorReceipt };