@maskera/mcp 0.3.0 → 0.4.1
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/README.md +28 -12
- package/dist/cli.js +3938 -2600
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +205 -4
- package/dist/index.js +3230 -2150
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,12 @@ declare class ApprovalBroker {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
type MaskMode = "auto" | "rules";
|
|
52
|
+
interface ModelLoadEvent {
|
|
53
|
+
phase: "loading" | "ready" | "error";
|
|
54
|
+
model: string;
|
|
55
|
+
elapsedMs?: number;
|
|
56
|
+
error?: string;
|
|
57
|
+
}
|
|
52
58
|
interface EngineOptions {
|
|
53
59
|
/** Default mode when a tool call omits `mode`. Default: `"auto"` (hybrid NER + rules). */
|
|
54
60
|
defaultMode?: MaskMode;
|
|
@@ -56,6 +62,8 @@ interface EngineOptions {
|
|
|
56
62
|
recognizer?: NerRecognizer;
|
|
57
63
|
/** Forwarded to `createNerRecognizer` when no custom recognizer is passed. */
|
|
58
64
|
nerOptions?: NerOptions;
|
|
65
|
+
/** Optional lifecycle hook fired when the local ONNX model starts/finishes loading. */
|
|
66
|
+
onModelStatus?: (event: ModelLoadEvent) => void;
|
|
59
67
|
/**
|
|
60
68
|
* Max entries in the in-memory span cache (stores only SHA-256 digest keys
|
|
61
69
|
* and `{ start, end, label }` offsets, never raw PII text). Default: `512`.
|
|
@@ -99,6 +107,13 @@ interface MaskeraEngine {
|
|
|
99
107
|
*/
|
|
100
108
|
declare function buildCustomTermsDetector(rawTerms: readonly string[]): Detector | null;
|
|
101
109
|
declare function createMaskeraEngine(options?: EngineOptions): MaskeraEngine;
|
|
110
|
+
/**
|
|
111
|
+
* Returns an `onModelStatus` handler that prints a concise progress line on
|
|
112
|
+
* stderr only when model loading takes longer than `delayMs` (default 350ms),
|
|
113
|
+
* keeping warm/cached runs quiet while reassuring users during the initial
|
|
114
|
+
* 43 MB ONNX download.
|
|
115
|
+
*/
|
|
116
|
+
declare function createModelProgressLogger(write?: (line: string) => void, delayMs?: number): (event: ModelLoadEvent) => void;
|
|
102
117
|
|
|
103
118
|
type DoctorCheckStatus = "ok" | "warn" | "fail";
|
|
104
119
|
interface DoctorCheck {
|
|
@@ -106,9 +121,25 @@ interface DoctorCheck {
|
|
|
106
121
|
status: DoctorCheckStatus;
|
|
107
122
|
detail: string;
|
|
108
123
|
}
|
|
124
|
+
interface DoctorSampleProof {
|
|
125
|
+
modeUsed: "hybrid" | "rules";
|
|
126
|
+
maskedCount: number;
|
|
127
|
+
countsByLabel: Record<string, number>;
|
|
128
|
+
redactedPreview: string;
|
|
129
|
+
rawPiiLeaked: boolean;
|
|
130
|
+
roundtripRestored: boolean;
|
|
131
|
+
elapsedMs: number;
|
|
132
|
+
}
|
|
109
133
|
interface DoctorReport {
|
|
134
|
+
schema: "maskera-setup-receipt/v1";
|
|
135
|
+
timestamp: string;
|
|
136
|
+
version: string;
|
|
110
137
|
ok: boolean;
|
|
111
138
|
mode: MaskMode;
|
|
139
|
+
client?: string;
|
|
140
|
+
transport?: string;
|
|
141
|
+
configPath?: string | null;
|
|
142
|
+
sampleProof: DoctorSampleProof | null;
|
|
112
143
|
checks: DoctorCheck[];
|
|
113
144
|
}
|
|
114
145
|
declare function runDoctor(options: {
|
|
@@ -118,8 +149,13 @@ declare function runDoctor(options: {
|
|
|
118
149
|
profile?: RedactionProfile;
|
|
119
150
|
customTerms?: readonly string[];
|
|
120
151
|
proxyUrl?: string;
|
|
152
|
+
mcpUrl?: string;
|
|
153
|
+
client?: string;
|
|
154
|
+
transport?: string;
|
|
155
|
+
configPath?: string | null;
|
|
121
156
|
}): Promise<DoctorReport>;
|
|
122
|
-
declare function
|
|
157
|
+
declare function writeDoctorReceipt(filePath: string, report: DoctorReport): Promise<string>;
|
|
158
|
+
declare function formatDoctorReport(report: DoctorReport, heading?: string): string;
|
|
123
159
|
|
|
124
160
|
interface ListedFile {
|
|
125
161
|
path: string;
|
|
@@ -193,6 +229,24 @@ declare function runGuard(rawInput: string, engine: MaskeraEngine, options?: {
|
|
|
193
229
|
customTerms?: readonly string[];
|
|
194
230
|
preserveJsonStructure?: boolean;
|
|
195
231
|
}): Promise<GuardResult>;
|
|
232
|
+
/**
|
|
233
|
+
* Sends a `guard` check to an already-running local loopback Maskera proxy
|
|
234
|
+
* (`POST /_maskera/guard`) to reuse its warm ONNX NER model (~5-15ms instead of
|
|
235
|
+
* cold-loading the 43 MB model per hook call).
|
|
236
|
+
*
|
|
237
|
+
* Returns `null` when no compatible local proxy is listening (so callers fall
|
|
238
|
+
* back transparently to local in-process redaction). Rejects non-loopback URLs
|
|
239
|
+
* and rethrows explicit proxy `502` fail-closed errors.
|
|
240
|
+
*/
|
|
241
|
+
declare function runGuardViaWarmProxy(rawInput: string, options?: {
|
|
242
|
+
proxyUrl?: string;
|
|
243
|
+
mode?: MaskMode;
|
|
244
|
+
profile?: RedactionProfile;
|
|
245
|
+
customTerms?: readonly string[];
|
|
246
|
+
preserveJsonStructure?: boolean;
|
|
247
|
+
includeRedacted?: boolean;
|
|
248
|
+
timeoutMs?: number;
|
|
249
|
+
}): Promise<GuardResult | null>;
|
|
196
250
|
|
|
197
251
|
interface InspectedRequest {
|
|
198
252
|
id: string;
|
|
@@ -235,6 +289,12 @@ declare function renderInspectorHtml(info: {
|
|
|
235
289
|
declare const SUPPORTED_CLIENTS: readonly ["claude-code", "claude-desktop", "codex", "cursor", "opencode", "t3-code"];
|
|
236
290
|
type InstallClient = (typeof SUPPORTED_CLIENTS)[number];
|
|
237
291
|
type InstallTransport = "stdio" | "http";
|
|
292
|
+
type CommandRunner = (command: string, args: readonly string[], cwd: string) => {
|
|
293
|
+
status: number | null;
|
|
294
|
+
stdout: string;
|
|
295
|
+
stderr: string;
|
|
296
|
+
error?: Error;
|
|
297
|
+
};
|
|
238
298
|
interface InstallOptions {
|
|
239
299
|
client: InstallClient;
|
|
240
300
|
transport?: InstallTransport;
|
|
@@ -247,10 +307,17 @@ interface InstallOptions {
|
|
|
247
307
|
profile?: RedactionProfile;
|
|
248
308
|
customTerms?: readonly string[];
|
|
249
309
|
configPath?: string;
|
|
310
|
+
/** Run CLI registration commands directly (`claude mcp add` / `codex mcp add`). */
|
|
311
|
+
apply?: boolean;
|
|
312
|
+
/** Write project-local `.mcp.json` when configuring `claude-code`. */
|
|
313
|
+
project?: boolean;
|
|
314
|
+
/** Also install a `maskera-mcp guard` prompt hook (supported for `claude-code` and `cursor`). */
|
|
315
|
+
withHook?: boolean;
|
|
250
316
|
dryRun?: boolean;
|
|
251
317
|
cwd?: string;
|
|
252
318
|
homeDir?: string;
|
|
253
319
|
platform?: NodeJS.Platform;
|
|
320
|
+
execCommand?: CommandRunner;
|
|
254
321
|
}
|
|
255
322
|
interface InstallResult {
|
|
256
323
|
client: InstallClient;
|
|
@@ -259,9 +326,22 @@ interface InstallResult {
|
|
|
259
326
|
command: string | null;
|
|
260
327
|
snippet: string;
|
|
261
328
|
written: boolean;
|
|
329
|
+
applied?: boolean;
|
|
330
|
+
applyOutput?: string;
|
|
331
|
+
hookPath?: string | null;
|
|
332
|
+
hookWritten?: boolean;
|
|
262
333
|
verifyStep: string;
|
|
263
334
|
}
|
|
264
335
|
declare function isInstallClient(value: string): value is InstallClient;
|
|
336
|
+
/**
|
|
337
|
+
* Auto-detects supported AI coding clients present in the workspace or on PATH.
|
|
338
|
+
*/
|
|
339
|
+
declare function detectInstalledClients(options?: {
|
|
340
|
+
cwd?: string;
|
|
341
|
+
homeDir?: string;
|
|
342
|
+
platform?: NodeJS.Platform;
|
|
343
|
+
pathEnv?: string;
|
|
344
|
+
}): Promise<InstallClient[]>;
|
|
265
345
|
declare function runInstall(options: InstallOptions): Promise<InstallResult>;
|
|
266
346
|
|
|
267
347
|
interface SessionSummary {
|
|
@@ -305,6 +385,13 @@ declare class SessionVault {
|
|
|
305
385
|
sessionId: string | null;
|
|
306
386
|
knownPlaceholders: number;
|
|
307
387
|
};
|
|
388
|
+
/**
|
|
389
|
+
* Picks the session that restores `text` when the caller named none.
|
|
390
|
+
* A candidate must know every placeholder in the text. When several do and
|
|
391
|
+
* would restore it differently, the choice is ambiguous and refused, so a
|
|
392
|
+
* missing session_id can never put another document's values into a file.
|
|
393
|
+
*/
|
|
394
|
+
resolveSessionFor(text: string): string;
|
|
308
395
|
getMap(sessionId: string): Record<string, string>;
|
|
309
396
|
entries(): Array<{
|
|
310
397
|
sessionId: string;
|
|
@@ -355,6 +442,12 @@ interface ProxyOptions {
|
|
|
355
442
|
/** Optional safe metadata logger (never receives raw PII). */
|
|
356
443
|
onLog?: (message: string) => void;
|
|
357
444
|
}
|
|
445
|
+
interface ProxyStats {
|
|
446
|
+
requests: number;
|
|
447
|
+
redactions: number;
|
|
448
|
+
counts: Record<string, number>;
|
|
449
|
+
sessions: number;
|
|
450
|
+
}
|
|
358
451
|
interface RunningMaskeraProxy {
|
|
359
452
|
readonly url: string;
|
|
360
453
|
readonly mcpUrl: string;
|
|
@@ -365,6 +458,7 @@ interface RunningMaskeraProxy {
|
|
|
365
458
|
readonly vault: SessionVault;
|
|
366
459
|
readonly inspector: ProxyInspector;
|
|
367
460
|
readonly approvals: ApprovalBroker;
|
|
461
|
+
stats(): ProxyStats;
|
|
368
462
|
close(): Promise<void>;
|
|
369
463
|
}
|
|
370
464
|
/**
|
|
@@ -425,7 +519,7 @@ declare function createSseRestorer(map: Readonly<Record<string, string>>): {
|
|
|
425
519
|
declare function startMaskeraProxy(options?: ProxyOptions): Promise<RunningMaskeraProxy>;
|
|
426
520
|
|
|
427
521
|
declare const SERVER_NAME = "maskera-mcp";
|
|
428
|
-
declare const SERVER_VERSION
|
|
522
|
+
declare const SERVER_VERSION: string;
|
|
429
523
|
interface JsonRpcResponse {
|
|
430
524
|
jsonrpc: "2.0";
|
|
431
525
|
id: string | number | null;
|
|
@@ -478,6 +572,57 @@ interface MaskeraMcpServer {
|
|
|
478
572
|
}
|
|
479
573
|
declare function createMaskeraMcpServer(options?: MaskeraMcpOptions): MaskeraMcpServer;
|
|
480
574
|
|
|
575
|
+
type ServiceAction = "install" | "status" | "uninstall";
|
|
576
|
+
interface ServiceOptions {
|
|
577
|
+
action: ServiceAction;
|
|
578
|
+
host?: string;
|
|
579
|
+
port?: number;
|
|
580
|
+
roots?: readonly string[];
|
|
581
|
+
rulesOnly?: boolean;
|
|
582
|
+
noRawRestore?: boolean;
|
|
583
|
+
readOnly?: boolean;
|
|
584
|
+
approvalMode?: ApprovalMode;
|
|
585
|
+
profile?: RedactionProfile;
|
|
586
|
+
customTerms?: readonly string[];
|
|
587
|
+
auditLogPath?: string;
|
|
588
|
+
dryRun?: boolean;
|
|
589
|
+
platform?: NodeJS.Platform;
|
|
590
|
+
homeDir?: string;
|
|
591
|
+
nodePath?: string;
|
|
592
|
+
cliPath?: string;
|
|
593
|
+
pathEnv?: string;
|
|
594
|
+
uid?: number;
|
|
595
|
+
execCommand?: CommandRunner;
|
|
596
|
+
}
|
|
597
|
+
interface ServiceResult {
|
|
598
|
+
action: ServiceAction;
|
|
599
|
+
platform: NodeJS.Platform;
|
|
600
|
+
manager: "launchd" | "systemd" | "unsupported";
|
|
601
|
+
serviceName: string;
|
|
602
|
+
serviceFile: string | null;
|
|
603
|
+
proxyUrl: string;
|
|
604
|
+
mcpUrl: string;
|
|
605
|
+
inspectorUrl: string;
|
|
606
|
+
installed: boolean;
|
|
607
|
+
running: boolean;
|
|
608
|
+
written: boolean;
|
|
609
|
+
snippet?: string;
|
|
610
|
+
detail: string;
|
|
611
|
+
}
|
|
612
|
+
declare const LAUNCHD_LABEL = "dev.maskera.proxy";
|
|
613
|
+
declare const SYSTEMD_UNIT = "maskera-proxy.service";
|
|
614
|
+
declare function renderLaunchdPlist(options: {
|
|
615
|
+
programArguments: readonly string[];
|
|
616
|
+
stdoutLogPath: string;
|
|
617
|
+
stderrLogPath: string;
|
|
618
|
+
pathEnv?: string;
|
|
619
|
+
}): string;
|
|
620
|
+
declare function renderSystemdUnit(options: {
|
|
621
|
+
programArguments: readonly string[];
|
|
622
|
+
pathEnv?: string;
|
|
623
|
+
}): string;
|
|
624
|
+
declare function runService(options: ServiceOptions): Promise<ServiceResult>;
|
|
625
|
+
|
|
481
626
|
declare const MASKERA_SKILL_URI = "maskera://skills/maskera/SKILL.md";
|
|
482
627
|
declare const MASKERA_STATUS_URI = "maskera://status";
|
|
483
628
|
/**
|
|
@@ -485,7 +630,7 @@ declare const MASKERA_STATUS_URI = "maskera://status";
|
|
|
485
630
|
* prompts so connected clients get the full operating guide without a separate
|
|
486
631
|
* skill install step. Kept in sync with `skills/maskera/SKILL.md` by unit test.
|
|
487
632
|
*/
|
|
488
|
-
declare const MASKERA_SKILL_MARKDOWN = "---\nname: maskera\ndescription: Redact Swedish personal data (names, personnummer, addresses, phones, emails, IBAN, org numbers) locally before text or files reach an AI model, and restore answers locally. Use when working with Swedish client files, HR/CVs, legal or municipal cases, healthcare notes, support transcripts, or when setting up @maskera/mcp (local LLM proxy, Streamable HTTP or stdio MCP server, guard) or the maskera npm SDK.\n---\n\n# Maskera: local Swedish PII redaction\n\nMaskera runs 100% locally on-device using deterministic Swedish rules plus the 43 MB Swedish ONNX NER model (`joelhagvall/maskera-sv-ner`). Raw PII and restore maps stay local so cloud LLMs only see placeholders such as `[NAMN_1]` and `[PERSONNUMMER_1]`.\n\n## Choose the right mode\n\nPick by where the text comes from: **proxy for text typed straight into the chat**, **MCP for files the agent reads with the Maskera tools**. Before the user sends real personal data, verify the setup with made-up data (a fictional address) and confirm a placeholder in the local inspector at `http://127.0.0.1:8787/_maskera`, or run `npx -y @maskera/mcp doctor`.\n\n1. **Local LLM proxy + warm Streamable HTTP MCP (`maskera-mcp proxy`):**\n Use when no prompt, history or tool output may leave the machine unredacted, or when multiple clients should share one warm ONNX model and session vault.\n ```bash\n npx -y @maskera/mcp proxy --root /path/to/workspace\n # Point any harness or SDK at the loopback proxy:\n ANTHROPIC_BASE_URL=http://127.0.0.1:8787 claude\n OPENAI_BASE_URL=http://127.0.0.1:8787/v1 codex # API key mode; ChatGPT-login Codex requires HTTPS so use MCP below\n # Same warm process also serves Streamable HTTP MCP:\n # http://127.0.0.1:8787/mcp (supports ?no_raw_restore=1&read_only=1&approval_mode=browser)\n ```\n - Claude Desktop: Help -> Troubleshooting -> Enable Developer Mode, then Developer -> Configure Third-Party Inference. Set Inference provider to **Gateway**, Credential kind **Static API key**, Gateway base URL `http://127.0.0.1:8787` (no `/v1`), Gateway API key = the user's Anthropic API key, Gateway auth scheme **x-api-key**. Apply Changes, then Save & Restart. Full guide: `https://maskera.dev/docs/guides`.\n - Routes Anthropic (`/v1/messages`) and OpenAI (`/v1/chat/completions`, `/v1/responses`) automatically, or set `--upstream <url>`.\n - Restores placeholders transparently in JSON, tool arguments and chunk-split SSE streams.\n - Fails closed (`502`) if local redaction fails. Inspect counts only at `http://127.0.0.1:8787/_maskera/status`.\n\n2. **Working with sensitive local Swedish files (MCP stdio or Streamable HTTP):**\n
|
|
633
|
+
declare const MASKERA_SKILL_MARKDOWN = "---\nname: maskera\ndescription: Redact Swedish personal data (names, personnummer, addresses, phones, emails, IBAN, org numbers) locally before text or files reach an AI model, and restore answers locally. Use when working with Swedish client files, HR/CVs, legal or municipal cases, healthcare notes, support transcripts, or when setting up @maskera/mcp (local LLM proxy, Streamable HTTP or stdio MCP server, guard) or the maskera npm SDK.\n---\n\n# Maskera: local Swedish PII redaction\n\nMaskera runs 100% locally on-device using deterministic Swedish rules plus the 43 MB Swedish ONNX NER model (`joelhagvall/maskera-sv-ner`). Raw PII and restore maps stay local so cloud LLMs only see placeholders such as `[NAMN_1]` and `[PERSONNUMMER_1]`.\n\n## Choose the right mode\n\nPick by where the text comes from: **proxy for text typed straight into the chat**, **MCP for files the agent reads with the Maskera tools**. Before the user sends real personal data, verify the setup with made-up data (a fictional address) and confirm a placeholder in the local inspector at `http://127.0.0.1:8787/_maskera`, or run `npx -y @maskera/mcp doctor`.\n\n1. **Local LLM proxy + warm Streamable HTTP MCP (`maskera-mcp wrap` / `proxy` / `service`):**\n Use when no prompt, history or tool output may leave the machine unredacted, or when multiple clients should share one warm ONNX model and session vault.\n ```bash\n # Single-command launch (starts local proxy, verifies 0 leaks, injects env vars, prints session receipt on exit):\n npx -y @maskera/mcp wrap -- claude\n # Or run a persistent local proxy (+ Streamable HTTP /mcp + live inspector with self-test button):\n npx -y @maskera/mcp proxy --root /path/to/workspace --open\n # Or install as a background service (launchd on macOS, systemd --user on Linux):\n npx -y @maskera/mcp service install --root /path/to/workspace --no-raw-restore\n # Point any harness or SDK at the loopback proxy:\n ANTHROPIC_BASE_URL=http://127.0.0.1:8787 claude\n OPENAI_BASE_URL=http://127.0.0.1:8787/v1 codex # API key mode; ChatGPT-login Codex requires HTTPS so use MCP below\n # Same warm process also serves Streamable HTTP MCP:\n # http://127.0.0.1:8787/mcp (supports ?no_raw_restore=1&read_only=1&approval_mode=browser)\n ```\n - Claude Desktop: Help -> Troubleshooting -> Enable Developer Mode, then Developer -> Configure Third-Party Inference. Set Inference provider to **Gateway**, Credential kind **Static API key**, Gateway base URL `http://127.0.0.1:8787` (no `/v1`), Gateway API key = the user's Anthropic API key, Gateway auth scheme **x-api-key**. Apply Changes, then Save & Restart. Full guide: `https://maskera.dev/docs/guides`.\n - Routes Anthropic (`/v1/messages`) and OpenAI (`/v1/chat/completions`, `/v1/responses`) automatically, or set `--upstream <url>`.\n - Restores placeholders transparently in JSON, tool arguments and chunk-split SSE streams.\n - Fails closed (`502`) if local redaction fails. Inspect counts only at `http://127.0.0.1:8787/_maskera/status`.\n\n2. **Working with sensitive local Swedish files (MCP stdio or Streamable HTTP):**\n Auto-detect or install automatically with `npx -y @maskera/mcp install [client|all]` (`claude-code`, `claude-desktop`, `codex`, `cursor`, `opencode`, `t3-code`; pass `--apply` to run `claude`/`codex mcp add`, `--with-hook` to install a `guard` hook). It verifies local Swedish PII masking (and any running `/mcp` server) automatically and prints a zero-PII setup receipt (`--receipt <file.json>` to save it, `--no-verify` to skip). Or configure manually:\n - Claude Code / Cursor (`mcpServers`):\n ```json\n {\n \"mcpServers\": {\n \"maskera\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@maskera/mcp\", \"--root\", \"/path/to/workspace\", \"--no-raw-restore\"]\n }\n }\n }\n ```\n - Codex CLI:\n ```bash\n codex mcp add maskera -- npx -y @maskera/mcp --root /path/to/workspace --no-raw-restore\n ```\n - OpenCode v2:\n ```bash\n opencode mcp add maskera -- npx -y @maskera/mcp --root /path/to/workspace --no-raw-restore\n ```\n Workflow rules when the Maskera MCP tools are available:\n - List and search sensitive Swedish directories with `maskera_list_files` and `maskera_search_files` instead of raw `grep`/`rg` so matched lines are redacted before entering context.\n - Read sensitive Swedish files with `maskera_read_file` instead of raw file-reading tools. Reuse one `session_id` across related files so `[NAMN_1]` stays consistent.\n - Pass `custom_terms` for client codenames, project names or case references not covered by built-in rules.\n - Pass `profile: \"clinical\"` for Swedish medical or care notes so diagnoses, doses and measurements stay intact while personal data is masked.\n - Write finished drafts directly to disk with `maskera_write_file` so placeholders are restored locally without echoing raw PII back into the conversation.\n - Use `--no-raw-restore` (or `--approval-mode browser`) when the agent should never pull raw PII back into chat via `maskera_restore` or `include_map: true`.\n - Clear the in-memory restore map with `maskera_clear_session` once the task is done.\n\n3. **Hooks and Unix pipes (guard):**\n ```bash\n # Block prompts or JSON hook payloads containing PII (exits 2, prints counts only):\n npx -y @maskera/mcp guard\n # Redact text locally in a pipeline:\n cat input.txt | npx -y @maskera/mcp guard --redact\n ```\n\n4. **Embedding in application code (browser or Node 18+):**\n ```bash\n npm install maskera @huggingface/transformers\n ```\n Reuse one `createNerRecognizer()` instance across calls and run `await redactWithNer(text, { recognizer })` (or `redact(text)` from `@maskera/core` for zero-dependency structured rules only).\n\n## Boundaries\n\n- A skill guides agent behaviour; for hard enforcement that cannot be bypassed by raw shell or file tools, use `maskera-mcp proxy` or restrict file access to `maskera-mcp` with `--no-raw-restore`.\n- Automated masking reduces exposure risk but is not a zero-leak guarantee. Never log restore maps or write them next to redacted outputs.\n- Reference docs and machine-readable details: `https://maskera.dev/docs` and `https://maskera.dev/llms.txt`.\n";
|
|
489
634
|
interface McpPromptDefinition {
|
|
490
635
|
name: string;
|
|
491
636
|
description: string;
|
|
@@ -507,4 +652,60 @@ declare function renderMaskeraPrompt(name: string, args: Record<string, unknown>
|
|
|
507
652
|
}>;
|
|
508
653
|
} | null;
|
|
509
654
|
|
|
510
|
-
|
|
655
|
+
interface WrapOptions {
|
|
656
|
+
command: string;
|
|
657
|
+
args: readonly string[];
|
|
658
|
+
engine: MaskeraEngine;
|
|
659
|
+
roots: readonly string[];
|
|
660
|
+
host?: string;
|
|
661
|
+
/** Defaults to `0` (ephemeral free port) so multiple wrapped sessions never collide. */
|
|
662
|
+
port?: number;
|
|
663
|
+
upstream?: string;
|
|
664
|
+
anthropicUpstream?: string;
|
|
665
|
+
openaiUpstream?: string;
|
|
666
|
+
allowRawRestore?: boolean;
|
|
667
|
+
readOnly?: boolean;
|
|
668
|
+
approvalMode?: ApprovalMode;
|
|
669
|
+
profile?: RedactionProfile;
|
|
670
|
+
customTerms?: readonly string[];
|
|
671
|
+
restoreResponses?: boolean;
|
|
672
|
+
auditLogPath?: string;
|
|
673
|
+
verify?: boolean;
|
|
674
|
+
receiptPath?: string;
|
|
675
|
+
openInspector?: boolean;
|
|
676
|
+
env?: NodeJS.ProcessEnv;
|
|
677
|
+
onStderr?: (line: string) => void;
|
|
678
|
+
}
|
|
679
|
+
interface WrapReceipt {
|
|
680
|
+
schema: "maskera-wrap-receipt/v1";
|
|
681
|
+
timestamp: string;
|
|
682
|
+
command: string;
|
|
683
|
+
exitCode: number;
|
|
684
|
+
proxyUrl: string;
|
|
685
|
+
mcpUrl: string;
|
|
686
|
+
startupReceipt: DoctorReport | null;
|
|
687
|
+
session: ProxyStats;
|
|
688
|
+
}
|
|
689
|
+
interface WrapResult {
|
|
690
|
+
exitCode: number;
|
|
691
|
+
signal: NodeJS.Signals | null;
|
|
692
|
+
proxyUrl: string;
|
|
693
|
+
mcpUrl: string;
|
|
694
|
+
startupReceipt: DoctorReport | null;
|
|
695
|
+
session: ProxyStats;
|
|
696
|
+
receiptPath?: string;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Best-effort opener for a local loopback URL in the user's default browser.
|
|
700
|
+
* Never throws if running headless or on a system without a GUI opener.
|
|
701
|
+
*/
|
|
702
|
+
declare function openUrlInBrowser(url: string, platform?: NodeJS.Platform): boolean;
|
|
703
|
+
/**
|
|
704
|
+
* Starts a local Maskera proxy on a loopback port, runs an optional zero-PII
|
|
705
|
+
* startup self-check, injects `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`,
|
|
706
|
+
* `MASKERA_PROXY_URL`, and `MASKERA_MCP_URL` into the wrapped child command,
|
|
707
|
+
* forwards stdio transparently, and shuts down cleanly with a session receipt.
|
|
708
|
+
*/
|
|
709
|
+
declare function runWrap(options: WrapOptions): Promise<WrapResult>;
|
|
710
|
+
|
|
711
|
+
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, detectInstalledClients, extractGuardText, formatDoctorReport, isInstallClient, openUrlInBrowser, redactLlmRequestBody, renderInspectorHtml, renderLaunchdPlist, renderMaskeraPrompt, renderSystemdUnit, restoreLlmResponseBody, runDoctor, runGuard, runGuardViaWarmProxy, runInstall, runService, runWrap, startMaskeraProxy, writeDoctorReceipt };
|