agentid-sdk 0.1.31 → 0.1.33
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/{agentid-agvYW2vW.d.mts → agentid-M5I7-YqI.d.mts} +1 -0
- package/dist/{agentid-agvYW2vW.d.ts → agentid-M5I7-YqI.d.ts} +1 -0
- package/dist/{chunk-WGJ7SVQB.mjs → chunk-TNBUENAF.mjs} +36 -9
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +36 -9
- package/dist/index.mjs +1 -1
- package/dist/langchain.d.mts +1 -1
- package/dist/langchain.d.ts +1 -1
- package/dist/langchain.js +1 -1
- package/dist/langchain.mjs +1 -1
- package/dist/transparency-badge.d.mts +1 -1
- package/dist/transparency-badge.d.ts +1 -1
- package/package.json +1 -1
|
@@ -152,6 +152,7 @@ declare class AgentID {
|
|
|
152
152
|
private resolveEffectiveStrictMode;
|
|
153
153
|
private maybeRaiseStrictIngestDependencyError;
|
|
154
154
|
private shouldRunLocalInjectionScan;
|
|
155
|
+
private refreshCapabilityConfigBeforeLocalEnforcement;
|
|
155
156
|
private applyLocalPolicyChecks;
|
|
156
157
|
prepareInputForDispatch(params: {
|
|
157
158
|
input: string;
|
|
@@ -152,6 +152,7 @@ declare class AgentID {
|
|
|
152
152
|
private resolveEffectiveStrictMode;
|
|
153
153
|
private maybeRaiseStrictIngestDependencyError;
|
|
154
154
|
private shouldRunLocalInjectionScan;
|
|
155
|
+
private refreshCapabilityConfigBeforeLocalEnforcement;
|
|
155
156
|
private applyLocalPolicyChecks;
|
|
156
157
|
prepareInputForDispatch(params: {
|
|
157
158
|
input: string;
|
|
@@ -1810,7 +1810,7 @@ function getInjectionScanner() {
|
|
|
1810
1810
|
|
|
1811
1811
|
// src/sdk-version.ts
|
|
1812
1812
|
var FALLBACK_SDK_VERSION = "js-0.0.0-dev";
|
|
1813
|
-
var AGENTID_SDK_VERSION_HEADER = "js-0.1.
|
|
1813
|
+
var AGENTID_SDK_VERSION_HEADER = "js-0.1.33".trim().length > 0 ? "js-0.1.33" : FALLBACK_SDK_VERSION;
|
|
1814
1814
|
|
|
1815
1815
|
// src/local-security-enforcer.ts
|
|
1816
1816
|
var DEFAULT_FAIL_OPEN_CONFIG = {
|
|
@@ -2058,8 +2058,11 @@ async function fetchCapabilityConfigAttempt(params) {
|
|
|
2058
2058
|
try {
|
|
2059
2059
|
const res = await fetch(`${normalizeBaseUrl2(params.baseUrl)}/agent/config`, {
|
|
2060
2060
|
method: "GET",
|
|
2061
|
+
cache: "no-store",
|
|
2061
2062
|
headers: {
|
|
2062
2063
|
"Content-Type": "application/json",
|
|
2064
|
+
"Cache-Control": "no-cache, no-store, max-age=0",
|
|
2065
|
+
Pragma: "no-cache",
|
|
2063
2066
|
"x-agentid-api-key": params.apiKey,
|
|
2064
2067
|
"X-AgentID-SDK-Version": AGENTID_SDK_VERSION_HEADER
|
|
2065
2068
|
},
|
|
@@ -2659,6 +2662,13 @@ var AgentID = class {
|
|
|
2659
2662
|
}
|
|
2660
2663
|
return config.block_on_heuristic;
|
|
2661
2664
|
}
|
|
2665
|
+
async refreshCapabilityConfigBeforeLocalEnforcement(params) {
|
|
2666
|
+
const refreshed = await this.getCapabilityConfigWithTelemetry(true, params.options);
|
|
2667
|
+
return {
|
|
2668
|
+
capabilityConfig: refreshed.capabilityConfig,
|
|
2669
|
+
sdkConfigFetchMs: params.sdkConfigFetchMs + refreshed.sdkConfigFetchMs
|
|
2670
|
+
};
|
|
2671
|
+
}
|
|
2662
2672
|
async applyLocalPolicyChecks(params) {
|
|
2663
2673
|
const localScanStartedAt = Date.now();
|
|
2664
2674
|
if (params.runPromptInjectionCheck && params.input && this.shouldRunLocalInjectionScan(params.capabilityConfig)) {
|
|
@@ -2715,7 +2725,7 @@ var AgentID = class {
|
|
|
2715
2725
|
}
|
|
2716
2726
|
async prepareInputForDispatch(params, options) {
|
|
2717
2727
|
const effectiveApiKey = this.resolveApiKey(options?.apiKey);
|
|
2718
|
-
|
|
2728
|
+
let { capabilityConfig, sdkConfigFetchMs } = await this.getCapabilityConfigWithTelemetry(
|
|
2719
2729
|
false,
|
|
2720
2730
|
options
|
|
2721
2731
|
);
|
|
@@ -2727,6 +2737,13 @@ var AgentID = class {
|
|
|
2727
2737
|
sdkLocalScanMs: 0
|
|
2728
2738
|
};
|
|
2729
2739
|
}
|
|
2740
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2741
|
+
capabilityConfig,
|
|
2742
|
+
sdkConfigFetchMs,
|
|
2743
|
+
options
|
|
2744
|
+
});
|
|
2745
|
+
capabilityConfig = refreshedConfig.capabilityConfig;
|
|
2746
|
+
sdkConfigFetchMs = refreshedConfig.sdkConfigFetchMs;
|
|
2730
2747
|
const enforced = await this.applyLocalPolicyChecks({
|
|
2731
2748
|
input: params.input,
|
|
2732
2749
|
systemId: params.systemId,
|
|
@@ -2750,20 +2767,25 @@ var AgentID = class {
|
|
|
2750
2767
|
capabilityConfig: params.capabilityConfig,
|
|
2751
2768
|
sdkConfigFetchMs: params.sdkConfigFetchMs
|
|
2752
2769
|
} : await this.getCapabilityConfigWithTelemetry(false, options);
|
|
2770
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2771
|
+
capabilityConfig: resolvedConfig.capabilityConfig,
|
|
2772
|
+
sdkConfigFetchMs: resolvedConfig.sdkConfigFetchMs,
|
|
2773
|
+
options
|
|
2774
|
+
});
|
|
2753
2775
|
const enforced = await this.applyLocalPolicyChecks({
|
|
2754
2776
|
input: params.input,
|
|
2755
2777
|
systemId: params.systemId,
|
|
2756
2778
|
stream: params.stream,
|
|
2757
|
-
capabilityConfig:
|
|
2779
|
+
capabilityConfig: refreshedConfig.capabilityConfig,
|
|
2758
2780
|
apiKey: effectiveApiKey,
|
|
2759
2781
|
clientEventId: params.clientEventId,
|
|
2760
|
-
sdkConfigFetchMs:
|
|
2782
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs,
|
|
2761
2783
|
runPromptInjectionCheck: true
|
|
2762
2784
|
});
|
|
2763
2785
|
return {
|
|
2764
2786
|
sanitizedInput: enforced.sanitizedInput,
|
|
2765
|
-
capabilityConfig:
|
|
2766
|
-
sdkConfigFetchMs:
|
|
2787
|
+
capabilityConfig: refreshedConfig.capabilityConfig,
|
|
2788
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs,
|
|
2767
2789
|
sdkLocalScanMs: enforced.sdkLocalScanMs
|
|
2768
2790
|
};
|
|
2769
2791
|
}
|
|
@@ -2771,11 +2793,16 @@ var AgentID = class {
|
|
|
2771
2793
|
if (!input) {
|
|
2772
2794
|
return;
|
|
2773
2795
|
}
|
|
2774
|
-
const
|
|
2796
|
+
const initialConfig = await this.getCapabilityConfigWithTelemetry(
|
|
2775
2797
|
false,
|
|
2776
2798
|
options
|
|
2777
2799
|
);
|
|
2778
|
-
|
|
2800
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2801
|
+
capabilityConfig: initialConfig.capabilityConfig,
|
|
2802
|
+
sdkConfigFetchMs: initialConfig.sdkConfigFetchMs,
|
|
2803
|
+
options
|
|
2804
|
+
});
|
|
2805
|
+
if (!this.shouldRunLocalInjectionScan(refreshedConfig.capabilityConfig)) {
|
|
2779
2806
|
return;
|
|
2780
2807
|
}
|
|
2781
2808
|
const effectiveApiKey = this.resolveApiKey(options?.apiKey);
|
|
@@ -2791,7 +2818,7 @@ var AgentID = class {
|
|
|
2791
2818
|
eventId: options?.clientEventId,
|
|
2792
2819
|
clientEventId: options?.clientEventId,
|
|
2793
2820
|
telemetryMetadata: buildSdkTimingMetadata({
|
|
2794
|
-
sdkConfigFetchMs
|
|
2821
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs
|
|
2795
2822
|
})
|
|
2796
2823
|
});
|
|
2797
2824
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AgentID, D as DependencyError, G as GuardParams, a as GuardResponse, L as LogParams, P as PreparedInput, R as RequestOptions, S as SecurityBlockError, T as TransparencyMetadata } from './agentid-
|
|
1
|
+
export { A as AgentID, D as DependencyError, G as GuardParams, a as GuardResponse, L as LogParams, P as PreparedInput, R as RequestOptions, S as SecurityBlockError, T as TransparencyMetadata } from './agentid-M5I7-YqI.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, D as DependencyError, G as GuardParams, a as GuardResponse, L as LogParams, P as PreparedInput, R as RequestOptions, S as SecurityBlockError, T as TransparencyMetadata } from './agentid-
|
|
1
|
+
export { A as AgentID, D as DependencyError, G as GuardParams, a as GuardResponse, L as LogParams, P as PreparedInput, R as RequestOptions, S as SecurityBlockError, T as TransparencyMetadata } from './agentid-M5I7-YqI.js';
|
|
2
2
|
|
|
3
3
|
type PIIMapping = Record<string, string>;
|
|
4
4
|
declare class PIIManager {
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ var OpenAIAdapter = class {
|
|
|
75
75
|
|
|
76
76
|
// src/sdk-version.ts
|
|
77
77
|
var FALLBACK_SDK_VERSION = "js-0.0.0-dev";
|
|
78
|
-
var AGENTID_SDK_VERSION_HEADER = "js-0.1.
|
|
78
|
+
var AGENTID_SDK_VERSION_HEADER = "js-0.1.33".trim().length > 0 ? "js-0.1.33" : FALLBACK_SDK_VERSION;
|
|
79
79
|
|
|
80
80
|
// src/pii-national-identifiers.ts
|
|
81
81
|
var MAX_CANDIDATES_PER_RULE = 256;
|
|
@@ -1432,8 +1432,11 @@ async function fetchCapabilityConfigAttempt(params) {
|
|
|
1432
1432
|
try {
|
|
1433
1433
|
const res = await fetch(`${normalizeBaseUrl(params.baseUrl)}/agent/config`, {
|
|
1434
1434
|
method: "GET",
|
|
1435
|
+
cache: "no-store",
|
|
1435
1436
|
headers: {
|
|
1436
1437
|
"Content-Type": "application/json",
|
|
1438
|
+
"Cache-Control": "no-cache, no-store, max-age=0",
|
|
1439
|
+
Pragma: "no-cache",
|
|
1437
1440
|
"x-agentid-api-key": params.apiKey,
|
|
1438
1441
|
"X-AgentID-SDK-Version": AGENTID_SDK_VERSION_HEADER
|
|
1439
1442
|
},
|
|
@@ -2692,6 +2695,13 @@ var AgentID = class {
|
|
|
2692
2695
|
}
|
|
2693
2696
|
return config.block_on_heuristic;
|
|
2694
2697
|
}
|
|
2698
|
+
async refreshCapabilityConfigBeforeLocalEnforcement(params) {
|
|
2699
|
+
const refreshed = await this.getCapabilityConfigWithTelemetry(true, params.options);
|
|
2700
|
+
return {
|
|
2701
|
+
capabilityConfig: refreshed.capabilityConfig,
|
|
2702
|
+
sdkConfigFetchMs: params.sdkConfigFetchMs + refreshed.sdkConfigFetchMs
|
|
2703
|
+
};
|
|
2704
|
+
}
|
|
2695
2705
|
async applyLocalPolicyChecks(params) {
|
|
2696
2706
|
const localScanStartedAt = Date.now();
|
|
2697
2707
|
if (params.runPromptInjectionCheck && params.input && this.shouldRunLocalInjectionScan(params.capabilityConfig)) {
|
|
@@ -2748,7 +2758,7 @@ var AgentID = class {
|
|
|
2748
2758
|
}
|
|
2749
2759
|
async prepareInputForDispatch(params, options) {
|
|
2750
2760
|
const effectiveApiKey = this.resolveApiKey(options?.apiKey);
|
|
2751
|
-
|
|
2761
|
+
let { capabilityConfig, sdkConfigFetchMs } = await this.getCapabilityConfigWithTelemetry(
|
|
2752
2762
|
false,
|
|
2753
2763
|
options
|
|
2754
2764
|
);
|
|
@@ -2760,6 +2770,13 @@ var AgentID = class {
|
|
|
2760
2770
|
sdkLocalScanMs: 0
|
|
2761
2771
|
};
|
|
2762
2772
|
}
|
|
2773
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2774
|
+
capabilityConfig,
|
|
2775
|
+
sdkConfigFetchMs,
|
|
2776
|
+
options
|
|
2777
|
+
});
|
|
2778
|
+
capabilityConfig = refreshedConfig.capabilityConfig;
|
|
2779
|
+
sdkConfigFetchMs = refreshedConfig.sdkConfigFetchMs;
|
|
2763
2780
|
const enforced = await this.applyLocalPolicyChecks({
|
|
2764
2781
|
input: params.input,
|
|
2765
2782
|
systemId: params.systemId,
|
|
@@ -2783,20 +2800,25 @@ var AgentID = class {
|
|
|
2783
2800
|
capabilityConfig: params.capabilityConfig,
|
|
2784
2801
|
sdkConfigFetchMs: params.sdkConfigFetchMs
|
|
2785
2802
|
} : await this.getCapabilityConfigWithTelemetry(false, options);
|
|
2803
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2804
|
+
capabilityConfig: resolvedConfig.capabilityConfig,
|
|
2805
|
+
sdkConfigFetchMs: resolvedConfig.sdkConfigFetchMs,
|
|
2806
|
+
options
|
|
2807
|
+
});
|
|
2786
2808
|
const enforced = await this.applyLocalPolicyChecks({
|
|
2787
2809
|
input: params.input,
|
|
2788
2810
|
systemId: params.systemId,
|
|
2789
2811
|
stream: params.stream,
|
|
2790
|
-
capabilityConfig:
|
|
2812
|
+
capabilityConfig: refreshedConfig.capabilityConfig,
|
|
2791
2813
|
apiKey: effectiveApiKey,
|
|
2792
2814
|
clientEventId: params.clientEventId,
|
|
2793
|
-
sdkConfigFetchMs:
|
|
2815
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs,
|
|
2794
2816
|
runPromptInjectionCheck: true
|
|
2795
2817
|
});
|
|
2796
2818
|
return {
|
|
2797
2819
|
sanitizedInput: enforced.sanitizedInput,
|
|
2798
|
-
capabilityConfig:
|
|
2799
|
-
sdkConfigFetchMs:
|
|
2820
|
+
capabilityConfig: refreshedConfig.capabilityConfig,
|
|
2821
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs,
|
|
2800
2822
|
sdkLocalScanMs: enforced.sdkLocalScanMs
|
|
2801
2823
|
};
|
|
2802
2824
|
}
|
|
@@ -2804,11 +2826,16 @@ var AgentID = class {
|
|
|
2804
2826
|
if (!input) {
|
|
2805
2827
|
return;
|
|
2806
2828
|
}
|
|
2807
|
-
const
|
|
2829
|
+
const initialConfig = await this.getCapabilityConfigWithTelemetry(
|
|
2808
2830
|
false,
|
|
2809
2831
|
options
|
|
2810
2832
|
);
|
|
2811
|
-
|
|
2833
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2834
|
+
capabilityConfig: initialConfig.capabilityConfig,
|
|
2835
|
+
sdkConfigFetchMs: initialConfig.sdkConfigFetchMs,
|
|
2836
|
+
options
|
|
2837
|
+
});
|
|
2838
|
+
if (!this.shouldRunLocalInjectionScan(refreshedConfig.capabilityConfig)) {
|
|
2812
2839
|
return;
|
|
2813
2840
|
}
|
|
2814
2841
|
const effectiveApiKey = this.resolveApiKey(options?.apiKey);
|
|
@@ -2824,7 +2851,7 @@ var AgentID = class {
|
|
|
2824
2851
|
eventId: options?.clientEventId,
|
|
2825
2852
|
clientEventId: options?.clientEventId,
|
|
2826
2853
|
telemetryMetadata: buildSdkTimingMetadata({
|
|
2827
|
-
sdkConfigFetchMs
|
|
2854
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs
|
|
2828
2855
|
})
|
|
2829
2856
|
});
|
|
2830
2857
|
}
|
package/dist/index.mjs
CHANGED
package/dist/langchain.d.mts
CHANGED
package/dist/langchain.d.ts
CHANGED
package/dist/langchain.js
CHANGED
|
@@ -27,7 +27,7 @@ var import_base = require("@langchain/core/callbacks/base");
|
|
|
27
27
|
|
|
28
28
|
// src/sdk-version.ts
|
|
29
29
|
var FALLBACK_SDK_VERSION = "js-0.0.0-dev";
|
|
30
|
-
var AGENTID_SDK_VERSION_HEADER = "js-0.1.
|
|
30
|
+
var AGENTID_SDK_VERSION_HEADER = "js-0.1.33".trim().length > 0 ? "js-0.1.33" : FALLBACK_SDK_VERSION;
|
|
31
31
|
|
|
32
32
|
// src/pii-national-identifiers.ts
|
|
33
33
|
var REGION_ANCHORS = {
|
package/dist/langchain.mjs
CHANGED