@driftgard/node 1.9.0 → 1.10.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 +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @driftgard/node
|
|
2
2
|
|
|
3
|
-
Official Node.js SDK for [
|
|
3
|
+
Official Node.js SDK for [DriftGard](https://driftgard.com) — evaluate LLM interactions against your compliance policy.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -51,7 +51,7 @@ const result = await dg.evaluate({
|
|
|
51
51
|
});
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
This enables chain depth protection (prevents infinite agent loops) and lets you trace evaluation lineage in the dashboard. When `sequence_no` is provided,
|
|
54
|
+
This enables chain depth protection (prevents infinite agent loops) and lets you trace evaluation lineage in the dashboard. When `sequence_no` is provided, DriftGard enforces ordering — if an eval arrives out of order, the response includes a `sequence_warning`.
|
|
55
55
|
|
|
56
56
|
## A/B experiments
|
|
57
57
|
|
|
@@ -67,7 +67,7 @@ const result = await dg.evaluate({
|
|
|
67
67
|
});
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
View experiment results on the Experiments page in the
|
|
70
|
+
View experiment results on the Experiments page in the DriftGard dashboard.
|
|
71
71
|
|
|
72
72
|
## Cost attribution
|
|
73
73
|
|
|
@@ -196,7 +196,7 @@ console.log(dg.circuitBreakerState);
|
|
|
196
196
|
// { state: "closed", failures: 0, openedAt: 0 }
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
-
With `failureMode: "open"` (default), the SDK allows requests through when
|
|
199
|
+
With `failureMode: "open"` (default), the SDK allows requests through when DriftGard is unavailable. With `failureMode: "closed"`, it blocks them with a fallback message.
|
|
200
200
|
|
|
201
201
|
## Error handling
|
|
202
202
|
|
|
@@ -222,7 +222,7 @@ try {
|
|
|
222
222
|
## Requirements
|
|
223
223
|
|
|
224
224
|
- Node.js 18+ (uses native `fetch`)
|
|
225
|
-
- API key from
|
|
225
|
+
- API key from DriftGard (Settings → API Keys)
|
|
226
226
|
- Compliance or Enterprise tier for API evaluation
|
|
227
227
|
|
|
228
228
|
## License
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class Driftgard {
|
|
|
31
31
|
*/
|
|
32
32
|
reportOutcome(evaluationId: string, projectId: string, outcome: OutcomeRequest): Promise<any>;
|
|
33
33
|
/**
|
|
34
|
-
* Wrap a tool function with
|
|
34
|
+
* Wrap a tool function with DriftGard policy check.
|
|
35
35
|
* Returns a guarded version that evaluates before executing.
|
|
36
36
|
*/
|
|
37
37
|
guard<T extends (...args: any[]) => any>(toolFn: T, toolName: string, projectId: string, opts?: {
|
package/dist/index.js
CHANGED
|
@@ -105,7 +105,7 @@ class Driftgard {
|
|
|
105
105
|
clause_id: "DRIFTGARD_UNAVAILABLE",
|
|
106
106
|
severity: "critical",
|
|
107
107
|
category: "system",
|
|
108
|
-
reason: `
|
|
108
|
+
reason: `DriftGard API unavailable — fail-closed policy applied (${source})`,
|
|
109
109
|
}],
|
|
110
110
|
},
|
|
111
111
|
...(allowed ? {} : {
|
|
@@ -147,7 +147,7 @@ class Driftgard {
|
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
|
-
* Wrap a tool function with
|
|
150
|
+
* Wrap a tool function with DriftGard policy check.
|
|
151
151
|
* Returns a guarded version that evaluates before executing.
|
|
152
152
|
*/
|
|
153
153
|
guard(toolFn, toolName, projectId, opts) {
|
package/dist/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface DriftgardConfig {
|
|
|
9
9
|
baseUrl?: string;
|
|
10
10
|
timeout?: number;
|
|
11
11
|
maxRetries?: number;
|
|
12
|
-
/** What to do when
|
|
12
|
+
/** What to do when DriftGard API is unreachable. "open" = allow, "closed" = block. Default "open". */
|
|
13
13
|
failureMode?: "open" | "closed";
|
|
14
14
|
/** Circuit breaker config. Skips API calls after consecutive failures. */
|
|
15
15
|
circuitBreaker?: CircuitBreakerConfig;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driftgard/node",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Official
|
|
3
|
+
"version": "1.10.0",
|
|
4
|
+
"description": "Official DriftGard Node.js SDK — evaluate LLM interactions against your compliance policy",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": ["dist", "README.md"],
|