@maskera/mcp 0.3.0 → 0.4.0
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 +27 -11
- package/dist/cli.js +3474 -2160
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +198 -4
- package/dist/index.js +3205 -2149
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 {
|
|
@@ -355,6 +435,12 @@ interface ProxyOptions {
|
|
|
355
435
|
/** Optional safe metadata logger (never receives raw PII). */
|
|
356
436
|
onLog?: (message: string) => void;
|
|
357
437
|
}
|
|
438
|
+
interface ProxyStats {
|
|
439
|
+
requests: number;
|
|
440
|
+
redactions: number;
|
|
441
|
+
counts: Record<string, number>;
|
|
442
|
+
sessions: number;
|
|
443
|
+
}
|
|
358
444
|
interface RunningMaskeraProxy {
|
|
359
445
|
readonly url: string;
|
|
360
446
|
readonly mcpUrl: string;
|
|
@@ -365,6 +451,7 @@ interface RunningMaskeraProxy {
|
|
|
365
451
|
readonly vault: SessionVault;
|
|
366
452
|
readonly inspector: ProxyInspector;
|
|
367
453
|
readonly approvals: ApprovalBroker;
|
|
454
|
+
stats(): ProxyStats;
|
|
368
455
|
close(): Promise<void>;
|
|
369
456
|
}
|
|
370
457
|
/**
|
|
@@ -425,7 +512,7 @@ declare function createSseRestorer(map: Readonly<Record<string, string>>): {
|
|
|
425
512
|
declare function startMaskeraProxy(options?: ProxyOptions): Promise<RunningMaskeraProxy>;
|
|
426
513
|
|
|
427
514
|
declare const SERVER_NAME = "maskera-mcp";
|
|
428
|
-
declare const SERVER_VERSION = "0.
|
|
515
|
+
declare const SERVER_VERSION = "0.4.0";
|
|
429
516
|
interface JsonRpcResponse {
|
|
430
517
|
jsonrpc: "2.0";
|
|
431
518
|
id: string | number | null;
|
|
@@ -478,6 +565,57 @@ interface MaskeraMcpServer {
|
|
|
478
565
|
}
|
|
479
566
|
declare function createMaskeraMcpServer(options?: MaskeraMcpOptions): MaskeraMcpServer;
|
|
480
567
|
|
|
568
|
+
type ServiceAction = "install" | "status" | "uninstall";
|
|
569
|
+
interface ServiceOptions {
|
|
570
|
+
action: ServiceAction;
|
|
571
|
+
host?: string;
|
|
572
|
+
port?: number;
|
|
573
|
+
roots?: readonly string[];
|
|
574
|
+
rulesOnly?: boolean;
|
|
575
|
+
noRawRestore?: boolean;
|
|
576
|
+
readOnly?: boolean;
|
|
577
|
+
approvalMode?: ApprovalMode;
|
|
578
|
+
profile?: RedactionProfile;
|
|
579
|
+
customTerms?: readonly string[];
|
|
580
|
+
auditLogPath?: string;
|
|
581
|
+
dryRun?: boolean;
|
|
582
|
+
platform?: NodeJS.Platform;
|
|
583
|
+
homeDir?: string;
|
|
584
|
+
nodePath?: string;
|
|
585
|
+
cliPath?: string;
|
|
586
|
+
pathEnv?: string;
|
|
587
|
+
uid?: number;
|
|
588
|
+
execCommand?: CommandRunner;
|
|
589
|
+
}
|
|
590
|
+
interface ServiceResult {
|
|
591
|
+
action: ServiceAction;
|
|
592
|
+
platform: NodeJS.Platform;
|
|
593
|
+
manager: "launchd" | "systemd" | "unsupported";
|
|
594
|
+
serviceName: string;
|
|
595
|
+
serviceFile: string | null;
|
|
596
|
+
proxyUrl: string;
|
|
597
|
+
mcpUrl: string;
|
|
598
|
+
inspectorUrl: string;
|
|
599
|
+
installed: boolean;
|
|
600
|
+
running: boolean;
|
|
601
|
+
written: boolean;
|
|
602
|
+
snippet?: string;
|
|
603
|
+
detail: string;
|
|
604
|
+
}
|
|
605
|
+
declare const LAUNCHD_LABEL = "dev.maskera.proxy";
|
|
606
|
+
declare const SYSTEMD_UNIT = "maskera-proxy.service";
|
|
607
|
+
declare function renderLaunchdPlist(options: {
|
|
608
|
+
programArguments: readonly string[];
|
|
609
|
+
stdoutLogPath: string;
|
|
610
|
+
stderrLogPath: string;
|
|
611
|
+
pathEnv?: string;
|
|
612
|
+
}): string;
|
|
613
|
+
declare function renderSystemdUnit(options: {
|
|
614
|
+
programArguments: readonly string[];
|
|
615
|
+
pathEnv?: string;
|
|
616
|
+
}): string;
|
|
617
|
+
declare function runService(options: ServiceOptions): Promise<ServiceResult>;
|
|
618
|
+
|
|
481
619
|
declare const MASKERA_SKILL_URI = "maskera://skills/maskera/SKILL.md";
|
|
482
620
|
declare const MASKERA_STATUS_URI = "maskera://status";
|
|
483
621
|
/**
|
|
@@ -485,7 +623,7 @@ declare const MASKERA_STATUS_URI = "maskera://status";
|
|
|
485
623
|
* prompts so connected clients get the full operating guide without a separate
|
|
486
624
|
* skill install step. Kept in sync with `skills/maskera/SKILL.md` by unit test.
|
|
487
625
|
*/
|
|
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
|
|
626
|
+
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
627
|
interface McpPromptDefinition {
|
|
490
628
|
name: string;
|
|
491
629
|
description: string;
|
|
@@ -507,4 +645,60 @@ declare function renderMaskeraPrompt(name: string, args: Record<string, unknown>
|
|
|
507
645
|
}>;
|
|
508
646
|
} | null;
|
|
509
647
|
|
|
510
|
-
|
|
648
|
+
interface WrapOptions {
|
|
649
|
+
command: string;
|
|
650
|
+
args: readonly string[];
|
|
651
|
+
engine: MaskeraEngine;
|
|
652
|
+
roots: readonly string[];
|
|
653
|
+
host?: string;
|
|
654
|
+
/** Defaults to `0` (ephemeral free port) so multiple wrapped sessions never collide. */
|
|
655
|
+
port?: number;
|
|
656
|
+
upstream?: string;
|
|
657
|
+
anthropicUpstream?: string;
|
|
658
|
+
openaiUpstream?: string;
|
|
659
|
+
allowRawRestore?: boolean;
|
|
660
|
+
readOnly?: boolean;
|
|
661
|
+
approvalMode?: ApprovalMode;
|
|
662
|
+
profile?: RedactionProfile;
|
|
663
|
+
customTerms?: readonly string[];
|
|
664
|
+
restoreResponses?: boolean;
|
|
665
|
+
auditLogPath?: string;
|
|
666
|
+
verify?: boolean;
|
|
667
|
+
receiptPath?: string;
|
|
668
|
+
openInspector?: boolean;
|
|
669
|
+
env?: NodeJS.ProcessEnv;
|
|
670
|
+
onStderr?: (line: string) => void;
|
|
671
|
+
}
|
|
672
|
+
interface WrapReceipt {
|
|
673
|
+
schema: "maskera-wrap-receipt/v1";
|
|
674
|
+
timestamp: string;
|
|
675
|
+
command: string;
|
|
676
|
+
exitCode: number;
|
|
677
|
+
proxyUrl: string;
|
|
678
|
+
mcpUrl: string;
|
|
679
|
+
startupReceipt: DoctorReport | null;
|
|
680
|
+
session: ProxyStats;
|
|
681
|
+
}
|
|
682
|
+
interface WrapResult {
|
|
683
|
+
exitCode: number;
|
|
684
|
+
signal: NodeJS.Signals | null;
|
|
685
|
+
proxyUrl: string;
|
|
686
|
+
mcpUrl: string;
|
|
687
|
+
startupReceipt: DoctorReport | null;
|
|
688
|
+
session: ProxyStats;
|
|
689
|
+
receiptPath?: string;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Best-effort opener for a local loopback URL in the user's default browser.
|
|
693
|
+
* Never throws if running headless or on a system without a GUI opener.
|
|
694
|
+
*/
|
|
695
|
+
declare function openUrlInBrowser(url: string, platform?: NodeJS.Platform): boolean;
|
|
696
|
+
/**
|
|
697
|
+
* Starts a local Maskera proxy on a loopback port, runs an optional zero-PII
|
|
698
|
+
* startup self-check, injects `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`,
|
|
699
|
+
* `MASKERA_PROXY_URL`, and `MASKERA_MCP_URL` into the wrapped child command,
|
|
700
|
+
* forwards stdio transparently, and shuts down cleanly with a session receipt.
|
|
701
|
+
*/
|
|
702
|
+
declare function runWrap(options: WrapOptions): Promise<WrapResult>;
|
|
703
|
+
|
|
704
|
+
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 };
|