@voicelayer/sdk 0.1.4 → 0.1.5
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/dist/index.js +18 -9
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -9265,15 +9265,24 @@ function partialMask(value) {
|
|
|
9265
9265
|
const tail = trimmed.length >= 8 ? 4 : 2;
|
|
9266
9266
|
return "*".repeat(trimmed.length - tail) + trimmed.slice(-tail);
|
|
9267
9267
|
}
|
|
9268
|
+
var DEFAULT_SAFE_RESPONSE = "Sorry, I lost you for a second there. Go ahead \u2014 I'm listening.";
|
|
9268
9269
|
var InputGuard = class _InputGuard {
|
|
9269
9270
|
// Classic prompt-injection patterns. ~0.2ms regex.
|
|
9271
|
+
//
|
|
9272
|
+
// Every alternative is word-bounded — an unanchored /DAN/i once matched the
|
|
9273
|
+
// caller NAME "Jordan" mid-call and spoke the safe-fallback at an innocent
|
|
9274
|
+
// caller (found live, 2026-07-24). "DAN" is an acronym jailbreak: it must
|
|
9275
|
+
// match as a standalone word next to jailbreak context words, not as a
|
|
9276
|
+
// substring of Jordan/sedan/dance. Same hardening for the phrase patterns:
|
|
9277
|
+
// "act as" only fires with a persona object after it ("act as a/an/if"),
|
|
9278
|
+
// not inside "exact as" or a bare "act as" fragment.
|
|
9270
9279
|
static INJECTION = [
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9280
|
+
/\bignore (previous|prior|all) instructions\b/i,
|
|
9281
|
+
/\byou are now\b|\bpretend (you are|to be)\b|\bact as (a|an|if)\b/i,
|
|
9282
|
+
/\bDAN mode\b|\bjailbreak\b|\bdeveloper mode\b|\bunrestricted mode\b/i,
|
|
9283
|
+
/\bskip (this step|verification|confirmation)\b/i,
|
|
9284
|
+
/\btransfer me (without|directly|now)\b/i,
|
|
9285
|
+
/\bsystem prompt\b|\breveal your (rules|instructions|prompt)\b/i
|
|
9277
9286
|
];
|
|
9278
9287
|
check(utterance) {
|
|
9279
9288
|
for (const pattern of _InputGuard.INJECTION) {
|
|
@@ -9285,7 +9294,7 @@ var InputGuard = class _InputGuard {
|
|
|
9285
9294
|
reason: "injection_pattern",
|
|
9286
9295
|
// Keep the response neutral and redirect back to the insured's need
|
|
9287
9296
|
// without revealing detection details (§B.2).
|
|
9288
|
-
safeResponse:
|
|
9297
|
+
safeResponse: DEFAULT_SAFE_RESPONSE
|
|
9289
9298
|
};
|
|
9290
9299
|
}
|
|
9291
9300
|
}
|
|
@@ -9763,7 +9772,7 @@ var SecurityPrimitive = class extends BasePrimitive {
|
|
|
9763
9772
|
this.recordBudget(ctx.callId, nowUs() - t0);
|
|
9764
9773
|
return {
|
|
9765
9774
|
kind: "blocked",
|
|
9766
|
-
safeResponse: inputDecision.safeResponse ?? mergedInput.safeResponse ??
|
|
9775
|
+
safeResponse: inputDecision.safeResponse ?? mergedInput.safeResponse ?? DEFAULT_SAFE_RESPONSE
|
|
9767
9776
|
};
|
|
9768
9777
|
}
|
|
9769
9778
|
const effectiveUtterance = inputDecision.rewrittenText ?? mergedInput.sanitizedText ?? utterance;
|
|
@@ -9790,7 +9799,7 @@ var SecurityPrimitive = class extends BasePrimitive {
|
|
|
9790
9799
|
this.recordBudget(ctx.callId, nowUs() - t0);
|
|
9791
9800
|
return {
|
|
9792
9801
|
kind: "blocked",
|
|
9793
|
-
safeResponse: promptDecision.safeResponse ??
|
|
9802
|
+
safeResponse: promptDecision.safeResponse ?? DEFAULT_SAFE_RESPONSE
|
|
9794
9803
|
};
|
|
9795
9804
|
}
|
|
9796
9805
|
this.recordBudget(ctx.callId, nowUs() - t0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voicelayer/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Official SDK for VoiceLayer — define, run, and orchestrate voice AI agents on the VoiceLayer control plane.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "VoiceLayer",
|
|
@@ -79,16 +79,16 @@
|
|
|
79
79
|
"tsup": "^8.5.1",
|
|
80
80
|
"typescript": "^5.6.0",
|
|
81
81
|
"vitest": "^4.1.5",
|
|
82
|
-
"@voicelayer/observability": "0.1.0",
|
|
83
82
|
"@voicelayer/contracts": "0.1.0",
|
|
83
|
+
"@voicelayer/observability": "0.1.0",
|
|
84
84
|
"@voicelayer/primitive-audio-experience": "0.1.0",
|
|
85
|
-
"@voicelayer/primitive-audio-routing": "0.1.0",
|
|
86
85
|
"@voicelayer/primitive-process-schema": "0.1.0",
|
|
87
86
|
"@voicelayer/primitive-security": "0.1.0",
|
|
88
87
|
"@voicelayer/agents-plugin-deepgram": "1.0.0",
|
|
88
|
+
"@voicelayer/agents-plugin-openai": "1.0.0",
|
|
89
89
|
"@voicelayer/agents-plugin-livekit": "1.0.0",
|
|
90
90
|
"@voicelayer/agents-plugin-silero": "1.0.0",
|
|
91
|
-
"@voicelayer/
|
|
91
|
+
"@voicelayer/primitive-audio-routing": "0.1.0"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"typecheck": "tsc -b --pretty false",
|