@declaw/sdk 1.2.1 → 1.2.3
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 +21 -0
- package/dist/index.cjs +43 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +42 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ All notable changes to the Declaw TypeScript / JavaScript SDK are documented in
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.2.3]
|
|
9
|
+
|
|
10
|
+
_Restore the conservative default connection ceiling._
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Reverted the default connection-pool ceiling back to 64 (from the 512
|
|
15
|
+
introduced in 1.2.2). High-concurrency workloads should opt in explicitly
|
|
16
|
+
via `DECLAW_SDK_CONNECTIONS`. No public API change.
|
|
17
|
+
|
|
18
|
+
## [1.2.2]
|
|
19
|
+
|
|
20
|
+
_Higher default connection ceiling._
|
|
21
|
+
|
|
22
|
+
### Performance
|
|
23
|
+
|
|
24
|
+
- Raised the default connection-pool ceiling from 64 to 512 so a
|
|
25
|
+
high-concurrency workload from a single client process is no longer queued
|
|
26
|
+
behind the connection cap. Still overridable via `DECLAW_SDK_CONNECTIONS`.
|
|
27
|
+
No public API change.
|
|
28
|
+
|
|
8
29
|
## [1.2.1]
|
|
9
30
|
|
|
10
31
|
_HTTP/2 burst performance._
|
package/dist/index.cjs
CHANGED
|
@@ -87,6 +87,7 @@ __export(index_exports, {
|
|
|
87
87
|
createToxicityConfig: () => createToxicityConfig,
|
|
88
88
|
createTransformationRule: () => createTransformationRule,
|
|
89
89
|
domainMatches: () => domainMatches,
|
|
90
|
+
fullInjectionDefensePolicy: () => fullInjectionDefensePolicy,
|
|
90
91
|
getSharedClient: () => getSharedClient,
|
|
91
92
|
invisibleTextConfigToJSON: () => invisibleTextConfigToJSON,
|
|
92
93
|
isSensitive: () => isSensitive,
|
|
@@ -641,7 +642,9 @@ function createInjectionDefenseConfig(opts) {
|
|
|
641
642
|
sensitivity: opts?.sensitivity ?? "medium" /* Medium */,
|
|
642
643
|
action: opts?.action ?? "log_only" /* LogOnly */,
|
|
643
644
|
threshold: opts?.threshold ?? 0.8,
|
|
644
|
-
domains: opts?.domains
|
|
645
|
+
domains: opts?.domains,
|
|
646
|
+
judge: opts?.judge,
|
|
647
|
+
injectionMode: opts?.injectionMode
|
|
645
648
|
};
|
|
646
649
|
if (!VALID_SENSITIVITIES.has(config.sensitivity)) {
|
|
647
650
|
throw new InvalidArgumentError(
|
|
@@ -666,7 +669,9 @@ function parseInjectionDefenseConfig(data) {
|
|
|
666
669
|
sensitivity: data.sensitivity ?? "medium" /* Medium */,
|
|
667
670
|
action: data.action ?? "log_only" /* LogOnly */,
|
|
668
671
|
threshold: data.threshold ?? 0.8,
|
|
669
|
-
domains: data.domains
|
|
672
|
+
domains: data.domains,
|
|
673
|
+
judge: data.judge ? { enabled: data.judge.enabled ?? false, always: data.judge.always, policy: data.judge.policy } : void 0,
|
|
674
|
+
injectionMode: data.injection_mode ?? data.injectionMode
|
|
670
675
|
};
|
|
671
676
|
}
|
|
672
677
|
|
|
@@ -969,6 +974,15 @@ function invisibleTextConfigToJSON(config) {
|
|
|
969
974
|
}
|
|
970
975
|
|
|
971
976
|
// src/security/customPolicy.ts
|
|
977
|
+
function createCustomPolicyConfig(opts) {
|
|
978
|
+
return {
|
|
979
|
+
enabled: opts?.enabled ?? false,
|
|
980
|
+
inlineRego: opts?.inlineRego,
|
|
981
|
+
inlineModules: opts?.inlineModules,
|
|
982
|
+
policyRef: opts?.policyRef,
|
|
983
|
+
defaultDeny: opts?.defaultDeny ?? false
|
|
984
|
+
};
|
|
985
|
+
}
|
|
972
986
|
function parseCustomPolicyConfig(data) {
|
|
973
987
|
return {
|
|
974
988
|
enabled: data.enabled ?? false,
|
|
@@ -1027,6 +1041,23 @@ function createSecurityPolicy(opts) {
|
|
|
1027
1041
|
customPolicy: opts?.customPolicy
|
|
1028
1042
|
};
|
|
1029
1043
|
}
|
|
1044
|
+
function fullInjectionDefensePolicy(opts) {
|
|
1045
|
+
return createSecurityPolicy({
|
|
1046
|
+
injectionDefense: createInjectionDefenseConfig({
|
|
1047
|
+
enabled: true,
|
|
1048
|
+
action: opts?.action ?? "block",
|
|
1049
|
+
threshold: opts?.threshold ?? 0.8,
|
|
1050
|
+
domains: opts?.domains,
|
|
1051
|
+
injectionMode: opts?.mode ?? "balanced",
|
|
1052
|
+
judge: { enabled: true, always: opts?.alwaysJudge ?? false, policy: opts?.agentPolicy ?? "" }
|
|
1053
|
+
}),
|
|
1054
|
+
customPolicy: createCustomPolicyConfig({
|
|
1055
|
+
enabled: true,
|
|
1056
|
+
policyRef: "prompt-injection@v2",
|
|
1057
|
+
defaultDeny: false
|
|
1058
|
+
})
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1030
1061
|
function parseSecurityPolicy(data) {
|
|
1031
1062
|
const injDef = data.injection_defense ?? data.injectionDefense;
|
|
1032
1063
|
const auditData = data.audit;
|
|
@@ -1066,6 +1097,15 @@ function securityPolicyToJSON(policy) {
|
|
|
1066
1097
|
if (injDefConfig.domains !== void 0) {
|
|
1067
1098
|
injDef.domains = injDefConfig.domains;
|
|
1068
1099
|
}
|
|
1100
|
+
if (injDefConfig.injectionMode !== void 0) {
|
|
1101
|
+
injDef.injection_mode = injDefConfig.injectionMode;
|
|
1102
|
+
}
|
|
1103
|
+
if (injDefConfig.judge !== void 0) {
|
|
1104
|
+
const j = { enabled: injDefConfig.judge.enabled };
|
|
1105
|
+
if (injDefConfig.judge.always) j.always = true;
|
|
1106
|
+
if (injDefConfig.judge.policy) j.policy = injDefConfig.judge.policy;
|
|
1107
|
+
injDef.judge = j;
|
|
1108
|
+
}
|
|
1069
1109
|
const auditConfig = typeof policy.audit === "boolean" ? createAuditConfig({ enabled: policy.audit }) : policy.audit;
|
|
1070
1110
|
const audit = {
|
|
1071
1111
|
enabled: auditConfig.enabled
|
|
@@ -3549,6 +3589,7 @@ var Governance = class {
|
|
|
3549
3589
|
createToxicityConfig,
|
|
3550
3590
|
createTransformationRule,
|
|
3551
3591
|
domainMatches,
|
|
3592
|
+
fullInjectionDefensePolicy,
|
|
3552
3593
|
getSharedClient,
|
|
3553
3594
|
invisibleTextConfigToJSON,
|
|
3554
3595
|
isSensitive,
|