agentid-sdk 0.1.7 → 0.1.8

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 CHANGED
@@ -58,3 +58,8 @@ const proxiedOpenAI = agent.wrapOpenAI(openai, {
58
58
  - Crypto-Shredding: Možnost nenávratně smazat citlivá data z logů na žádost uživatele (GDPR).
59
59
  - Fail-Safe architektura: Inteligentní přepínání mezi bezpečností a dostupností (Fail-Open/Closed).
60
60
  - Strict mode: při timeoutu Guard API můžeš vynutit fail-closed (`strictMode: true`).
61
+
62
+ ## Guard transformed input
63
+
64
+ If `/guard` returns `transformed_input`, the OpenAI and LangChain wrappers automatically
65
+ forward that transformed value to the downstream LLM call.
@@ -169,8 +169,17 @@ var AgentIDCallbackHandler = class {
169
169
  if (!verdict.allowed) {
170
170
  throw new Error(`AgentID: Security Blocked (${verdict.reason ?? "guard_denied"})`);
171
171
  }
172
+ const transformedInput = typeof verdict.transformed_input === "string" && verdict.transformed_input.length > 0 ? verdict.transformed_input : sanitizedInput;
173
+ if (transformedInput !== sanitizedInput) {
174
+ const mutated = setPromptInPrompts(prompts, transformedInput);
175
+ if (!mutated) {
176
+ throw new Error(
177
+ "AgentID: Guard transformed input could not be applied to LangChain prompt payload."
178
+ );
179
+ }
180
+ }
172
181
  this.runs.set(id, {
173
- input: sanitizedInput,
182
+ input: transformedInput,
174
183
  startedAtMs: Date.now(),
175
184
  model: extractModel(serialized, extraParams)
176
185
  });
@@ -199,8 +208,17 @@ var AgentIDCallbackHandler = class {
199
208
  if (!verdict.allowed) {
200
209
  throw new Error(`AgentID: Security Blocked (${verdict.reason ?? "guard_denied"})`);
201
210
  }
211
+ const transformedInput = typeof verdict.transformed_input === "string" && verdict.transformed_input.length > 0 ? verdict.transformed_input : sanitizedInput;
212
+ if (transformedInput !== sanitizedInput) {
213
+ const mutated = setPromptInMessages(messages, transformedInput);
214
+ if (!mutated) {
215
+ throw new Error(
216
+ "AgentID: Guard transformed input could not be applied to LangChain message payload."
217
+ );
218
+ }
219
+ }
202
220
  this.runs.set(id, {
203
- input: sanitizedInput,
221
+ input: transformedInput,
204
222
  startedAtMs: Date.now(),
205
223
  model: extractModel(serialized, extraParams)
206
224
  });
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
- export { A as AgentID, a as AgentIDCallbackHandler, G as GuardParams, b as GuardResponse, L as LogParams, P as PreparedInput, R as RequestOptions } from './langchain-C6HJAK2b.mjs';
1
+ export { A as AgentID, a as AgentIDCallbackHandler, G as GuardParams, b as GuardResponse, L as LogParams, P as PreparedInput, R as RequestOptions } from './langchain-DPMzxdoO.mjs';
2
2
 
3
3
  type PIIMapping = Record<string, string>;
4
4
  declare class PIIManager {
5
5
  /**
6
6
  * Reversible local-first masking using <TYPE_INDEX> placeholders.
7
7
  *
8
- * Zero-dep (regex-based). Designed for "good enough" privacy first-pass.
8
+ * Zero-dependency fallback with strict checksum validation for CEE national IDs.
9
9
  */
10
10
  anonymize(text: string): {
11
11
  maskedText: string;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { A as AgentID, a as AgentIDCallbackHandler, G as GuardParams, b as GuardResponse, L as LogParams, P as PreparedInput, R as RequestOptions } from './langchain-C6HJAK2b.js';
1
+ export { A as AgentID, a as AgentIDCallbackHandler, G as GuardParams, b as GuardResponse, L as LogParams, P as PreparedInput, R as RequestOptions } from './langchain-DPMzxdoO.js';
2
2
 
3
3
  type PIIMapping = Record<string, string>;
4
4
  declare class PIIManager {
5
5
  /**
6
6
  * Reversible local-first masking using <TYPE_INDEX> placeholders.
7
7
  *
8
- * Zero-dep (regex-based). Designed for "good enough" privacy first-pass.
8
+ * Zero-dependency fallback with strict checksum validation for CEE national IDs.
9
9
  */
10
10
  anonymize(text: string): {
11
11
  maskedText: string;