@zespan/sdk 1.3.0 → 1.3.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/dist/index.d.mts CHANGED
@@ -8,13 +8,30 @@ import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
8
8
  import { Serialized } from '@langchain/core/load/serializable';
9
9
  import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
10
10
 
11
- interface ZespanOptions {
11
+ type PiiPreset = "gdpr" | "hipaa" | "ccpa" | "pci-dss" | "soc2" | "finance" | "education" | "transportation";
12
+ type PiiCategory = "personal" | "financial" | "government_ids" | "healthcare" | "digital_identity";
13
+ type PiiRedactionMode = "placeholder" | "mask-middle" | "mask-all";
14
+ interface ZespanPiiConfig {
15
+ piiPreset?: PiiPreset;
16
+ piiCategories?: PiiCategory[];
17
+ piiIncludeNames?: boolean;
18
+ piiIncludeEmails?: boolean;
19
+ piiIncludePhones?: boolean;
20
+ piiIncludeAddresses?: boolean;
21
+ piiConfidenceThreshold?: number;
22
+ piiRedactionMode?: PiiRedactionMode;
23
+ piiWhitelist?: string[];
24
+ piiCustomPatterns?: RegExp[];
25
+ }
26
+ interface ZespanOptions extends ZespanPiiConfig {
12
27
  apiKey: string;
13
28
  endpoint?: string;
14
29
  baseURL?: string;
15
30
  environment?: string;
16
31
  storePrompts?: boolean;
17
32
  redactKeys?: string[];
33
+ /** Pattern-based PII detection via openredaction. OFF by default — must opt in. */
34
+ redactPii?: boolean;
18
35
  sampleRate?: number;
19
36
  debug?: boolean;
20
37
  batchSize?: number;
@@ -71,6 +88,7 @@ interface Prompt {
71
88
  declare class PromptClient {
72
89
  private client;
73
90
  private cache;
91
+ private cacheIndex;
74
92
  private cacheTTL;
75
93
  constructor(client: ZespanClient);
76
94
  /**
@@ -245,6 +263,7 @@ declare class ZespanClient {
245
263
  readonly environment: string;
246
264
  readonly storePrompts: boolean;
247
265
  readonly redactKeys: string[];
266
+ readonly redactPii: boolean;
248
267
  readonly sampleRate: number;
249
268
  readonly debug: boolean;
250
269
  readonly enableOTel: boolean;
@@ -257,6 +276,9 @@ declare class ZespanClient {
257
276
  constructor(opts: ZespanOptions);
258
277
  enqueue(event: ZespanEvent): void;
259
278
  redactForStorage(value: unknown): string;
279
+ redactValueAsync(value: unknown): Promise<string>;
280
+ redactTextAsync(text: string): Promise<string>;
281
+ redactObjectAsync(obj: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
260
282
  private resolveGuardrailsUrl;
261
283
  checkGuardrails(input: GuardrailCheckInput): Promise<GuardrailCheckResponse>;
262
284
  flush(): Promise<void>;
@@ -567,4 +589,4 @@ declare const zespan: {
567
589
  ZespanLlamaIndexHandler: typeof ZespanLlamaIndexHandler;
568
590
  };
569
591
 
570
- export { type ADKAgentOptions, type ADKRunnerOptions, AgentContext, type AgentOptions, BaggageSpanProcessor, CREWAI_OTEL_ENV, GuardrailBlockedError, type GuardrailCheckInput, type GuardrailCheckResponse, type GuardrailResult, type InstrumentADKOptions, type OTelConfig, type Prompt, PromptClient, type PromptOptions, type ResolvedWrapperGuardrailsSettings, type WrapperGuardrailsOptions, type WrapperGuardrailsSettings, ZespanADKCallbackHandler, ZespanCallbackHandler, ZespanClient, type ZespanContextOptions, ZespanLlamaIndexHandler, attachTraceToAutoGenMessage, autopatch, createSpan, extractAgentContext, extractAgentContext as extractAutoGenContext, extractTraceFromAutoGenMessage, getCrewAIInstrumentationGuide, getPydanticAIConfig, getTracer, getZespanClient, getZespanVercelTelemetry, init, initOTel, initZespan, injectAgentContext, injectAgentContext as injectAutoGenContext, instrumentADK, instrumentVercelAI, markFrameworkActive, markFrameworkInactive, startSpan, withAgent, withSpan, withZespan, withZespanContext, withZespanTrace, wrapADKAgent, wrapADKRunner, wrapAnthropic, wrapBedrock, wrapGoogle, wrapGoogleGenAI, wrapGroq, wrapLiteLLM, wrapMistral, wrapOpenAI, wrapOpenRouter, wrapZespanADKAgent, zespan };
592
+ export { type ADKAgentOptions, type ADKRunnerOptions, AgentContext, type AgentOptions, BaggageSpanProcessor, CREWAI_OTEL_ENV, GuardrailBlockedError, type GuardrailCheckInput, type GuardrailCheckResponse, type GuardrailResult, type InstrumentADKOptions, type OTelConfig, type PiiCategory, type PiiPreset, type PiiRedactionMode, type Prompt, PromptClient, type PromptOptions, type ResolvedWrapperGuardrailsSettings, type WrapperGuardrailsOptions, type WrapperGuardrailsSettings, ZespanADKCallbackHandler, ZespanCallbackHandler, ZespanClient, type ZespanContextOptions, ZespanLlamaIndexHandler, type ZespanOptions, type ZespanPiiConfig, attachTraceToAutoGenMessage, autopatch, createSpan, extractAgentContext, extractAgentContext as extractAutoGenContext, extractTraceFromAutoGenMessage, getCrewAIInstrumentationGuide, getPydanticAIConfig, getTracer, getZespanClient, getZespanVercelTelemetry, init, initOTel, initZespan, injectAgentContext, injectAgentContext as injectAutoGenContext, instrumentADK, instrumentVercelAI, markFrameworkActive, markFrameworkInactive, startSpan, withAgent, withSpan, withZespan, withZespanContext, withZespanTrace, wrapADKAgent, wrapADKRunner, wrapAnthropic, wrapBedrock, wrapGoogle, wrapGoogleGenAI, wrapGroq, wrapLiteLLM, wrapMistral, wrapOpenAI, wrapOpenRouter, wrapZespanADKAgent, zespan };
package/dist/index.d.ts CHANGED
@@ -8,13 +8,30 @@ import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
8
8
  import { Serialized } from '@langchain/core/load/serializable';
9
9
  import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
10
10
 
11
- interface ZespanOptions {
11
+ type PiiPreset = "gdpr" | "hipaa" | "ccpa" | "pci-dss" | "soc2" | "finance" | "education" | "transportation";
12
+ type PiiCategory = "personal" | "financial" | "government_ids" | "healthcare" | "digital_identity";
13
+ type PiiRedactionMode = "placeholder" | "mask-middle" | "mask-all";
14
+ interface ZespanPiiConfig {
15
+ piiPreset?: PiiPreset;
16
+ piiCategories?: PiiCategory[];
17
+ piiIncludeNames?: boolean;
18
+ piiIncludeEmails?: boolean;
19
+ piiIncludePhones?: boolean;
20
+ piiIncludeAddresses?: boolean;
21
+ piiConfidenceThreshold?: number;
22
+ piiRedactionMode?: PiiRedactionMode;
23
+ piiWhitelist?: string[];
24
+ piiCustomPatterns?: RegExp[];
25
+ }
26
+ interface ZespanOptions extends ZespanPiiConfig {
12
27
  apiKey: string;
13
28
  endpoint?: string;
14
29
  baseURL?: string;
15
30
  environment?: string;
16
31
  storePrompts?: boolean;
17
32
  redactKeys?: string[];
33
+ /** Pattern-based PII detection via openredaction. OFF by default — must opt in. */
34
+ redactPii?: boolean;
18
35
  sampleRate?: number;
19
36
  debug?: boolean;
20
37
  batchSize?: number;
@@ -71,6 +88,7 @@ interface Prompt {
71
88
  declare class PromptClient {
72
89
  private client;
73
90
  private cache;
91
+ private cacheIndex;
74
92
  private cacheTTL;
75
93
  constructor(client: ZespanClient);
76
94
  /**
@@ -245,6 +263,7 @@ declare class ZespanClient {
245
263
  readonly environment: string;
246
264
  readonly storePrompts: boolean;
247
265
  readonly redactKeys: string[];
266
+ readonly redactPii: boolean;
248
267
  readonly sampleRate: number;
249
268
  readonly debug: boolean;
250
269
  readonly enableOTel: boolean;
@@ -257,6 +276,9 @@ declare class ZespanClient {
257
276
  constructor(opts: ZespanOptions);
258
277
  enqueue(event: ZespanEvent): void;
259
278
  redactForStorage(value: unknown): string;
279
+ redactValueAsync(value: unknown): Promise<string>;
280
+ redactTextAsync(text: string): Promise<string>;
281
+ redactObjectAsync(obj: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
260
282
  private resolveGuardrailsUrl;
261
283
  checkGuardrails(input: GuardrailCheckInput): Promise<GuardrailCheckResponse>;
262
284
  flush(): Promise<void>;
@@ -567,4 +589,4 @@ declare const zespan: {
567
589
  ZespanLlamaIndexHandler: typeof ZespanLlamaIndexHandler;
568
590
  };
569
591
 
570
- export { type ADKAgentOptions, type ADKRunnerOptions, AgentContext, type AgentOptions, BaggageSpanProcessor, CREWAI_OTEL_ENV, GuardrailBlockedError, type GuardrailCheckInput, type GuardrailCheckResponse, type GuardrailResult, type InstrumentADKOptions, type OTelConfig, type Prompt, PromptClient, type PromptOptions, type ResolvedWrapperGuardrailsSettings, type WrapperGuardrailsOptions, type WrapperGuardrailsSettings, ZespanADKCallbackHandler, ZespanCallbackHandler, ZespanClient, type ZespanContextOptions, ZespanLlamaIndexHandler, attachTraceToAutoGenMessage, autopatch, createSpan, extractAgentContext, extractAgentContext as extractAutoGenContext, extractTraceFromAutoGenMessage, getCrewAIInstrumentationGuide, getPydanticAIConfig, getTracer, getZespanClient, getZespanVercelTelemetry, init, initOTel, initZespan, injectAgentContext, injectAgentContext as injectAutoGenContext, instrumentADK, instrumentVercelAI, markFrameworkActive, markFrameworkInactive, startSpan, withAgent, withSpan, withZespan, withZespanContext, withZespanTrace, wrapADKAgent, wrapADKRunner, wrapAnthropic, wrapBedrock, wrapGoogle, wrapGoogleGenAI, wrapGroq, wrapLiteLLM, wrapMistral, wrapOpenAI, wrapOpenRouter, wrapZespanADKAgent, zespan };
592
+ export { type ADKAgentOptions, type ADKRunnerOptions, AgentContext, type AgentOptions, BaggageSpanProcessor, CREWAI_OTEL_ENV, GuardrailBlockedError, type GuardrailCheckInput, type GuardrailCheckResponse, type GuardrailResult, type InstrumentADKOptions, type OTelConfig, type PiiCategory, type PiiPreset, type PiiRedactionMode, type Prompt, PromptClient, type PromptOptions, type ResolvedWrapperGuardrailsSettings, type WrapperGuardrailsOptions, type WrapperGuardrailsSettings, ZespanADKCallbackHandler, ZespanCallbackHandler, ZespanClient, type ZespanContextOptions, ZespanLlamaIndexHandler, type ZespanOptions, type ZespanPiiConfig, attachTraceToAutoGenMessage, autopatch, createSpan, extractAgentContext, extractAgentContext as extractAutoGenContext, extractTraceFromAutoGenMessage, getCrewAIInstrumentationGuide, getPydanticAIConfig, getTracer, getZespanClient, getZespanVercelTelemetry, init, initOTel, initZespan, injectAgentContext, injectAgentContext as injectAutoGenContext, instrumentADK, instrumentVercelAI, markFrameworkActive, markFrameworkInactive, startSpan, withAgent, withSpan, withZespan, withZespanContext, withZespanTrace, wrapADKAgent, wrapADKRunner, wrapAnthropic, wrapBedrock, wrapGoogle, wrapGoogleGenAI, wrapGroq, wrapLiteLLM, wrapMistral, wrapOpenAI, wrapOpenRouter, wrapZespanADKAgent, zespan };