@theoremjs/agents 0.3.4-next.817.g7602a31 → 0.3.4-next.819.g62d1f4f
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/esm/src/guardrails/detectors.d.ts +5 -3
- package/esm/src/guardrails/detectors.js +26 -3
- package/esm/src/guardrails/egress-automata.js +20025 -19310
- package/esm/src/guardrails/labels.d.ts +1 -1
- package/esm/src/guardrails/labels.js +9 -0
- package/esm/src/guardrails/rules.d.ts +3 -0
- package/esm/src/guardrails/rules.js +3 -0
- package/esm/src/guardrails/sensitive-groups.d.ts +11 -3
- package/esm/src/guardrails/sensitive-groups.js +18 -2
- package/esm/src/guardrails/sensitive.d.ts +1 -1
- package/esm/src/guardrails/sensitive.js +101 -15
- package/esm/src/kernel/tools/model-text.d.ts +4 -4
- package/esm/src/kernel/tools/model-text.js +10 -7
- package/esm/src/observability/trace-catalog.js +12 -0
- package/esm/src/observability/trace-record.js +2 -2
- package/esm/src/surface/formats.js +2 -2
- package/package.json +1 -1
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
import { type Boundary } from './boundaries.js';
|
|
3
3
|
import { type CompiledPatterns, type HostMatcher, type HostPattern } from './host-patterns.js';
|
|
4
4
|
/**
|
|
5
|
-
* What the kernel finds in text: the
|
|
5
|
+
* What the kernel finds in text: the families of sensitive data, prompt-injection phrasing,
|
|
6
6
|
* a tool's text that instructs the agent, and what is the profile's own on its way out (the canary token, the system instruction, the
|
|
7
7
|
* kernel's markers, an image or link to an address the model was not given, and the names of its
|
|
8
8
|
* tools).
|
|
9
9
|
*/
|
|
10
|
-
declare const DETECTORS: readonly ["ids", "financial", "network", "credentials", "injection", "tool_instructions", "canary_leak", "prompt_leak", "marker_leak", "ungiven_images", "ungiven_links", "tool_leak"];
|
|
10
|
+
declare const DETECTORS: readonly ["ids", "financial", "network", "credentials", "email", "phone", "bank_account", "injection", "tool_instructions", "canary_leak", "prompt_leak", "marker_leak", "ungiven_images", "ungiven_links", "tool_leak"];
|
|
11
11
|
/** A detector recognizes a particular kind of content in text. Its configured action determines what happens when it finds a match. */
|
|
12
12
|
type Detector = (typeof DETECTORS)[number];
|
|
13
|
+
/** The detectors a text is cleaned with when no profile says how: every one but the working groups (`WORKING_GROUPS`). */
|
|
14
|
+
declare const UNPROFILED_DETECTORS: readonly Detector[];
|
|
13
15
|
/**
|
|
14
16
|
* What the kernel does with a match, the same at every boundary:
|
|
15
17
|
* - `ignore` — the text is not checked.
|
|
@@ -213,4 +215,4 @@ declare function isDetector(value: string): value is Detector;
|
|
|
213
215
|
*/
|
|
214
216
|
declare function detectProblem(path: string, spec: unknown, boundaries?: readonly Boundary[]): string | undefined;
|
|
215
217
|
export type { DetectAction, DetectMatrix, DetectMeta, Detector, DetectorConfig, DetectorDeclaration, DetectorGroup, DetectorRule, DetectorSource, DetectSources, DetectSpec, HostDetector, HostDetectorConfig, HostDetectorId, HostFind, HostSpan, NameAllow, ResolvedAllow, ResolvedDetect, UrlAllow, UrlDetector, };
|
|
216
|
-
export { actionAt, DETECT_ACTION_META, DETECT_ACTIONS, DETECT_DEFAULTS, DETECTOR_BOUNDARIES, DETECTOR_GROUP_META, DETECTOR_GROUPS, DETECTOR_META, DETECTORS, detectProblem, detects, HOST_FIND_HOLD, HOST_FIND_HOLD_LIVE, hintProblem, isDetector, NO_ALLOW, PATTERN_DETECTORS, resolveAllow, resolveDetect, };
|
|
218
|
+
export { actionAt, DETECT_ACTION_META, DETECT_ACTIONS, DETECT_DEFAULTS, DETECTOR_BOUNDARIES, DETECTOR_GROUP_META, DETECTOR_GROUPS, DETECTOR_META, DETECTORS, detectProblem, detects, HOST_FIND_HOLD, HOST_FIND_HOLD_LIVE, hintProblem, isDetector, NO_ALLOW, PATTERN_DETECTORS, resolveAllow, resolveDetect, UNPROFILED_DETECTORS, };
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
/** labels-exempt-file: authoring labels, descriptions and profile-registration diagnostics for detectors — not runtime user or model copy (P2) */
|
|
5
5
|
import { BOUNDARIES, INBOUND_BOUNDARIES, OUTBOUND_BOUNDARIES, recordOf, TOOL_BOUNDARIES, TOOL_KINDS, toolBoundary, } from './boundaries.js';
|
|
6
6
|
import { matchersOf, patternsProblem, } from './host-patterns.js';
|
|
7
|
-
import { SENSITIVE_GROUPS } from './sensitive-groups.js';
|
|
7
|
+
import { SENSITIVE_GROUPS, WORKING_GROUPS } from './sensitive-groups.js';
|
|
8
8
|
/**
|
|
9
|
-
* What the kernel finds in text: the
|
|
9
|
+
* What the kernel finds in text: the families of sensitive data, prompt-injection phrasing,
|
|
10
10
|
* a tool's text that instructs the agent, and what is the profile's own on its way out (the canary token, the system instruction, the
|
|
11
11
|
* kernel's markers, an image or link to an address the model was not given, and the names of its
|
|
12
12
|
* tools).
|
|
@@ -22,6 +22,8 @@ const DETECTORS = [
|
|
|
22
22
|
'ungiven_links',
|
|
23
23
|
'tool_leak',
|
|
24
24
|
];
|
|
25
|
+
/** The detectors a text is cleaned with when no profile says how: every one but the working groups (`WORKING_GROUPS`). */
|
|
26
|
+
const UNPROFILED_DETECTORS = DETECTORS.filter((detector) => !WORKING_GROUPS.includes(detector));
|
|
25
27
|
/**
|
|
26
28
|
* What the kernel does with a match, the same at every boundary:
|
|
27
29
|
* - `ignore` — the text is not checked.
|
|
@@ -123,6 +125,27 @@ const DETECTOR_META = {
|
|
|
123
125
|
},
|
|
124
126
|
patterns: true,
|
|
125
127
|
},
|
|
128
|
+
email: {
|
|
129
|
+
label: 'Email',
|
|
130
|
+
doc: 'Email addresses.',
|
|
131
|
+
group: 'data',
|
|
132
|
+
defaults: everywhere('flag'),
|
|
133
|
+
patterns: true,
|
|
134
|
+
},
|
|
135
|
+
phone: {
|
|
136
|
+
label: 'Phone',
|
|
137
|
+
doc: 'Phone numbers: international, North American, and national, or any number after a phone label.',
|
|
138
|
+
group: 'data',
|
|
139
|
+
defaults: everywhere('flag'),
|
|
140
|
+
patterns: true,
|
|
141
|
+
},
|
|
142
|
+
bank_account: {
|
|
143
|
+
label: 'Bank account',
|
|
144
|
+
doc: 'Account, routing, and sort-code numbers after a label that names them. IBANs are `financial`.',
|
|
145
|
+
group: 'data',
|
|
146
|
+
defaults: everywhere('flag'),
|
|
147
|
+
patterns: true,
|
|
148
|
+
},
|
|
126
149
|
injection: {
|
|
127
150
|
label: 'Injection',
|
|
128
151
|
doc: 'Prompt-injection phrasing, plain or disguised.',
|
|
@@ -499,4 +522,4 @@ function hostProblem(path, id, rule, boundaries) {
|
|
|
499
522
|
hintProblem(`${path}.hint`, hint) ??
|
|
500
523
|
patternsProblem(path, patterns, compiled));
|
|
501
524
|
}
|
|
502
|
-
export { actionAt, DETECT_ACTION_META, DETECT_ACTIONS, DETECT_DEFAULTS, DETECTOR_BOUNDARIES, DETECTOR_GROUP_META, DETECTOR_GROUPS, DETECTOR_META, DETECTORS, detectProblem, detects, HOST_FIND_HOLD, HOST_FIND_HOLD_LIVE, hintProblem, isDetector, NO_ALLOW, PATTERN_DETECTORS, resolveAllow, resolveDetect, };
|
|
525
|
+
export { actionAt, DETECT_ACTION_META, DETECT_ACTIONS, DETECT_DEFAULTS, DETECTOR_BOUNDARIES, DETECTOR_GROUP_META, DETECTOR_GROUPS, DETECTOR_META, DETECTORS, detectProblem, detects, HOST_FIND_HOLD, HOST_FIND_HOLD_LIVE, hintProblem, isDetector, NO_ALLOW, PATTERN_DETECTORS, resolveAllow, resolveDetect, UNPROFILED_DETECTORS, };
|