avantgate 2.1.0 → 2.3.0
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 +10 -22
- package/dist/chunk-Z6QOMLZ2.mjs +55 -0
- package/dist/control-layer.d.ts +20 -2
- package/dist/control-layer.d.ts.map +1 -1
- package/dist/custom-terms.d.ts +8 -0
- package/dist/custom-terms.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +367 -34
- package/dist/index.mjs +358 -34
- package/dist/middleware.d.ts +15 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/presets.d.ts +13 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/secret-guard.d.ts +5 -0
- package/dist/secret-guard.d.ts.map +1 -1
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +65 -0
- package/dist/ui/index.mjs +6 -0
- package/dist/ui/react/index.mjs +4 -51
- package/package.json +10 -13
package/dist/index.mjs
CHANGED
|
@@ -562,6 +562,70 @@ var createHttpProviderClient = (config) => {
|
|
|
562
562
|
return new HttpProviderClient(config);
|
|
563
563
|
};
|
|
564
564
|
|
|
565
|
+
// src/custom-terms.ts
|
|
566
|
+
var DEFAULT_MASKS = {
|
|
567
|
+
PROJECT: "[REDACTED_PROJECT]",
|
|
568
|
+
COMPANY: "[REDACTED_COMPANY]",
|
|
569
|
+
INFRA: "[REDACTED_INFRA]",
|
|
570
|
+
CUSTOM: "[REDACTED_CUSTOM]"
|
|
571
|
+
};
|
|
572
|
+
var escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
573
|
+
var resolveTermDefinition = (entry) => {
|
|
574
|
+
if (typeof entry === "string") {
|
|
575
|
+
return {
|
|
576
|
+
term: entry.trim(),
|
|
577
|
+
mask: DEFAULT_MASKS.CUSTOM,
|
|
578
|
+
category: "CUSTOM",
|
|
579
|
+
caseSensitive: false
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
const category = entry.category ?? "CUSTOM";
|
|
583
|
+
return {
|
|
584
|
+
term: entry.term.trim(),
|
|
585
|
+
mask: entry.mask ?? (DEFAULT_MASKS[category] ?? DEFAULT_MASKS.CUSTOM),
|
|
586
|
+
category,
|
|
587
|
+
caseSensitive: Boolean(entry.caseSensitive)
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
var buildTermRegex = (def) => {
|
|
591
|
+
const escaped = escapeRegex(def.term);
|
|
592
|
+
const leadingBoundary = /^\w/.test(def.term) ? "\\b" : "";
|
|
593
|
+
const trailingBoundary = /\w$/.test(def.term) ? "\\b" : "";
|
|
594
|
+
return new RegExp(`${leadingBoundary}${escaped}${trailingBoundary}`, def.caseSensitive ? "g" : "gi");
|
|
595
|
+
};
|
|
596
|
+
var replaceTermsInText = (initialText, definitions) => {
|
|
597
|
+
let currentText = initialText;
|
|
598
|
+
let totalMaskedCount = 0;
|
|
599
|
+
const matchedTermsSet = /* @__PURE__ */ new Set();
|
|
600
|
+
for (const item of definitions) {
|
|
601
|
+
const regex = buildTermRegex(item);
|
|
602
|
+
let matchCount = 0;
|
|
603
|
+
currentText = currentText.replace(regex, () => {
|
|
604
|
+
matchCount++;
|
|
605
|
+
return item.mask;
|
|
606
|
+
});
|
|
607
|
+
if (matchCount > 0) {
|
|
608
|
+
totalMaskedCount += matchCount;
|
|
609
|
+
matchedTermsSet.add(item.term);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
return {
|
|
613
|
+
text: currentText,
|
|
614
|
+
maskedCount: totalMaskedCount,
|
|
615
|
+
matchedTerms: Array.from(matchedTermsSet)
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
var sanitizeCustomTerms = (input, terms) => {
|
|
619
|
+
if (!input || !terms || terms.length === 0) {
|
|
620
|
+
return { text: input, maskedCount: 0, matchedTerms: [] };
|
|
621
|
+
}
|
|
622
|
+
const normalized = terms.map(resolveTermDefinition).filter((t) => t.term.length > 0).sort((a, b) => b.term.length - a.term.length);
|
|
623
|
+
if (normalized.length === 0) {
|
|
624
|
+
return { text: input, maskedCount: 0, matchedTerms: [] };
|
|
625
|
+
}
|
|
626
|
+
return replaceTermsInText(input, normalized);
|
|
627
|
+
};
|
|
628
|
+
|
|
565
629
|
// src/secret-guard.ts
|
|
566
630
|
var SECRET_PATTERNS = [
|
|
567
631
|
// 1. Clés privées (RSA, OpenSSH, EC, DSA)
|
|
@@ -642,6 +706,7 @@ var sanitizeSecrets = (input) => {
|
|
|
642
706
|
var applyOutputGuards = (rawOutput, options) => {
|
|
643
707
|
let currentText = rawOutput;
|
|
644
708
|
let piiCount = 0;
|
|
709
|
+
let customTermsCount = 0;
|
|
645
710
|
if (options?.maskPII) {
|
|
646
711
|
const piiResult = sanitizePII(currentText);
|
|
647
712
|
currentText = piiResult.text;
|
|
@@ -649,6 +714,11 @@ var applyOutputGuards = (rawOutput, options) => {
|
|
|
649
714
|
}
|
|
650
715
|
const secretResult = sanitizeSecrets(currentText);
|
|
651
716
|
currentText = secretResult.text;
|
|
717
|
+
if (options?.customRedactionTerms && options.customRedactionTerms.length > 0) {
|
|
718
|
+
const customResult = sanitizeCustomTerms(currentText, options.customRedactionTerms);
|
|
719
|
+
currentText = customResult.text;
|
|
720
|
+
customTermsCount = customResult.maskedCount;
|
|
721
|
+
}
|
|
652
722
|
if (secretResult.hasSecrets && options?.secretLeakAction === "BLOCK") {
|
|
653
723
|
const types = secretResult.detections.map((d) => d.type).join(", ");
|
|
654
724
|
throw new SecretLeakBlockedError(
|
|
@@ -658,13 +728,71 @@ var applyOutputGuards = (rawOutput, options) => {
|
|
|
658
728
|
}
|
|
659
729
|
return {
|
|
660
730
|
text: currentText,
|
|
661
|
-
sanitized: piiCount > 0 || secretResult.hasSecrets,
|
|
731
|
+
sanitized: piiCount > 0 || secretResult.hasSecrets || customTermsCount > 0,
|
|
662
732
|
secretDetected: secretResult.hasSecrets,
|
|
663
733
|
piiMaskedCount: piiCount,
|
|
734
|
+
customTermsMaskedCount: customTermsCount,
|
|
664
735
|
detections: secretResult.detections
|
|
665
736
|
};
|
|
666
737
|
};
|
|
667
738
|
|
|
739
|
+
// src/middleware.ts
|
|
740
|
+
var applySingleBeforeMiddleware = async (middleware, current, model, temperature) => {
|
|
741
|
+
if (!middleware.beforeRequest) return current;
|
|
742
|
+
const result = await middleware.beforeRequest({
|
|
743
|
+
messages: current.messages,
|
|
744
|
+
model,
|
|
745
|
+
temperature,
|
|
746
|
+
metadata: current.metadata
|
|
747
|
+
});
|
|
748
|
+
if (!result) return current;
|
|
749
|
+
return {
|
|
750
|
+
messages: result.messages ?? current.messages,
|
|
751
|
+
shortCircuit: result.shortCircuit,
|
|
752
|
+
metadata: current.metadata
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
var executeBeforeRequestHooks = async (middlewares, context) => {
|
|
756
|
+
if (!middlewares || middlewares.length === 0) {
|
|
757
|
+
return { messages: context.messages, metadata: context.metadata };
|
|
758
|
+
}
|
|
759
|
+
let current = {
|
|
760
|
+
messages: context.messages,
|
|
761
|
+
metadata: context.metadata
|
|
762
|
+
};
|
|
763
|
+
for (const middleware of middlewares) {
|
|
764
|
+
current = await applySingleBeforeMiddleware(middleware, current, context.model, context.temperature);
|
|
765
|
+
if (current.shortCircuit) return current;
|
|
766
|
+
}
|
|
767
|
+
return current;
|
|
768
|
+
};
|
|
769
|
+
var applySingleAfterMiddleware = async (middleware, current, baseContext) => {
|
|
770
|
+
if (!middleware.afterResponse) return current;
|
|
771
|
+
const result = await middleware.afterResponse({
|
|
772
|
+
...baseContext,
|
|
773
|
+
responseText: current.responseText,
|
|
774
|
+
metadata: current.metadata
|
|
775
|
+
});
|
|
776
|
+
if (!result) return current;
|
|
777
|
+
return {
|
|
778
|
+
responseText: result.responseText ?? current.responseText,
|
|
779
|
+
metadata: result.metadata ?? current.metadata
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
var executeAfterResponseHooks = async (middlewares, context) => {
|
|
783
|
+
if (!middlewares || middlewares.length === 0) {
|
|
784
|
+
return { responseText: context.responseText, metadata: context.metadata };
|
|
785
|
+
}
|
|
786
|
+
let current = {
|
|
787
|
+
responseText: context.responseText,
|
|
788
|
+
metadata: context.metadata
|
|
789
|
+
};
|
|
790
|
+
for (const middleware of middlewares) {
|
|
791
|
+
current = await applySingleAfterMiddleware(middleware, current, context);
|
|
792
|
+
}
|
|
793
|
+
return current;
|
|
794
|
+
};
|
|
795
|
+
|
|
668
796
|
// src/control-layer.ts
|
|
669
797
|
var AvantGateControlLayer = class {
|
|
670
798
|
config;
|
|
@@ -725,21 +853,27 @@ var AvantGateControlLayer = class {
|
|
|
725
853
|
if (!guard.valid) {
|
|
726
854
|
throw new Error(`[AvantGate Security Guard] Request blocked: ${guard.blockedReason}`);
|
|
727
855
|
}
|
|
856
|
+
let processed = userQuery;
|
|
857
|
+
if (this.config.security?.customRedactionTerms && this.config.security.customRedactionTerms.length > 0) {
|
|
858
|
+
processed = sanitizeCustomTerms(processed, this.config.security.customRedactionTerms).text;
|
|
859
|
+
}
|
|
728
860
|
if (this.config.security?.maskPII) {
|
|
729
|
-
return sanitizePII(
|
|
861
|
+
return sanitizePII(processed).text;
|
|
730
862
|
}
|
|
731
|
-
return
|
|
863
|
+
return processed;
|
|
732
864
|
};
|
|
733
865
|
applyOutputSecurityGuards = (rawOutput) => {
|
|
734
866
|
const isDlpEnabled = this.config.security?.outputDLP ?? this.config.security?.maskPII ?? false;
|
|
735
867
|
const shouldCheckSecrets = this.config.security?.blockSecretLeaks ?? true;
|
|
736
|
-
|
|
868
|
+
const customTerms = this.config.security?.customRedactionTerms;
|
|
869
|
+
if (!isDlpEnabled && !shouldCheckSecrets && (!customTerms || customTerms.length === 0)) {
|
|
737
870
|
return rawOutput;
|
|
738
871
|
}
|
|
739
872
|
const guardResult = applyOutputGuards(rawOutput, {
|
|
740
873
|
maskPII: isDlpEnabled,
|
|
741
874
|
blockSecretLeaks: shouldCheckSecrets,
|
|
742
|
-
secretLeakAction: this.config.security?.secretLeakAction ?? "REDACT"
|
|
875
|
+
secretLeakAction: this.config.security?.secretLeakAction ?? "REDACT",
|
|
876
|
+
customRedactionTerms: customTerms
|
|
743
877
|
});
|
|
744
878
|
return guardResult.text;
|
|
745
879
|
};
|
|
@@ -902,28 +1036,103 @@ var AvantGateControlLayer = class {
|
|
|
902
1036
|
attempts: result.attempts
|
|
903
1037
|
});
|
|
904
1038
|
};
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1039
|
+
prepareInputMessages = (options) => {
|
|
1040
|
+
if (options.messages && options.messages.length > 0) {
|
|
1041
|
+
return this.sanitizeIncomingMessages(options.messages);
|
|
1042
|
+
}
|
|
1043
|
+
if (options.userQuery !== void 0) {
|
|
1044
|
+
const sanitizedQuery = this.applySecurityGuards(options.userQuery);
|
|
1045
|
+
return this.buildMessages(options.systemPrompt, sanitizedQuery);
|
|
1046
|
+
}
|
|
1047
|
+
throw new ConfigurationError("[AvantGate Input Guard] Either 'userQuery' or 'messages' must be provided.");
|
|
1048
|
+
};
|
|
1049
|
+
handleShortCircuit = async (shortCircuit, targetModel) => {
|
|
1050
|
+
const sanitizedText = this.applyOutputSecurityGuards(shortCircuit.text);
|
|
1051
|
+
const result = {
|
|
1052
|
+
text: sanitizedText,
|
|
1053
|
+
tokens: {
|
|
1054
|
+
prompt: shortCircuit.tokens?.promptTokens ?? 0,
|
|
1055
|
+
completion: shortCircuit.tokens?.completionTokens ?? 0,
|
|
1056
|
+
total: shortCircuit.tokens?.totalTokens ?? 0
|
|
1057
|
+
},
|
|
1058
|
+
costUSD: shortCircuit.costUSD ?? 0,
|
|
1059
|
+
modelUsed: `${targetModel}:shortcircuit`,
|
|
1060
|
+
failoverOccurred: false,
|
|
1061
|
+
attempts: 0
|
|
1062
|
+
};
|
|
1063
|
+
await this.notifyAuditSink(result);
|
|
1064
|
+
return result;
|
|
1065
|
+
};
|
|
1066
|
+
dispatchPromptExecution = async (messages, temperature, providerOverride) => {
|
|
1067
|
+
const query = messages[messages.length - 1]?.content ?? "";
|
|
1068
|
+
if (providerOverride) {
|
|
1069
|
+
return this.executeOverrideProvider(providerOverride, messages, query, temperature);
|
|
1070
|
+
}
|
|
1071
|
+
if (this.getProviderChain().length === 0) {
|
|
912
1072
|
if (this.config.mockSimulation) {
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
|
|
1073
|
+
const sim = this.executeSimulation(query);
|
|
1074
|
+
return {
|
|
1075
|
+
responseText: sim.text,
|
|
1076
|
+
usage: { promptTokens: sim.tokens.prompt, completionTokens: sim.tokens.completion, totalTokens: sim.tokens.total },
|
|
1077
|
+
modelUsed: sim.modelUsed,
|
|
1078
|
+
failoverOccurred: false,
|
|
1079
|
+
attempts: 1
|
|
1080
|
+
};
|
|
916
1081
|
}
|
|
917
1082
|
throw new ConfigurationError(
|
|
918
1083
|
"[AvantGate Configuration Error] No active LLM provider configured. Provide a client implementing LLMProviderPort or configure credentials (apiKey / baseUrl)."
|
|
919
1084
|
);
|
|
920
1085
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1086
|
+
return this.executeProviderPipeline(messages, query, temperature);
|
|
1087
|
+
};
|
|
1088
|
+
finalizeExecutionResult = async (output, responseText) => {
|
|
1089
|
+
const sanitizedText = this.applyOutputSecurityGuards(responseText);
|
|
1090
|
+
const hitTokens = output.usage.promptCacheHitTokens ?? 0;
|
|
1091
|
+
const costUSD = this.calculateCost(output.modelUsed, output.usage.promptTokens, output.usage.completionTokens, hitTokens);
|
|
1092
|
+
this.checkPostExecutionBudget(output.usage.totalTokens, costUSD);
|
|
1093
|
+
const tokens = { prompt: output.usage.promptTokens, completion: output.usage.completionTokens, total: output.usage.totalTokens };
|
|
1094
|
+
const result = {
|
|
1095
|
+
text: sanitizedText,
|
|
1096
|
+
tokens,
|
|
1097
|
+
costUSD,
|
|
1098
|
+
modelUsed: output.modelUsed,
|
|
1099
|
+
failoverOccurred: output.failoverOccurred,
|
|
1100
|
+
attempts: output.attempts
|
|
1101
|
+
};
|
|
924
1102
|
await this.notifyAuditSink(result);
|
|
925
1103
|
return result;
|
|
926
1104
|
};
|
|
1105
|
+
runAfterHooks = async (beforeState, output) => {
|
|
1106
|
+
const tokens = { prompt: output.usage.promptTokens, completion: output.usage.completionTokens, total: output.usage.totalTokens };
|
|
1107
|
+
const costUSD = this.calculateCost(output.modelUsed, output.usage.promptTokens, output.usage.completionTokens);
|
|
1108
|
+
return executeAfterResponseHooks(this.config.middlewares, {
|
|
1109
|
+
messages: beforeState.messages,
|
|
1110
|
+
responseText: output.responseText,
|
|
1111
|
+
modelUsed: output.modelUsed,
|
|
1112
|
+
tokens,
|
|
1113
|
+
costUSD,
|
|
1114
|
+
attempts: output.attempts,
|
|
1115
|
+
failoverOccurred: output.failoverOccurred,
|
|
1116
|
+
metadata: beforeState.metadata
|
|
1117
|
+
});
|
|
1118
|
+
};
|
|
1119
|
+
execute = async (options) => {
|
|
1120
|
+
const inputMessages = this.prepareInputMessages(options);
|
|
1121
|
+
const beforeState = await executeBeforeRequestHooks(this.config.middlewares, {
|
|
1122
|
+
messages: inputMessages,
|
|
1123
|
+
model: this.config.primary.model,
|
|
1124
|
+
temperature: options.temperature,
|
|
1125
|
+
metadata: options.metadata
|
|
1126
|
+
});
|
|
1127
|
+
if (beforeState.shortCircuit) {
|
|
1128
|
+
return this.handleShortCircuit(beforeState.shortCircuit, this.config.primary.model);
|
|
1129
|
+
}
|
|
1130
|
+
await this.verifyPromptBudget(beforeState.messages, this.config.primary.model);
|
|
1131
|
+
const output = await this.dispatchPromptExecution(beforeState.messages, options.temperature, options.providerOverride);
|
|
1132
|
+
const afterState = await this.runAfterHooks(beforeState, output);
|
|
1133
|
+
return this.finalizeExecutionResult(output, afterState.responseText);
|
|
1134
|
+
};
|
|
1135
|
+
executePrompt = this.execute;
|
|
927
1136
|
executeStructured = async (options) => {
|
|
928
1137
|
const rawResult = await this.execute({
|
|
929
1138
|
userQuery: options.userQuery,
|
|
@@ -1058,28 +1267,56 @@ var AvantGateControlLayer = class {
|
|
|
1058
1267
|
const delay = initialDelay * Math.pow(factor, attempt);
|
|
1059
1268
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1060
1269
|
};
|
|
1061
|
-
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1270
|
+
handleStructuredShortCircuit = async (shortCircuit, options, targetModel) => {
|
|
1271
|
+
const { parsedData, sanitizedResponse } = this.parseAndValidateStructuredResult(
|
|
1272
|
+
shortCircuit.text,
|
|
1273
|
+
options
|
|
1274
|
+
);
|
|
1275
|
+
const tokens = {
|
|
1276
|
+
prompt: shortCircuit.tokens?.promptTokens ?? 0,
|
|
1277
|
+
completion: shortCircuit.tokens?.completionTokens ?? 0,
|
|
1278
|
+
total: shortCircuit.tokens?.totalTokens ?? 0
|
|
1279
|
+
};
|
|
1280
|
+
const result = {
|
|
1281
|
+
data: parsedData,
|
|
1282
|
+
rawText: sanitizedResponse,
|
|
1283
|
+
tokens,
|
|
1284
|
+
costUSD: shortCircuit.costUSD ?? 0,
|
|
1285
|
+
modelUsed: `${targetModel}:shortcircuit`,
|
|
1286
|
+
failoverOccurred: false
|
|
1287
|
+
};
|
|
1288
|
+
await this.notifyAuditSinkSafe(sanitizedResponse, result, 0);
|
|
1289
|
+
return result;
|
|
1290
|
+
};
|
|
1291
|
+
runStructuredAfterHooks = async (messages, output, attempt) => {
|
|
1292
|
+
const tokens = { prompt: output.promptTokens, completion: output.completionTokens, total: output.promptTokens + output.completionTokens };
|
|
1293
|
+
const costUSD = this.calculateCost(output.modelUsed, output.promptTokens, output.completionTokens);
|
|
1294
|
+
return executeAfterResponseHooks(this.config.middlewares, {
|
|
1295
|
+
messages,
|
|
1296
|
+
responseText: output.responseText,
|
|
1297
|
+
modelUsed: output.modelUsed,
|
|
1298
|
+
tokens,
|
|
1299
|
+
costUSD,
|
|
1300
|
+
attempts: attempt,
|
|
1301
|
+
failoverOccurred: output.failoverOccurred
|
|
1302
|
+
});
|
|
1303
|
+
};
|
|
1304
|
+
executeStructuredLoop = async (options, messages, targetModel, maxRetries) => {
|
|
1066
1305
|
let lastError;
|
|
1067
|
-
let
|
|
1068
|
-
let
|
|
1306
|
+
let accPrompt = 0;
|
|
1307
|
+
let accComp = 0;
|
|
1069
1308
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1070
1309
|
try {
|
|
1071
|
-
const output = await this.dispatchProviderAttempt(options,
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
-
options
|
|
1077
|
-
);
|
|
1310
|
+
const output = await this.dispatchProviderAttempt(options, messages, targetModel);
|
|
1311
|
+
accPrompt += output.promptTokens;
|
|
1312
|
+
accComp += output.completionTokens;
|
|
1313
|
+
const afterState = await this.runStructuredAfterHooks(messages, output, attempt + 1);
|
|
1314
|
+
const { parsedData, sanitizedResponse } = this.parseAndValidateStructuredResult(afterState.responseText, options);
|
|
1078
1315
|
const result = this.buildStructuredResult({
|
|
1079
1316
|
data: parsedData,
|
|
1080
1317
|
rawText: sanitizedResponse,
|
|
1081
|
-
promptTokens:
|
|
1082
|
-
completionTokens:
|
|
1318
|
+
promptTokens: accPrompt,
|
|
1319
|
+
completionTokens: accComp,
|
|
1083
1320
|
modelUsed: output.modelUsed,
|
|
1084
1321
|
failoverOccurred: output.failoverOccurred
|
|
1085
1322
|
});
|
|
@@ -1092,6 +1329,21 @@ var AvantGateControlLayer = class {
|
|
|
1092
1329
|
}
|
|
1093
1330
|
throw lastError;
|
|
1094
1331
|
};
|
|
1332
|
+
generateStructuredOutput = async (options) => {
|
|
1333
|
+
const maxRetries = options.maxRetries ?? this.config.retryOptions?.maxRetries ?? 2;
|
|
1334
|
+
const targetModel = options.model ?? this.config.primary.model;
|
|
1335
|
+
const processedMessages = this.sanitizeIncomingMessages(options.messages);
|
|
1336
|
+
const beforeState = await executeBeforeRequestHooks(this.config.middlewares, {
|
|
1337
|
+
messages: processedMessages,
|
|
1338
|
+
model: targetModel,
|
|
1339
|
+
temperature: options.temperature
|
|
1340
|
+
});
|
|
1341
|
+
if (beforeState.shortCircuit) {
|
|
1342
|
+
return this.handleStructuredShortCircuit(beforeState.shortCircuit, options, targetModel);
|
|
1343
|
+
}
|
|
1344
|
+
await this.verifyPromptBudget(beforeState.messages, targetModel);
|
|
1345
|
+
return this.executeStructuredLoop(options, beforeState.messages, targetModel, maxRetries);
|
|
1346
|
+
};
|
|
1095
1347
|
};
|
|
1096
1348
|
var createLLMControlLayer = (config) => {
|
|
1097
1349
|
return new AvantGateControlLayer(config);
|
|
@@ -1412,6 +1664,69 @@ var PromptRegistry = class {
|
|
|
1412
1664
|
this.registry.clear();
|
|
1413
1665
|
}
|
|
1414
1666
|
};
|
|
1667
|
+
|
|
1668
|
+
// src/presets.ts
|
|
1669
|
+
var createLaunchSafeConfig = (options) => {
|
|
1670
|
+
const defaultSecurity = {
|
|
1671
|
+
detectPromptInjection: true,
|
|
1672
|
+
maskPII: true,
|
|
1673
|
+
outputDLP: true,
|
|
1674
|
+
blockSecretLeaks: true,
|
|
1675
|
+
secretLeakAction: "REDACT"
|
|
1676
|
+
};
|
|
1677
|
+
const defaultRetries = { maxRetries: 2, initialDelayMs: 300, backoffFactor: 1.5 };
|
|
1678
|
+
return {
|
|
1679
|
+
maxTokenBudget: 8192,
|
|
1680
|
+
maxCostUSD: 0.5,
|
|
1681
|
+
...options,
|
|
1682
|
+
retryOptions: { ...defaultRetries, ...options.retryOptions },
|
|
1683
|
+
security: { ...defaultSecurity, ...options.security }
|
|
1684
|
+
};
|
|
1685
|
+
};
|
|
1686
|
+
var createEnterpriseStrictConfig = (options) => {
|
|
1687
|
+
const defaultSecurity = {
|
|
1688
|
+
detectPromptInjection: true,
|
|
1689
|
+
maskPII: true,
|
|
1690
|
+
outputDLP: true,
|
|
1691
|
+
blockSecretLeaks: true,
|
|
1692
|
+
secretLeakAction: "BLOCK"
|
|
1693
|
+
};
|
|
1694
|
+
const defaultRetries = {
|
|
1695
|
+
maxRetries: 3,
|
|
1696
|
+
initialDelayMs: 500,
|
|
1697
|
+
backoffFactor: 2
|
|
1698
|
+
};
|
|
1699
|
+
return {
|
|
1700
|
+
maxTokenBudget: 4096,
|
|
1701
|
+
maxCostUSD: 0.15,
|
|
1702
|
+
...options,
|
|
1703
|
+
retryOptions: { ...defaultRetries, ...options.retryOptions },
|
|
1704
|
+
security: { ...defaultSecurity, ...options.security }
|
|
1705
|
+
};
|
|
1706
|
+
};
|
|
1707
|
+
var createDevPermissiveConfig = (options) => {
|
|
1708
|
+
const defaultSecurity = {
|
|
1709
|
+
detectPromptInjection: false,
|
|
1710
|
+
maskPII: false,
|
|
1711
|
+
outputDLP: false,
|
|
1712
|
+
blockSecretLeaks: false
|
|
1713
|
+
};
|
|
1714
|
+
const defaultRetries = {
|
|
1715
|
+
maxRetries: 1,
|
|
1716
|
+
initialDelayMs: 200,
|
|
1717
|
+
backoffFactor: 1
|
|
1718
|
+
};
|
|
1719
|
+
return {
|
|
1720
|
+
...options,
|
|
1721
|
+
retryOptions: { ...defaultRetries, ...options.retryOptions },
|
|
1722
|
+
security: { ...defaultSecurity, ...options.security }
|
|
1723
|
+
};
|
|
1724
|
+
};
|
|
1725
|
+
var PRESETS = {
|
|
1726
|
+
LAUNCH_SAFE: createLaunchSafeConfig,
|
|
1727
|
+
ENTERPRISE_STRICT: createEnterpriseStrictConfig,
|
|
1728
|
+
DEV_PERMISSIVE: createDevPermissiveConfig
|
|
1729
|
+
};
|
|
1415
1730
|
export {
|
|
1416
1731
|
BudgetExceededError as AvantGateBudgetExceededError,
|
|
1417
1732
|
ConfigurationError as AvantGateConfigurationError,
|
|
@@ -1422,6 +1737,7 @@ export {
|
|
|
1422
1737
|
ConfigurationError,
|
|
1423
1738
|
DEFAULT_MODEL_PRICES,
|
|
1424
1739
|
HttpProviderClient,
|
|
1740
|
+
PRESETS,
|
|
1425
1741
|
PricingRegistry,
|
|
1426
1742
|
PromptBuilder,
|
|
1427
1743
|
PromptRegistry,
|
|
@@ -1434,16 +1750,24 @@ export {
|
|
|
1434
1750
|
WorkflowValidationError,
|
|
1435
1751
|
AvantGateControlLayer as ZenLLMControlLayer,
|
|
1436
1752
|
applyOutputGuards,
|
|
1753
|
+
applySingleAfterMiddleware,
|
|
1754
|
+
applySingleBeforeMiddleware,
|
|
1437
1755
|
calculateCostUSD,
|
|
1438
1756
|
createAvantGate,
|
|
1757
|
+
createDevPermissiveConfig,
|
|
1758
|
+
createEnterpriseStrictConfig,
|
|
1439
1759
|
createHttpProviderClient,
|
|
1440
1760
|
createLLMControlLayer,
|
|
1761
|
+
createLaunchSafeConfig,
|
|
1441
1762
|
defineWorkflow,
|
|
1763
|
+
executeAfterResponseHooks,
|
|
1764
|
+
executeBeforeRequestHooks,
|
|
1442
1765
|
executeWorkflow,
|
|
1443
1766
|
extractAndCleanJSON,
|
|
1444
1767
|
isWorkflowAbortSignal,
|
|
1445
1768
|
resolveModelPrice,
|
|
1446
1769
|
resolveModelPriceAsync,
|
|
1770
|
+
sanitizeCustomTerms,
|
|
1447
1771
|
sanitizePII,
|
|
1448
1772
|
sanitizeSecrets,
|
|
1449
1773
|
validateUserInput,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AvantGateMiddleware, BeforeRequestContext, BeforeRequestResult, AfterResponseContext, ChatMessage } from "./types";
|
|
2
|
+
export interface BeforeExecutionState {
|
|
3
|
+
messages: ChatMessage[];
|
|
4
|
+
metadata?: Record<string, unknown>;
|
|
5
|
+
shortCircuit?: BeforeRequestResult["shortCircuit"];
|
|
6
|
+
}
|
|
7
|
+
export interface AfterExecutionState {
|
|
8
|
+
responseText: string;
|
|
9
|
+
metadata?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare const applySingleBeforeMiddleware: (middleware: AvantGateMiddleware, current: BeforeExecutionState, model: string, temperature?: number) => Promise<BeforeExecutionState>;
|
|
12
|
+
export declare const executeBeforeRequestHooks: (middlewares: AvantGateMiddleware[] | undefined, context: BeforeRequestContext) => Promise<BeforeExecutionState>;
|
|
13
|
+
export declare const applySingleAfterMiddleware: (middleware: AvantGateMiddleware, current: AfterExecutionState, baseContext: Omit<AfterResponseContext, "responseText" | "metadata">) => Promise<AfterExecutionState>;
|
|
14
|
+
export declare const executeAfterResponseHooks: (middlewares: AvantGateMiddleware[] | undefined, context: AfterResponseContext) => Promise<AfterExecutionState>;
|
|
15
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,2BAA2B,GACtC,YAAY,mBAAmB,EAC/B,SAAS,oBAAoB,EAC7B,OAAO,MAAM,EACb,cAAc,MAAM,KACnB,OAAO,CAAC,oBAAoB,CAc9B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,aAAa,mBAAmB,EAAE,GAAG,SAAS,EAC9C,SAAS,oBAAoB,KAC5B,OAAO,CAAC,oBAAoB,CAa9B,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,YAAY,mBAAmB,EAC/B,SAAS,mBAAmB,EAC5B,aAAa,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,KACnE,OAAO,CAAC,mBAAmB,CAY7B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,aAAa,mBAAmB,EAAE,GAAG,SAAS,EAC9C,SAAS,oBAAoB,KAC5B,OAAO,CAAC,mBAAmB,CAY7B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ControlLayerConfig, ProviderConfig } from "./types";
|
|
2
|
+
export interface PresetBaseOptions extends Partial<ControlLayerConfig> {
|
|
3
|
+
primary: ProviderConfig;
|
|
4
|
+
}
|
|
5
|
+
export declare const createLaunchSafeConfig: (options: PresetBaseOptions) => ControlLayerConfig;
|
|
6
|
+
export declare const createEnterpriseStrictConfig: (options: PresetBaseOptions) => ControlLayerConfig;
|
|
7
|
+
export declare const createDevPermissiveConfig: (options: PresetBaseOptions) => ControlLayerConfig;
|
|
8
|
+
export declare const PRESETS: {
|
|
9
|
+
LAUNCH_SAFE: (options: PresetBaseOptions) => ControlLayerConfig;
|
|
10
|
+
ENTERPRISE_STRICT: (options: PresetBaseOptions) => ControlLayerConfig;
|
|
11
|
+
DEV_PERMISSIVE: (options: PresetBaseOptions) => ControlLayerConfig;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAA+B,MAAM,SAAS,CAAC;AAE/F,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,kBAAkB,CAAC;IACpE,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,iBAAiB,KAAG,kBAgBnE,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,SAAS,iBAAiB,KAAG,kBAoBzE,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,SAAS,iBAAiB,KAAG,kBAiBtE,CAAC;AAEF,eAAO,MAAM,OAAO;2BA3D4B,iBAAiB,KAAG,kBAAkB;iCAkBhC,iBAAiB,KAAG,kBAAkB;8BAsBzC,iBAAiB,KAAG,kBAAkB;CAuBxF,CAAC"}
|
package/dist/secret-guard.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { CustomRedactionTermDef } from "./types";
|
|
2
|
+
import { sanitizeCustomTerms, CustomTermsSanitizationResult } from "./custom-terms";
|
|
3
|
+
export { sanitizeCustomTerms, CustomTermsSanitizationResult };
|
|
1
4
|
export interface SecretPatternDef {
|
|
2
5
|
type: string;
|
|
3
6
|
regex: RegExp;
|
|
@@ -17,12 +20,14 @@ export interface OutputGuardOptions {
|
|
|
17
20
|
maskPII?: boolean;
|
|
18
21
|
blockSecretLeaks?: boolean;
|
|
19
22
|
secretLeakAction?: "REDACT" | "BLOCK";
|
|
23
|
+
customRedactionTerms?: Array<string | CustomRedactionTermDef>;
|
|
20
24
|
}
|
|
21
25
|
export interface OutputGuardResult {
|
|
22
26
|
text: string;
|
|
23
27
|
sanitized: boolean;
|
|
24
28
|
secretDetected: boolean;
|
|
25
29
|
piiMaskedCount: number;
|
|
30
|
+
customTermsMaskedCount: number;
|
|
26
31
|
detections: SecretDetection[];
|
|
27
32
|
}
|
|
28
33
|
export declare const applyOutputGuards: (rawOutput: string, options?: OutputGuardOptions) => OutputGuardResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-guard.d.ts","sourceRoot":"","sources":["../src/secret-guard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secret-guard.d.ts","sourceRoot":"","sources":["../src/secret-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,sBAAsB,EAAE,MAA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Category = "PROJECT" | "COMPANY" | "INFRA" | "CUSTOM";
|
|
71
|
+
export interface CustomRedactionTermDef {
|
|
72
|
+
id?: string;
|
|
73
|
+
term: string;
|
|
74
|
+
mask?: string;
|
|
75
|
+
category?: TermCategory;
|
|
76
|
+
caseSensitive?: boolean;
|
|
77
|
+
}
|
|
70
78
|
export interface SecurityConfig {
|
|
71
79
|
detectPromptInjection?: boolean;
|
|
72
80
|
maskPII?: boolean;
|
|
@@ -74,6 +82,7 @@ export interface SecurityConfig {
|
|
|
74
82
|
outputDLP?: boolean;
|
|
75
83
|
blockSecretLeaks?: boolean;
|
|
76
84
|
secretLeakAction?: "REDACT" | "BLOCK";
|
|
85
|
+
customRedactionTerms?: Array<string | CustomRedactionTermDef>;
|
|
77
86
|
}
|
|
78
87
|
export interface RetryConfig {
|
|
79
88
|
maxRetries?: number;
|
|
@@ -106,6 +115,43 @@ export interface FinanceFeaturesConfig {
|
|
|
106
115
|
export interface FeaturesConfig {
|
|
107
116
|
finance?: FinanceFeaturesConfig;
|
|
108
117
|
}
|
|
118
|
+
export interface BeforeRequestContext {
|
|
119
|
+
messages: ChatMessage[];
|
|
120
|
+
model: string;
|
|
121
|
+
temperature?: number;
|
|
122
|
+
metadata?: Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
export interface BeforeRequestResult {
|
|
125
|
+
messages?: ChatMessage[];
|
|
126
|
+
shortCircuit?: {
|
|
127
|
+
text: string;
|
|
128
|
+
tokens?: LLMUsage;
|
|
129
|
+
costUSD?: number;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export interface AfterResponseContext {
|
|
133
|
+
messages: ChatMessage[];
|
|
134
|
+
responseText: string;
|
|
135
|
+
modelUsed: string;
|
|
136
|
+
tokens: {
|
|
137
|
+
prompt: number;
|
|
138
|
+
completion: number;
|
|
139
|
+
total: number;
|
|
140
|
+
};
|
|
141
|
+
costUSD: number;
|
|
142
|
+
attempts: number;
|
|
143
|
+
failoverOccurred: boolean;
|
|
144
|
+
metadata?: Record<string, unknown>;
|
|
145
|
+
}
|
|
146
|
+
export interface AfterResponseResult {
|
|
147
|
+
responseText?: string;
|
|
148
|
+
metadata?: Record<string, unknown>;
|
|
149
|
+
}
|
|
150
|
+
export interface AvantGateMiddleware {
|
|
151
|
+
name: string;
|
|
152
|
+
beforeRequest?: (context: BeforeRequestContext) => Promise<BeforeRequestResult | void> | BeforeRequestResult | void;
|
|
153
|
+
afterResponse?: (context: AfterResponseContext) => Promise<AfterResponseResult | void> | AfterResponseResult | void;
|
|
154
|
+
}
|
|
109
155
|
export interface ControlLayerConfig {
|
|
110
156
|
primary: ProviderConfig;
|
|
111
157
|
fallback?: ProviderConfig;
|
|
@@ -122,6 +168,7 @@ export interface ControlLayerConfig {
|
|
|
122
168
|
pricingCacheTtlMs?: number;
|
|
123
169
|
customPricing?: Record<string, ModelPrice>;
|
|
124
170
|
mockSimulation?: boolean;
|
|
171
|
+
middlewares?: AvantGateMiddleware[];
|
|
125
172
|
}
|
|
126
173
|
export interface ExecutionResult {
|
|
127
174
|
text: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAA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