@silmaril-security/sdk 0.10.3 → 0.11.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/CHANGELOG.md +16 -2
- package/README.md +13 -5
- package/dist/adapters/deepagents.d.cts +1 -1
- package/dist/adapters/deepagents.d.ts +1 -1
- package/dist/adapters/langchain.d.cts +1 -1
- package/dist/adapters/langchain.d.ts +1 -1
- package/dist/adapters/vercel-v4.d.cts +1 -1
- package/dist/adapters/vercel-v4.d.ts +1 -1
- package/dist/adapters/vercel.d.cts +1 -1
- package/dist/adapters/vercel.d.ts +1 -1
- package/dist/{firewall-BXM2BWEr.d.cts → firewall-BD4YdAmB.d.cts} +4 -4
- package/dist/{firewall-BXM2BWEr.d.ts → firewall-BD4YdAmB.d.ts} +4 -4
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.1
|
|
4
|
+
|
|
5
|
+
- Pin the Vercel AI SDK install recipes to compatible AI SDK and OpenAI
|
|
6
|
+
provider versions.
|
|
7
|
+
|
|
8
|
+
## 0.11.0
|
|
9
|
+
|
|
10
|
+
- Breaking: rename the tenant acceptable-use policy outcome to `abuse`.
|
|
11
|
+
`Outcome.Abuse` replaces the tenant-specific member, and
|
|
12
|
+
`KnownPrimaryOutcome`, `KnownHarmfulOutcome`, `PRIMARY_OUTCOMES`,
|
|
13
|
+
`HARMFUL_OUTCOMES`, and `OUTCOME_DESCRIPTIONS` list `abuse` in the same
|
|
14
|
+
position. Responses that still carry the previous label continue to decode
|
|
15
|
+
as an `UnknownOutcome` string.
|
|
16
|
+
|
|
3
17
|
## 0.10.3
|
|
4
18
|
|
|
5
19
|
- Match Python `str.strip()` when validating optional governance
|
|
@@ -254,8 +268,8 @@ All notable changes to the Silmaril Firewall TypeScript SDK are documented here.
|
|
|
254
268
|
## 0.5.1 - 2026-07-29
|
|
255
269
|
|
|
256
270
|
- Add typed support for `code_generation`, `story_script_generation`,
|
|
257
|
-
`game_generation`, `website_generation`, `
|
|
258
|
-
`
|
|
271
|
+
`game_generation`, `website_generation`, `traditional_ai_abuse`, and the
|
|
272
|
+
tenant acceptable-use policy outcome now named `abuse`.
|
|
259
273
|
- Extend ordered outcome collections, descriptions, guards, normalization
|
|
260
274
|
fixtures, exports, and documentation without changing the `/classify` wire
|
|
261
275
|
shape.
|
package/README.md
CHANGED
|
@@ -35,10 +35,10 @@ This SDK is distributed as an npm package.
|
|
|
35
35
|
npm install @silmaril-security/sdk
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Pin version 0.
|
|
38
|
+
Pin version 0.11.1 for reproducible installs:
|
|
39
39
|
|
|
40
40
|
```sh
|
|
41
|
-
npm install @silmaril-security/sdk@0.
|
|
41
|
+
npm install @silmaril-security/sdk@0.11.1
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Requires Node 20 or later.
|
|
@@ -56,7 +56,11 @@ existing `adapters/vercel` middleware remains compatible with Vercel AI SDK v5
|
|
|
56
56
|
and v6:
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
|
-
|
|
59
|
+
# AI SDK 5
|
|
60
|
+
npm install ai@^5 @ai-sdk/openai@^2
|
|
61
|
+
|
|
62
|
+
# AI SDK 6
|
|
63
|
+
npm install ai@^6 @ai-sdk/openai@^3
|
|
60
64
|
```
|
|
61
65
|
|
|
62
66
|
AI SDK 7 applications require Node 22 or later and use the separate
|
|
@@ -262,7 +266,7 @@ if (result.prediction === "BENIGN") {
|
|
|
262
266
|
case Outcome.StoryScriptGeneration:
|
|
263
267
|
case Outcome.GameGeneration:
|
|
264
268
|
case Outcome.WebsiteGeneration:
|
|
265
|
-
case Outcome.
|
|
269
|
+
case Outcome.Abuse:
|
|
266
270
|
case Outcome.TraditionalAiAbuse:
|
|
267
271
|
applyTenantPolicy(result);
|
|
268
272
|
break;
|
|
@@ -284,7 +288,7 @@ Outcome taxonomy:
|
|
|
284
288
|
- `story_script_generation`: generation of narrative prose, dialogue, scripts, or story artifacts.
|
|
285
289
|
- `game_generation`: generation of a game, quest, level, mechanic, or playable experience.
|
|
286
290
|
- `website_generation`: generation of a website, landing page, storefront, or web experience.
|
|
287
|
-
- `
|
|
291
|
+
- `abuse`: content or actions that violate the tenant's acceptable-use policy.
|
|
288
292
|
- `traditional_ai_abuse`: unsafe AI assistance outside the concrete security outcome classes.
|
|
289
293
|
|
|
290
294
|
## Options
|
|
@@ -667,6 +671,10 @@ AI SDK 7 uses the `LanguageModelV4Middleware` contract and requires Node 22 or
|
|
|
667
671
|
later. Import its adapter explicitly; `Firewall.asMiddleware()` intentionally
|
|
668
672
|
retains the AI SDK 5/6 v3 contract.
|
|
669
673
|
|
|
674
|
+
```sh
|
|
675
|
+
npm install ai@7.0.166 @ai-sdk/openai@4.0.111
|
|
676
|
+
```
|
|
677
|
+
|
|
670
678
|
```ts
|
|
671
679
|
import { generateText, wrapLanguageModel } from "ai";
|
|
672
680
|
import { openai } from "@ai-sdk/openai";
|
|
@@ -13,7 +13,7 @@ import * as langchain from 'langchain';
|
|
|
13
13
|
import { CreateAgentParams } from 'langchain';
|
|
14
14
|
import * as _langchain_core_tools from '@langchain/core/tools';
|
|
15
15
|
import { StructuredTool } from '@langchain/core/tools';
|
|
16
|
-
import { h as FirewallMode, b as ClassifyEvent, e as Firewall } from '../firewall-
|
|
16
|
+
import { h as FirewallMode, b as ClassifyEvent, e as Firewall } from '../firewall-BD4YdAmB.cjs';
|
|
17
17
|
|
|
18
18
|
declare const SAFE_TOOL_MESSAGE = "Silmaril Firewall blocked this tool interaction. Choose a different safe action.";
|
|
19
19
|
declare const SAFE_FINAL_MESSAGE = "Silmaril Firewall stopped this request after repeated unsafe actions.";
|
|
@@ -13,7 +13,7 @@ import * as langchain from 'langchain';
|
|
|
13
13
|
import { CreateAgentParams } from 'langchain';
|
|
14
14
|
import * as _langchain_core_tools from '@langchain/core/tools';
|
|
15
15
|
import { StructuredTool } from '@langchain/core/tools';
|
|
16
|
-
import { h as FirewallMode, b as ClassifyEvent, e as Firewall } from '../firewall-
|
|
16
|
+
import { h as FirewallMode, b as ClassifyEvent, e as Firewall } from '../firewall-BD4YdAmB.js';
|
|
17
17
|
|
|
18
18
|
declare const SAFE_TOOL_MESSAGE = "Silmaril Firewall blocked this tool interaction. Choose a different safe action.";
|
|
19
19
|
declare const SAFE_FINAL_MESSAGE = "Silmaril Firewall stopped this request after repeated unsafe actions.";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RunnableConfig, Runnable, RunnableBinding } from '@langchain/core/runnables';
|
|
2
2
|
import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
3
|
-
import { e as Firewall, L as LangChainAdapterOptions } from '../firewall-
|
|
3
|
+
import { e as Firewall, L as LangChainAdapterOptions } from '../firewall-BD4YdAmB.cjs';
|
|
4
4
|
|
|
5
5
|
declare function createLangChainHandler(firewall: Firewall, options?: LangChainAdapterOptions): Promise<BaseCallbackHandler>;
|
|
6
6
|
/** Protect a runnable using its actual invocation config, including direct model/tool calls. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RunnableConfig, Runnable, RunnableBinding } from '@langchain/core/runnables';
|
|
2
2
|
import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
3
|
-
import { e as Firewall, L as LangChainAdapterOptions } from '../firewall-
|
|
3
|
+
import { e as Firewall, L as LangChainAdapterOptions } from '../firewall-BD4YdAmB.js';
|
|
4
4
|
|
|
5
5
|
declare function createLangChainHandler(firewall: Firewall, options?: LangChainAdapterOptions): Promise<BaseCallbackHandler>;
|
|
6
6
|
/** Protect a runnable using its actual invocation config, including direct model/tool calls. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { g as FirewallMiddleware, S as createMiddleware } from '../firewall-
|
|
1
|
+
export { g as FirewallMiddleware, S as createMiddleware } from '../firewall-BD4YdAmB.cjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { g as FirewallMiddleware, S as createMiddleware } from '../firewall-
|
|
1
|
+
export { g as FirewallMiddleware, S as createMiddleware } from '../firewall-BD4YdAmB.js';
|
|
@@ -37,7 +37,7 @@ declare const Outcome: {
|
|
|
37
37
|
readonly StoryScriptGeneration: "story_script_generation";
|
|
38
38
|
readonly GameGeneration: "game_generation";
|
|
39
39
|
readonly WebsiteGeneration: "website_generation";
|
|
40
|
-
readonly
|
|
40
|
+
readonly Abuse: "abuse";
|
|
41
41
|
readonly TraditionalAiAbuse: "traditional_ai_abuse";
|
|
42
42
|
};
|
|
43
43
|
declare const unknownOutcomeBrand: unique symbol;
|
|
@@ -48,8 +48,8 @@ type UnknownOutcome = string & {
|
|
|
48
48
|
};
|
|
49
49
|
type PrimaryOutcome = KnownPrimaryOutcome | UnknownOutcome;
|
|
50
50
|
type HarmfulOutcome = KnownHarmfulOutcome | UnknownOutcome;
|
|
51
|
-
declare const PRIMARY_OUTCOMES: readonly ["benign", "information_disclosure", "secret_exposure", "control_abuse", "system_compromise", "service_disruption", "code_generation", "story_script_generation", "game_generation", "website_generation", "
|
|
52
|
-
declare const HARMFUL_OUTCOMES: readonly ["information_disclosure", "secret_exposure", "control_abuse", "system_compromise", "service_disruption", "code_generation", "story_script_generation", "game_generation", "website_generation", "
|
|
51
|
+
declare const PRIMARY_OUTCOMES: readonly ["benign", "information_disclosure", "secret_exposure", "control_abuse", "system_compromise", "service_disruption", "code_generation", "story_script_generation", "game_generation", "website_generation", "abuse", "traditional_ai_abuse"];
|
|
52
|
+
declare const HARMFUL_OUTCOMES: readonly ["information_disclosure", "secret_exposure", "control_abuse", "system_compromise", "service_disruption", "code_generation", "story_script_generation", "game_generation", "website_generation", "abuse", "traditional_ai_abuse"];
|
|
53
53
|
declare const OUTCOME_DESCRIPTIONS: {
|
|
54
54
|
readonly benign: "No harmful firewall outcome detected.";
|
|
55
55
|
readonly information_disclosure: "Exposes private data, documents, internal context, logs, traces, customer data, SQL rows, topology, or similar non-secret sensitive information.";
|
|
@@ -61,7 +61,7 @@ declare const OUTCOME_DESCRIPTIONS: {
|
|
|
61
61
|
readonly story_script_generation: "Requests generation of narrative prose, dialogue, scripts, or story artifacts.";
|
|
62
62
|
readonly game_generation: "Requests generation of a game, quest, level, mechanic, or playable experience.";
|
|
63
63
|
readonly website_generation: "Requests generation of a website, landing page, storefront, or web experience.";
|
|
64
|
-
readonly
|
|
64
|
+
readonly abuse: "Requests content or actions that violate the tenant's acceptable-use policy.";
|
|
65
65
|
readonly traditional_ai_abuse: "Requests unsafe AI assistance outside the concrete security outcome classes.";
|
|
66
66
|
};
|
|
67
67
|
declare function isPrimaryOutcome(value: unknown): value is KnownPrimaryOutcome;
|
|
@@ -37,7 +37,7 @@ declare const Outcome: {
|
|
|
37
37
|
readonly StoryScriptGeneration: "story_script_generation";
|
|
38
38
|
readonly GameGeneration: "game_generation";
|
|
39
39
|
readonly WebsiteGeneration: "website_generation";
|
|
40
|
-
readonly
|
|
40
|
+
readonly Abuse: "abuse";
|
|
41
41
|
readonly TraditionalAiAbuse: "traditional_ai_abuse";
|
|
42
42
|
};
|
|
43
43
|
declare const unknownOutcomeBrand: unique symbol;
|
|
@@ -48,8 +48,8 @@ type UnknownOutcome = string & {
|
|
|
48
48
|
};
|
|
49
49
|
type PrimaryOutcome = KnownPrimaryOutcome | UnknownOutcome;
|
|
50
50
|
type HarmfulOutcome = KnownHarmfulOutcome | UnknownOutcome;
|
|
51
|
-
declare const PRIMARY_OUTCOMES: readonly ["benign", "information_disclosure", "secret_exposure", "control_abuse", "system_compromise", "service_disruption", "code_generation", "story_script_generation", "game_generation", "website_generation", "
|
|
52
|
-
declare const HARMFUL_OUTCOMES: readonly ["information_disclosure", "secret_exposure", "control_abuse", "system_compromise", "service_disruption", "code_generation", "story_script_generation", "game_generation", "website_generation", "
|
|
51
|
+
declare const PRIMARY_OUTCOMES: readonly ["benign", "information_disclosure", "secret_exposure", "control_abuse", "system_compromise", "service_disruption", "code_generation", "story_script_generation", "game_generation", "website_generation", "abuse", "traditional_ai_abuse"];
|
|
52
|
+
declare const HARMFUL_OUTCOMES: readonly ["information_disclosure", "secret_exposure", "control_abuse", "system_compromise", "service_disruption", "code_generation", "story_script_generation", "game_generation", "website_generation", "abuse", "traditional_ai_abuse"];
|
|
53
53
|
declare const OUTCOME_DESCRIPTIONS: {
|
|
54
54
|
readonly benign: "No harmful firewall outcome detected.";
|
|
55
55
|
readonly information_disclosure: "Exposes private data, documents, internal context, logs, traces, customer data, SQL rows, topology, or similar non-secret sensitive information.";
|
|
@@ -61,7 +61,7 @@ declare const OUTCOME_DESCRIPTIONS: {
|
|
|
61
61
|
readonly story_script_generation: "Requests generation of narrative prose, dialogue, scripts, or story artifacts.";
|
|
62
62
|
readonly game_generation: "Requests generation of a game, quest, level, mechanic, or playable experience.";
|
|
63
63
|
readonly website_generation: "Requests generation of a website, landing page, storefront, or web experience.";
|
|
64
|
-
readonly
|
|
64
|
+
readonly abuse: "Requests content or actions that violate the tenant's acceptable-use policy.";
|
|
65
65
|
readonly traditional_ai_abuse: "Requests unsafe AI assistance outside the concrete security outcome classes.";
|
|
66
66
|
};
|
|
67
67
|
declare function isPrimaryOutcome(value: unknown): value is KnownPrimaryOutcome;
|
package/dist/index.cjs
CHANGED
|
@@ -1457,7 +1457,7 @@ var Outcome = {
|
|
|
1457
1457
|
StoryScriptGeneration: "story_script_generation",
|
|
1458
1458
|
GameGeneration: "game_generation",
|
|
1459
1459
|
WebsiteGeneration: "website_generation",
|
|
1460
|
-
|
|
1460
|
+
Abuse: "abuse",
|
|
1461
1461
|
TraditionalAiAbuse: "traditional_ai_abuse"
|
|
1462
1462
|
};
|
|
1463
1463
|
var PRIMARY_OUTCOMES = [
|
|
@@ -1471,7 +1471,7 @@ var PRIMARY_OUTCOMES = [
|
|
|
1471
1471
|
Outcome.StoryScriptGeneration,
|
|
1472
1472
|
Outcome.GameGeneration,
|
|
1473
1473
|
Outcome.WebsiteGeneration,
|
|
1474
|
-
Outcome.
|
|
1474
|
+
Outcome.Abuse,
|
|
1475
1475
|
Outcome.TraditionalAiAbuse
|
|
1476
1476
|
];
|
|
1477
1477
|
var HARMFUL_OUTCOMES = [
|
|
@@ -1484,7 +1484,7 @@ var HARMFUL_OUTCOMES = [
|
|
|
1484
1484
|
Outcome.StoryScriptGeneration,
|
|
1485
1485
|
Outcome.GameGeneration,
|
|
1486
1486
|
Outcome.WebsiteGeneration,
|
|
1487
|
-
Outcome.
|
|
1487
|
+
Outcome.Abuse,
|
|
1488
1488
|
Outcome.TraditionalAiAbuse
|
|
1489
1489
|
];
|
|
1490
1490
|
var OUTCOME_DESCRIPTIONS = {
|
|
@@ -1498,7 +1498,7 @@ var OUTCOME_DESCRIPTIONS = {
|
|
|
1498
1498
|
[Outcome.StoryScriptGeneration]: "Requests generation of narrative prose, dialogue, scripts, or story artifacts.",
|
|
1499
1499
|
[Outcome.GameGeneration]: "Requests generation of a game, quest, level, mechanic, or playable experience.",
|
|
1500
1500
|
[Outcome.WebsiteGeneration]: "Requests generation of a website, landing page, storefront, or web experience.",
|
|
1501
|
-
[Outcome.
|
|
1501
|
+
[Outcome.Abuse]: "Requests content or actions that violate the tenant's acceptable-use policy.",
|
|
1502
1502
|
[Outcome.TraditionalAiAbuse]: "Requests unsafe AI assistance outside the concrete security outcome classes."
|
|
1503
1503
|
};
|
|
1504
1504
|
var PRIMARY_OUTCOME_SET = new Set(PRIMARY_OUTCOMES);
|
|
@@ -1580,7 +1580,7 @@ function sanitizeText(text) {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
1582
|
// src/firewall.ts
|
|
1583
|
-
var SDK_VERSION = "0.
|
|
1583
|
+
var SDK_VERSION = "0.11.1";
|
|
1584
1584
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
1585
1585
|
var DEFAULT_MAX_RETRIES = 5;
|
|
1586
1586
|
var MAX_BACKOFF_SECONDS = 30;
|