agentid-sdk 0.1.31 → 0.1.32
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-BgahmiuN.d.mts} +2 -0
- package/dist/{agentid-agvYW2vW.d.ts → agentid-BgahmiuN.d.ts} +2 -0
- package/dist/{chunk-WGJ7SVQB.mjs → chunk-Z2M5A4YZ.mjs} +48 -9
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +48 -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,8 @@ declare class AgentID {
|
|
|
152
152
|
private resolveEffectiveStrictMode;
|
|
153
153
|
private maybeRaiseStrictIngestDependencyError;
|
|
154
154
|
private shouldRunLocalInjectionScan;
|
|
155
|
+
private shouldRefreshCapabilityConfigBeforeLocalEnforcement;
|
|
156
|
+
private refreshCapabilityConfigBeforeLocalEnforcement;
|
|
155
157
|
private applyLocalPolicyChecks;
|
|
156
158
|
prepareInputForDispatch(params: {
|
|
157
159
|
input: string;
|
|
@@ -152,6 +152,8 @@ declare class AgentID {
|
|
|
152
152
|
private resolveEffectiveStrictMode;
|
|
153
153
|
private maybeRaiseStrictIngestDependencyError;
|
|
154
154
|
private shouldRunLocalInjectionScan;
|
|
155
|
+
private shouldRefreshCapabilityConfigBeforeLocalEnforcement;
|
|
156
|
+
private refreshCapabilityConfigBeforeLocalEnforcement;
|
|
155
157
|
private applyLocalPolicyChecks;
|
|
156
158
|
prepareInputForDispatch(params: {
|
|
157
159
|
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.32".trim().length > 0 ? "js-0.1.32" : 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,25 @@ var AgentID = class {
|
|
|
2659
2662
|
}
|
|
2660
2663
|
return config.block_on_heuristic;
|
|
2661
2664
|
}
|
|
2665
|
+
shouldRefreshCapabilityConfigBeforeLocalEnforcement(config) {
|
|
2666
|
+
if (config.shadow_mode) {
|
|
2667
|
+
return false;
|
|
2668
|
+
}
|
|
2669
|
+
return this.shouldRunLocalInjectionScan(config) || config.block_db_access || config.block_code_execution || config.block_pii_leakage;
|
|
2670
|
+
}
|
|
2671
|
+
async refreshCapabilityConfigBeforeLocalEnforcement(params) {
|
|
2672
|
+
if (!this.shouldRefreshCapabilityConfigBeforeLocalEnforcement(params.capabilityConfig)) {
|
|
2673
|
+
return {
|
|
2674
|
+
capabilityConfig: params.capabilityConfig,
|
|
2675
|
+
sdkConfigFetchMs: params.sdkConfigFetchMs
|
|
2676
|
+
};
|
|
2677
|
+
}
|
|
2678
|
+
const refreshed = await this.getCapabilityConfigWithTelemetry(true, params.options);
|
|
2679
|
+
return {
|
|
2680
|
+
capabilityConfig: refreshed.capabilityConfig,
|
|
2681
|
+
sdkConfigFetchMs: params.sdkConfigFetchMs + refreshed.sdkConfigFetchMs
|
|
2682
|
+
};
|
|
2683
|
+
}
|
|
2662
2684
|
async applyLocalPolicyChecks(params) {
|
|
2663
2685
|
const localScanStartedAt = Date.now();
|
|
2664
2686
|
if (params.runPromptInjectionCheck && params.input && this.shouldRunLocalInjectionScan(params.capabilityConfig)) {
|
|
@@ -2715,7 +2737,7 @@ var AgentID = class {
|
|
|
2715
2737
|
}
|
|
2716
2738
|
async prepareInputForDispatch(params, options) {
|
|
2717
2739
|
const effectiveApiKey = this.resolveApiKey(options?.apiKey);
|
|
2718
|
-
|
|
2740
|
+
let { capabilityConfig, sdkConfigFetchMs } = await this.getCapabilityConfigWithTelemetry(
|
|
2719
2741
|
false,
|
|
2720
2742
|
options
|
|
2721
2743
|
);
|
|
@@ -2727,6 +2749,13 @@ var AgentID = class {
|
|
|
2727
2749
|
sdkLocalScanMs: 0
|
|
2728
2750
|
};
|
|
2729
2751
|
}
|
|
2752
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2753
|
+
capabilityConfig,
|
|
2754
|
+
sdkConfigFetchMs,
|
|
2755
|
+
options
|
|
2756
|
+
});
|
|
2757
|
+
capabilityConfig = refreshedConfig.capabilityConfig;
|
|
2758
|
+
sdkConfigFetchMs = refreshedConfig.sdkConfigFetchMs;
|
|
2730
2759
|
const enforced = await this.applyLocalPolicyChecks({
|
|
2731
2760
|
input: params.input,
|
|
2732
2761
|
systemId: params.systemId,
|
|
@@ -2750,20 +2779,25 @@ var AgentID = class {
|
|
|
2750
2779
|
capabilityConfig: params.capabilityConfig,
|
|
2751
2780
|
sdkConfigFetchMs: params.sdkConfigFetchMs
|
|
2752
2781
|
} : await this.getCapabilityConfigWithTelemetry(false, options);
|
|
2782
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2783
|
+
capabilityConfig: resolvedConfig.capabilityConfig,
|
|
2784
|
+
sdkConfigFetchMs: resolvedConfig.sdkConfigFetchMs,
|
|
2785
|
+
options
|
|
2786
|
+
});
|
|
2753
2787
|
const enforced = await this.applyLocalPolicyChecks({
|
|
2754
2788
|
input: params.input,
|
|
2755
2789
|
systemId: params.systemId,
|
|
2756
2790
|
stream: params.stream,
|
|
2757
|
-
capabilityConfig:
|
|
2791
|
+
capabilityConfig: refreshedConfig.capabilityConfig,
|
|
2758
2792
|
apiKey: effectiveApiKey,
|
|
2759
2793
|
clientEventId: params.clientEventId,
|
|
2760
|
-
sdkConfigFetchMs:
|
|
2794
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs,
|
|
2761
2795
|
runPromptInjectionCheck: true
|
|
2762
2796
|
});
|
|
2763
2797
|
return {
|
|
2764
2798
|
sanitizedInput: enforced.sanitizedInput,
|
|
2765
|
-
capabilityConfig:
|
|
2766
|
-
sdkConfigFetchMs:
|
|
2799
|
+
capabilityConfig: refreshedConfig.capabilityConfig,
|
|
2800
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs,
|
|
2767
2801
|
sdkLocalScanMs: enforced.sdkLocalScanMs
|
|
2768
2802
|
};
|
|
2769
2803
|
}
|
|
@@ -2771,11 +2805,16 @@ var AgentID = class {
|
|
|
2771
2805
|
if (!input) {
|
|
2772
2806
|
return;
|
|
2773
2807
|
}
|
|
2774
|
-
const
|
|
2808
|
+
const initialConfig = await this.getCapabilityConfigWithTelemetry(
|
|
2775
2809
|
false,
|
|
2776
2810
|
options
|
|
2777
2811
|
);
|
|
2778
|
-
|
|
2812
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2813
|
+
capabilityConfig: initialConfig.capabilityConfig,
|
|
2814
|
+
sdkConfigFetchMs: initialConfig.sdkConfigFetchMs,
|
|
2815
|
+
options
|
|
2816
|
+
});
|
|
2817
|
+
if (!this.shouldRunLocalInjectionScan(refreshedConfig.capabilityConfig)) {
|
|
2779
2818
|
return;
|
|
2780
2819
|
}
|
|
2781
2820
|
const effectiveApiKey = this.resolveApiKey(options?.apiKey);
|
|
@@ -2791,7 +2830,7 @@ var AgentID = class {
|
|
|
2791
2830
|
eventId: options?.clientEventId,
|
|
2792
2831
|
clientEventId: options?.clientEventId,
|
|
2793
2832
|
telemetryMetadata: buildSdkTimingMetadata({
|
|
2794
|
-
sdkConfigFetchMs
|
|
2833
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs
|
|
2795
2834
|
})
|
|
2796
2835
|
});
|
|
2797
2836
|
}
|
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-BgahmiuN.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-BgahmiuN.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.32".trim().length > 0 ? "js-0.1.32" : 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,25 @@ var AgentID = class {
|
|
|
2692
2695
|
}
|
|
2693
2696
|
return config.block_on_heuristic;
|
|
2694
2697
|
}
|
|
2698
|
+
shouldRefreshCapabilityConfigBeforeLocalEnforcement(config) {
|
|
2699
|
+
if (config.shadow_mode) {
|
|
2700
|
+
return false;
|
|
2701
|
+
}
|
|
2702
|
+
return this.shouldRunLocalInjectionScan(config) || config.block_db_access || config.block_code_execution || config.block_pii_leakage;
|
|
2703
|
+
}
|
|
2704
|
+
async refreshCapabilityConfigBeforeLocalEnforcement(params) {
|
|
2705
|
+
if (!this.shouldRefreshCapabilityConfigBeforeLocalEnforcement(params.capabilityConfig)) {
|
|
2706
|
+
return {
|
|
2707
|
+
capabilityConfig: params.capabilityConfig,
|
|
2708
|
+
sdkConfigFetchMs: params.sdkConfigFetchMs
|
|
2709
|
+
};
|
|
2710
|
+
}
|
|
2711
|
+
const refreshed = await this.getCapabilityConfigWithTelemetry(true, params.options);
|
|
2712
|
+
return {
|
|
2713
|
+
capabilityConfig: refreshed.capabilityConfig,
|
|
2714
|
+
sdkConfigFetchMs: params.sdkConfigFetchMs + refreshed.sdkConfigFetchMs
|
|
2715
|
+
};
|
|
2716
|
+
}
|
|
2695
2717
|
async applyLocalPolicyChecks(params) {
|
|
2696
2718
|
const localScanStartedAt = Date.now();
|
|
2697
2719
|
if (params.runPromptInjectionCheck && params.input && this.shouldRunLocalInjectionScan(params.capabilityConfig)) {
|
|
@@ -2748,7 +2770,7 @@ var AgentID = class {
|
|
|
2748
2770
|
}
|
|
2749
2771
|
async prepareInputForDispatch(params, options) {
|
|
2750
2772
|
const effectiveApiKey = this.resolveApiKey(options?.apiKey);
|
|
2751
|
-
|
|
2773
|
+
let { capabilityConfig, sdkConfigFetchMs } = await this.getCapabilityConfigWithTelemetry(
|
|
2752
2774
|
false,
|
|
2753
2775
|
options
|
|
2754
2776
|
);
|
|
@@ -2760,6 +2782,13 @@ var AgentID = class {
|
|
|
2760
2782
|
sdkLocalScanMs: 0
|
|
2761
2783
|
};
|
|
2762
2784
|
}
|
|
2785
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2786
|
+
capabilityConfig,
|
|
2787
|
+
sdkConfigFetchMs,
|
|
2788
|
+
options
|
|
2789
|
+
});
|
|
2790
|
+
capabilityConfig = refreshedConfig.capabilityConfig;
|
|
2791
|
+
sdkConfigFetchMs = refreshedConfig.sdkConfigFetchMs;
|
|
2763
2792
|
const enforced = await this.applyLocalPolicyChecks({
|
|
2764
2793
|
input: params.input,
|
|
2765
2794
|
systemId: params.systemId,
|
|
@@ -2783,20 +2812,25 @@ var AgentID = class {
|
|
|
2783
2812
|
capabilityConfig: params.capabilityConfig,
|
|
2784
2813
|
sdkConfigFetchMs: params.sdkConfigFetchMs
|
|
2785
2814
|
} : await this.getCapabilityConfigWithTelemetry(false, options);
|
|
2815
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2816
|
+
capabilityConfig: resolvedConfig.capabilityConfig,
|
|
2817
|
+
sdkConfigFetchMs: resolvedConfig.sdkConfigFetchMs,
|
|
2818
|
+
options
|
|
2819
|
+
});
|
|
2786
2820
|
const enforced = await this.applyLocalPolicyChecks({
|
|
2787
2821
|
input: params.input,
|
|
2788
2822
|
systemId: params.systemId,
|
|
2789
2823
|
stream: params.stream,
|
|
2790
|
-
capabilityConfig:
|
|
2824
|
+
capabilityConfig: refreshedConfig.capabilityConfig,
|
|
2791
2825
|
apiKey: effectiveApiKey,
|
|
2792
2826
|
clientEventId: params.clientEventId,
|
|
2793
|
-
sdkConfigFetchMs:
|
|
2827
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs,
|
|
2794
2828
|
runPromptInjectionCheck: true
|
|
2795
2829
|
});
|
|
2796
2830
|
return {
|
|
2797
2831
|
sanitizedInput: enforced.sanitizedInput,
|
|
2798
|
-
capabilityConfig:
|
|
2799
|
-
sdkConfigFetchMs:
|
|
2832
|
+
capabilityConfig: refreshedConfig.capabilityConfig,
|
|
2833
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs,
|
|
2800
2834
|
sdkLocalScanMs: enforced.sdkLocalScanMs
|
|
2801
2835
|
};
|
|
2802
2836
|
}
|
|
@@ -2804,11 +2838,16 @@ var AgentID = class {
|
|
|
2804
2838
|
if (!input) {
|
|
2805
2839
|
return;
|
|
2806
2840
|
}
|
|
2807
|
-
const
|
|
2841
|
+
const initialConfig = await this.getCapabilityConfigWithTelemetry(
|
|
2808
2842
|
false,
|
|
2809
2843
|
options
|
|
2810
2844
|
);
|
|
2811
|
-
|
|
2845
|
+
const refreshedConfig = await this.refreshCapabilityConfigBeforeLocalEnforcement({
|
|
2846
|
+
capabilityConfig: initialConfig.capabilityConfig,
|
|
2847
|
+
sdkConfigFetchMs: initialConfig.sdkConfigFetchMs,
|
|
2848
|
+
options
|
|
2849
|
+
});
|
|
2850
|
+
if (!this.shouldRunLocalInjectionScan(refreshedConfig.capabilityConfig)) {
|
|
2812
2851
|
return;
|
|
2813
2852
|
}
|
|
2814
2853
|
const effectiveApiKey = this.resolveApiKey(options?.apiKey);
|
|
@@ -2824,7 +2863,7 @@ var AgentID = class {
|
|
|
2824
2863
|
eventId: options?.clientEventId,
|
|
2825
2864
|
clientEventId: options?.clientEventId,
|
|
2826
2865
|
telemetryMetadata: buildSdkTimingMetadata({
|
|
2827
|
-
sdkConfigFetchMs
|
|
2866
|
+
sdkConfigFetchMs: refreshedConfig.sdkConfigFetchMs
|
|
2828
2867
|
})
|
|
2829
2868
|
});
|
|
2830
2869
|
}
|
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.32".trim().length > 0 ? "js-0.1.32" : FALLBACK_SDK_VERSION;
|
|
31
31
|
|
|
32
32
|
// src/pii-national-identifiers.ts
|
|
33
33
|
var REGION_ANCHORS = {
|
package/dist/langchain.mjs
CHANGED