@crewhaus/boundary-classifier 0.5.8 → 0.6.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/dist/index.d.ts +29 -3
- package/dist/index.js +23 -0
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,38 @@ export declare class BoundaryClassifierError extends CrewhausError {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Where the content originated. Use the strongest applicable label.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* Adding a new origin is a SIX-site change that lands in one PR (0.6.0
|
|
13
|
+
* design §10.1; the `memory` and `consult` precedents prove the count):
|
|
14
|
+
* 1. this union;
|
|
15
|
+
* 2. `ORIGIN_DEFAULT_POLICY` below (a `Record<TrustOrigin, …>`, so omission
|
|
16
|
+
* is a compile error — but the tier is a real decision);
|
|
17
|
+
* 3. the deliberately MIRRORED union in `@crewhaus/run-context` (it carries
|
|
18
|
+
* the metadata and must not depend on this package) — the
|
|
19
|
+
* `origin-mirror.test.ts` bridge fails `tsc -b` when the two drift;
|
|
20
|
+
* 4. `@crewhaus/egress-classifier`'s sink-side severity matrix;
|
|
21
|
+
* 5. the §41 `crewhaus doctor --philosophy-alignment` boundary-site list
|
|
22
|
+
* (and a drift-signal row) in `apps/cli`;
|
|
23
|
+
* 6. factory's own `AGENTS.md` (the verbatim union + the source-site
|
|
24
|
+
* table). The test arrays derive from {@link TRUST_ORIGINS}, so they
|
|
25
|
+
* never need a hand edit.
|
|
13
26
|
*/
|
|
14
|
-
export type TrustOrigin = "user" | "mcp" | "subagent" | "channel" | "federation" | "skill" | "compaction" | "tool" | "chain" | "memory";
|
|
27
|
+
export type TrustOrigin = "user" | "mcp" | "subagent" | "channel" | "federation" | "skill" | "compaction" | "tool" | "chain" | "memory" | "consult";
|
|
15
28
|
export type BoundarySeverity = "block" | "warn" | "pass";
|
|
16
29
|
export type BoundaryAction = "pass" | "warn" | "redact";
|
|
30
|
+
/**
|
|
31
|
+
* Every declared origin, in declaration order — derived from the policy
|
|
32
|
+
* table so it can never disagree with the union. Test arrays and the
|
|
33
|
+
* run-context mirror bridge read this instead of hand-listing origins.
|
|
34
|
+
*/
|
|
35
|
+
export declare const TRUST_ORIGINS: ReadonlyArray<TrustOrigin>;
|
|
36
|
+
/**
|
|
37
|
+
* The origin's default source-side severity — what `classifyBoundary`
|
|
38
|
+
* applies when the caller passes no `severity` override. Exposed read-only
|
|
39
|
+
* so tests and `doctor` can assert the tier of each origin without
|
|
40
|
+
* re-deriving the table.
|
|
41
|
+
*/
|
|
42
|
+
export declare function defaultBoundarySeverity(origin: TrustOrigin): BoundarySeverity;
|
|
17
43
|
export type ClassifyBoundaryOptions = {
|
|
18
44
|
/** Required: where the content came from. Drives the default policy. */
|
|
19
45
|
readonly origin: TrustOrigin;
|
package/dist/index.js
CHANGED
|
@@ -78,7 +78,30 @@ const ORIGIN_DEFAULT_POLICY = {
|
|
|
78
78
|
// read time. Block by default, same tier as "skill" (both are
|
|
79
79
|
// disk-persisted instructions-adjacent content).
|
|
80
80
|
memory: "block",
|
|
81
|
+
// Consult content (0.6.0 design §7.5, §10.1): the reply of a nested
|
|
82
|
+
// single-turn side call on a roster sibling (`Consult`), and the `<guide>`
|
|
83
|
+
// text a plan-execute strategy injects. The sibling is a model the spec
|
|
84
|
+
// trusts to SERVE, not content the run may trust to READ: its reply was
|
|
85
|
+
// shaped by whatever the question carried (tool output, channel text) and
|
|
86
|
+
// re-enters the parent's context verbatim, so it is classified exactly
|
|
87
|
+
// once, here, at the tool. Block by default, the "skill" / "memory" tier.
|
|
88
|
+
consult: "block",
|
|
81
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Every declared origin, in declaration order — derived from the policy
|
|
92
|
+
* table so it can never disagree with the union. Test arrays and the
|
|
93
|
+
* run-context mirror bridge read this instead of hand-listing origins.
|
|
94
|
+
*/
|
|
95
|
+
export const TRUST_ORIGINS = Object.keys(ORIGIN_DEFAULT_POLICY);
|
|
96
|
+
/**
|
|
97
|
+
* The origin's default source-side severity — what `classifyBoundary`
|
|
98
|
+
* applies when the caller passes no `severity` override. Exposed read-only
|
|
99
|
+
* so tests and `doctor` can assert the tier of each origin without
|
|
100
|
+
* re-deriving the table.
|
|
101
|
+
*/
|
|
102
|
+
export function defaultBoundarySeverity(origin) {
|
|
103
|
+
return ORIGIN_DEFAULT_POLICY[origin];
|
|
104
|
+
}
|
|
82
105
|
/**
|
|
83
106
|
* In-process LRU cache over `(sha256(content), origin)` → result. The
|
|
84
107
|
* cap is sized to handle the largest realistic working set (a long
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewhaus/boundary-classifier",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pillar-3 chokepoint — classify content crossing every trust boundary (MCP / sub-agent / channel / federation / skill / compaction / tool) with origin metadata and a content-hash LRU cache",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
"test": "bun test src"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@crewhaus/errors": "0.
|
|
19
|
-
"@crewhaus/prompt-injection-detector": "0.
|
|
18
|
+
"@crewhaus/errors": "0.6.0",
|
|
19
|
+
"@crewhaus/prompt-injection-detector": "0.6.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@crewhaus/run-context": "workspace:*"
|
|
20
23
|
},
|
|
21
24
|
"license": "Apache-2.0",
|
|
22
25
|
"author": {
|