@entrustai/pilcrow 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ENTRUST AI (entrustai.co)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # The Pilcrow™ — Node.js / TypeScript SDK
2
+
3
+ Official Node.js SDK for [The Pilcrow™](https://entrustai.co) — the deterministic AI governance linter by **ENTRUST AI**.
4
+
5
+ Lint AI-generated text against a Protocol Contract. Get a binary RELEASE / REJECT verdict, cryptographic audit tokens, and repair guidance — deterministically, every time.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @entrustai/pilcrow
11
+ ```
12
+
13
+ **Requires Node.js ≥ 18** (uses native `fetch` — zero runtime dependencies).
14
+
15
+ ## Quick Start
16
+
17
+ ### 1 — Check any text
18
+
19
+ ```typescript
20
+ import { PilcrowClient } from '@entrustai/pilcrow';
21
+
22
+ const client = new PilcrowClient({
23
+ apiKey: 'pk_...',
24
+ workspaceId: 'ws_...',
25
+ });
26
+
27
+ const result = await client.check(
28
+ 'The patient should probably take this medication.'
29
+ );
30
+
31
+ console.log(result.verdict); // "REJECT"
32
+ console.log(result.repair_guidance); // ["Remove hedging language (probably)..."]
33
+ console.log(result.audit_token); // cryptographic attestation
34
+ console.log(result.score.score); // e.g. 62
35
+ ```
36
+
37
+ ### 2 — Self-Healing Guardrails ✦ The Magic
38
+
39
+ Drop any async LLM callable in. The SDK calls it, lints the output, and automatically re-prompts with deterministic repair guidance until RELEASE — or throws with the last result attached.
40
+
41
+ Works with **OpenAI, Anthropic, AWS Bedrock, LangChain, LlamaIndex**, or any async function that takes a string and returns a string.
42
+
43
+ ```typescript
44
+ import { PilcrowClient, PilcrowMaxRetriesExceeded } from '@entrustai/pilcrow';
45
+ import OpenAI from 'openai';
46
+
47
+ const client = new PilcrowClient({
48
+ apiKey: 'pk_...',
49
+ workspaceId: 'ws_...',
50
+ });
51
+
52
+ const openai = new OpenAI();
53
+
54
+ async function myLlm(prompt: string): Promise<string> {
55
+ const response = await openai.chat.completions.create({
56
+ model: 'gpt-4o',
57
+ messages: [{ role: 'user', content: prompt }],
58
+ });
59
+ return response.choices[0].message.content ?? '';
60
+ }
61
+
62
+ try {
63
+ const result = await client.withGuardrails({
64
+ llmCallable: myLlm,
65
+ prompt: 'Write a medical discharge summary for patient Jane Doe.',
66
+ maxRetries: 3,
67
+ });
68
+
69
+ console.log(result.text); // Compliant output — guaranteed
70
+ console.log(result.attempts); // e.g. 2 (needed one retry)
71
+ console.log(result.audit_token); // cryptographic attestation
72
+
73
+ } catch (err) {
74
+ if (err instanceof PilcrowMaxRetriesExceeded) {
75
+ console.error('Max retries exhausted:', err.lastResult.findings);
76
+ // Route to human review queue
77
+ }
78
+ }
79
+ ```
80
+
81
+ ### With Anthropic
82
+
83
+ ```typescript
84
+ import Anthropic from '@anthropic-ai/sdk';
85
+
86
+ const anthropic = new Anthropic();
87
+
88
+ async function claudeLlm(prompt: string): Promise<string> {
89
+ const message = await anthropic.messages.create({
90
+ model: 'claude-opus-4-6',
91
+ max_tokens: 1024,
92
+ messages: [{ role: 'user', content: prompt }],
93
+ });
94
+ const block = message.content[0];
95
+ return block.type === 'text' ? block.text : '';
96
+ }
97
+
98
+ const result = await client.withGuardrails({
99
+ llmCallable: claudeLlm,
100
+ prompt: 'Summarize the quarterly earnings report.',
101
+ maxRetries: 3,
102
+ });
103
+ ```
104
+
105
+ ## API Reference
106
+
107
+ ### `new PilcrowClient(options)`
108
+
109
+ | Option | Type | Required | Default |
110
+ |---|---|---|---|
111
+ | `apiKey` | `string` | ✓ | — |
112
+ | `workspaceId` | `string` | ✓ | — |
113
+ | `baseUrl` | `string` | | `https://pilcrow.entrustai.co` |
114
+ | `timeoutMs` | `number` | | `30000` |
115
+
116
+ ---
117
+
118
+ ### `client.check(text, options?): Promise<CheckResult>`
119
+
120
+ Lint a string against your Protocol Contract.
121
+
122
+ ```typescript
123
+ interface CheckResult {
124
+ verdict: 'RELEASE' | 'REJECT';
125
+ score: { score: number; grade: string; violations: number; warnings: number };
126
+ findings: Finding[];
127
+ repair_guidance: string[];
128
+ audit_token: string;
129
+ protocol_version: string;
130
+ model?: string;
131
+ }
132
+ ```
133
+
134
+ ---
135
+
136
+ ### `client.withGuardrails(options): Promise<GuardrailsResult>`
137
+
138
+ Auto-retry middleware.
139
+
140
+ ```typescript
141
+ interface WithGuardrailsOptions {
142
+ llmCallable: (prompt: string) => Promise<string>;
143
+ prompt: string;
144
+ maxRetries?: number; // default: 3
145
+ protocolVersion?: string;
146
+ model?: string;
147
+ }
148
+
149
+ interface GuardrailsResult {
150
+ text: string;
151
+ attempts: number;
152
+ final_check: CheckResult;
153
+ check_results: CheckResult[];
154
+ audit_token: string;
155
+ }
156
+ ```
157
+
158
+ Throws `PilcrowMaxRetriesExceeded` if RELEASE is not achieved. The exception carries `.lastResult` (the final `CheckResult`) so you can log findings or route to a human review queue.
159
+
160
+ ---
161
+
162
+ ## Error Types
163
+
164
+ | Class | When |
165
+ |---|---|
166
+ | `PilcrowError` | Base class for all SDK errors |
167
+ | `PilcrowAuthError` | Invalid API key or workspace ID (HTTP 401/403) |
168
+ | `PilcrowAPIError` | Unexpected API error (`.status`, `.body` attached) |
169
+ | `PilcrowContractError` | Unexpected response shape from API |
170
+ | `PilcrowMaxRetriesExceeded` | `withGuardrails()` exhausted retries (`.lastResult` attached) |
171
+
172
+ ---
173
+
174
+ ## Get an API Key
175
+
176
+ Visit [entrustai.co](https://entrustai.co) to get your API key and workspace ID.
177
+
178
+ ---
179
+
180
+ © 2026 ENTRUST AI. The Pilcrow is a trademark of ENTRUST AI.
@@ -0,0 +1,45 @@
1
+ import type { PilcrowClientOptions, CheckOptions, CheckResult, GuardrailsResult, WithGuardrailsOptions } from "./types.js";
2
+ export declare class PilcrowClient {
3
+ private readonly apiKey;
4
+ private readonly workspaceId;
5
+ private readonly baseUrl;
6
+ private readonly timeoutMs;
7
+ constructor(options: PilcrowClientOptions);
8
+ /**
9
+ * Lint a piece of AI-generated text against your Protocol Contract.
10
+ * Returns a CheckResult with verdict (RELEASE | REJECT), findings,
11
+ * repair guidance, and a cryptographic audit token.
12
+ *
13
+ * @example
14
+ * const result = await client.check("The patient should probably take this.");
15
+ * console.log(result.verdict); // "REJECT"
16
+ * console.log(result.repair_guidance); // ["Remove hedging language..."]
17
+ */
18
+ check(text: string, options?: CheckOptions): Promise<CheckResult>;
19
+ /**
20
+ * Auto-retry middleware. Calls your LLM, lints the output, and automatically
21
+ * re-prompts with deterministic repair guidance until RELEASE or maxRetries
22
+ * is exhausted.
23
+ *
24
+ * Works with any async function that accepts a string and returns a string:
25
+ * OpenAI, Anthropic, AWS Bedrock, LangChain, LlamaIndex, custom callables.
26
+ *
27
+ * @throws {PilcrowMaxRetriesExceeded} if RELEASE is not achieved.
28
+ * Inspect error.lastResult to log or route to human review.
29
+ *
30
+ * @example
31
+ * const result = await client.withGuardrails({
32
+ * llmCallable: myLlm,
33
+ * prompt: "Write a medical discharge summary for patient Jane Doe.",
34
+ * maxRetries: 3,
35
+ * });
36
+ * console.log(result.text); // Compliant output — guaranteed
37
+ * console.log(result.attempts); // e.g. 2
38
+ * console.log(result.audit_token); // Cryptographic attestation
39
+ */
40
+ withGuardrails(options: WithGuardrailsOptions): Promise<GuardrailsResult>;
41
+ private _buildRepairPrompt;
42
+ private _post;
43
+ private _parseCheckResult;
44
+ }
45
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAMpB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,OAAO,EAAE,oBAAoB;IAYzC;;;;;;;;;OASG;IACG,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAc3E;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8C/E,OAAO,CAAC,kBAAkB;YAkBZ,KAAK;IAoCnB,OAAO,CAAC,iBAAiB;CAyC1B"}
package/dist/client.js ADDED
@@ -0,0 +1,182 @@
1
+ // ─────────────────────────────────────────────────────────────────────────────
2
+ // The Pilcrow™ Node.js SDK — PilcrowClient
3
+ // © 2026 ENTRUST AI (entrustai.co). All rights reserved.
4
+ // ─────────────────────────────────────────────────────────────────────────────
5
+ import { PilcrowAuthError, PilcrowAPIError, PilcrowContractError, PilcrowMaxRetriesExceeded, } from "./exceptions.js";
6
+ const DEFAULT_BASE_URL = "https://pilcrow.entrustai.co";
7
+ const DEFAULT_TIMEOUT_MS = 30_000;
8
+ const DEFAULT_MAX_RETRIES = 3;
9
+ export class PilcrowClient {
10
+ apiKey;
11
+ workspaceId;
12
+ baseUrl;
13
+ timeoutMs;
14
+ constructor(options) {
15
+ if (!options.apiKey)
16
+ throw new PilcrowAuthError("apiKey is required.");
17
+ if (!options.workspaceId)
18
+ throw new PilcrowAuthError("workspaceId is required.");
19
+ this.apiKey = options.apiKey;
20
+ this.workspaceId = options.workspaceId;
21
+ this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
22
+ this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
23
+ }
24
+ // ─── Low-level: check() ──────────────────────────────────────────────────
25
+ /**
26
+ * Lint a piece of AI-generated text against your Protocol Contract.
27
+ * Returns a CheckResult with verdict (RELEASE | REJECT), findings,
28
+ * repair guidance, and a cryptographic audit token.
29
+ *
30
+ * @example
31
+ * const result = await client.check("The patient should probably take this.");
32
+ * console.log(result.verdict); // "REJECT"
33
+ * console.log(result.repair_guidance); // ["Remove hedging language..."]
34
+ */
35
+ async check(text, options = {}) {
36
+ const payload = {
37
+ text,
38
+ workspaceId: this.workspaceId,
39
+ ...(options.protocolVersion && { protocolVersion: options.protocolVersion }),
40
+ ...(options.model && { model: options.model }),
41
+ };
42
+ const data = await this._post("/pilcrow/check", payload);
43
+ return this._parseCheckResult(data);
44
+ }
45
+ // ─── High-level: withGuardrails() ────────────────────────────────────────
46
+ /**
47
+ * Auto-retry middleware. Calls your LLM, lints the output, and automatically
48
+ * re-prompts with deterministic repair guidance until RELEASE or maxRetries
49
+ * is exhausted.
50
+ *
51
+ * Works with any async function that accepts a string and returns a string:
52
+ * OpenAI, Anthropic, AWS Bedrock, LangChain, LlamaIndex, custom callables.
53
+ *
54
+ * @throws {PilcrowMaxRetriesExceeded} if RELEASE is not achieved.
55
+ * Inspect error.lastResult to log or route to human review.
56
+ *
57
+ * @example
58
+ * const result = await client.withGuardrails({
59
+ * llmCallable: myLlm,
60
+ * prompt: "Write a medical discharge summary for patient Jane Doe.",
61
+ * maxRetries: 3,
62
+ * });
63
+ * console.log(result.text); // Compliant output — guaranteed
64
+ * console.log(result.attempts); // e.g. 2
65
+ * console.log(result.audit_token); // Cryptographic attestation
66
+ */
67
+ async withGuardrails(options) {
68
+ const maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
69
+ const checkOptions = {
70
+ protocolVersion: options.protocolVersion,
71
+ model: options.model,
72
+ };
73
+ const checkResults = [];
74
+ let currentPrompt = options.prompt;
75
+ let lastText = "";
76
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
77
+ // 1. Call the LLM
78
+ lastText = await options.llmCallable(currentPrompt);
79
+ // 2. Lint the output
80
+ const result = await this.check(lastText, checkOptions);
81
+ checkResults.push(result);
82
+ // 3. RELEASE — we're done
83
+ if (result.verdict === "RELEASE") {
84
+ return {
85
+ text: lastText,
86
+ attempts: attempt,
87
+ final_check: result,
88
+ check_results: checkResults,
89
+ audit_token: result.audit_token,
90
+ };
91
+ }
92
+ // 4. REJECT — build a context-aware repair prompt for the next attempt
93
+ if (attempt < maxRetries) {
94
+ currentPrompt = this._buildRepairPrompt(options.prompt, lastText, result.repair_guidance);
95
+ }
96
+ }
97
+ // All retries exhausted — throw with last result attached
98
+ throw new PilcrowMaxRetriesExceeded(maxRetries, checkResults[checkResults.length - 1]);
99
+ }
100
+ // ─── Internal helpers ────────────────────────────────────────────────────
101
+ _buildRepairPrompt(originalPrompt, rejectedDraft, repairGuidance) {
102
+ const guidanceList = repairGuidance
103
+ .map((g, i) => `${i + 1}. ${g}`)
104
+ .join("\n");
105
+ return (`ORIGINAL INSTRUCTIONS\n${originalPrompt}\n\n` +
106
+ `--- YOUR PREVIOUS DRAFT ---\n${rejectedDraft}\n\n` +
107
+ `COMPLIANCE CORRECTIONS REQUIRED\n` +
108
+ `Your previous draft was rejected by the compliance linter. ` +
109
+ `Rewrite it addressing every item below:\n${guidanceList}`);
110
+ }
111
+ async _post(path, body) {
112
+ const url = `${this.baseUrl}${path}`;
113
+ const controller = new AbortController();
114
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
115
+ let response;
116
+ try {
117
+ response = await fetch(url, {
118
+ method: "POST",
119
+ headers: {
120
+ "Content-Type": "application/json",
121
+ "x-api-key": this.apiKey,
122
+ },
123
+ body: JSON.stringify(body),
124
+ signal: controller.signal,
125
+ });
126
+ }
127
+ catch (err) {
128
+ const msg = err instanceof Error ? err.message : String(err);
129
+ throw new PilcrowAPIError(0, `Network error: ${msg}`);
130
+ }
131
+ finally {
132
+ clearTimeout(timer);
133
+ }
134
+ if (response.status === 401 || response.status === 403) {
135
+ throw new PilcrowAuthError("Invalid API key or workspace ID.");
136
+ }
137
+ const data = await response.json().catch(() => null);
138
+ if (!response.ok) {
139
+ throw new PilcrowAPIError(response.status, data);
140
+ }
141
+ return data;
142
+ }
143
+ _parseCheckResult(data) {
144
+ if (typeof data !== "object" || data === null) {
145
+ throw new PilcrowContractError("Unexpected API response shape.");
146
+ }
147
+ const d = data;
148
+ if (!d.gate || !d.score || !d.findings) {
149
+ throw new PilcrowContractError("Missing required fields in API response.");
150
+ }
151
+ const gate = d.gate;
152
+ const score = d.score;
153
+ const findings = d.findings.map((f) => {
154
+ const fi = f;
155
+ return {
156
+ rule: String(fi.rule ?? ""),
157
+ message: String(fi.message ?? ""),
158
+ severity: (fi.severity ?? "info"),
159
+ weight: Number(fi.weight ?? 0),
160
+ };
161
+ });
162
+ const repairGuidance = Array.isArray(d.repair_guidance)
163
+ ? d.repair_guidance.map(String)
164
+ : (gate.reasons ?? []).map(String);
165
+ return {
166
+ verdict: String(gate.status ?? "REJECT"),
167
+ score: {
168
+ score: Number(score.score ?? 0),
169
+ grade: String(score.grade ?? ""),
170
+ violations: Number(score.violations ?? 0),
171
+ warnings: Number(score.warnings ?? 0),
172
+ },
173
+ findings,
174
+ repair_guidance: repairGuidance,
175
+ audit_token: String(d.audit_token ?? d.auditToken ?? ""),
176
+ protocol_version: String(d.protocolVersion ?? d.protocol_version ?? ""),
177
+ model: d.model ? String(d.model) : undefined,
178
+ meta: typeof d.meta === "object" ? d.meta : undefined,
179
+ };
180
+ }
181
+ }
182
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,2CAA2C;AAC3C,yDAAyD;AACzD,gFAAgF;AAEhF,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAUzB,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AACxD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,MAAM,OAAO,aAAa;IACP,MAAM,CAAS;IACf,WAAW,CAAS;IACpB,OAAO,CAAS;IAChB,SAAS,CAAS;IAEnC,YAAY,OAA6B;QACvC,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,MAAM,IAAI,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO,CAAC,WAAW;YAAE,MAAM,IAAI,gBAAgB,CAAC,0BAA0B,CAAC,CAAC;QAEjF,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,SA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E,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;gBAChC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC;gBACzC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC;aACtC;YACD,QAAQ;YACR,eAAe,EAAE,cAAc;YAC/B,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC;YACxD,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,gBAAgB,IAAI,EAAE,CAAC;YACvE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;YAC5C,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAE,CAAC,CAAC,IAAgC,CAAC,CAAC,CAAC,SAAS;SACnF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ import type { CheckResult } from "./types.js";
2
+ /** Base error for all Pilcrow SDK errors. */
3
+ export declare class PilcrowError extends Error {
4
+ constructor(message: string);
5
+ }
6
+ /** Thrown when the API key or workspace ID is rejected (HTTP 401 / 403). */
7
+ export declare class PilcrowAuthError extends PilcrowError {
8
+ constructor(message?: string);
9
+ }
10
+ /** Thrown when the API returns an unexpected error response. */
11
+ export declare class PilcrowAPIError extends PilcrowError {
12
+ readonly status: number;
13
+ readonly body: unknown;
14
+ constructor(status: number, body: unknown);
15
+ }
16
+ /** Thrown when the contract shape returned by the API is unexpected. */
17
+ export declare class PilcrowContractError extends PilcrowError {
18
+ constructor(message: string);
19
+ }
20
+ /**
21
+ * Thrown by withGuardrails() when max retries are exhausted without a RELEASE.
22
+ * Inspect `lastResult` to log findings, route to human review, or alert.
23
+ */
24
+ export declare class PilcrowMaxRetriesExceeded extends PilcrowError {
25
+ readonly lastResult: CheckResult;
26
+ readonly attempts: number;
27
+ constructor(attempts: number, lastResult: CheckResult);
28
+ }
29
+ //# sourceMappingURL=exceptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,6CAA6C;AAC7C,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAI5B;AAED,4EAA4E;AAC5E,qBAAa,gBAAiB,SAAQ,YAAY;gBACpC,OAAO,SAAqC;CAIzD;AAED,gEAAgE;AAChE,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,IAAI,EAAE,OAAO,CAAC;gBAElB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM1C;AAED,wEAAwE;AACxE,qBAAa,oBAAqB,SAAQ,YAAY;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,YAAY;IACzD,SAAgB,UAAU,EAAE,WAAW,CAAC;IACxC,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW;CAStD"}
@@ -0,0 +1,52 @@
1
+ // ─────────────────────────────────────────────────────────────────────────────
2
+ // The Pilcrow™ Node.js SDK — Exceptions
3
+ // © 2026 ENTRUST AI (entrustai.co). All rights reserved.
4
+ // ─────────────────────────────────────────────────────────────────────────────
5
+ /** Base error for all Pilcrow SDK errors. */
6
+ export class PilcrowError extends Error {
7
+ constructor(message) {
8
+ super(message);
9
+ this.name = "PilcrowError";
10
+ }
11
+ }
12
+ /** Thrown when the API key or workspace ID is rejected (HTTP 401 / 403). */
13
+ export class PilcrowAuthError extends PilcrowError {
14
+ constructor(message = "Invalid API key or workspace ID.") {
15
+ super(message);
16
+ this.name = "PilcrowAuthError";
17
+ }
18
+ }
19
+ /** Thrown when the API returns an unexpected error response. */
20
+ export class PilcrowAPIError extends PilcrowError {
21
+ status;
22
+ body;
23
+ constructor(status, body) {
24
+ super(`Pilcrow API error: HTTP ${status}`);
25
+ this.name = "PilcrowAPIError";
26
+ this.status = status;
27
+ this.body = body;
28
+ }
29
+ }
30
+ /** Thrown when the contract shape returned by the API is unexpected. */
31
+ export class PilcrowContractError extends PilcrowError {
32
+ constructor(message) {
33
+ super(message);
34
+ this.name = "PilcrowContractError";
35
+ }
36
+ }
37
+ /**
38
+ * Thrown by withGuardrails() when max retries are exhausted without a RELEASE.
39
+ * Inspect `lastResult` to log findings, route to human review, or alert.
40
+ */
41
+ export class PilcrowMaxRetriesExceeded extends PilcrowError {
42
+ lastResult;
43
+ attempts;
44
+ constructor(attempts, lastResult) {
45
+ super(`Pilcrow: max retries (${attempts}) exhausted — final verdict: REJECT. ` +
46
+ `Inspect lastResult for findings.`);
47
+ this.name = "PilcrowMaxRetriesExceeded";
48
+ this.attempts = attempts;
49
+ this.lastResult = lastResult;
50
+ }
51
+ }
52
+ //# sourceMappingURL=exceptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,yDAAyD;AACzD,gFAAgF;AAIhF,6CAA6C;AAC7C,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,4EAA4E;AAC5E,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAChD,YAAY,OAAO,GAAG,kCAAkC;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,gEAAgE;AAChE,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/B,MAAM,CAAS;IACf,IAAI,CAAU;IAE9B,YAAY,MAAc,EAAE,IAAa;QACvC,KAAK,CAAC,2BAA2B,MAAM,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,wEAAwE;AACxE,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,YAAY;IACzC,UAAU,CAAc;IACxB,QAAQ,CAAS;IAEjC,YAAY,QAAgB,EAAE,UAAuB;QACnD,KAAK,CACH,yBAAyB,QAAQ,uCAAuC;YACxE,kCAAkC,CACnC,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export { PilcrowClient } from "./client.js";
2
+ export { PilcrowError, PilcrowAuthError, PilcrowAPIError, PilcrowContractError, PilcrowMaxRetriesExceeded, } from "./exceptions.js";
3
+ export type { Severity, Verdict, Finding, Score, CheckResult, GuardrailsResult, PilcrowClientOptions, CheckOptions, WithGuardrailsOptions, } from "./types.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,QAAQ,EACR,OAAO,EACP,OAAO,EACP,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ // ─────────────────────────────────────────────────────────────────────────────
2
+ // The Pilcrow™ Node.js SDK
3
+ // © 2026 ENTRUST AI (entrustai.co). All rights reserved.
4
+ // ─────────────────────────────────────────────────────────────────────────────
5
+ export { PilcrowClient } from "./client.js";
6
+ export { PilcrowError, PilcrowAuthError, PilcrowAPIError, PilcrowContractError, PilcrowMaxRetriesExceeded, } from "./exceptions.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,2BAA2B;AAC3B,yDAAyD;AACzD,gFAAgF;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,66 @@
1
+ export type Severity = "violation" | "warning" | "info";
2
+ export type Verdict = "RELEASE" | "REJECT";
3
+ /** A single rule finding returned by the linter. */
4
+ export interface Finding {
5
+ rule: string;
6
+ message: string;
7
+ severity: Severity;
8
+ weight: number;
9
+ }
10
+ /** Score block returned with every lint result. */
11
+ export interface Score {
12
+ score: number;
13
+ grade: string;
14
+ violations: number;
15
+ warnings: number;
16
+ }
17
+ /** The result of a single client.check() call. */
18
+ export interface CheckResult {
19
+ verdict: Verdict;
20
+ score: Score;
21
+ findings: Finding[];
22
+ repair_guidance: string[];
23
+ audit_token: string;
24
+ protocol_version: string;
25
+ model?: string;
26
+ meta?: Record<string, unknown>;
27
+ }
28
+ /** The result of a client.withGuardrails() call. */
29
+ export interface GuardrailsResult {
30
+ /** The final compliant text. */
31
+ text: string;
32
+ /** Number of LLM attempts made (1 = passed on first try). */
33
+ attempts: number;
34
+ /** The final CheckResult (always RELEASE). */
35
+ final_check: CheckResult;
36
+ /** All CheckResults from every attempt, in order. */
37
+ check_results: CheckResult[];
38
+ /** Audit token from the final RELEASE check. */
39
+ audit_token: string;
40
+ }
41
+ /** Options for constructing a PilcrowClient. */
42
+ export interface PilcrowClientOptions {
43
+ apiKey: string;
44
+ workspaceId: string;
45
+ /** Override the API base URL. Defaults to https://pilcrow.entrustai.co */
46
+ baseUrl?: string;
47
+ /** Request timeout in milliseconds. Defaults to 30000 (30s). */
48
+ timeoutMs?: number;
49
+ }
50
+ /** Options for client.check(). */
51
+ export interface CheckOptions {
52
+ protocolVersion?: string;
53
+ model?: string;
54
+ }
55
+ /** Options for client.withGuardrails(). */
56
+ export interface WithGuardrailsOptions {
57
+ /** The async LLM callable — any function that takes a string and returns a string. */
58
+ llmCallable: (prompt: string) => Promise<string>;
59
+ /** The original prompt to send to the LLM. */
60
+ prompt: string;
61
+ /** Maximum retry attempts. Defaults to 3. */
62
+ maxRetries?: number;
63
+ protocolVersion?: string;
64
+ model?: string;
65
+ }
66
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AACxD,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE3C,oDAAoD;AACpD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAA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AAM,CAAC,CAAC;IACjD,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ // ─────────────────────────────────────────────────────────────────────────────
2
+ // The Pilcrow™ Node.js SDK — Type Definitions
3
+ // © 2026 ENTRUST AI (entrustai.co). All rights reserved.
4
+ // ─────────────────────────────────────────────────────────────────────────────
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8CAA8C;AAC9C,yDAAyD;AACzD,gFAAgF"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@entrustai/pilcrow",
3
+ "version": "1.0.0",
4
+ "description": "Official Node.js / TypeScript SDK for The Pilcrow™ — Deterministic AI Governance Linter by ENTRUST AI.",
5
+ "author": "ENTRUST AI <contact@entrustai.co> (https://entrustai.co)",
6
+ "license": "MIT",
7
+ "homepage": "https://entrustai.co",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/entrustai/pilcrow-node"
11
+ },
12
+ "keywords": [
13
+ "pilcrow",
14
+ "entrust-ai",
15
+ "ai-governance",
16
+ "compliance",
17
+ "linter",
18
+ "llm",
19
+ "openai",
20
+ "anthropic",
21
+ "guardrails",
22
+ "typescript"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "import": "./dist/index.js",
30
+ "types": "./dist/index.d.ts"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "engines": {
42
+ "node": ">=18.0.0"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc",
46
+ "prepublishOnly": "npm run build"
47
+ },
48
+ "dependencies": {},
49
+ "devDependencies": {
50
+ "typescript": "^5.4.0"
51
+ }
52
+ }