agentid-sdk 0.1.37 → 0.1.40
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 +303 -57
- package/dist/agentid-BWlN5KCq.d.mts +400 -0
- package/dist/agentid-BWlN5KCq.d.ts +400 -0
- package/dist/{chunk-HWES3LI2.mjs → chunk-25SZBEYX.mjs} +1596 -169
- package/dist/index.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +1655 -168
- package/dist/index.mjs +66 -1
- package/dist/langchain.d.mts +15 -1
- package/dist/langchain.d.ts +15 -1
- package/dist/langchain.js +988 -71
- package/dist/langchain.mjs +451 -16
- package/dist/transparency-badge.d.mts +1 -1
- package/dist/transparency-badge.d.ts +1 -1
- package/package.json +9 -5
- package/dist/agentid-JQx2Iy7B.d.mts +0 -240
- package/dist/agentid-JQx2Iy7B.d.ts +0 -240
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
type PIIMapping = Record<string, string>;
|
|
2
|
-
declare class PIIManager {
|
|
3
|
-
/**
|
|
4
|
-
* Reversible local-first masking using <TYPE_INDEX> placeholders.
|
|
5
|
-
*
|
|
6
|
-
* Zero-dependency fallback with strict checksum validation for CEE national IDs.
|
|
7
|
-
*/
|
|
8
|
-
anonymize(text: string): {
|
|
9
|
-
maskedText: string;
|
|
10
|
-
mapping: PIIMapping;
|
|
11
|
-
};
|
|
12
|
-
deanonymize(text: string, mapping: PIIMapping): string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type CapabilityConfig = {
|
|
16
|
-
version?: number | null;
|
|
17
|
-
shadow_mode: boolean;
|
|
18
|
-
strict_security_mode: boolean;
|
|
19
|
-
failure_mode: "fail_open" | "fail_close";
|
|
20
|
-
block_on_heuristic: boolean;
|
|
21
|
-
inject_transparency_metadata: boolean;
|
|
22
|
-
block_pii_leakage: boolean;
|
|
23
|
-
enable_sdk_pii_masking?: boolean;
|
|
24
|
-
block_db_access: boolean;
|
|
25
|
-
block_code_execution: boolean;
|
|
26
|
-
block_toxicity: boolean;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
interface GuardParams {
|
|
30
|
-
input: string;
|
|
31
|
-
system_id: string;
|
|
32
|
-
model?: string;
|
|
33
|
-
user_id?: string;
|
|
34
|
-
client_event_id?: string;
|
|
35
|
-
expected_languages?: string[];
|
|
36
|
-
request_identity?: Record<string, unknown>;
|
|
37
|
-
client_capabilities?: {
|
|
38
|
-
capabilities: {
|
|
39
|
-
has_feedback_handler: boolean;
|
|
40
|
-
pii_masking_enabled: boolean;
|
|
41
|
-
framework: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
interface GuardResponse {
|
|
46
|
-
allowed: boolean;
|
|
47
|
-
reason?: string;
|
|
48
|
-
detected_pii?: boolean;
|
|
49
|
-
transformed_input?: string;
|
|
50
|
-
guard_event_id?: string;
|
|
51
|
-
client_event_id?: string;
|
|
52
|
-
guard_latency_ms?: number;
|
|
53
|
-
shadow_mode?: boolean;
|
|
54
|
-
simulated_decision?: "allowed" | "masked" | "blocked";
|
|
55
|
-
shadow_blocked?: boolean;
|
|
56
|
-
policy_pack_matcher_backend?: "rust_wasm" | "js_hybrid" | "legacy_fallback";
|
|
57
|
-
policy_pack_scan_profile?: "expected_languages" | "auto_detected" | "global_high_priority" | "core_en_fallback";
|
|
58
|
-
policy_pack_scan_mode?: "full" | "segmented";
|
|
59
|
-
exotic_language_detected?: boolean;
|
|
60
|
-
langid_primary?: string;
|
|
61
|
-
langid_confidence?: "high" | "medium" | "low";
|
|
62
|
-
langid_secondary?: string[];
|
|
63
|
-
langid_mixed?: boolean;
|
|
64
|
-
langid_source?: "input_detection" | "input_detection_with_hint";
|
|
65
|
-
transparency?: TransparencyMetadata;
|
|
66
|
-
}
|
|
67
|
-
interface TransparencyMetadata {
|
|
68
|
-
is_ai_generated: true;
|
|
69
|
-
disclosure: "You are interacting with an AI.";
|
|
70
|
-
article: "EU_AI_ACT_ARTICLE_50";
|
|
71
|
-
injection_mode: "deterministic";
|
|
72
|
-
}
|
|
73
|
-
interface RequestOptions {
|
|
74
|
-
apiKey?: string;
|
|
75
|
-
}
|
|
76
|
-
type InjectionScanRequestOptions = RequestOptions & {
|
|
77
|
-
clientEventId?: string;
|
|
78
|
-
systemId?: string;
|
|
79
|
-
};
|
|
80
|
-
interface LogParams {
|
|
81
|
-
event_id?: string;
|
|
82
|
-
system_id?: string;
|
|
83
|
-
input: string;
|
|
84
|
-
output: string;
|
|
85
|
-
model: string;
|
|
86
|
-
usage?: Record<string, unknown>;
|
|
87
|
-
tokens?: Record<string, unknown>;
|
|
88
|
-
latency?: number;
|
|
89
|
-
user_id?: string;
|
|
90
|
-
request_identity?: Record<string, unknown>;
|
|
91
|
-
metadata?: Record<string, unknown>;
|
|
92
|
-
event_type?: "start" | "complete" | "error" | "human_override" | "security_alert" | "security_block" | "security_policy_violation" | "transparency_badge_rendered";
|
|
93
|
-
severity?: "info" | "warning" | "error" | "high";
|
|
94
|
-
timestamp?: string;
|
|
95
|
-
client_capabilities?: {
|
|
96
|
-
capabilities: {
|
|
97
|
-
has_feedback_handler: boolean;
|
|
98
|
-
pii_masking_enabled: boolean;
|
|
99
|
-
framework: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
type AgentIDConfig = {
|
|
104
|
-
apiKey?: string;
|
|
105
|
-
baseUrl?: string;
|
|
106
|
-
piiMasking?: boolean;
|
|
107
|
-
checkInjection?: boolean;
|
|
108
|
-
clientFastFail?: boolean;
|
|
109
|
-
client_fast_fail?: boolean;
|
|
110
|
-
aiScanEnabled?: boolean;
|
|
111
|
-
storePii?: boolean;
|
|
112
|
-
strictMode?: boolean;
|
|
113
|
-
failureMode?: "fail_open" | "fail_close";
|
|
114
|
-
guardTimeoutMs?: number;
|
|
115
|
-
ingestTimeoutMs?: number;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
type PreparedInput = {
|
|
119
|
-
sanitizedInput: string;
|
|
120
|
-
capabilityConfig: CapabilityConfig;
|
|
121
|
-
sdkConfigFetchMs?: number;
|
|
122
|
-
sdkLocalScanMs?: number;
|
|
123
|
-
piiMapping?: PIIMapping;
|
|
124
|
-
shouldDeanonymize?: boolean;
|
|
125
|
-
};
|
|
126
|
-
declare class SecurityBlockError extends Error {
|
|
127
|
-
reason: string;
|
|
128
|
-
constructor(reason?: string);
|
|
129
|
-
}
|
|
130
|
-
declare class DependencyError extends Error {
|
|
131
|
-
dependency: "ingest";
|
|
132
|
-
reason: string;
|
|
133
|
-
status: number | null;
|
|
134
|
-
constructor(params: {
|
|
135
|
-
dependency: "ingest";
|
|
136
|
-
reason: string;
|
|
137
|
-
status: number | null;
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
declare class AgentID {
|
|
141
|
-
private baseUrl;
|
|
142
|
-
private apiKey;
|
|
143
|
-
private configuredPiiMasking;
|
|
144
|
-
private checkInjection;
|
|
145
|
-
private clientFastFail;
|
|
146
|
-
private aiScanEnabled;
|
|
147
|
-
private storePii;
|
|
148
|
-
private strictMode;
|
|
149
|
-
private configuredFailureMode;
|
|
150
|
-
private guardTimeoutMs;
|
|
151
|
-
private ingestTimeoutMs;
|
|
152
|
-
private pii;
|
|
153
|
-
private localEnforcer;
|
|
154
|
-
private injectionScanner;
|
|
155
|
-
private recentGuardVerdicts;
|
|
156
|
-
constructor(config?: AgentIDConfig);
|
|
157
|
-
get piiMasking(): boolean | undefined;
|
|
158
|
-
private resolveEffectivePiiMasking;
|
|
159
|
-
getEffectivePiiMasking(options?: RequestOptions): boolean;
|
|
160
|
-
getEffectivePiiMaskingForConfig(capabilityConfig?: CapabilityConfig): boolean;
|
|
161
|
-
private buildClientCapabilities;
|
|
162
|
-
private resolveApiKey;
|
|
163
|
-
private resolveClientEventId;
|
|
164
|
-
private buildGuardCacheKey;
|
|
165
|
-
private readCachedGuardVerdict;
|
|
166
|
-
private cacheGuardVerdict;
|
|
167
|
-
getCapabilityConfig(force?: boolean, options?: RequestOptions): Promise<CapabilityConfig>;
|
|
168
|
-
private getCapabilityConfigWithTelemetry;
|
|
169
|
-
private getCachedCapabilityConfig;
|
|
170
|
-
private resolveEffectiveStrictMode;
|
|
171
|
-
private maybeRaiseStrictIngestDependencyError;
|
|
172
|
-
private shouldRunLocalInjectionScan;
|
|
173
|
-
private refreshCapabilityConfigBeforeClientControl;
|
|
174
|
-
private applyLocalPolicyChecks;
|
|
175
|
-
prepareInputForDispatch(params: {
|
|
176
|
-
input: string;
|
|
177
|
-
systemId: string;
|
|
178
|
-
stream: boolean;
|
|
179
|
-
skipInjectionScan?: boolean;
|
|
180
|
-
clientEventId?: string;
|
|
181
|
-
}, options?: RequestOptions): Promise<PreparedInput>;
|
|
182
|
-
applyLocalFallbackForGuardFailure(params: {
|
|
183
|
-
input: string;
|
|
184
|
-
systemId: string;
|
|
185
|
-
stream: boolean;
|
|
186
|
-
clientEventId?: string;
|
|
187
|
-
capabilityConfig?: CapabilityConfig;
|
|
188
|
-
sdkConfigFetchMs?: number;
|
|
189
|
-
}, options?: RequestOptions): Promise<PreparedInput>;
|
|
190
|
-
scanPromptInjection(input: string, options?: InjectionScanRequestOptions): Promise<void>;
|
|
191
|
-
private withMaskedOpenAIRequest;
|
|
192
|
-
private logSecurityPolicyViolation;
|
|
193
|
-
private logGuardFallback;
|
|
194
|
-
private finalizeIngestTelemetry;
|
|
195
|
-
/**
|
|
196
|
-
* GUARD: Checks limits, PII, and security before execution.
|
|
197
|
-
* strictMode=false (default): FAIL-OPEN on connectivity/timeouts.
|
|
198
|
-
* strictMode=true: FAIL-CLOSED and throws on connectivity/timeouts.
|
|
199
|
-
*/
|
|
200
|
-
guard(params: GuardParams, options?: RequestOptions): Promise<GuardResponse>;
|
|
201
|
-
private sendIngest;
|
|
202
|
-
private extractStreamChunkText;
|
|
203
|
-
private extractStreamChunkUsage;
|
|
204
|
-
private isOpenAIStreamFinishChunk;
|
|
205
|
-
private setOpenAIStreamChunkText;
|
|
206
|
-
private createSyntheticOpenAIStreamChunk;
|
|
207
|
-
private rewriteOpenAIStreamChunkForClient;
|
|
208
|
-
private wrapCompletion;
|
|
209
|
-
/**
|
|
210
|
-
* LOG: Sends telemetry after execution.
|
|
211
|
-
* Returns a Promise so callers can await persistence when needed.
|
|
212
|
-
*/
|
|
213
|
-
log(params: LogParams, options?: RequestOptions): Promise<void>;
|
|
214
|
-
/**
|
|
215
|
-
* Analytics alias for telemetry logging.
|
|
216
|
-
*/
|
|
217
|
-
analytics(params: LogParams, options?: RequestOptions): Promise<void>;
|
|
218
|
-
/**
|
|
219
|
-
* Trace alias for telemetry logging.
|
|
220
|
-
*/
|
|
221
|
-
trace(params: LogParams, options?: RequestOptions): Promise<void>;
|
|
222
|
-
/**
|
|
223
|
-
* Wrap an OpenAI client once; AgentID will automatically:
|
|
224
|
-
* - run guard() before chat.completions.create
|
|
225
|
-
* - measure latency
|
|
226
|
-
* - persist ingest telemetry for the wrapped call
|
|
227
|
-
*/
|
|
228
|
-
wrapOpenAI<T>(openai: T, options: {
|
|
229
|
-
system_id: string;
|
|
230
|
-
user_id?: string;
|
|
231
|
-
expected_languages?: string[];
|
|
232
|
-
expectedLanguages?: string[];
|
|
233
|
-
request_identity?: Record<string, unknown>;
|
|
234
|
-
apiKey?: string;
|
|
235
|
-
api_key?: string;
|
|
236
|
-
resolveApiKey?: (request: Record<string, unknown>) => string | undefined;
|
|
237
|
-
}): T;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export { AgentID as A, DependencyError as D, type GuardParams as G, type LogParams as L, PIIManager as P, type RequestOptions as R, SecurityBlockError as S, type TransparencyMetadata as T, type GuardResponse as a, type PIIMapping as b, type PreparedInput as c };
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
type PIIMapping = Record<string, string>;
|
|
2
|
-
declare class PIIManager {
|
|
3
|
-
/**
|
|
4
|
-
* Reversible local-first masking using <TYPE_INDEX> placeholders.
|
|
5
|
-
*
|
|
6
|
-
* Zero-dependency fallback with strict checksum validation for CEE national IDs.
|
|
7
|
-
*/
|
|
8
|
-
anonymize(text: string): {
|
|
9
|
-
maskedText: string;
|
|
10
|
-
mapping: PIIMapping;
|
|
11
|
-
};
|
|
12
|
-
deanonymize(text: string, mapping: PIIMapping): string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type CapabilityConfig = {
|
|
16
|
-
version?: number | null;
|
|
17
|
-
shadow_mode: boolean;
|
|
18
|
-
strict_security_mode: boolean;
|
|
19
|
-
failure_mode: "fail_open" | "fail_close";
|
|
20
|
-
block_on_heuristic: boolean;
|
|
21
|
-
inject_transparency_metadata: boolean;
|
|
22
|
-
block_pii_leakage: boolean;
|
|
23
|
-
enable_sdk_pii_masking?: boolean;
|
|
24
|
-
block_db_access: boolean;
|
|
25
|
-
block_code_execution: boolean;
|
|
26
|
-
block_toxicity: boolean;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
interface GuardParams {
|
|
30
|
-
input: string;
|
|
31
|
-
system_id: string;
|
|
32
|
-
model?: string;
|
|
33
|
-
user_id?: string;
|
|
34
|
-
client_event_id?: string;
|
|
35
|
-
expected_languages?: string[];
|
|
36
|
-
request_identity?: Record<string, unknown>;
|
|
37
|
-
client_capabilities?: {
|
|
38
|
-
capabilities: {
|
|
39
|
-
has_feedback_handler: boolean;
|
|
40
|
-
pii_masking_enabled: boolean;
|
|
41
|
-
framework: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
interface GuardResponse {
|
|
46
|
-
allowed: boolean;
|
|
47
|
-
reason?: string;
|
|
48
|
-
detected_pii?: boolean;
|
|
49
|
-
transformed_input?: string;
|
|
50
|
-
guard_event_id?: string;
|
|
51
|
-
client_event_id?: string;
|
|
52
|
-
guard_latency_ms?: number;
|
|
53
|
-
shadow_mode?: boolean;
|
|
54
|
-
simulated_decision?: "allowed" | "masked" | "blocked";
|
|
55
|
-
shadow_blocked?: boolean;
|
|
56
|
-
policy_pack_matcher_backend?: "rust_wasm" | "js_hybrid" | "legacy_fallback";
|
|
57
|
-
policy_pack_scan_profile?: "expected_languages" | "auto_detected" | "global_high_priority" | "core_en_fallback";
|
|
58
|
-
policy_pack_scan_mode?: "full" | "segmented";
|
|
59
|
-
exotic_language_detected?: boolean;
|
|
60
|
-
langid_primary?: string;
|
|
61
|
-
langid_confidence?: "high" | "medium" | "low";
|
|
62
|
-
langid_secondary?: string[];
|
|
63
|
-
langid_mixed?: boolean;
|
|
64
|
-
langid_source?: "input_detection" | "input_detection_with_hint";
|
|
65
|
-
transparency?: TransparencyMetadata;
|
|
66
|
-
}
|
|
67
|
-
interface TransparencyMetadata {
|
|
68
|
-
is_ai_generated: true;
|
|
69
|
-
disclosure: "You are interacting with an AI.";
|
|
70
|
-
article: "EU_AI_ACT_ARTICLE_50";
|
|
71
|
-
injection_mode: "deterministic";
|
|
72
|
-
}
|
|
73
|
-
interface RequestOptions {
|
|
74
|
-
apiKey?: string;
|
|
75
|
-
}
|
|
76
|
-
type InjectionScanRequestOptions = RequestOptions & {
|
|
77
|
-
clientEventId?: string;
|
|
78
|
-
systemId?: string;
|
|
79
|
-
};
|
|
80
|
-
interface LogParams {
|
|
81
|
-
event_id?: string;
|
|
82
|
-
system_id?: string;
|
|
83
|
-
input: string;
|
|
84
|
-
output: string;
|
|
85
|
-
model: string;
|
|
86
|
-
usage?: Record<string, unknown>;
|
|
87
|
-
tokens?: Record<string, unknown>;
|
|
88
|
-
latency?: number;
|
|
89
|
-
user_id?: string;
|
|
90
|
-
request_identity?: Record<string, unknown>;
|
|
91
|
-
metadata?: Record<string, unknown>;
|
|
92
|
-
event_type?: "start" | "complete" | "error" | "human_override" | "security_alert" | "security_block" | "security_policy_violation" | "transparency_badge_rendered";
|
|
93
|
-
severity?: "info" | "warning" | "error" | "high";
|
|
94
|
-
timestamp?: string;
|
|
95
|
-
client_capabilities?: {
|
|
96
|
-
capabilities: {
|
|
97
|
-
has_feedback_handler: boolean;
|
|
98
|
-
pii_masking_enabled: boolean;
|
|
99
|
-
framework: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
type AgentIDConfig = {
|
|
104
|
-
apiKey?: string;
|
|
105
|
-
baseUrl?: string;
|
|
106
|
-
piiMasking?: boolean;
|
|
107
|
-
checkInjection?: boolean;
|
|
108
|
-
clientFastFail?: boolean;
|
|
109
|
-
client_fast_fail?: boolean;
|
|
110
|
-
aiScanEnabled?: boolean;
|
|
111
|
-
storePii?: boolean;
|
|
112
|
-
strictMode?: boolean;
|
|
113
|
-
failureMode?: "fail_open" | "fail_close";
|
|
114
|
-
guardTimeoutMs?: number;
|
|
115
|
-
ingestTimeoutMs?: number;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
type PreparedInput = {
|
|
119
|
-
sanitizedInput: string;
|
|
120
|
-
capabilityConfig: CapabilityConfig;
|
|
121
|
-
sdkConfigFetchMs?: number;
|
|
122
|
-
sdkLocalScanMs?: number;
|
|
123
|
-
piiMapping?: PIIMapping;
|
|
124
|
-
shouldDeanonymize?: boolean;
|
|
125
|
-
};
|
|
126
|
-
declare class SecurityBlockError extends Error {
|
|
127
|
-
reason: string;
|
|
128
|
-
constructor(reason?: string);
|
|
129
|
-
}
|
|
130
|
-
declare class DependencyError extends Error {
|
|
131
|
-
dependency: "ingest";
|
|
132
|
-
reason: string;
|
|
133
|
-
status: number | null;
|
|
134
|
-
constructor(params: {
|
|
135
|
-
dependency: "ingest";
|
|
136
|
-
reason: string;
|
|
137
|
-
status: number | null;
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
declare class AgentID {
|
|
141
|
-
private baseUrl;
|
|
142
|
-
private apiKey;
|
|
143
|
-
private configuredPiiMasking;
|
|
144
|
-
private checkInjection;
|
|
145
|
-
private clientFastFail;
|
|
146
|
-
private aiScanEnabled;
|
|
147
|
-
private storePii;
|
|
148
|
-
private strictMode;
|
|
149
|
-
private configuredFailureMode;
|
|
150
|
-
private guardTimeoutMs;
|
|
151
|
-
private ingestTimeoutMs;
|
|
152
|
-
private pii;
|
|
153
|
-
private localEnforcer;
|
|
154
|
-
private injectionScanner;
|
|
155
|
-
private recentGuardVerdicts;
|
|
156
|
-
constructor(config?: AgentIDConfig);
|
|
157
|
-
get piiMasking(): boolean | undefined;
|
|
158
|
-
private resolveEffectivePiiMasking;
|
|
159
|
-
getEffectivePiiMasking(options?: RequestOptions): boolean;
|
|
160
|
-
getEffectivePiiMaskingForConfig(capabilityConfig?: CapabilityConfig): boolean;
|
|
161
|
-
private buildClientCapabilities;
|
|
162
|
-
private resolveApiKey;
|
|
163
|
-
private resolveClientEventId;
|
|
164
|
-
private buildGuardCacheKey;
|
|
165
|
-
private readCachedGuardVerdict;
|
|
166
|
-
private cacheGuardVerdict;
|
|
167
|
-
getCapabilityConfig(force?: boolean, options?: RequestOptions): Promise<CapabilityConfig>;
|
|
168
|
-
private getCapabilityConfigWithTelemetry;
|
|
169
|
-
private getCachedCapabilityConfig;
|
|
170
|
-
private resolveEffectiveStrictMode;
|
|
171
|
-
private maybeRaiseStrictIngestDependencyError;
|
|
172
|
-
private shouldRunLocalInjectionScan;
|
|
173
|
-
private refreshCapabilityConfigBeforeClientControl;
|
|
174
|
-
private applyLocalPolicyChecks;
|
|
175
|
-
prepareInputForDispatch(params: {
|
|
176
|
-
input: string;
|
|
177
|
-
systemId: string;
|
|
178
|
-
stream: boolean;
|
|
179
|
-
skipInjectionScan?: boolean;
|
|
180
|
-
clientEventId?: string;
|
|
181
|
-
}, options?: RequestOptions): Promise<PreparedInput>;
|
|
182
|
-
applyLocalFallbackForGuardFailure(params: {
|
|
183
|
-
input: string;
|
|
184
|
-
systemId: string;
|
|
185
|
-
stream: boolean;
|
|
186
|
-
clientEventId?: string;
|
|
187
|
-
capabilityConfig?: CapabilityConfig;
|
|
188
|
-
sdkConfigFetchMs?: number;
|
|
189
|
-
}, options?: RequestOptions): Promise<PreparedInput>;
|
|
190
|
-
scanPromptInjection(input: string, options?: InjectionScanRequestOptions): Promise<void>;
|
|
191
|
-
private withMaskedOpenAIRequest;
|
|
192
|
-
private logSecurityPolicyViolation;
|
|
193
|
-
private logGuardFallback;
|
|
194
|
-
private finalizeIngestTelemetry;
|
|
195
|
-
/**
|
|
196
|
-
* GUARD: Checks limits, PII, and security before execution.
|
|
197
|
-
* strictMode=false (default): FAIL-OPEN on connectivity/timeouts.
|
|
198
|
-
* strictMode=true: FAIL-CLOSED and throws on connectivity/timeouts.
|
|
199
|
-
*/
|
|
200
|
-
guard(params: GuardParams, options?: RequestOptions): Promise<GuardResponse>;
|
|
201
|
-
private sendIngest;
|
|
202
|
-
private extractStreamChunkText;
|
|
203
|
-
private extractStreamChunkUsage;
|
|
204
|
-
private isOpenAIStreamFinishChunk;
|
|
205
|
-
private setOpenAIStreamChunkText;
|
|
206
|
-
private createSyntheticOpenAIStreamChunk;
|
|
207
|
-
private rewriteOpenAIStreamChunkForClient;
|
|
208
|
-
private wrapCompletion;
|
|
209
|
-
/**
|
|
210
|
-
* LOG: Sends telemetry after execution.
|
|
211
|
-
* Returns a Promise so callers can await persistence when needed.
|
|
212
|
-
*/
|
|
213
|
-
log(params: LogParams, options?: RequestOptions): Promise<void>;
|
|
214
|
-
/**
|
|
215
|
-
* Analytics alias for telemetry logging.
|
|
216
|
-
*/
|
|
217
|
-
analytics(params: LogParams, options?: RequestOptions): Promise<void>;
|
|
218
|
-
/**
|
|
219
|
-
* Trace alias for telemetry logging.
|
|
220
|
-
*/
|
|
221
|
-
trace(params: LogParams, options?: RequestOptions): Promise<void>;
|
|
222
|
-
/**
|
|
223
|
-
* Wrap an OpenAI client once; AgentID will automatically:
|
|
224
|
-
* - run guard() before chat.completions.create
|
|
225
|
-
* - measure latency
|
|
226
|
-
* - persist ingest telemetry for the wrapped call
|
|
227
|
-
*/
|
|
228
|
-
wrapOpenAI<T>(openai: T, options: {
|
|
229
|
-
system_id: string;
|
|
230
|
-
user_id?: string;
|
|
231
|
-
expected_languages?: string[];
|
|
232
|
-
expectedLanguages?: string[];
|
|
233
|
-
request_identity?: Record<string, unknown>;
|
|
234
|
-
apiKey?: string;
|
|
235
|
-
api_key?: string;
|
|
236
|
-
resolveApiKey?: (request: Record<string, unknown>) => string | undefined;
|
|
237
|
-
}): T;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export { AgentID as A, DependencyError as D, type GuardParams as G, type LogParams as L, PIIManager as P, type RequestOptions as R, SecurityBlockError as S, type TransparencyMetadata as T, type GuardResponse as a, type PIIMapping as b, type PreparedInput as c };
|