agentid-sdk 0.1.41 → 0.1.42
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 +83 -2
- package/dist/{agentid-Mjh8rXn0.d.mts → agentid-DbTWrLnN.d.mts} +29 -0
- package/dist/{agentid-Mjh8rXn0.d.ts → agentid-DbTWrLnN.d.ts} +29 -0
- package/dist/{chunk-L2WVWRAC.mjs → chunk-C5U4L4JY.mjs} +566 -418
- package/dist/index.d.mts +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +598 -422
- package/dist/index.mjs +32 -5
- package/dist/langchain.d.mts +8 -1
- package/dist/langchain.d.ts +8 -1
- package/dist/langchain.js +301 -71
- package/dist/langchain.mjs +129 -44
- package/dist/transparency-badge.d.mts +1 -1
- package/dist/transparency-badge.d.ts +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createAgentIdWorkflowTrail,
|
|
14
14
|
getInjectionScanner,
|
|
15
15
|
scanWithRegex
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-C5U4L4JY.mjs";
|
|
17
17
|
|
|
18
18
|
// src/message-history.ts
|
|
19
19
|
function isPlainRecord(value) {
|
|
@@ -25,13 +25,15 @@ function protectMessageHistory(messages, options = { pii: true, secrets: true })
|
|
|
25
25
|
const piiManager = new PIIManager();
|
|
26
26
|
let textPartsCount = 0;
|
|
27
27
|
let transformedTextPartsCount = 0;
|
|
28
|
+
const placeholderMapping = {};
|
|
28
29
|
const protectString = (value) => {
|
|
29
30
|
textPartsCount += 1;
|
|
30
|
-
const masked = piiManager.anonymize(value, options)
|
|
31
|
-
|
|
31
|
+
const masked = piiManager.anonymize(value, options);
|
|
32
|
+
Object.assign(placeholderMapping, masked.mapping);
|
|
33
|
+
if (masked.maskedText !== value) {
|
|
32
34
|
transformedTextPartsCount += 1;
|
|
33
35
|
}
|
|
34
|
-
return masked;
|
|
36
|
+
return masked.maskedText;
|
|
35
37
|
};
|
|
36
38
|
const visit = (value, key) => {
|
|
37
39
|
if (typeof value === "string") {
|
|
@@ -63,7 +65,31 @@ function protectMessageHistory(messages, options = { pii: true, secrets: true })
|
|
|
63
65
|
messages: protectedMessages,
|
|
64
66
|
transformed: protectedMessages !== messages,
|
|
65
67
|
textPartsCount,
|
|
66
|
-
transformedTextPartsCount
|
|
68
|
+
transformedTextPartsCount,
|
|
69
|
+
placeholderMapping
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function protectChatState(messages, options = {}) {
|
|
73
|
+
const transcript = {
|
|
74
|
+
ui: options.transcript?.ui ?? "masked",
|
|
75
|
+
provider: options.transcript?.provider ?? "masked",
|
|
76
|
+
persistence: options.transcript?.persistence ?? "masked"
|
|
77
|
+
};
|
|
78
|
+
const protectedHistory = protectMessageHistory(messages, {
|
|
79
|
+
pii: options.pii ?? true,
|
|
80
|
+
secrets: options.secrets ?? true
|
|
81
|
+
});
|
|
82
|
+
const maskedMessages = protectedHistory.messages;
|
|
83
|
+
return {
|
|
84
|
+
rawMessages: messages,
|
|
85
|
+
uiMessages: transcript.ui === "masked" ? maskedMessages : messages,
|
|
86
|
+
providerMessages: transcript.provider === "masked" ? maskedMessages : messages,
|
|
87
|
+
persistenceMessages: transcript.persistence === "masked" ? maskedMessages : messages,
|
|
88
|
+
transformed: protectedHistory.transformed,
|
|
89
|
+
textPartsCount: protectedHistory.textPartsCount,
|
|
90
|
+
transformedTextPartsCount: protectedHistory.transformedTextPartsCount,
|
|
91
|
+
placeholderMapping: protectedHistory.placeholderMapping,
|
|
92
|
+
transcript
|
|
67
93
|
};
|
|
68
94
|
}
|
|
69
95
|
export {
|
|
@@ -80,6 +106,7 @@ export {
|
|
|
80
106
|
createAgentIdTelemetryContext,
|
|
81
107
|
createAgentIdWorkflowTrail,
|
|
82
108
|
getInjectionScanner,
|
|
109
|
+
protectChatState,
|
|
83
110
|
protectMessageHistory,
|
|
84
111
|
scanWithRegex
|
|
85
112
|
};
|
package/dist/langchain.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
2
|
-
import { b as AgentID, j as AgentTelemetryContext } from './agentid-
|
|
2
|
+
import { b as AgentID, j as AgentTelemetryContext } from './agentid-DbTWrLnN.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* LangChainJS callback handler (dependency-free shape).
|
|
@@ -14,6 +14,7 @@ declare class AgentIDCallbackHandler extends BaseCallbackHandler {
|
|
|
14
14
|
private apiKeyOverride?;
|
|
15
15
|
private expectedLanguages?;
|
|
16
16
|
private telemetry?;
|
|
17
|
+
private deanonymizeOutputForClient;
|
|
17
18
|
private runs;
|
|
18
19
|
private toolRuns;
|
|
19
20
|
private chainRuns;
|
|
@@ -24,6 +25,12 @@ declare class AgentIDCallbackHandler extends BaseCallbackHandler {
|
|
|
24
25
|
apiKey?: string;
|
|
25
26
|
api_key?: string;
|
|
26
27
|
telemetry?: AgentTelemetryContext;
|
|
28
|
+
/**
|
|
29
|
+
* Opt-in legacy behavior: restore AgentID placeholders in caller-facing
|
|
30
|
+
* LangChain output. Defaults to false so output stays masked.
|
|
31
|
+
*/
|
|
32
|
+
deanonymizeOutputForClient?: boolean;
|
|
33
|
+
deanonymize_output_for_client?: boolean;
|
|
27
34
|
});
|
|
28
35
|
private get requestOptions();
|
|
29
36
|
private getLangchainCapabilities;
|
package/dist/langchain.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
2
|
-
import { b as AgentID, j as AgentTelemetryContext } from './agentid-
|
|
2
|
+
import { b as AgentID, j as AgentTelemetryContext } from './agentid-DbTWrLnN.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* LangChainJS callback handler (dependency-free shape).
|
|
@@ -14,6 +14,7 @@ declare class AgentIDCallbackHandler extends BaseCallbackHandler {
|
|
|
14
14
|
private apiKeyOverride?;
|
|
15
15
|
private expectedLanguages?;
|
|
16
16
|
private telemetry?;
|
|
17
|
+
private deanonymizeOutputForClient;
|
|
17
18
|
private runs;
|
|
18
19
|
private toolRuns;
|
|
19
20
|
private chainRuns;
|
|
@@ -24,6 +25,12 @@ declare class AgentIDCallbackHandler extends BaseCallbackHandler {
|
|
|
24
25
|
apiKey?: string;
|
|
25
26
|
api_key?: string;
|
|
26
27
|
telemetry?: AgentTelemetryContext;
|
|
28
|
+
/**
|
|
29
|
+
* Opt-in legacy behavior: restore AgentID placeholders in caller-facing
|
|
30
|
+
* LangChain output. Defaults to false so output stays masked.
|
|
31
|
+
*/
|
|
32
|
+
deanonymizeOutputForClient?: boolean;
|
|
33
|
+
deanonymize_output_for_client?: boolean;
|
|
27
34
|
});
|
|
28
35
|
private get requestOptions();
|
|
29
36
|
private getLangchainCapabilities;
|