agentid-sdk 0.1.8 → 0.1.9
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -2
- package/dist/index.mjs +23 -2
- package/dist/{langchain-DPMzxdoO.d.mts → langchain-DVPOWfCC.d.mts} +1 -0
- package/dist/{langchain-DPMzxdoO.d.ts → langchain-DVPOWfCC.d.ts} +1 -0
- package/dist/langchain.d.mts +1 -1
- package/dist/langchain.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-DVPOWfCC.mjs';
|
|
2
2
|
|
|
3
3
|
type PIIMapping = Record<string, string>;
|
|
4
4
|
declare class PIIManager {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-DVPOWfCC.js';
|
|
2
2
|
|
|
3
3
|
type PIIMapping = Record<string, string>;
|
|
4
4
|
declare class PIIManager {
|
package/dist/index.js
CHANGED
|
@@ -2106,7 +2106,9 @@ var AgentID = class {
|
|
|
2106
2106
|
source: "guard",
|
|
2107
2107
|
status: params.status,
|
|
2108
2108
|
guard_reason: params.reason,
|
|
2109
|
-
shadow_mode: false
|
|
2109
|
+
shadow_mode: false,
|
|
2110
|
+
suppress_ui: true,
|
|
2111
|
+
internal_retry: true
|
|
2110
2112
|
}
|
|
2111
2113
|
},
|
|
2112
2114
|
{ apiKey: params.apiKey }
|
|
@@ -2140,6 +2142,12 @@ var AgentID = class {
|
|
|
2140
2142
|
if (responseBody && typeof responseBody.allowed === "boolean") {
|
|
2141
2143
|
const verdict = responseBody;
|
|
2142
2144
|
if (verdict.allowed === false && (isInfrastructureGuardReason(verdict.reason) || res.status >= 500)) {
|
|
2145
|
+
if (this.strictMode) {
|
|
2146
|
+
console.warn(
|
|
2147
|
+
`[AgentID] Guard API infrastructure failure in strict mode (${verdict.reason ?? `http_${res.status}`}). Blocking request.`
|
|
2148
|
+
);
|
|
2149
|
+
return { allowed: false, reason: verdict.reason ?? "network_error_strict_mode" };
|
|
2150
|
+
}
|
|
2143
2151
|
console.warn(
|
|
2144
2152
|
`[AgentID] Guard API infrastructure fallback in fail-open mode (${verdict.reason ?? `http_${res.status}`}).`
|
|
2145
2153
|
);
|
|
@@ -2168,15 +2176,24 @@ var AgentID = class {
|
|
|
2168
2176
|
guardParams: params,
|
|
2169
2177
|
apiKey: effectiveApiKey
|
|
2170
2178
|
});
|
|
2179
|
+
if (this.strictMode) {
|
|
2180
|
+
return { allowed: false, reason: "network_error_strict_mode" };
|
|
2181
|
+
}
|
|
2171
2182
|
return { allowed: true, reason: "timeout_fallback" };
|
|
2172
2183
|
}
|
|
2173
|
-
console.warn(
|
|
2184
|
+
console.warn(
|
|
2185
|
+
this.strictMode ? "[AgentID] Guard check failed (Strict mode active):" : "[AgentID] Guard check failed (Fail-Open active):",
|
|
2186
|
+
error
|
|
2187
|
+
);
|
|
2174
2188
|
this.logGuardFallback({
|
|
2175
2189
|
reason: "guard_unreachable",
|
|
2176
2190
|
status: "guard_unreachable",
|
|
2177
2191
|
guardParams: params,
|
|
2178
2192
|
apiKey: effectiveApiKey
|
|
2179
2193
|
});
|
|
2194
|
+
if (this.strictMode) {
|
|
2195
|
+
return { allowed: false, reason: "network_error_strict_mode" };
|
|
2196
|
+
}
|
|
2180
2197
|
return { allowed: true, reason: "guard_unreachable" };
|
|
2181
2198
|
} finally {
|
|
2182
2199
|
clearTimeout(timeoutId);
|
|
@@ -2411,11 +2428,13 @@ var AgentID = class {
|
|
|
2411
2428
|
"AgentID: No user message found. Security guard requires string input."
|
|
2412
2429
|
);
|
|
2413
2430
|
}
|
|
2431
|
+
const clientEventId = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `evt_${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
2414
2432
|
const verdict = await this.guard({
|
|
2415
2433
|
input: maskedText,
|
|
2416
2434
|
system_id: systemId,
|
|
2417
2435
|
model: adapter.getModelName(maskedReq),
|
|
2418
2436
|
user_id: options.user_id,
|
|
2437
|
+
client_event_id: clientEventId,
|
|
2419
2438
|
client_capabilities: this.buildClientCapabilities("openai", false)
|
|
2420
2439
|
}, requestOptions);
|
|
2421
2440
|
if (!verdict.allowed) {
|
|
@@ -2448,6 +2467,7 @@ var AgentID = class {
|
|
|
2448
2467
|
void wrappedCompletion.done.then((result) => {
|
|
2449
2468
|
const outputForLog = isShadowMode ? result.rawOutput : result.transformedOutput;
|
|
2450
2469
|
this.log({
|
|
2470
|
+
event_id: clientEventId,
|
|
2451
2471
|
system_id: systemId,
|
|
2452
2472
|
user_id: options.user_id,
|
|
2453
2473
|
input: maskedText,
|
|
@@ -2482,6 +2502,7 @@ var AgentID = class {
|
|
|
2482
2502
|
const usage = adapter.getTokenUsage(res);
|
|
2483
2503
|
const outputForLog = isShadowMode ? wrappedCompletion.rawOutput : wrappedCompletion.transformedOutput;
|
|
2484
2504
|
this.log({
|
|
2505
|
+
event_id: clientEventId,
|
|
2485
2506
|
system_id: systemId,
|
|
2486
2507
|
user_id: options.user_id,
|
|
2487
2508
|
input: maskedText,
|
package/dist/index.mjs
CHANGED
|
@@ -2068,7 +2068,9 @@ var AgentID = class {
|
|
|
2068
2068
|
source: "guard",
|
|
2069
2069
|
status: params.status,
|
|
2070
2070
|
guard_reason: params.reason,
|
|
2071
|
-
shadow_mode: false
|
|
2071
|
+
shadow_mode: false,
|
|
2072
|
+
suppress_ui: true,
|
|
2073
|
+
internal_retry: true
|
|
2072
2074
|
}
|
|
2073
2075
|
},
|
|
2074
2076
|
{ apiKey: params.apiKey }
|
|
@@ -2102,6 +2104,12 @@ var AgentID = class {
|
|
|
2102
2104
|
if (responseBody && typeof responseBody.allowed === "boolean") {
|
|
2103
2105
|
const verdict = responseBody;
|
|
2104
2106
|
if (verdict.allowed === false && (isInfrastructureGuardReason(verdict.reason) || res.status >= 500)) {
|
|
2107
|
+
if (this.strictMode) {
|
|
2108
|
+
console.warn(
|
|
2109
|
+
`[AgentID] Guard API infrastructure failure in strict mode (${verdict.reason ?? `http_${res.status}`}). Blocking request.`
|
|
2110
|
+
);
|
|
2111
|
+
return { allowed: false, reason: verdict.reason ?? "network_error_strict_mode" };
|
|
2112
|
+
}
|
|
2105
2113
|
console.warn(
|
|
2106
2114
|
`[AgentID] Guard API infrastructure fallback in fail-open mode (${verdict.reason ?? `http_${res.status}`}).`
|
|
2107
2115
|
);
|
|
@@ -2130,15 +2138,24 @@ var AgentID = class {
|
|
|
2130
2138
|
guardParams: params,
|
|
2131
2139
|
apiKey: effectiveApiKey
|
|
2132
2140
|
});
|
|
2141
|
+
if (this.strictMode) {
|
|
2142
|
+
return { allowed: false, reason: "network_error_strict_mode" };
|
|
2143
|
+
}
|
|
2133
2144
|
return { allowed: true, reason: "timeout_fallback" };
|
|
2134
2145
|
}
|
|
2135
|
-
console.warn(
|
|
2146
|
+
console.warn(
|
|
2147
|
+
this.strictMode ? "[AgentID] Guard check failed (Strict mode active):" : "[AgentID] Guard check failed (Fail-Open active):",
|
|
2148
|
+
error
|
|
2149
|
+
);
|
|
2136
2150
|
this.logGuardFallback({
|
|
2137
2151
|
reason: "guard_unreachable",
|
|
2138
2152
|
status: "guard_unreachable",
|
|
2139
2153
|
guardParams: params,
|
|
2140
2154
|
apiKey: effectiveApiKey
|
|
2141
2155
|
});
|
|
2156
|
+
if (this.strictMode) {
|
|
2157
|
+
return { allowed: false, reason: "network_error_strict_mode" };
|
|
2158
|
+
}
|
|
2142
2159
|
return { allowed: true, reason: "guard_unreachable" };
|
|
2143
2160
|
} finally {
|
|
2144
2161
|
clearTimeout(timeoutId);
|
|
@@ -2373,11 +2390,13 @@ var AgentID = class {
|
|
|
2373
2390
|
"AgentID: No user message found. Security guard requires string input."
|
|
2374
2391
|
);
|
|
2375
2392
|
}
|
|
2393
|
+
const clientEventId = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `evt_${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
2376
2394
|
const verdict = await this.guard({
|
|
2377
2395
|
input: maskedText,
|
|
2378
2396
|
system_id: systemId,
|
|
2379
2397
|
model: adapter.getModelName(maskedReq),
|
|
2380
2398
|
user_id: options.user_id,
|
|
2399
|
+
client_event_id: clientEventId,
|
|
2381
2400
|
client_capabilities: this.buildClientCapabilities("openai", false)
|
|
2382
2401
|
}, requestOptions);
|
|
2383
2402
|
if (!verdict.allowed) {
|
|
@@ -2410,6 +2429,7 @@ var AgentID = class {
|
|
|
2410
2429
|
void wrappedCompletion.done.then((result) => {
|
|
2411
2430
|
const outputForLog = isShadowMode ? result.rawOutput : result.transformedOutput;
|
|
2412
2431
|
this.log({
|
|
2432
|
+
event_id: clientEventId,
|
|
2413
2433
|
system_id: systemId,
|
|
2414
2434
|
user_id: options.user_id,
|
|
2415
2435
|
input: maskedText,
|
|
@@ -2444,6 +2464,7 @@ var AgentID = class {
|
|
|
2444
2464
|
const usage = adapter.getTokenUsage(res);
|
|
2445
2465
|
const outputForLog = isShadowMode ? wrappedCompletion.rawOutput : wrappedCompletion.transformedOutput;
|
|
2446
2466
|
this.log({
|
|
2467
|
+
event_id: clientEventId,
|
|
2447
2468
|
system_id: systemId,
|
|
2448
2469
|
user_id: options.user_id,
|
|
2449
2470
|
input: maskedText,
|
package/dist/langchain.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as AgentIDCallbackHandler } from './langchain-
|
|
1
|
+
export { a as AgentIDCallbackHandler } from './langchain-DVPOWfCC.mjs';
|
package/dist/langchain.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as AgentIDCallbackHandler } from './langchain-
|
|
1
|
+
export { a as AgentIDCallbackHandler } from './langchain-DVPOWfCC.js';
|