@framers/agentos 0.1.56 → 0.1.58
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 +67 -16
- package/dist/api/types/AgentOSResponse.d.ts +7 -0
- package/dist/api/types/AgentOSResponse.d.ts.map +1 -1
- package/dist/core/guardrails/IGuardrailService.d.ts +39 -0
- package/dist/core/guardrails/IGuardrailService.d.ts.map +1 -1
- package/dist/core/guardrails/ParallelGuardrailDispatcher.d.ts +92 -0
- package/dist/core/guardrails/ParallelGuardrailDispatcher.d.ts.map +1 -0
- package/dist/core/guardrails/ParallelGuardrailDispatcher.js +463 -0
- package/dist/core/guardrails/ParallelGuardrailDispatcher.js.map +1 -0
- package/dist/core/guardrails/guardrailDispatcher.d.ts +59 -1
- package/dist/core/guardrails/guardrailDispatcher.d.ts.map +1 -1
- package/dist/core/guardrails/guardrailDispatcher.js +49 -154
- package/dist/core/guardrails/guardrailDispatcher.js.map +1 -1
- package/dist/core/guardrails/index.d.ts +1 -0
- package/dist/core/guardrails/index.d.ts.map +1 -1
- package/dist/core/guardrails/index.js +2 -0
- package/dist/core/guardrails/index.js.map +1 -1
- package/dist/core/utils/index.d.ts +13 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +13 -0
- package/dist/core/utils/index.js.map +1 -0
- package/dist/core/utils/text-utils.d.ts +164 -0
- package/dist/core/utils/text-utils.d.ts.map +1 -0
- package/dist/core/utils/text-utils.js +254 -0
- package/dist/core/utils/text-utils.js.map +1 -0
- package/dist/extensions/index.d.ts +0 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +0 -2
- package/dist/extensions/index.js.map +1 -1
- package/package.json +1 -6
- package/dist/extensions/packs/pii-redaction/EntityMerger.d.ts +0 -127
- package/dist/extensions/packs/pii-redaction/EntityMerger.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/EntityMerger.js +0 -263
- package/dist/extensions/packs/pii-redaction/EntityMerger.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/PiiDetectionPipeline.d.ts +0 -199
- package/dist/extensions/packs/pii-redaction/PiiDetectionPipeline.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/PiiDetectionPipeline.js +0 -456
- package/dist/extensions/packs/pii-redaction/PiiDetectionPipeline.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/PiiRedactionGuardrail.d.ts +0 -121
- package/dist/extensions/packs/pii-redaction/PiiRedactionGuardrail.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/PiiRedactionGuardrail.js +0 -271
- package/dist/extensions/packs/pii-redaction/PiiRedactionGuardrail.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/RedactionEngine.d.ts +0 -61
- package/dist/extensions/packs/pii-redaction/RedactionEngine.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/RedactionEngine.js +0 -207
- package/dist/extensions/packs/pii-redaction/RedactionEngine.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/index.d.ts +0 -90
- package/dist/extensions/packs/pii-redaction/index.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/index.js +0 -195
- package/dist/extensions/packs/pii-redaction/index.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/IEntityRecognizer.d.ts +0 -151
- package/dist/extensions/packs/pii-redaction/recognizers/IEntityRecognizer.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/IEntityRecognizer.js +0 -14
- package/dist/extensions/packs/pii-redaction/recognizers/IEntityRecognizer.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/LlmJudgeRecognizer.d.ts +0 -177
- package/dist/extensions/packs/pii-redaction/recognizers/LlmJudgeRecognizer.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/LlmJudgeRecognizer.js +0 -420
- package/dist/extensions/packs/pii-redaction/recognizers/LlmJudgeRecognizer.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/NerModelRecognizer.d.ts +0 -145
- package/dist/extensions/packs/pii-redaction/recognizers/NerModelRecognizer.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/NerModelRecognizer.js +0 -299
- package/dist/extensions/packs/pii-redaction/recognizers/NerModelRecognizer.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/NlpPrefilterRecognizer.d.ts +0 -102
- package/dist/extensions/packs/pii-redaction/recognizers/NlpPrefilterRecognizer.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/NlpPrefilterRecognizer.js +0 -228
- package/dist/extensions/packs/pii-redaction/recognizers/NlpPrefilterRecognizer.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/RegexRecognizer.d.ts +0 -103
- package/dist/extensions/packs/pii-redaction/recognizers/RegexRecognizer.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/recognizers/RegexRecognizer.js +0 -275
- package/dist/extensions/packs/pii-redaction/recognizers/RegexRecognizer.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/tools/PiiRedactTool.d.ts +0 -118
- package/dist/extensions/packs/pii-redaction/tools/PiiRedactTool.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/tools/PiiRedactTool.js +0 -152
- package/dist/extensions/packs/pii-redaction/tools/PiiRedactTool.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/tools/PiiScanTool.d.ts +0 -98
- package/dist/extensions/packs/pii-redaction/tools/PiiScanTool.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/tools/PiiScanTool.js +0 -153
- package/dist/extensions/packs/pii-redaction/tools/PiiScanTool.js.map +0 -1
- package/dist/extensions/packs/pii-redaction/types.d.ts +0 -332
- package/dist/extensions/packs/pii-redaction/types.d.ts.map +0 -1
- package/dist/extensions/packs/pii-redaction/types.js +0 -83
- package/dist/extensions/packs/pii-redaction/types.js.map +0 -1
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { AgentOSResponseChunkType, } from '../../api/types/AgentOSResponse.js';
|
|
2
|
+
import { GuardrailAction, } from './IGuardrailService.js';
|
|
3
|
+
import { serializeEvaluation, withGuardrailMetadata, createGuardrailBlockedStream, hasEvaluateOutput, } from './guardrailDispatcher.js';
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Severity map used by worstAction — SANITIZE is excluded because it is
|
|
6
|
+
// always downgraded to FLAG before reaching the aggregator.
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
/** @internal Numeric severity for each guardrail action. Higher = worse. */
|
|
9
|
+
const ACTION_SEVERITY = {
|
|
10
|
+
[GuardrailAction.ALLOW]: 0,
|
|
11
|
+
[GuardrailAction.SANITIZE]: 1, // only used as tiebreaker — should not appear in Phase 2
|
|
12
|
+
[GuardrailAction.FLAG]: 2,
|
|
13
|
+
[GuardrailAction.BLOCK]: 3,
|
|
14
|
+
};
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Helpers
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
/**
|
|
19
|
+
* Race a promise against an optional timeout.
|
|
20
|
+
*
|
|
21
|
+
* If `timeoutMs` is not set (undefined / 0), the original promise is returned
|
|
22
|
+
* unmodified. On timeout or error the function returns `null` (fail-open)
|
|
23
|
+
* and logs a warning so operators can tune the timeout.
|
|
24
|
+
*
|
|
25
|
+
* @param fn - The async function to execute
|
|
26
|
+
* @param timeoutMs - Maximum milliseconds to wait (undefined = no limit)
|
|
27
|
+
* @returns The evaluation result, or `null` on timeout / error
|
|
28
|
+
*/
|
|
29
|
+
async function callWithTimeout(fn, timeoutMs) {
|
|
30
|
+
try {
|
|
31
|
+
if (!timeoutMs || timeoutMs <= 0) {
|
|
32
|
+
return await fn();
|
|
33
|
+
}
|
|
34
|
+
// Race the evaluation against a timeout sentinel
|
|
35
|
+
const result = await Promise.race([
|
|
36
|
+
fn(),
|
|
37
|
+
new Promise((resolve) => {
|
|
38
|
+
setTimeout(() => resolve(null), timeoutMs);
|
|
39
|
+
}),
|
|
40
|
+
]);
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.warn('[AgentOS][Guardrails] callWithTimeout: guardrail threw, failing open.', error);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Determine the worst (highest-severity) action from a list of evaluations.
|
|
50
|
+
*
|
|
51
|
+
* Returns `GuardrailAction.ALLOW` when the list is empty.
|
|
52
|
+
*
|
|
53
|
+
* @param evaluations - Non-empty array of evaluation results
|
|
54
|
+
* @returns The action with the highest severity
|
|
55
|
+
*/
|
|
56
|
+
function worstAction(evaluations) {
|
|
57
|
+
if (evaluations.length === 0) {
|
|
58
|
+
return GuardrailAction.ALLOW;
|
|
59
|
+
}
|
|
60
|
+
let worst = evaluations[0].action;
|
|
61
|
+
for (let i = 1; i < evaluations.length; i++) {
|
|
62
|
+
const candidate = evaluations[i].action;
|
|
63
|
+
if (ACTION_SEVERITY[candidate] > ACTION_SEVERITY[worst]) {
|
|
64
|
+
worst = candidate;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return worst;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* If a Phase 2 guardrail returns SANITIZE, downgrade it to FLAG with a
|
|
71
|
+
* warning. Concurrent sanitization is non-deterministic so we refuse it.
|
|
72
|
+
*
|
|
73
|
+
* @param evaluation - The raw evaluation from Phase 2
|
|
74
|
+
* @param svcIndex - Registration index for logging
|
|
75
|
+
* @returns The (potentially downgraded) evaluation
|
|
76
|
+
*/
|
|
77
|
+
function downgradePhase2Sanitize(evaluation, svcIndex) {
|
|
78
|
+
if (evaluation.action !== GuardrailAction.SANITIZE) {
|
|
79
|
+
return evaluation;
|
|
80
|
+
}
|
|
81
|
+
console.warn(`[AgentOS][Guardrails] Phase 2 guardrail at index ${svcIndex} returned SANITIZE — ` +
|
|
82
|
+
'downgrading to FLAG because concurrent sanitization is non-deterministic.');
|
|
83
|
+
return {
|
|
84
|
+
...evaluation,
|
|
85
|
+
action: GuardrailAction.FLAG,
|
|
86
|
+
reason: evaluation.reason
|
|
87
|
+
? `${evaluation.reason} [downgraded from SANITIZE]`
|
|
88
|
+
: 'SANITIZE downgraded to FLAG in parallel phase',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// ParallelGuardrailDispatcher
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
/**
|
|
95
|
+
* Stateless two-phase parallel guardrail dispatcher.
|
|
96
|
+
*
|
|
97
|
+
* All methods are static — no instantiation needed. The class exists purely
|
|
98
|
+
* as a namespace to keep the two public entry points grouped.
|
|
99
|
+
*/
|
|
100
|
+
export class ParallelGuardrailDispatcher {
|
|
101
|
+
// -----------------------------------------------------------------------
|
|
102
|
+
// evaluateInput
|
|
103
|
+
// -----------------------------------------------------------------------
|
|
104
|
+
/**
|
|
105
|
+
* Evaluate user input through registered guardrails using two-phase execution.
|
|
106
|
+
*
|
|
107
|
+
* **Phase 1 (Sequential — sanitizers):**
|
|
108
|
+
* Guardrails with `config.canSanitize === true` run one-at-a-time in
|
|
109
|
+
* registration order. Each sees (and may modify) the cumulative sanitized
|
|
110
|
+
* input. A BLOCK result short-circuits immediately — Phase 2 never runs.
|
|
111
|
+
*
|
|
112
|
+
* **Phase 2 (Parallel — classifiers):**
|
|
113
|
+
* All remaining guardrails run concurrently via `Promise.allSettled` on
|
|
114
|
+
* the text produced by Phase 1. A Phase 2 SANITIZE is downgraded to FLAG.
|
|
115
|
+
*
|
|
116
|
+
* **Aggregation:** worst-wins (BLOCK > FLAG > ALLOW). The singular
|
|
117
|
+
* `evaluation` field is set to the first BLOCK, else the worst-severity
|
|
118
|
+
* evaluation, else the last evaluation by registration order.
|
|
119
|
+
*
|
|
120
|
+
* @param services - Array of guardrail services (already normalized)
|
|
121
|
+
* @param input - User input to evaluate
|
|
122
|
+
* @param context - Conversational context for policy decisions
|
|
123
|
+
* @returns Outcome with sanitized input and all evaluations in registration order
|
|
124
|
+
*/
|
|
125
|
+
static async evaluateInput(services, input, context) {
|
|
126
|
+
if (services.length === 0) {
|
|
127
|
+
return { sanitizedInput: input, evaluations: [] };
|
|
128
|
+
}
|
|
129
|
+
// -- Partition into sanitizers (Phase 1) and parallel classifiers (Phase 2)
|
|
130
|
+
const sanitizers = [];
|
|
131
|
+
const parallel = [];
|
|
132
|
+
for (let i = 0; i < services.length; i++) {
|
|
133
|
+
const svc = services[i];
|
|
134
|
+
if (svc.config?.canSanitize === true) {
|
|
135
|
+
sanitizers.push(svc);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
parallel.push({ svc, registrationIndex: i });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Pre-allocate evaluation slots so results appear in registration order.
|
|
142
|
+
// null slots are compacted away at the end.
|
|
143
|
+
const evaluationSlots = new Array(services.length).fill(null);
|
|
144
|
+
let sanitizedInput = input;
|
|
145
|
+
// -----------------------------------------------------------------
|
|
146
|
+
// Phase 1: Sequential sanitizers
|
|
147
|
+
// -----------------------------------------------------------------
|
|
148
|
+
for (let i = 0; i < services.length; i++) {
|
|
149
|
+
const svc = services[i];
|
|
150
|
+
// Only Phase 1 services (sanitizers) run sequentially
|
|
151
|
+
if (svc.config?.canSanitize !== true) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (!svc.evaluateInput) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const timeoutMs = svc.config?.timeoutMs;
|
|
158
|
+
const evaluation = await callWithTimeout(() => svc.evaluateInput({ context, input: sanitizedInput }), timeoutMs);
|
|
159
|
+
if (!evaluation) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
evaluationSlots[i] = evaluation;
|
|
163
|
+
// BLOCK in Phase 1 short-circuits everything — Phase 2 never runs
|
|
164
|
+
if (evaluation.action === GuardrailAction.BLOCK) {
|
|
165
|
+
const evaluations = evaluationSlots.filter(Boolean);
|
|
166
|
+
return { sanitizedInput, evaluation, evaluations };
|
|
167
|
+
}
|
|
168
|
+
// SANITIZE: update the running sanitized input for the next sanitizer
|
|
169
|
+
if (evaluation.action === GuardrailAction.SANITIZE && evaluation.modifiedText !== undefined) {
|
|
170
|
+
sanitizedInput = {
|
|
171
|
+
...sanitizedInput,
|
|
172
|
+
textInput: evaluation.modifiedText,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// -----------------------------------------------------------------
|
|
177
|
+
// Phase 2: Parallel classifiers
|
|
178
|
+
// -----------------------------------------------------------------
|
|
179
|
+
if (parallel.length > 0) {
|
|
180
|
+
const settled = await Promise.allSettled(parallel.map(({ svc }) => {
|
|
181
|
+
if (!svc.evaluateInput) {
|
|
182
|
+
return Promise.resolve(null);
|
|
183
|
+
}
|
|
184
|
+
const timeoutMs = svc.config?.timeoutMs;
|
|
185
|
+
return callWithTimeout(() => svc.evaluateInput({ context, input: sanitizedInput }), timeoutMs);
|
|
186
|
+
}));
|
|
187
|
+
// Slot results back into registration order
|
|
188
|
+
for (let j = 0; j < parallel.length; j++) {
|
|
189
|
+
const outcome = settled[j];
|
|
190
|
+
if (outcome.status === 'rejected') {
|
|
191
|
+
console.warn('[AgentOS][Guardrails] Phase 2 evaluateInput rejected.', outcome.reason);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
let evaluation = outcome.value;
|
|
195
|
+
if (!evaluation) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
// Downgrade SANITIZE → FLAG in Phase 2
|
|
199
|
+
evaluation = downgradePhase2Sanitize(evaluation, parallel[j].registrationIndex);
|
|
200
|
+
evaluationSlots[parallel[j].registrationIndex] = evaluation;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// -----------------------------------------------------------------
|
|
204
|
+
// Aggregate: compact slots, pick "evaluation" (singular)
|
|
205
|
+
// -----------------------------------------------------------------
|
|
206
|
+
const evaluations = evaluationSlots.filter(Boolean);
|
|
207
|
+
if (evaluations.length === 0) {
|
|
208
|
+
return { sanitizedInput, evaluations: [] };
|
|
209
|
+
}
|
|
210
|
+
// Pick the singular evaluation: first BLOCK, else worst severity, else last
|
|
211
|
+
const blockEval = evaluations.find((e) => e.action === GuardrailAction.BLOCK);
|
|
212
|
+
if (blockEval) {
|
|
213
|
+
return { sanitizedInput, evaluation: blockEval, evaluations };
|
|
214
|
+
}
|
|
215
|
+
const worst = worstAction(evaluations);
|
|
216
|
+
// Find the first evaluation matching worst severity
|
|
217
|
+
const worstEval = evaluations.find((e) => e.action === worst) ?? evaluations.at(-1);
|
|
218
|
+
return {
|
|
219
|
+
sanitizedInput,
|
|
220
|
+
evaluation: worstEval,
|
|
221
|
+
evaluations,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
// -----------------------------------------------------------------------
|
|
225
|
+
// wrapOutput
|
|
226
|
+
// -----------------------------------------------------------------------
|
|
227
|
+
/**
|
|
228
|
+
* Wrap a response stream with two-phase guardrail filtering.
|
|
229
|
+
*
|
|
230
|
+
* Partitions services into four groups (once, up front):
|
|
231
|
+
* 1. **Streaming sanitizers** (`canSanitize && evaluateStreamingChunks`)
|
|
232
|
+
* 2. **Streaming parallel** classifiers (`evaluateStreamingChunks && !canSanitize`)
|
|
233
|
+
* 3. **Final sanitizers** (`canSanitize && !evaluateStreamingChunks`)
|
|
234
|
+
* 4. **Final parallel** classifiers (the rest with `evaluateOutput`)
|
|
235
|
+
*
|
|
236
|
+
* For each TEXT_DELTA chunk: Phase 1 runs streaming sanitizers sequentially
|
|
237
|
+
* (with per-service rate limiting), then Phase 2 runs streaming classifiers
|
|
238
|
+
* in parallel.
|
|
239
|
+
*
|
|
240
|
+
* For each isFinal chunk: Phase 1 runs final sanitizers sequentially, then
|
|
241
|
+
* Phase 2 runs final classifiers in parallel. All services with
|
|
242
|
+
* `evaluateOutput` participate in final evaluation.
|
|
243
|
+
*
|
|
244
|
+
* A BLOCK in either phase terminates the stream immediately with an error
|
|
245
|
+
* chunk.
|
|
246
|
+
*
|
|
247
|
+
* @param services - Array of guardrail services (already normalized)
|
|
248
|
+
* @param context - Conversational context for policy decisions
|
|
249
|
+
* @param stream - Source response stream to filter
|
|
250
|
+
* @param options - Stream options and input evaluations to embed
|
|
251
|
+
* @returns Wrapped async generator with guardrail filtering applied
|
|
252
|
+
*/
|
|
253
|
+
static async *wrapOutput(services, context, stream, options) {
|
|
254
|
+
if (services.length === 0) {
|
|
255
|
+
yield* stream;
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
// -- Partition into 4 groups once --------------------------------
|
|
259
|
+
/** Streaming sanitizers: Phase 1 for TEXT_DELTA chunks */
|
|
260
|
+
const streamingSanitizers = [];
|
|
261
|
+
/** Streaming classifiers: Phase 2 for TEXT_DELTA chunks */
|
|
262
|
+
const streamingParallel = [];
|
|
263
|
+
/** Final sanitizers: Phase 1 for isFinal chunks */
|
|
264
|
+
const finalSanitizers = [];
|
|
265
|
+
/** Final classifiers: Phase 2 for isFinal chunks */
|
|
266
|
+
const finalParallel = [];
|
|
267
|
+
for (let i = 0; i < services.length; i++) {
|
|
268
|
+
const svc = services[i];
|
|
269
|
+
if (!hasEvaluateOutput(svc)) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const isStreaming = svc.config?.evaluateStreamingChunks === true;
|
|
273
|
+
const isSanitizer = svc.config?.canSanitize === true;
|
|
274
|
+
if (isStreaming && isSanitizer) {
|
|
275
|
+
streamingSanitizers.push(svc);
|
|
276
|
+
}
|
|
277
|
+
else if (isStreaming && !isSanitizer) {
|
|
278
|
+
streamingParallel.push({ svc, registrationIndex: i });
|
|
279
|
+
}
|
|
280
|
+
// All services with evaluateOutput participate in final evaluation
|
|
281
|
+
if (isSanitizer) {
|
|
282
|
+
finalSanitizers.push(svc);
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
finalParallel.push({ svc, registrationIndex: i });
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// -- Metadata from input evaluation --------------------------------
|
|
289
|
+
const serializedInputEvaluations = (options.inputEvaluations ?? []).map(serializeEvaluation);
|
|
290
|
+
let inputMetadataApplied = serializedInputEvaluations.length === 0;
|
|
291
|
+
// -- Per-service rate limiting for streaming evaluation -------------
|
|
292
|
+
const streamingEvaluationCounts = new Map();
|
|
293
|
+
// -- Main stream loop ----------------------------------------------
|
|
294
|
+
for await (const chunk of stream) {
|
|
295
|
+
let currentChunk = chunk;
|
|
296
|
+
// Attach input evaluation metadata to the first output chunk
|
|
297
|
+
if (!inputMetadataApplied && serializedInputEvaluations.length > 0) {
|
|
298
|
+
currentChunk = withGuardrailMetadata(currentChunk, { input: serializedInputEvaluations });
|
|
299
|
+
inputMetadataApplied = true;
|
|
300
|
+
}
|
|
301
|
+
// ---------------------------------------------------------------
|
|
302
|
+
// TEXT_DELTA (non-final): streaming guardrails
|
|
303
|
+
// ---------------------------------------------------------------
|
|
304
|
+
if (chunk.type === AgentOSResponseChunkType.TEXT_DELTA &&
|
|
305
|
+
!chunk.isFinal &&
|
|
306
|
+
(streamingSanitizers.length > 0 || streamingParallel.length > 0)) {
|
|
307
|
+
const outputEvaluations = [];
|
|
308
|
+
let workingChunk = currentChunk;
|
|
309
|
+
// Phase 1: sequential streaming sanitizers
|
|
310
|
+
for (const svc of streamingSanitizers) {
|
|
311
|
+
const svcId = svc.id || 'unknown';
|
|
312
|
+
const currentCount = streamingEvaluationCounts.get(svcId) || 0;
|
|
313
|
+
const maxEvals = svc.config?.maxStreamingEvaluations;
|
|
314
|
+
// Skip if this service has hit its rate limit
|
|
315
|
+
if (maxEvals !== undefined && currentCount >= maxEvals) {
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
const timeoutMs = svc.config?.timeoutMs;
|
|
319
|
+
const evaluation = await callWithTimeout(() => svc.evaluateOutput({ context, chunk: workingChunk, ragSources: options.ragSources }), timeoutMs);
|
|
320
|
+
streamingEvaluationCounts.set(svcId, currentCount + 1);
|
|
321
|
+
if (!evaluation) {
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
outputEvaluations.push(evaluation);
|
|
325
|
+
// BLOCK terminates the stream immediately
|
|
326
|
+
if (evaluation.action === GuardrailAction.BLOCK) {
|
|
327
|
+
yield* createGuardrailBlockedStream(context, evaluation, options);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
// SANITIZE: modify the textDelta for downstream services
|
|
331
|
+
if (evaluation.action === GuardrailAction.SANITIZE && evaluation.modifiedText !== undefined) {
|
|
332
|
+
workingChunk = {
|
|
333
|
+
...workingChunk,
|
|
334
|
+
textDelta: evaluation.modifiedText,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
// Phase 2: parallel streaming classifiers
|
|
339
|
+
if (streamingParallel.length > 0) {
|
|
340
|
+
const tasks = streamingParallel.map(({ svc, registrationIndex }) => {
|
|
341
|
+
const svcId = svc.id || `svc-${registrationIndex}`;
|
|
342
|
+
const currentCount = streamingEvaluationCounts.get(svcId) || 0;
|
|
343
|
+
const maxEvals = svc.config?.maxStreamingEvaluations;
|
|
344
|
+
// Rate-limited services return null immediately
|
|
345
|
+
if (maxEvals !== undefined && currentCount >= maxEvals) {
|
|
346
|
+
return Promise.resolve({ evaluation: null, registrationIndex, svcId });
|
|
347
|
+
}
|
|
348
|
+
const timeoutMs = svc.config?.timeoutMs;
|
|
349
|
+
return callWithTimeout(() => svc.evaluateOutput({ context, chunk: workingChunk, ragSources: options.ragSources }), timeoutMs).then((evaluation) => {
|
|
350
|
+
streamingEvaluationCounts.set(svcId, currentCount + 1);
|
|
351
|
+
return { evaluation, registrationIndex, svcId };
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
const results = await Promise.allSettled(tasks);
|
|
355
|
+
for (const result of results) {
|
|
356
|
+
if (result.status === 'rejected') {
|
|
357
|
+
console.warn('[AgentOS][Guardrails] Phase 2 streaming evaluateOutput rejected.', result.reason);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const { evaluation: rawEvaluation, registrationIndex } = result.value;
|
|
361
|
+
if (!rawEvaluation) {
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
// Downgrade SANITIZE → FLAG in Phase 2
|
|
365
|
+
const evaluation = downgradePhase2Sanitize(rawEvaluation, registrationIndex);
|
|
366
|
+
outputEvaluations.push(evaluation);
|
|
367
|
+
// BLOCK terminates the stream immediately
|
|
368
|
+
if (evaluation.action === GuardrailAction.BLOCK) {
|
|
369
|
+
yield* createGuardrailBlockedStream(context, evaluation, options);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// Attach output evaluation metadata
|
|
375
|
+
if (outputEvaluations.length > 0) {
|
|
376
|
+
workingChunk = withGuardrailMetadata(workingChunk, {
|
|
377
|
+
output: outputEvaluations.map(serializeEvaluation),
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
currentChunk = workingChunk;
|
|
381
|
+
}
|
|
382
|
+
// ---------------------------------------------------------------
|
|
383
|
+
// isFinal chunks: all guardrails participate
|
|
384
|
+
// ---------------------------------------------------------------
|
|
385
|
+
if (chunk.isFinal &&
|
|
386
|
+
(finalSanitizers.length > 0 || finalParallel.length > 0)) {
|
|
387
|
+
const outputEvaluations = [];
|
|
388
|
+
let workingChunk = currentChunk;
|
|
389
|
+
// Phase 1: sequential final sanitizers
|
|
390
|
+
for (const svc of finalSanitizers) {
|
|
391
|
+
if (!svc.evaluateOutput) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
const timeoutMs = svc.config?.timeoutMs;
|
|
395
|
+
const evaluation = await callWithTimeout(() => svc.evaluateOutput({ context, chunk: workingChunk, ragSources: options.ragSources }), timeoutMs);
|
|
396
|
+
if (!evaluation) {
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
outputEvaluations.push(evaluation);
|
|
400
|
+
// BLOCK terminates the stream
|
|
401
|
+
if (evaluation.action === GuardrailAction.BLOCK) {
|
|
402
|
+
yield* createGuardrailBlockedStream(context, evaluation, options);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
// SANITIZE: modify finalResponseText or textDelta
|
|
406
|
+
if (evaluation.action === GuardrailAction.SANITIZE &&
|
|
407
|
+
evaluation.modifiedText !== undefined) {
|
|
408
|
+
if (workingChunk.type === AgentOSResponseChunkType.FINAL_RESPONSE) {
|
|
409
|
+
workingChunk = {
|
|
410
|
+
...workingChunk,
|
|
411
|
+
finalResponseText: evaluation.modifiedText,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
workingChunk = {
|
|
416
|
+
...workingChunk,
|
|
417
|
+
textDelta: evaluation.modifiedText,
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
// Phase 2: parallel final classifiers
|
|
423
|
+
if (finalParallel.length > 0) {
|
|
424
|
+
const tasks = finalParallel.map(({ svc, registrationIndex }) => {
|
|
425
|
+
if (!svc.evaluateOutput) {
|
|
426
|
+
return Promise.resolve({ evaluation: null, registrationIndex });
|
|
427
|
+
}
|
|
428
|
+
const timeoutMs = svc.config?.timeoutMs;
|
|
429
|
+
return callWithTimeout(() => svc.evaluateOutput({ context, chunk: workingChunk, ragSources: options.ragSources }), timeoutMs).then((evaluation) => ({ evaluation, registrationIndex }));
|
|
430
|
+
});
|
|
431
|
+
const results = await Promise.allSettled(tasks);
|
|
432
|
+
for (const result of results) {
|
|
433
|
+
if (result.status === 'rejected') {
|
|
434
|
+
console.warn('[AgentOS][Guardrails] Phase 2 final evaluateOutput rejected.', result.reason);
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
const { evaluation: rawEvaluation, registrationIndex } = result.value;
|
|
438
|
+
if (!rawEvaluation) {
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
// Downgrade SANITIZE → FLAG in Phase 2
|
|
442
|
+
const evaluation = downgradePhase2Sanitize(rawEvaluation, registrationIndex);
|
|
443
|
+
outputEvaluations.push(evaluation);
|
|
444
|
+
// BLOCK terminates the stream
|
|
445
|
+
if (evaluation.action === GuardrailAction.BLOCK) {
|
|
446
|
+
yield* createGuardrailBlockedStream(context, evaluation, options);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
// Attach output evaluation metadata
|
|
452
|
+
if (outputEvaluations.length > 0) {
|
|
453
|
+
workingChunk = withGuardrailMetadata(workingChunk, {
|
|
454
|
+
output: outputEvaluations.map(serializeEvaluation),
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
currentChunk = workingChunk;
|
|
458
|
+
}
|
|
459
|
+
yield currentChunk;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
//# sourceMappingURL=ParallelGuardrailDispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelGuardrailDispatcher.js","sourceRoot":"","sources":["../../../src/core/guardrails/ParallelGuardrailDispatcher.ts"],"names":[],"mappings":"AA+BA,OAAO,EAEL,wBAAwB,GAEzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,eAAe,GAIhB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,8EAA8E;AAC9E,wEAAwE;AACxE,4DAA4D;AAC5D,8EAA8E;AAE9E,4EAA4E;AAC5E,MAAM,eAAe,GAAoC;IACvD,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IAC1B,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,yDAAyD;IACxF,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IACzB,CAAC,eA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CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import type { AgentOSInput } from '../../api/types/AgentOSInput';
|
|
2
2
|
import { AgentOSResponse } from '../../api/types/AgentOSResponse';
|
|
3
|
-
import { type GuardrailContext, type GuardrailEvaluationResult, type IGuardrailService } from './IGuardrailService';
|
|
3
|
+
import { GuardrailAction, type GuardrailContext, type GuardrailEvaluationResult, type IGuardrailService } from './IGuardrailService';
|
|
4
|
+
/**
|
|
5
|
+
* Normalize a service input (single, array, or undefined) into a flat array.
|
|
6
|
+
*
|
|
7
|
+
* Filters out falsy entries so callers never need null-checks.
|
|
8
|
+
*
|
|
9
|
+
* @param service - Single guardrail, array of guardrails, or undefined
|
|
10
|
+
* @returns Non-empty array of valid guardrail services
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeServices(service: IGuardrailService | IGuardrailService[] | undefined): IGuardrailService[];
|
|
13
|
+
/**
|
|
14
|
+
* Type guard to check if a guardrail service implements evaluateOutput.
|
|
15
|
+
*
|
|
16
|
+
* @param svc - The guardrail service to inspect
|
|
17
|
+
* @returns `true` when `svc.evaluateOutput` is a callable function
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasEvaluateOutput(svc: IGuardrailService): svc is IGuardrailService & {
|
|
20
|
+
evaluateOutput: NonNullable<IGuardrailService['evaluateOutput']>;
|
|
21
|
+
};
|
|
4
22
|
/**
|
|
5
23
|
* Result of running input guardrails.
|
|
6
24
|
*
|
|
@@ -25,6 +43,20 @@ export interface GuardrailOutputOptions {
|
|
|
25
43
|
personaId?: string;
|
|
26
44
|
/** Input evaluations to attach to first output chunk */
|
|
27
45
|
inputEvaluations?: GuardrailEvaluationResult[] | null;
|
|
46
|
+
/** RAG sources to thread through to output guardrails for grounding verification */
|
|
47
|
+
ragSources?: import('../../rag').RagRetrievedChunk[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Metadata entry attached to response chunks.
|
|
51
|
+
*
|
|
52
|
+
* Compact representation of a {@link GuardrailEvaluationResult} that gets
|
|
53
|
+
* embedded into chunk `metadata.guardrail.input[]` / `metadata.guardrail.output[]`.
|
|
54
|
+
*/
|
|
55
|
+
export interface GuardrailMetadataEntry {
|
|
56
|
+
action: GuardrailAction;
|
|
57
|
+
reason?: string;
|
|
58
|
+
reasonCode?: string;
|
|
59
|
+
metadata?: Record<string, unknown>;
|
|
28
60
|
}
|
|
29
61
|
/**
|
|
30
62
|
* Evaluate user input through all registered guardrails.
|
|
@@ -121,4 +153,30 @@ export declare function createGuardrailBlockedStream(context: GuardrailContext,
|
|
|
121
153
|
* ```
|
|
122
154
|
*/
|
|
123
155
|
export declare function wrapOutputGuardrails(service: IGuardrailService | IGuardrailService[] | undefined, context: GuardrailContext, stream: AsyncGenerator<AgentOSResponse, void, undefined>, options: GuardrailOutputOptions): AsyncGenerator<AgentOSResponse, void, undefined>;
|
|
156
|
+
/**
|
|
157
|
+
* Convert a full {@link GuardrailEvaluationResult} into the compact
|
|
158
|
+
* {@link GuardrailMetadataEntry} shape that gets embedded in chunk metadata.
|
|
159
|
+
*
|
|
160
|
+
* Strips heavy fields (`details`, `modifiedText`) that are not needed
|
|
161
|
+
* for downstream telemetry / observability.
|
|
162
|
+
*
|
|
163
|
+
* @param evaluation - The evaluation to serialize
|
|
164
|
+
* @returns A lightweight metadata entry suitable for chunk embedding
|
|
165
|
+
*/
|
|
166
|
+
export declare function serializeEvaluation(evaluation: GuardrailEvaluationResult): GuardrailMetadataEntry;
|
|
167
|
+
/**
|
|
168
|
+
* Attach guardrail evaluation metadata to a response chunk.
|
|
169
|
+
*
|
|
170
|
+
* Merges new input/output evaluation entries into any existing
|
|
171
|
+
* `metadata.guardrail` structure on the chunk. The result is a
|
|
172
|
+
* shallow-cloned chunk — the original is never mutated.
|
|
173
|
+
*
|
|
174
|
+
* @param chunk - The response chunk to annotate
|
|
175
|
+
* @param entry - Input and/or output metadata entries to merge
|
|
176
|
+
* @returns A new chunk with guardrail metadata merged in
|
|
177
|
+
*/
|
|
178
|
+
export declare function withGuardrailMetadata(chunk: AgentOSResponse, entry: {
|
|
179
|
+
input?: GuardrailMetadataEntry | GuardrailMetadataEntry[];
|
|
180
|
+
output?: GuardrailMetadataEntry | GuardrailMetadataEntry[];
|
|
181
|
+
}): AgentOSResponse;
|
|
124
182
|
//# sourceMappingURL=guardrailDispatcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guardrailDispatcher.d.ts","sourceRoot":"","sources":["../../../src/core/guardrails/guardrailDispatcher.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"guardrailDispatcher.d.ts","sourceRoot":"","sources":["../../../src/core/guardrails/guardrailDispatcher.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACL,eAAe,EAGhB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAG7B;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,GAAG,SAAS,GAC3D,iBAAiB,EAAE,CAMrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,iBAAiB,GACrB,GAAG,IAAI,iBAAiB,GAAG;IAC5B,cAAc,EAAE,WAAW,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC;CAClE,CAEA;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,cAAc,EAAE,YAAY,CAAC;IAE7B,+DAA+D;IAC/D,UAAU,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IA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