evidential-protocol 1.0.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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @psm/evidential-protocol — EP-1
3
+ *
4
+ * Matsés-inspired evidential metadata for AI agent systems.
5
+ * Every claim must declare its epistemic basis.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export { type EvidenceClass, type Evidence, type EvidenceSource, type EvidentialClaim, type EvidentialResponse, type McpEvidenceTag, type ContentEvidenceMarker, type TrustScore, type ToolClassification, type DegradationEvent, CONFIDENCE_FLOORS, CLASS_WEIGHTS, CLASS_STRENGTH, } from "./types.js";
10
+ export { weakerClass, strongerClass, isExpired, degradedClass, computeTrustScore, aggregateClass, aggregateConfidence, evidence, claim, response, mcpTag, parseContentMarker, formatContentMarker, extractMarkers, formatTrustDisplay, classifyTool, DEFAULT_TOOL_CLASSIFICATIONS, } from "./schema.js";
11
+ export { validateEvidence, validateClaim, validateResponse, validateMcpTag, type ValidationError, type ValidationResult, } from "./validate.js";
12
+ export { wrapToolResult, buildAgentResponse, directClaim, inferredClaim, reportedClaim, conjectureClaim, inheritClaim, verifyClaim, checkDegradation, applyDegradation, type McpMiddlewareOptions, type EvidentialToolResult, type AgentResponseOptions, } from "./middleware.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,WAAW,EACX,aAAa,EACb,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @psm/evidential-protocol — EP-1
3
+ *
4
+ * Matsés-inspired evidential metadata for AI agent systems.
5
+ * Every claim must declare its epistemic basis.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ // Core types
10
+ export { CONFIDENCE_FLOORS, CLASS_WEIGHTS, CLASS_STRENGTH, } from "./types.js";
11
+ // Schema builders & utilities
12
+ export { weakerClass, strongerClass, isExpired, degradedClass, computeTrustScore, aggregateClass, aggregateConfidence, evidence, claim, response, mcpTag, parseContentMarker, formatContentMarker, extractMarkers, formatTrustDisplay, classifyTool, DEFAULT_TOOL_CLASSIFICATIONS, } from "./schema.js";
13
+ // Validation
14
+ export { validateEvidence, validateClaim, validateResponse, validateMcpTag, } from "./validate.js";
15
+ // Middleware
16
+ export { wrapToolResult, buildAgentResponse, directClaim, inferredClaim, reportedClaim, conjectureClaim, inheritClaim, verifyClaim, checkDegradation, applyDegradation, } from "./middleware.js";
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,aAAa;AACb,OAAO,EAWL,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,8BAA8B;AAC9B,OAAO,EACL,WAAW,EACX,aAAa,EACb,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAErB,aAAa;AACb,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,cAAc,GAGf,MAAM,eAAe,CAAC;AAEvB,aAAa;AACb,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,GAIjB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * EP-1 Middleware — wraps MCP tool calls and agent outputs with evidential metadata.
3
+ */
4
+ import { type EvidenceClass, type EvidentialClaim, type EvidentialResponse, type McpEvidenceTag, type DegradationEvent } from "./types.js";
5
+ import { type ToolClassification } from "./schema.js";
6
+ /** Options for the MCP evidence middleware. */
7
+ export interface McpMiddlewareOptions {
8
+ /** Custom tool classifications (merged with defaults). */
9
+ classifications?: ToolClassification[];
10
+ /** Called when evidence degrades. */
11
+ onDegradation?: (event: DegradationEvent) => void;
12
+ /** Override class for specific tool calls. */
13
+ classOverride?: EvidenceClass;
14
+ }
15
+ /** Result of wrapping a tool call with evidence. */
16
+ export interface EvidentialToolResult<T = unknown> {
17
+ result: T;
18
+ _evidence: McpEvidenceTag;
19
+ }
20
+ /**
21
+ * Wrap an MCP tool result with evidential metadata.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const balance = await rpcGetBalance(pubkey);
26
+ * const tagged = wrapToolResult("solana-rpc:getBalance", balance);
27
+ * // tagged._evidence.class === "direct"
28
+ * ```
29
+ */
30
+ export declare function wrapToolResult<T>(toolName: string, result: T, opts?: McpMiddlewareOptions): EvidentialToolResult<T>;
31
+ /** Options for building agent evidential responses. */
32
+ export interface AgentResponseOptions {
33
+ /** Producer identifier (e.g., "security-team:credential-auditor"). */
34
+ producer: string;
35
+ }
36
+ /**
37
+ * Build an EvidentialResponse from raw agent output and claims.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const resp = buildAgentResponse(
42
+ * "security-team:credential-auditor",
43
+ * { expired_keys: 3 },
44
+ * [
45
+ * directClaim("EXPO_TOKEN expires in 12 days", "expo-api:token-info"),
46
+ * inferredClaim("SHOPIFY_KEY may be revoked", "shopify-api:401", "3 consecutive 401s"),
47
+ * ]
48
+ * );
49
+ * ```
50
+ */
51
+ export declare function buildAgentResponse<T>(producer: string, data: T, claims: EvidentialClaim[]): EvidentialResponse<T>;
52
+ /** Build a direct-evidence claim. */
53
+ export declare function directClaim(text: string, source: string, opts?: {
54
+ confidence?: number;
55
+ ttl?: number;
56
+ refs?: string[];
57
+ }): EvidentialClaim;
58
+ /** Build an inferred-evidence claim. */
59
+ export declare function inferredClaim(text: string, source: string, reasoning: string, opts?: {
60
+ confidence?: number;
61
+ refs?: string[];
62
+ }): EvidentialClaim;
63
+ /** Build a reported-evidence claim. */
64
+ export declare function reportedClaim(text: string, source: string, opts?: {
65
+ confidence?: number;
66
+ refs?: string[];
67
+ }): EvidentialClaim;
68
+ /** Build a conjecture claim. Reasoning is required. */
69
+ export declare function conjectureClaim(text: string, source: string, reasoning: string, opts?: {
70
+ confidence?: number;
71
+ refs?: string[];
72
+ }): EvidentialClaim;
73
+ /**
74
+ * Inherit a claim from another agent. The evidence class can only stay
75
+ * the same or degrade — never upgrade.
76
+ */
77
+ export declare function inheritClaim(originalClaim: EvidentialClaim, inheritingAgent: string): EvidentialClaim;
78
+ /**
79
+ * Verify and potentially upgrade an inherited claim.
80
+ * Only call this when the agent has independently confirmed the claim.
81
+ */
82
+ export declare function verifyClaim(originalClaim: EvidentialClaim, verifyingAgent: string, verificationSource: string, newClass: EvidenceClass): EvidentialClaim;
83
+ /** Check all claims in a response for degradation. Returns events for any that degraded. */
84
+ export declare function checkDegradation(resp: EvidentialResponse): DegradationEvent[];
85
+ /**
86
+ * Apply degradation to a response, returning an updated copy.
87
+ * Does not mutate the original.
88
+ */
89
+ export declare function applyDegradation(resp: EvidentialResponse): EvidentialResponse;
90
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EAUL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAMrB,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,eAAe,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACvC,qCAAqC;IACrC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,8CAA8C;IAC9C,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,oDAAoD;AACpD,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,OAAO;IAC/C,MAAM,EAAE,CAAC,CAAC;IACV,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,EACT,IAAI,GAAE,oBAAyB,GAC9B,oBAAoB,CAAC,CAAC,CAAC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AC9B,eAAe,EAAE,MAAM,GACtB,eAAe,CAajB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,eAAe,EAC9B,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,EAC1B,QAAQ,EAAE,aAAa,GACtB,eAAe,CAKjB;AAMD,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,kBAAkB,GACvB,gBAAgB,EAAE,CAoBpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,kBAAkB,GACvB,kBAAkB,CAepB"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * EP-1 Middleware — wraps MCP tool calls and agent outputs with evidential metadata.
3
+ */
4
+ import { evidence, claim, response, mcpTag, classifyTool, degradedClass, isExpired, aggregateClass, aggregateConfidence, } from "./schema.js";
5
+ /**
6
+ * Wrap an MCP tool result with evidential metadata.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const balance = await rpcGetBalance(pubkey);
11
+ * const tagged = wrapToolResult("solana-rpc:getBalance", balance);
12
+ * // tagged._evidence.class === "direct"
13
+ * ```
14
+ */
15
+ export function wrapToolResult(toolName, result, opts = {}) {
16
+ const classification = classifyTool(toolName, opts.classifications);
17
+ const cls = opts.classOverride ?? classification?.default_class ?? "reported";
18
+ const ttl = classification?.default_ttl;
19
+ return {
20
+ result,
21
+ _evidence: mcpTag(cls, toolName, { ttl }),
22
+ };
23
+ }
24
+ /**
25
+ * Build an EvidentialResponse from raw agent output and claims.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const resp = buildAgentResponse(
30
+ * "security-team:credential-auditor",
31
+ * { expired_keys: 3 },
32
+ * [
33
+ * directClaim("EXPO_TOKEN expires in 12 days", "expo-api:token-info"),
34
+ * inferredClaim("SHOPIFY_KEY may be revoked", "shopify-api:401", "3 consecutive 401s"),
35
+ * ]
36
+ * );
37
+ * ```
38
+ */
39
+ export function buildAgentResponse(producer, data, claims) {
40
+ return response(producer, data, claims);
41
+ }
42
+ // ---------------------------------------------------------------------------
43
+ // Claim Shorthand Builders
44
+ // ---------------------------------------------------------------------------
45
+ /** Build a direct-evidence claim. */
46
+ export function directClaim(text, source, opts = {}) {
47
+ return claim(text, evidence("direct", source, {
48
+ confidence: opts.confidence ?? 0.95,
49
+ ttl: opts.ttl ?? 60,
50
+ }), opts.refs);
51
+ }
52
+ /** Build an inferred-evidence claim. */
53
+ export function inferredClaim(text, source, reasoning, opts = {}) {
54
+ return claim(text, evidence("inferred", source, {
55
+ confidence: opts.confidence ?? 0.7,
56
+ reasoning,
57
+ }), opts.refs);
58
+ }
59
+ /** Build a reported-evidence claim. */
60
+ export function reportedClaim(text, source, opts = {}) {
61
+ return claim(text, evidence("reported", source, {
62
+ confidence: opts.confidence ?? 0.5,
63
+ }), opts.refs);
64
+ }
65
+ /** Build a conjecture claim. Reasoning is required. */
66
+ export function conjectureClaim(text, source, reasoning, opts = {}) {
67
+ return claim(text, evidence("conjecture", source, {
68
+ confidence: opts.confidence ?? 0.2,
69
+ reasoning,
70
+ }), opts.refs);
71
+ }
72
+ // ---------------------------------------------------------------------------
73
+ // Inter-Agent Propagation
74
+ // ---------------------------------------------------------------------------
75
+ /**
76
+ * Inherit a claim from another agent. The evidence class can only stay
77
+ * the same or degrade — never upgrade.
78
+ */
79
+ export function inheritClaim(originalClaim, inheritingAgent) {
80
+ const currentClass = degradedClass(originalClaim.evidence);
81
+ return claim(originalClaim.claim, {
82
+ class: currentClass,
83
+ confidence: Math.min(originalClaim.evidence.confidence, originalClaim.evidence.confidence * 0.9 // 10% confidence penalty on inheritance
84
+ ),
85
+ source: `agent:${inheritingAgent} <- ${originalClaim.evidence.source}`,
86
+ reasoning: `Inherited from ${originalClaim.evidence.source}. Not independently verified.`,
87
+ timestamp: new Date().toISOString(),
88
+ });
89
+ }
90
+ /**
91
+ * Verify and potentially upgrade an inherited claim.
92
+ * Only call this when the agent has independently confirmed the claim.
93
+ */
94
+ export function verifyClaim(originalClaim, verifyingAgent, verificationSource, newClass) {
95
+ return claim(originalClaim.claim, evidence(newClass, verificationSource), [
96
+ ...(originalClaim.refs ?? []),
97
+ `verified-by:${verifyingAgent}`,
98
+ ]);
99
+ }
100
+ // ---------------------------------------------------------------------------
101
+ // Degradation Engine
102
+ // ---------------------------------------------------------------------------
103
+ /** Check all claims in a response for degradation. Returns events for any that degraded. */
104
+ export function checkDegradation(resp) {
105
+ const events = [];
106
+ for (let i = 0; i < resp.claims.length; i++) {
107
+ const c = resp.claims[i];
108
+ const currentClass = c.evidence.class;
109
+ const newClass = degradedClass(c.evidence);
110
+ if (newClass !== currentClass) {
111
+ events.push({
112
+ claim_id: `${resp.producer}:claim[${i}]`,
113
+ from_class: currentClass,
114
+ to_class: newClass,
115
+ reason: isExpired(c.evidence) ? "ttl_expired" : "stale_24h",
116
+ timestamp: new Date().toISOString(),
117
+ });
118
+ }
119
+ }
120
+ return events;
121
+ }
122
+ /**
123
+ * Apply degradation to a response, returning an updated copy.
124
+ * Does not mutate the original.
125
+ */
126
+ export function applyDegradation(resp) {
127
+ const updatedClaims = resp.claims.map((c) => ({
128
+ ...c,
129
+ evidence: {
130
+ ...c.evidence,
131
+ class: degradedClass(c.evidence),
132
+ },
133
+ }));
134
+ return {
135
+ ...resp,
136
+ claims: updatedClaims,
137
+ aggregate_class: aggregateClass(updatedClaims),
138
+ aggregate_confidence: aggregateConfidence(updatedClaims),
139
+ };
140
+ }
141
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EACL,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,aAAa,EACb,SAAS,EACT,cAAc,EACd,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AAsBrB;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,MAA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EAAE;YACR,GAAG,CAAC,CAAC,QAAQ;YACb,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;SACjC;KACF,CAAC,CAAC,CAAC;IAEJ,OAAO;QACL,GAAG,IAAI;QACP,MAAM,EAAE,aAAa;QACrB,eAAe,EAAE,cAAc,CAAC,aAAa,CAAC;QAC9C,oBAAoB,EAAE,mBAAmB,CAAC,aAAa,CAAC;KACzD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * EP-1 Builder utilities — construct evidential responses fluently.
3
+ */
4
+ import { type EvidenceClass, type Evidence, type EvidentialClaim, type EvidentialResponse, type McpEvidenceTag, type TrustScore, type ContentEvidenceMarker, type ToolClassification } from "./types.js";
5
+ export type { ToolClassification } from "./types.js";
6
+ /** Get the weaker of two evidence classes. */
7
+ export declare function weakerClass(a: EvidenceClass, b: EvidenceClass): EvidenceClass;
8
+ /** Get the stronger of two evidence classes. */
9
+ export declare function strongerClass(a: EvidenceClass, b: EvidenceClass): EvidenceClass;
10
+ /** Check if evidence has expired its TTL. */
11
+ export declare function isExpired(evidence: Evidence): boolean;
12
+ /** Compute degraded class based on age and TTL. */
13
+ export declare function degradedClass(evidence: Evidence): EvidenceClass;
14
+ /** Compute trust score for a set of claims. */
15
+ export declare function computeTrustScore(claims: EvidentialClaim[]): TrustScore;
16
+ /** Find the aggregate (lowest) class among claims. */
17
+ export declare function aggregateClass(claims: EvidentialClaim[]): EvidenceClass;
18
+ /** Compute weighted mean confidence across claims. */
19
+ export declare function aggregateConfidence(claims: EvidentialClaim[]): number;
20
+ /** Build an Evidence object with defaults. */
21
+ export declare function evidence(cls: EvidenceClass, source: string, opts?: Partial<Omit<Evidence, "class" | "source">>): Evidence;
22
+ /** Build an EvidentialClaim. */
23
+ export declare function claim(text: string, ev: Evidence, refs?: string[]): EvidentialClaim;
24
+ /** Build a complete EvidentialResponse. */
25
+ export declare function response<T>(producer: string, data: T, claims: EvidentialClaim[]): EvidentialResponse<T>;
26
+ /** Build an MCP evidence tag for tool responses. */
27
+ export declare function mcpTag(cls: EvidenceClass, source: string, opts?: Partial<Omit<McpEvidenceTag, "ep_version" | "class" | "source">>): McpEvidenceTag;
28
+ /** Parse inline content evidence marker: [ev:class|source|confidence] */
29
+ export declare function parseContentMarker(marker: string): ContentEvidenceMarker | null;
30
+ /** Format a ContentEvidenceMarker to inline string. */
31
+ export declare function formatContentMarker(m: ContentEvidenceMarker): string;
32
+ /** Extract all evidence markers from a content string. */
33
+ export declare function extractMarkers(content: string): ContentEvidenceMarker[];
34
+ /** Display format for trust scores: [●●●○○] 3/5 verified | Trust: 0.72 */
35
+ export declare function formatTrustDisplay(trust: TrustScore): string;
36
+ /** Default tool classifications. Override or extend as needed. */
37
+ export declare const DEFAULT_TOOL_CLASSIFICATIONS: ToolClassification[];
38
+ /** Look up default classification for a tool. */
39
+ export declare function classifyTool(toolName: string, classifications?: ToolClassification[]): ToolClassification | undefined;
40
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAIxB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,8CAA8C;AAC9C,wBAAgB,WAAW,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,aAAa,CAE7E;AAED,gDAAgD;AAChD,wBAAgB,aAAa,CAC3B,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,GACf,aAAa,CAEf;AAED,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAA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1D,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,EAAE,CAavE;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAmB5D;AAMD,kEAAkE;AAClE,eAAO,MAAM,4BAA4B,EAAE,kBAAkB,EAuB5D,CAAC;AAEF,iDAAiD;AACjD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,eAAe,GAAE,kBAAkB,EAAiC,GACnE,kBAAkB,GAAG,SAAS,CAOhC"}
package/dist/schema.js ADDED
@@ -0,0 +1,203 @@
1
+ /**
2
+ * EP-1 Builder utilities — construct evidential responses fluently.
3
+ */
4
+ import { CONFIDENCE_FLOORS, CLASS_WEIGHTS, CLASS_STRENGTH, } from "./types.js";
5
+ /** Get the weaker of two evidence classes. */
6
+ export function weakerClass(a, b) {
7
+ return CLASS_STRENGTH[a] <= CLASS_STRENGTH[b] ? a : b;
8
+ }
9
+ /** Get the stronger of two evidence classes. */
10
+ export function strongerClass(a, b) {
11
+ return CLASS_STRENGTH[a] >= CLASS_STRENGTH[b] ? a : b;
12
+ }
13
+ /** Check if evidence has expired its TTL. */
14
+ export function isExpired(evidence) {
15
+ if (!evidence.ttl)
16
+ return false;
17
+ const gathered = new Date(evidence.timestamp).getTime();
18
+ const now = Date.now();
19
+ return now - gathered > evidence.ttl * 1000;
20
+ }
21
+ /** Compute degraded class based on age and TTL. */
22
+ export function degradedClass(evidence) {
23
+ const age = Date.now() - new Date(evidence.timestamp).getTime();
24
+ const ageHours = age / (1000 * 60 * 60);
25
+ if (evidence.class === "direct") {
26
+ if (evidence.ttl && age > evidence.ttl * 1000)
27
+ return "reported";
28
+ if (ageHours > 24)
29
+ return "reported";
30
+ }
31
+ if (evidence.class === "reported" && ageHours > 24)
32
+ return "conjecture";
33
+ return evidence.class;
34
+ }
35
+ /** Compute trust score for a set of claims. */
36
+ export function computeTrustScore(claims) {
37
+ if (claims.length === 0) {
38
+ return {
39
+ score: 0,
40
+ total_claims: 0,
41
+ breakdown: { direct: 0, inferred: 0, reported: 0, conjecture: 0 },
42
+ requires_review: true,
43
+ };
44
+ }
45
+ const breakdown = {
46
+ direct: 0,
47
+ inferred: 0,
48
+ reported: 0,
49
+ conjecture: 0,
50
+ };
51
+ let weightedSum = 0;
52
+ for (const claim of claims) {
53
+ const cls = claim.evidence.class;
54
+ breakdown[cls]++;
55
+ weightedSum += claim.evidence.confidence * CLASS_WEIGHTS[cls];
56
+ }
57
+ const score = weightedSum / claims.length;
58
+ return {
59
+ score: Math.round(score * 1000) / 1000,
60
+ total_claims: claims.length,
61
+ breakdown,
62
+ requires_review: score < 0.5,
63
+ };
64
+ }
65
+ /** Find the aggregate (lowest) class among claims. */
66
+ export function aggregateClass(claims) {
67
+ if (claims.length === 0)
68
+ return "conjecture";
69
+ return claims.reduce((lowest, claim) => weakerClass(lowest, claim.evidence.class), "direct");
70
+ }
71
+ /** Compute weighted mean confidence across claims. */
72
+ export function aggregateConfidence(claims) {
73
+ if (claims.length === 0)
74
+ return 0;
75
+ const sum = claims.reduce((acc, c) => acc + c.evidence.confidence, 0);
76
+ return Math.round((sum / claims.length) * 1000) / 1000;
77
+ }
78
+ // ---------------------------------------------------------------------------
79
+ // Builders
80
+ // ---------------------------------------------------------------------------
81
+ /** Build an Evidence object with defaults. */
82
+ export function evidence(cls, source, opts = {}) {
83
+ const confidence = opts.confidence ?? CONFIDENCE_FLOORS[cls];
84
+ return {
85
+ class: cls,
86
+ confidence,
87
+ source,
88
+ timestamp: opts.timestamp ?? new Date().toISOString(),
89
+ ...opts,
90
+ };
91
+ }
92
+ /** Build an EvidentialClaim. */
93
+ export function claim(text, ev, refs) {
94
+ return { claim: text, evidence: ev, ...(refs ? { refs } : {}) };
95
+ }
96
+ /** Build a complete EvidentialResponse. */
97
+ export function response(producer, data, claims) {
98
+ return {
99
+ ep_version: "1.0",
100
+ data,
101
+ claims,
102
+ aggregate_class: aggregateClass(claims),
103
+ aggregate_confidence: aggregateConfidence(claims),
104
+ producer,
105
+ produced_at: new Date().toISOString(),
106
+ };
107
+ }
108
+ /** Build an MCP evidence tag for tool responses. */
109
+ export function mcpTag(cls, source, opts = {}) {
110
+ return {
111
+ ep_version: "1.0",
112
+ class: cls,
113
+ confidence: opts.confidence ?? CONFIDENCE_FLOORS[cls],
114
+ source,
115
+ timestamp: opts.timestamp ?? new Date().toISOString(),
116
+ ...opts,
117
+ };
118
+ }
119
+ /** Parse inline content evidence marker: [ev:class|source|confidence] */
120
+ export function parseContentMarker(marker) {
121
+ const match = marker.match(/\[ev:(direct|inferred|reported|conjecture)\|([^|]+)\|([0-9.]+)\]/);
122
+ if (!match)
123
+ return null;
124
+ return {
125
+ class: match[1],
126
+ source: match[2],
127
+ confidence: parseFloat(match[3]),
128
+ };
129
+ }
130
+ /** Format a ContentEvidenceMarker to inline string. */
131
+ export function formatContentMarker(m) {
132
+ return `[ev:${m.class}|${m.source}|${m.confidence}]`;
133
+ }
134
+ /** Extract all evidence markers from a content string. */
135
+ export function extractMarkers(content) {
136
+ const regex = /\[ev:(direct|inferred|reported|conjecture)\|([^|]+)\|([0-9.]+)\]/g;
137
+ const markers = [];
138
+ let match;
139
+ while ((match = regex.exec(content)) !== null) {
140
+ markers.push({
141
+ class: match[1],
142
+ source: match[2],
143
+ confidence: parseFloat(match[3]),
144
+ });
145
+ }
146
+ return markers;
147
+ }
148
+ /** Display format for trust scores: [●●●○○] 3/5 verified | Trust: 0.72 */
149
+ export function formatTrustDisplay(trust) {
150
+ const icons = {
151
+ direct: "●",
152
+ inferred: "◐",
153
+ reported: "○",
154
+ conjecture: "◌",
155
+ };
156
+ const dots = [
157
+ ...Array(trust.breakdown.direct).fill(icons.direct),
158
+ ...Array(trust.breakdown.inferred).fill(icons.inferred),
159
+ ...Array(trust.breakdown.reported).fill(icons.reported),
160
+ ...Array(trust.breakdown.conjecture).fill(icons.conjecture),
161
+ ].join("");
162
+ const verified = trust.breakdown.direct + trust.breakdown.inferred;
163
+ const flag = trust.requires_review ? " ⚠ REVIEW" : "";
164
+ return `[${dots}] ${verified}/${trust.total_claims} verified | Trust: ${trust.score}${flag}`;
165
+ }
166
+ // ---------------------------------------------------------------------------
167
+ // Tool Classification
168
+ // ---------------------------------------------------------------------------
169
+ /** Default tool classifications. Override or extend as needed. */
170
+ export const DEFAULT_TOOL_CLASSIFICATIONS = [
171
+ // Direct — first-hand API/RPC/file access
172
+ { tool: "solana-rpc:*", default_class: "direct", default_ttl: 30 },
173
+ { tool: "github-api:*", default_class: "direct", default_ttl: 300 },
174
+ { tool: "shopify-api:*", default_class: "direct", default_ttl: 60 },
175
+ { tool: "postgres:query", default_class: "direct", default_ttl: 30 },
176
+ { tool: "chromadb:*", default_class: "direct", default_ttl: 60 },
177
+ { tool: "Read", default_class: "direct" },
178
+ { tool: "Glob", default_class: "direct" },
179
+ { tool: "Grep", default_class: "direct" },
180
+ { tool: "Bash", default_class: "direct", default_ttl: 60 },
181
+ // Reported — external sources
182
+ { tool: "WebFetch", default_class: "reported" },
183
+ { tool: "WebSearch", default_class: "reported" },
184
+ { tool: "veil:*", default_class: "reported" },
185
+ // Conjecture — AI generation
186
+ { tool: "apple_generate", default_class: "conjecture" },
187
+ { tool: "ollama:*", default_class: "conjecture" },
188
+ { tool: "nanobanana:*", default_class: "conjecture" },
189
+ // Inferred — computed/derived
190
+ { tool: "apple_classify", default_class: "inferred" },
191
+ { tool: "apple_sentiment", default_class: "inferred" },
192
+ { tool: "apple_extract", default_class: "inferred" },
193
+ ];
194
+ /** Look up default classification for a tool. */
195
+ export function classifyTool(toolName, classifications = DEFAULT_TOOL_CLASSIFICATIONS) {
196
+ return classifications.find((c) => {
197
+ if (c.tool.endsWith(":*")) {
198
+ return toolName.startsWith(c.tool.slice(0, -2));
199
+ }
200
+ return c.tool === toolName;
201
+ });
202
+ }
203
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["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