promptguard-sdk 1.5.1 → 1.6.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 +12 -12
- package/dist/auto.d.ts +1 -2
- package/dist/auto.d.ts.map +1 -1
- package/dist/auto.js +6 -19
- package/dist/auto.js.map +1 -1
- package/dist/client.d.ts +219 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +198 -0
- package/dist/client.js.map +1 -0
- package/dist/guard.d.ts +1 -1
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +6 -4
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +4 -224
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -202
- package/dist/index.js.map +1 -1
- package/dist/integrations/langchain.d.ts +1 -5
- package/dist/integrations/langchain.d.ts.map +1 -1
- package/dist/integrations/langchain.js +4 -23
- package/dist/integrations/langchain.js.map +1 -1
- package/dist/integrations/vercel-ai.d.ts +3 -3
- package/dist/integrations/vercel-ai.d.ts.map +1 -1
- package/dist/integrations/vercel-ai.js +6 -23
- package/dist/integrations/vercel-ai.js.map +1 -1
- package/dist/patches/anthropic.d.ts +2 -2
- package/dist/patches/anthropic.d.ts.map +1 -1
- package/dist/patches/anthropic.js +32 -74
- package/dist/patches/anthropic.js.map +1 -1
- package/dist/patches/base.d.ts +20 -0
- package/dist/patches/base.d.ts.map +1 -0
- package/dist/patches/base.js +63 -0
- package/dist/patches/base.js.map +1 -0
- package/dist/patches/bedrock.d.ts +1 -1
- package/dist/patches/bedrock.d.ts.map +1 -1
- package/dist/patches/bedrock.js +28 -69
- package/dist/patches/bedrock.js.map +1 -1
- package/dist/patches/cohere.d.ts +1 -1
- package/dist/patches/cohere.d.ts.map +1 -1
- package/dist/patches/cohere.js +16 -56
- package/dist/patches/cohere.js.map +1 -1
- package/dist/patches/google.d.ts +2 -2
- package/dist/patches/google.d.ts.map +1 -1
- package/dist/patches/google.js +17 -53
- package/dist/patches/google.js.map +1 -1
- package/dist/patches/openai.d.ts +2 -2
- package/dist/patches/openai.d.ts.map +1 -1
- package/dist/patches/openai.js +21 -64
- package/dist/patches/openai.js.map +1 -1
- package/dist/resolve.d.ts +9 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +19 -0
- package/dist/resolve.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# PromptGuard Node.js SDK
|
|
2
2
|
|
|
3
|
-
Drop-in security for AI applications. Secure any GenAI app
|
|
3
|
+
Drop-in security for AI applications. Secure any GenAI app - regardless of framework or LLM provider.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,12 +10,12 @@ npm install promptguard-sdk
|
|
|
10
10
|
|
|
11
11
|
## Option 1: Auto-Instrumentation (Recommended)
|
|
12
12
|
|
|
13
|
-
One line secures **every** LLM call in your application
|
|
13
|
+
One line secures **every** LLM call in your application - no matter which framework you use.
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
import { init } from 'promptguard-sdk';
|
|
17
17
|
|
|
18
|
-
// Call once at startup
|
|
18
|
+
// Call once at startup - before any LLM SDK usage.
|
|
19
19
|
init({ apiKey: 'pg_xxx' });
|
|
20
20
|
|
|
21
21
|
// Everything below is now secured transparently.
|
|
@@ -46,10 +46,10 @@ Any framework built on these SDKs is automatically covered: **LangChain.js**, **
|
|
|
46
46
|
### Modes
|
|
47
47
|
|
|
48
48
|
```typescript
|
|
49
|
-
// Enforce mode (default)
|
|
49
|
+
// Enforce mode (default) - blocks policy violations.
|
|
50
50
|
init({ apiKey: 'pg_xxx', mode: 'enforce' });
|
|
51
51
|
|
|
52
|
-
// Monitor mode
|
|
52
|
+
// Monitor mode - logs threats but never blocks. Good for shadow deployment.
|
|
53
53
|
init({ apiKey: 'pg_xxx', mode: 'monitor' });
|
|
54
54
|
```
|
|
55
55
|
|
|
@@ -136,7 +136,7 @@ const result = await chain.invoke(
|
|
|
136
136
|
);
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
The callback handler provides rich context to PromptGuard
|
|
139
|
+
The callback handler provides rich context to PromptGuard - chain names, tool calls, agent steps - for more precise threat detection.
|
|
140
140
|
|
|
141
141
|
### Vercel AI SDK
|
|
142
142
|
|
|
@@ -202,7 +202,7 @@ const pg = new PromptGuard({
|
|
|
202
202
|
});
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
Retries use exponential backoff starting from `retryDelay`. Only transient errors (network timeouts, 5xx responses) are retried
|
|
205
|
+
Retries use exponential backoff starting from `retryDelay`. Only transient errors (network timeouts, 5xx responses) are retried; client errors (4xx) fail immediately.
|
|
206
206
|
|
|
207
207
|
## Embeddings
|
|
208
208
|
|
|
@@ -263,12 +263,12 @@ console.log(`Total patterns: ${stats.total_patterns}`);
|
|
|
263
263
|
|
|
264
264
|
| Option | Environment Variable | Default | Description |
|
|
265
265
|
|--------|---------------------|---------|-------------|
|
|
266
|
-
| `apiKey` | `PROMPTGUARD_API_KEY` |
|
|
266
|
+
| `apiKey` | `PROMPTGUARD_API_KEY` | - | PromptGuard API key (required) |
|
|
267
267
|
| `baseUrl` | `PROMPTGUARD_BASE_URL` | `https://api.promptguard.co/api/v1` | API base URL |
|
|
268
|
-
| `mode` |
|
|
269
|
-
| `failOpen` |
|
|
270
|
-
| `scanResponses` |
|
|
271
|
-
| `timeout` |
|
|
268
|
+
| `mode` | - | `"enforce"` | `"enforce"` or `"monitor"` |
|
|
269
|
+
| `failOpen` | - | `true` | Allow calls when Guard API is unreachable |
|
|
270
|
+
| `scanResponses` | - | `false` | Also scan LLM responses |
|
|
271
|
+
| `timeout` | - | `10000` | HTTP timeout in milliseconds |
|
|
272
272
|
|
|
273
273
|
## Error Handling
|
|
274
274
|
|
package/dist/auto.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Auto-instrumentation for PromptGuard (Node.js).
|
|
3
3
|
*
|
|
4
4
|
* Call {@link init} once at application startup to automatically
|
|
5
|
-
* secure **all** LLM calls made through popular SDKs
|
|
5
|
+
* secure **all** LLM calls made through popular SDKs - regardless of
|
|
6
6
|
* which framework (LangChain.js, Vercel AI SDK, etc.) sits on top.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -36,5 +36,4 @@ export declare function getGuardClient(): GuardClient | null;
|
|
|
36
36
|
export declare function getMode(): "enforce" | "monitor";
|
|
37
37
|
export declare function isFailOpen(): boolean;
|
|
38
38
|
export declare function shouldScanResponses(): boolean;
|
|
39
|
-
export declare function isInitialized(): boolean;
|
|
40
39
|
//# sourceMappingURL=auto.d.ts.map
|
package/dist/auto.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../src/auto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAkBrC,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mFAAmF;IACnF,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kDAAkD;IAClD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../src/auto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAkBrC,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mFAAmF;IACnF,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kDAAkD;IAClD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,IAAI,CAuBpD;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAU/B;AAMD,wBAAgB,cAAc,IAAI,WAAW,GAAG,IAAI,CAEnD;AAED,wBAAgB,OAAO,IAAI,SAAS,GAAG,SAAS,CAE/C;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C"}
|
package/dist/auto.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Auto-instrumentation for PromptGuard (Node.js).
|
|
4
4
|
*
|
|
5
5
|
* Call {@link init} once at application startup to automatically
|
|
6
|
-
* secure **all** LLM calls made through popular SDKs
|
|
6
|
+
* secure **all** LLM calls made through popular SDKs - regardless of
|
|
7
7
|
* which framework (LangChain.js, Vercel AI SDK, etc.) sits on top.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -25,8 +25,8 @@ exports.getGuardClient = getGuardClient;
|
|
|
25
25
|
exports.getMode = getMode;
|
|
26
26
|
exports.isFailOpen = isFailOpen;
|
|
27
27
|
exports.shouldScanResponses = shouldScanResponses;
|
|
28
|
-
exports.isInitialized = isInitialized;
|
|
29
28
|
const guard_1 = require("./guard");
|
|
29
|
+
const resolve_1 = require("./resolve");
|
|
30
30
|
// ---------------------------------------------------------------------------
|
|
31
31
|
// Global state
|
|
32
32
|
// ---------------------------------------------------------------------------
|
|
@@ -34,30 +34,22 @@ let guardClient = null;
|
|
|
34
34
|
let mode = "enforce";
|
|
35
35
|
let failOpen = true;
|
|
36
36
|
let scanResponses = false;
|
|
37
|
-
let initialized = false;
|
|
38
37
|
const appliedPatches = [];
|
|
39
38
|
function init(options = {}) {
|
|
40
|
-
const
|
|
41
|
-
if (!resolvedKey) {
|
|
42
|
-
throw new Error("PromptGuard API key required. Pass apiKey or set the " +
|
|
43
|
-
"PROMPTGUARD_API_KEY environment variable.");
|
|
44
|
-
}
|
|
45
|
-
const resolvedUrl = options.baseUrl ?? process.env.PROMPTGUARD_BASE_URL ?? "https://api.promptguard.co/api/v1";
|
|
39
|
+
const { apiKey, baseUrl } = (0, resolve_1.resolveCredentials)(options.apiKey, options.baseUrl);
|
|
46
40
|
const resolvedMode = options.mode ?? "enforce";
|
|
47
41
|
if (resolvedMode !== "enforce" && resolvedMode !== "monitor") {
|
|
48
42
|
throw new Error("mode must be 'enforce' or 'monitor'");
|
|
49
43
|
}
|
|
50
44
|
guardClient = new guard_1.GuardClient({
|
|
51
|
-
apiKey
|
|
52
|
-
baseUrl
|
|
45
|
+
apiKey,
|
|
46
|
+
baseUrl,
|
|
53
47
|
timeout: options.timeout ?? 10000,
|
|
54
48
|
});
|
|
55
49
|
mode = resolvedMode;
|
|
56
50
|
failOpen = options.failOpen ?? true;
|
|
57
51
|
scanResponses = options.scanResponses ?? false;
|
|
58
|
-
initialized = true;
|
|
59
52
|
applyPatches();
|
|
60
|
-
// eslint-disable-next-line no-console
|
|
61
53
|
console.log(`[promptguard] auto-instrumentation initialised (mode=${mode}, fail_open=${failOpen})`);
|
|
62
54
|
}
|
|
63
55
|
function shutdown() {
|
|
@@ -71,7 +63,6 @@ function shutdown() {
|
|
|
71
63
|
}
|
|
72
64
|
appliedPatches.length = 0;
|
|
73
65
|
guardClient = null;
|
|
74
|
-
initialized = false;
|
|
75
66
|
}
|
|
76
67
|
// ---------------------------------------------------------------------------
|
|
77
68
|
// Accessors (used by patches)
|
|
@@ -88,9 +79,6 @@ function isFailOpen() {
|
|
|
88
79
|
function shouldScanResponses() {
|
|
89
80
|
return scanResponses;
|
|
90
81
|
}
|
|
91
|
-
function isInitialized() {
|
|
92
|
-
return initialized;
|
|
93
|
-
}
|
|
94
82
|
// ---------------------------------------------------------------------------
|
|
95
83
|
// Patch orchestration
|
|
96
84
|
// ---------------------------------------------------------------------------
|
|
@@ -104,14 +92,13 @@ function applyPatches() {
|
|
|
104
92
|
];
|
|
105
93
|
for (const mod of patchModules) {
|
|
106
94
|
try {
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
108
95
|
const patchModule = require(mod.path);
|
|
109
96
|
if (patchModule.apply()) {
|
|
110
97
|
appliedPatches.push({ name: mod.name, revert: patchModule.revert });
|
|
111
98
|
}
|
|
112
99
|
}
|
|
113
100
|
catch {
|
|
114
|
-
// SDK not installed or incompatible
|
|
101
|
+
// SDK not installed or incompatible - skip silently
|
|
115
102
|
}
|
|
116
103
|
}
|
|
117
104
|
}
|
package/dist/auto.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.js","sourceRoot":"","sources":["../src/auto.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;AAiCH,
|
|
1
|
+
{"version":3,"file":"auto.js","sourceRoot":"","sources":["../src/auto.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;AAiCH,oBAuBC;AAED,4BAUC;AAMD,wCAEC;AAED,0BAEC;AAED,gCAEC;AAED,kDAEC;AAtFD,mCAAqC;AACrC,uCAA8C;AAE9C,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,IAAI,WAAW,GAAuB,IAAI,CAAA;AAC1C,IAAI,IAAI,GAA0B,SAAS,CAAA;AAC3C,IAAI,QAAQ,GAAG,IAAI,CAAA;AACnB,IAAI,aAAa,GAAG,KAAK,CAAA;AAEzB,MAAM,cAAc,GAAgD,EAAE,CAAA;AAmBtE,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AO,aAAa,CAAA;AACtB,CAAC;AAED,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,SAAS,YAAY;IACnB,MAAM,YAAY,GAAG;QACnB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC5C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,qBAAqB,EAAE;QAClD,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC5C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC5C,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,mBAAmB,EAAE;KAC/C,CAAA;IAED,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAGnC,CAAA;YACD,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC;gBACxB,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAA;YACrE,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,oDAAoD;QACtD,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PromptGuard proxy client — OpenAI-compatible API with built-in
|
|
3
|
+
* security scanning, retry logic, and namespace helpers.
|
|
4
|
+
*/
|
|
5
|
+
interface PromptGuardConfig {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
timeout?: number;
|
|
9
|
+
maxRetries?: number;
|
|
10
|
+
retryDelay?: number;
|
|
11
|
+
}
|
|
12
|
+
interface Message {
|
|
13
|
+
role: "system" | "user" | "assistant";
|
|
14
|
+
content: string;
|
|
15
|
+
}
|
|
16
|
+
interface ChatCompletionRequest {
|
|
17
|
+
model: string;
|
|
18
|
+
messages: Message[];
|
|
19
|
+
temperature?: number;
|
|
20
|
+
maxTokens?: number;
|
|
21
|
+
stream?: boolean;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
interface ChatCompletionResponse {
|
|
25
|
+
id: string;
|
|
26
|
+
object: string;
|
|
27
|
+
created: number;
|
|
28
|
+
model: string;
|
|
29
|
+
choices: Array<{
|
|
30
|
+
index: number;
|
|
31
|
+
message: Message;
|
|
32
|
+
finish_reason: string;
|
|
33
|
+
}>;
|
|
34
|
+
usage?: {
|
|
35
|
+
prompt_tokens: number;
|
|
36
|
+
completion_tokens: number;
|
|
37
|
+
total_tokens: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface CompletionRequest {
|
|
41
|
+
model: string;
|
|
42
|
+
prompt: string;
|
|
43
|
+
temperature?: number;
|
|
44
|
+
maxTokens?: number;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
interface CompletionResponse {
|
|
48
|
+
id: string;
|
|
49
|
+
object: string;
|
|
50
|
+
created: number;
|
|
51
|
+
model: string;
|
|
52
|
+
choices: Array<{
|
|
53
|
+
text: string;
|
|
54
|
+
index: number;
|
|
55
|
+
finish_reason: string;
|
|
56
|
+
}>;
|
|
57
|
+
usage?: {
|
|
58
|
+
prompt_tokens: number;
|
|
59
|
+
completion_tokens: number;
|
|
60
|
+
total_tokens: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
interface EmbeddingRequest {
|
|
64
|
+
model: string;
|
|
65
|
+
input: string | string[];
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
interface EmbeddingResponse {
|
|
69
|
+
object: string;
|
|
70
|
+
data: Array<{
|
|
71
|
+
object: string;
|
|
72
|
+
embedding: number[];
|
|
73
|
+
index: number;
|
|
74
|
+
}>;
|
|
75
|
+
model: string;
|
|
76
|
+
usage?: {
|
|
77
|
+
prompt_tokens: number;
|
|
78
|
+
total_tokens: number;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
interface SecurityScanResult {
|
|
82
|
+
blocked: boolean;
|
|
83
|
+
decision: "allow" | "block" | "redact";
|
|
84
|
+
reason?: string;
|
|
85
|
+
threatType?: string;
|
|
86
|
+
confidence?: number;
|
|
87
|
+
}
|
|
88
|
+
interface RedactResult {
|
|
89
|
+
original: string;
|
|
90
|
+
redacted: string;
|
|
91
|
+
piiFound: string[];
|
|
92
|
+
}
|
|
93
|
+
interface ScrapeResult {
|
|
94
|
+
url: string;
|
|
95
|
+
status: "safe" | "blocked";
|
|
96
|
+
content: string;
|
|
97
|
+
threats_detected: string[];
|
|
98
|
+
message?: string;
|
|
99
|
+
}
|
|
100
|
+
interface ToolValidationResult {
|
|
101
|
+
allowed: boolean;
|
|
102
|
+
risk_score: number;
|
|
103
|
+
risk_level: string;
|
|
104
|
+
reason: string;
|
|
105
|
+
warnings: string[];
|
|
106
|
+
blocked_reasons: string[];
|
|
107
|
+
}
|
|
108
|
+
interface RedTeamTestResult {
|
|
109
|
+
test_name: string;
|
|
110
|
+
prompt: string;
|
|
111
|
+
decision: string;
|
|
112
|
+
reason: string;
|
|
113
|
+
threat_type?: string;
|
|
114
|
+
confidence: number;
|
|
115
|
+
blocked: boolean;
|
|
116
|
+
details: Record<string, unknown>;
|
|
117
|
+
}
|
|
118
|
+
interface RedTeamSummary {
|
|
119
|
+
total_tests: number;
|
|
120
|
+
blocked: number;
|
|
121
|
+
allowed: number;
|
|
122
|
+
block_rate: number;
|
|
123
|
+
results: RedTeamTestResult[];
|
|
124
|
+
}
|
|
125
|
+
interface AutonomousRedTeamRequest {
|
|
126
|
+
budget?: number;
|
|
127
|
+
target_preset?: string;
|
|
128
|
+
enabled_detectors?: string[];
|
|
129
|
+
}
|
|
130
|
+
interface AutonomousRedTeamReport {
|
|
131
|
+
grade: string;
|
|
132
|
+
bypass_rate: number;
|
|
133
|
+
total_attempts: number;
|
|
134
|
+
bypasses_found: number;
|
|
135
|
+
bypasses: Array<Record<string, unknown>>;
|
|
136
|
+
recommendations: string[];
|
|
137
|
+
}
|
|
138
|
+
interface IntelligenceStats {
|
|
139
|
+
total_patterns: number;
|
|
140
|
+
by_category: Record<string, number>;
|
|
141
|
+
by_severity: Record<string, number>;
|
|
142
|
+
recent_discoveries: number;
|
|
143
|
+
}
|
|
144
|
+
declare class ChatCompletions {
|
|
145
|
+
private client;
|
|
146
|
+
constructor(client: PromptGuard);
|
|
147
|
+
create(params: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
148
|
+
}
|
|
149
|
+
declare class Chat {
|
|
150
|
+
completions: ChatCompletions;
|
|
151
|
+
constructor(client: PromptGuard);
|
|
152
|
+
}
|
|
153
|
+
declare class Completions {
|
|
154
|
+
private client;
|
|
155
|
+
constructor(client: PromptGuard);
|
|
156
|
+
create(params: CompletionRequest): Promise<CompletionResponse>;
|
|
157
|
+
}
|
|
158
|
+
declare class Embeddings {
|
|
159
|
+
private client;
|
|
160
|
+
constructor(client: PromptGuard);
|
|
161
|
+
create(params: EmbeddingRequest): Promise<EmbeddingResponse>;
|
|
162
|
+
}
|
|
163
|
+
declare class Security {
|
|
164
|
+
private client;
|
|
165
|
+
constructor(client: PromptGuard);
|
|
166
|
+
scan(content: string, type?: "prompt" | "response"): Promise<SecurityScanResult>;
|
|
167
|
+
redact(content: string, piiTypes?: string[]): Promise<RedactResult>;
|
|
168
|
+
}
|
|
169
|
+
declare class Scrape {
|
|
170
|
+
private client;
|
|
171
|
+
constructor(client: PromptGuard);
|
|
172
|
+
url(url: string, options?: {
|
|
173
|
+
renderJs?: boolean;
|
|
174
|
+
extractText?: boolean;
|
|
175
|
+
timeout?: number;
|
|
176
|
+
}): Promise<ScrapeResult>;
|
|
177
|
+
batch(urls: string[], options?: Record<string, unknown>): Promise<{
|
|
178
|
+
job_id: string;
|
|
179
|
+
}>;
|
|
180
|
+
}
|
|
181
|
+
declare class Agent {
|
|
182
|
+
private client;
|
|
183
|
+
constructor(client: PromptGuard);
|
|
184
|
+
validateTool(agentId: string, toolName: string, args: Record<string, unknown>, sessionId?: string): Promise<ToolValidationResult>;
|
|
185
|
+
stats(agentId: string): Promise<Record<string, unknown>>;
|
|
186
|
+
}
|
|
187
|
+
declare class RedTeam {
|
|
188
|
+
private client;
|
|
189
|
+
private base;
|
|
190
|
+
constructor(client: PromptGuard);
|
|
191
|
+
listTests(): Promise<{
|
|
192
|
+
total: number;
|
|
193
|
+
tests: Array<Record<string, unknown>>;
|
|
194
|
+
}>;
|
|
195
|
+
runTest(testName: string, targetPreset?: string): Promise<RedTeamTestResult>;
|
|
196
|
+
runAll(targetPreset?: string): Promise<RedTeamSummary>;
|
|
197
|
+
runCustom(prompt: string, targetPreset?: string): Promise<RedTeamTestResult>;
|
|
198
|
+
runAutonomous(options?: AutonomousRedTeamRequest): Promise<AutonomousRedTeamReport>;
|
|
199
|
+
intelligenceStats(): Promise<IntelligenceStats>;
|
|
200
|
+
}
|
|
201
|
+
export declare class PromptGuard {
|
|
202
|
+
private config;
|
|
203
|
+
chat: Chat;
|
|
204
|
+
completions: Completions;
|
|
205
|
+
embeddings: Embeddings;
|
|
206
|
+
security: Security;
|
|
207
|
+
scrape: Scrape;
|
|
208
|
+
agent: Agent;
|
|
209
|
+
redteam: RedTeam;
|
|
210
|
+
constructor(config: PromptGuardConfig);
|
|
211
|
+
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
212
|
+
}
|
|
213
|
+
export declare class PromptGuardError extends Error {
|
|
214
|
+
code: string;
|
|
215
|
+
statusCode: number;
|
|
216
|
+
constructor(message: string, code: string, statusCode: number);
|
|
217
|
+
}
|
|
218
|
+
export default PromptGuard;
|
|
219
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"A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Aa,WAAW;IACtB,OAAO,CAAC,MAAM,CAA6B;IAE3C,IAAI,EAAE,IAAI,CAAA;IACV,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;gBAEJ,MAAM,EAAE,iBAAiB;IAoB/B,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CA8C3E;AAMD,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;gBAEN,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAM9D;AAED,eAAe,WAAW,CAAA"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PromptGuard proxy client — OpenAI-compatible API with built-in
|
|
4
|
+
* security scanning, retry logic, and namespace helpers.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PromptGuardError = exports.PromptGuard = void 0;
|
|
8
|
+
const resolve_1 = require("./resolve");
|
|
9
|
+
const version_1 = require("./version");
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Namespace classes
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
const RETRYABLE_STATUS_CODES = new Set([429, 500, 502, 503, 504]);
|
|
14
|
+
const PROXY_BASE_URL = `${resolve_1.DEFAULT_BASE_URL}/proxy`;
|
|
15
|
+
class ChatCompletions {
|
|
16
|
+
constructor(client) {
|
|
17
|
+
this.client = client;
|
|
18
|
+
}
|
|
19
|
+
async create(params) {
|
|
20
|
+
return this.client.request("POST", "/chat/completions", params);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
class Chat {
|
|
24
|
+
constructor(client) {
|
|
25
|
+
this.completions = new ChatCompletions(client);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
class Completions {
|
|
29
|
+
constructor(client) {
|
|
30
|
+
this.client = client;
|
|
31
|
+
}
|
|
32
|
+
async create(params) {
|
|
33
|
+
return this.client.request("POST", "/completions", params);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class Embeddings {
|
|
37
|
+
constructor(client) {
|
|
38
|
+
this.client = client;
|
|
39
|
+
}
|
|
40
|
+
async create(params) {
|
|
41
|
+
return this.client.request("POST", "/embeddings", params);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
class Security {
|
|
45
|
+
constructor(client) {
|
|
46
|
+
this.client = client;
|
|
47
|
+
}
|
|
48
|
+
async scan(content, type = "prompt") {
|
|
49
|
+
return this.client.request("POST", "/security/scan", { content, type });
|
|
50
|
+
}
|
|
51
|
+
async redact(content, piiTypes) {
|
|
52
|
+
return this.client.request("POST", "/security/redact", {
|
|
53
|
+
content,
|
|
54
|
+
pii_types: piiTypes,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
class Scrape {
|
|
59
|
+
constructor(client) {
|
|
60
|
+
this.client = client;
|
|
61
|
+
}
|
|
62
|
+
async url(url, options) {
|
|
63
|
+
return this.client.request("POST", "/scrape", {
|
|
64
|
+
url,
|
|
65
|
+
render_js: options?.renderJs ?? false,
|
|
66
|
+
extract_text: options?.extractText ?? true,
|
|
67
|
+
timeout: options?.timeout ?? 30,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async batch(urls, options) {
|
|
71
|
+
return this.client.request("POST", "/scrape/batch", { urls, ...options });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
class Agent {
|
|
75
|
+
constructor(client) {
|
|
76
|
+
this.client = client;
|
|
77
|
+
}
|
|
78
|
+
async validateTool(agentId, toolName, args, sessionId) {
|
|
79
|
+
return this.client.request("POST", "/agent/validate-tool", {
|
|
80
|
+
agent_id: agentId,
|
|
81
|
+
tool_name: toolName,
|
|
82
|
+
arguments: args,
|
|
83
|
+
session_id: sessionId,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async stats(agentId) {
|
|
87
|
+
return this.client.request("GET", `/agent/${agentId}/stats`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
class RedTeam {
|
|
91
|
+
constructor(client) {
|
|
92
|
+
this.base = "/internal/redteam";
|
|
93
|
+
this.client = client;
|
|
94
|
+
}
|
|
95
|
+
async listTests() {
|
|
96
|
+
return this.client.request("GET", `${this.base}/tests`);
|
|
97
|
+
}
|
|
98
|
+
async runTest(testName, targetPreset = "default") {
|
|
99
|
+
return this.client.request("POST", `${this.base}/test/${testName}`, {
|
|
100
|
+
target_preset: targetPreset,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async runAll(targetPreset = "default") {
|
|
104
|
+
return this.client.request("POST", `${this.base}/test-all`, {
|
|
105
|
+
target_preset: targetPreset,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async runCustom(prompt, targetPreset = "default") {
|
|
109
|
+
return this.client.request("POST", `${this.base}/test-custom`, {
|
|
110
|
+
custom_prompt: prompt,
|
|
111
|
+
target_preset: targetPreset,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
async runAutonomous(options) {
|
|
115
|
+
return this.client.request("POST", `${this.base}/autonomous`, {
|
|
116
|
+
budget: options?.budget ?? 100,
|
|
117
|
+
target_preset: options?.target_preset ?? "default",
|
|
118
|
+
...(options?.enabled_detectors && { enabled_detectors: options.enabled_detectors }),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async intelligenceStats() {
|
|
122
|
+
return this.client.request("GET", `${this.base}/intelligence/stats`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// PromptGuard client
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
class PromptGuard {
|
|
129
|
+
constructor(config) {
|
|
130
|
+
const { apiKey, baseUrl } = (0, resolve_1.resolveCredentials)(config.apiKey, config.baseUrl, PROXY_BASE_URL);
|
|
131
|
+
this.config = {
|
|
132
|
+
apiKey,
|
|
133
|
+
baseUrl,
|
|
134
|
+
timeout: config.timeout ?? 30000,
|
|
135
|
+
maxRetries: config.maxRetries ?? 3,
|
|
136
|
+
retryDelay: config.retryDelay ?? 1000,
|
|
137
|
+
};
|
|
138
|
+
this.chat = new Chat(this);
|
|
139
|
+
this.completions = new Completions(this);
|
|
140
|
+
this.embeddings = new Embeddings(this);
|
|
141
|
+
this.security = new Security(this);
|
|
142
|
+
this.scrape = new Scrape(this);
|
|
143
|
+
this.agent = new Agent(this);
|
|
144
|
+
this.redteam = new RedTeam(this);
|
|
145
|
+
}
|
|
146
|
+
async request(method, path, body) {
|
|
147
|
+
const url = `${this.config.baseUrl}${path}`;
|
|
148
|
+
let lastError;
|
|
149
|
+
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
|
150
|
+
try {
|
|
151
|
+
const response = await fetch(url, {
|
|
152
|
+
method,
|
|
153
|
+
headers: {
|
|
154
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
155
|
+
"Content-Type": "application/json",
|
|
156
|
+
"X-PromptGuard-SDK": "node",
|
|
157
|
+
"X-PromptGuard-Version": version_1.SDK_VERSION,
|
|
158
|
+
},
|
|
159
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
160
|
+
signal: AbortSignal.timeout(this.config.timeout),
|
|
161
|
+
});
|
|
162
|
+
if (RETRYABLE_STATUS_CODES.has(response.status) && attempt < this.config.maxRetries) {
|
|
163
|
+
await new Promise((r) => setTimeout(r, this.config.retryDelay * 2 ** attempt));
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (!response.ok) {
|
|
167
|
+
const errorBody = (await response.json().catch(() => ({})));
|
|
168
|
+
throw new PromptGuardError(errorBody.error?.message || "Request failed", errorBody.error?.code || "UNKNOWN", response.status);
|
|
169
|
+
}
|
|
170
|
+
return response.json();
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
if (err instanceof PromptGuardError)
|
|
174
|
+
throw err;
|
|
175
|
+
lastError = err;
|
|
176
|
+
if (attempt < this.config.maxRetries) {
|
|
177
|
+
await new Promise((r) => setTimeout(r, this.config.retryDelay * 2 ** attempt));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
throw lastError ?? new PromptGuardError("Max retries exceeded", "MAX_RETRIES", 0);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.PromptGuard = PromptGuard;
|
|
185
|
+
// ---------------------------------------------------------------------------
|
|
186
|
+
// Error
|
|
187
|
+
// ---------------------------------------------------------------------------
|
|
188
|
+
class PromptGuardError extends Error {
|
|
189
|
+
constructor(message, code, statusCode) {
|
|
190
|
+
super(`${code}: ${message}`);
|
|
191
|
+
this.name = "PromptGuardError";
|
|
192
|
+
this.code = code;
|
|
193
|
+
this.statusCode = statusCode;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.PromptGuardError = PromptGuardError;
|
|
197
|
+
exports.default = PromptGuard;
|
|
198
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCAAgE;AAChE,uCAAuC;AAsKvC,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AACjE,MAAM,cAA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AAQ,CAAC,MAAM,CAChB,CAAA;gBACH,CAAC;gBAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAA;YACtC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,gBAAgB;oBAAE,MAAM,GAAG,CAAA;gBAC9C,SAAS,GAAG,GAAY,CAAA;gBACxB,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;oBACrC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC,CAAA;gBAChF,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,SAAS,IAAI,IAAI,gBAAgB,CAAC,sBAAsB,EAAE,aAAa,EAAE,CAAC,CAAC,CAAA;IACnF,CAAC;CACF;AA7ED,kCA6EC;AAED,8EAA8E;AAC9E,QAAQ;AACR,8EAA8E;AAE9E,MAAa,gBAAiB,SAAQ,KAAK;IAIzC,YAAY,OAAe,EAAE,IAAY,EAAE,UAAkB;QAC3D,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF;AAVD,4CAUC;AAED,kBAAe,WAAW,CAAA"}
|
package/dist/guard.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Guard client
|
|
2
|
+
* Guard client - calls the PromptGuard Guard API for content scanning.
|
|
3
3
|
*
|
|
4
4
|
* Used internally by auto-instrumentation patches and framework
|
|
5
5
|
* integrations. Sends messages to POST /api/v1/guard and returns
|
package/dist/guard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,YAAY,EAAE,CAAA;IAClC,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB;AAMD,qBAAa,aAAa;I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