jingu-protocol 0.1.6 → 0.1.7

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,5 @@
1
+ export type { EvidenceRef, RuleRef, MethodRef, DerivedRef, Reference, CognitiveStep, ResponseStep, RPPRecord, RPPFailureCode, RPPFailure, RPPValidationResult, RPPPolicy, } from "./rpp/rpp.types.js";
2
+ export type { RPPFailureDescription } from "./rpp/rpp.failures.js";
3
+ export { RPP_FAILURE_DESCRIPTIONS, isHardFailure } from "./rpp/rpp.failures.js";
4
+ export { validateRPP } from "./rpp/rpp.validate.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,WAAW,EACX,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,SAAS,EACT,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,SAAS,GACV,MAAM,oBAAoB,CAAA;AAE3B,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // src/index.ts — jingu-protocol public API
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.validateRPP = exports.isHardFailure = exports.RPP_FAILURE_DESCRIPTIONS = void 0;
5
+ var rpp_failures_js_1 = require("./rpp/rpp.failures.js");
6
+ Object.defineProperty(exports, "RPP_FAILURE_DESCRIPTIONS", { enumerable: true, get: function () { return rpp_failures_js_1.RPP_FAILURE_DESCRIPTIONS; } });
7
+ Object.defineProperty(exports, "isHardFailure", { enumerable: true, get: function () { return rpp_failures_js_1.isHardFailure; } });
8
+ var rpp_validate_js_1 = require("./rpp/rpp.validate.js");
9
+ Object.defineProperty(exports, "validateRPP", { enumerable: true, get: function () { return rpp_validate_js_1.validateRPP; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,2CAA2C;;;AAkB3C,yDAA+E;AAAtE,2HAAA,wBAAwB,OAAA;AAAE,gHAAA,aAAa,OAAA;AAEhD,yDAAmD;AAA1C,8GAAA,WAAW,OAAA"}
@@ -0,0 +1,9 @@
1
+ import { RPPFailureCode } from "./rpp.types.js";
2
+ export type RPPFailureDescription = {
3
+ severity: "error" | "warning";
4
+ description: string;
5
+ example: string;
6
+ };
7
+ export declare const RPP_FAILURE_DESCRIPTIONS: Record<RPPFailureCode, RPPFailureDescription>;
8
+ export declare function isHardFailure(code: RPPFailureCode): boolean;
9
+ //# sourceMappingURL=rpp.failures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpp.failures.d.ts","sourceRoot":"","sources":["../../src/rpp/rpp.failures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAwGlF,CAAA;AAmBD,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAE3D"}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ // src/rpp/rpp.failures.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RPP_FAILURE_DESCRIPTIONS = void 0;
5
+ exports.isHardFailure = isHardFailure;
6
+ exports.RPP_FAILURE_DESCRIPTIONS = {
7
+ // Hard failures (severity: "error") — block execution
8
+ MISSING_STAGE: {
9
+ severity: "error",
10
+ description: "A required cognitive stage (interpretation, reasoning, decision, or action) is absent from the RPP record.",
11
+ example: "RPP record has steps for interpretation and decision but omits the reasoning stage entirely.",
12
+ },
13
+ EMPTY_CONTENT: {
14
+ severity: "error",
15
+ description: "A stage or response step has an empty content array or all content entries are blank strings.",
16
+ example: "The decision stage has content: [] with no entries explaining what was decided.",
17
+ },
18
+ NO_REFERENCES: {
19
+ severity: "error",
20
+ description: "A stage or response step that requires references has none, making the output ungrounded.",
21
+ example: "The response step cites no evidence or rules despite making factual claims.",
22
+ },
23
+ UNTRACEABLE_RESPONSE: {
24
+ severity: "error",
25
+ description: "The response has no structural link to the cognitive chain. Response references must include at least one { type: \"derived\" } entry declaring that the response follows from the prior reasoning steps.",
26
+ example: "Response references contain only evidence refs pointing to external files, but no derived ref asserting that the response is grounded in the interpretation/reasoning/decision/action above it.",
27
+ },
28
+ UNJUSTIFIED_DECISION: {
29
+ severity: "error",
30
+ description: "A decision stage has no supporting rule or evidence reference to justify why this decision was made.",
31
+ example: "Decision stage selects option B but provides no rule_id or evidence reference explaining the choice.",
32
+ },
33
+ INVALID_REFERENCE: {
34
+ severity: "error",
35
+ description: "A reference is structurally malformed or points to a non-existent source, rule, or method.",
36
+ example: "A RuleRef has rule_id: '' (empty string) or an EvidenceRef has a locator that does not match any known document.",
37
+ },
38
+ // Soft failures (severity: "warning") — flagged but do not block
39
+ UNSUPPORTED_CLAIM: {
40
+ severity: "warning",
41
+ description: "A content entry makes a factual claim that has no corresponding reference supporting it.",
42
+ example: "Reasoning stage states 'This pattern is always inefficient' but no evidence reference backs that claim.",
43
+ },
44
+ INFERENCE_AS_FACT: {
45
+ severity: "warning",
46
+ description: "An inference or assumption is stated as established fact without acknowledging uncertainty.",
47
+ example: "Content says 'The user intends to deploy to production' without marking it as an inference or listing it in uncertainties.",
48
+ },
49
+ SUPPORTS_TOO_VAGUE: {
50
+ severity: "warning",
51
+ description: "A reference's 'supports' field is empty. The supports field must state what specific claim this reference backs — even a short phrase is valid, empty is not.",
52
+ example: "EvidenceRef has supports: '' (empty string). Should be something like 'user request grounding' or 'why this method applies here'.",
53
+ },
54
+ METHOD_NOT_ACTUALLY_USED: {
55
+ severity: "warning",
56
+ description: "A method_ref is declared in a stage but the method's logic is not reflected in the stage's content.",
57
+ example: "Stage declares method_ref for 'cost-benefit-analysis' but the content shows no cost or benefit comparison.",
58
+ },
59
+ CIRCULAR_REFERENCE: {
60
+ severity: "warning",
61
+ description: "Two or more references form a cycle where each claims to support the other with no external grounding.",
62
+ example: "Step A references step B as evidence, and step B references step A as its justification.",
63
+ },
64
+ ACTION_SCOPE_VIOLATION: {
65
+ severity: "warning",
66
+ description: "An action step proposes actions that exceed the scope authorized by the preceding decision stage.",
67
+ example: "Decision stage authorizes 'update config file' but action stage also proposes 'delete the database'.",
68
+ },
69
+ DANGLING_PROVENANCE_LINK: {
70
+ severity: "error",
71
+ description: "A DerivedRef.from_steps entry references a step id that does not exist in the RPP record, references a step that has no references, or references a step whose references are all 'derived' type (no grounding in evidence/rule/method — the chain terminates in another floating declaration).",
72
+ example: "response.references has { type: 'derived', from_steps: ['s3'] } but no step has id: 's3', or step 's3' has only { type: 'derived' } refs with no evidence/rule/method.",
73
+ },
74
+ EMPTY_PROVENANCE_LINK: {
75
+ severity: "error",
76
+ description: "A DerivedRef.from_steps is an empty array. A derived reference that points to no steps is equivalent to a self-claim with no grounding — the provenance chain does not exist.",
77
+ example: "response.references has { type: 'derived', from_steps: [] } — this declares derivation but names no source steps.",
78
+ },
79
+ ACTION_NO_EVIDENCE: {
80
+ severity: "error",
81
+ description: "The action stage has no evidence reference. Actions must be grounded in observable reality — a rule or method alone is not sufficient to justify what is being done.",
82
+ example: "Action stage has only { type: 'rule', rule_id: 'RUL-002' } but no evidence ref showing what file/source/result grounds the action.",
83
+ },
84
+ RESPONSE_MISSING_GROUNDED_STEP: {
85
+ severity: "error",
86
+ description: "The response DerivedRef.from_steps does not include the decision or action step. Responses must trace to a decision or action — tracing only to interpretation or reasoning is insufficient because those steps do not represent concluded actions.",
87
+ example: "from_steps: ['s-interpretation'] — interpretation establishes context but does not authorize action. Include 's-decision' or 's-action'.",
88
+ },
89
+ STEP_DERIVED_REF_FORBIDDEN: {
90
+ severity: "error",
91
+ description: "Step references must not contain derived refs. DerivedRef is only valid in response.references. A step whose grounding is itself a derived claim has no grounded evidence/rule/method.",
92
+ example: "A step has references: [{ type: 'derived', from_steps: ['s-other'] }] — steps must use evidence, rule, or method references to ground their content, not derived refs.",
93
+ },
94
+ UNKNOWN_RULE_ID: {
95
+ severity: "error",
96
+ description: "rule_id is not in the project's allowed_rule_ids list.",
97
+ example: "A RuleRef has rule_id: 'RUL-999' but the project policy only allows ['RUL-001', 'RUL-002'].",
98
+ },
99
+ UNKNOWN_METHOD_ID: {
100
+ severity: "error",
101
+ description: "method_id is not in the project's allowed_method_ids list.",
102
+ example: "A MethodRef has method_id: 'XYZ-999' but the project policy only allows ['RCA-001', 'OBS-001'].",
103
+ },
104
+ DISALLOWED_EVIDENCE_SOURCE: {
105
+ severity: "error",
106
+ description: "evidence source is not in the project's allowed action_evidence_sources list.",
107
+ example: "Action stage EvidenceRef has source: 'external_api' but the project policy only allows ['file', 'tool_result'].",
108
+ },
109
+ };
110
+ const HARD_FAILURE_CODES = new Set([
111
+ "MISSING_STAGE",
112
+ "EMPTY_CONTENT",
113
+ "NO_REFERENCES",
114
+ "UNTRACEABLE_RESPONSE",
115
+ "UNJUSTIFIED_DECISION",
116
+ "INVALID_REFERENCE",
117
+ "DANGLING_PROVENANCE_LINK",
118
+ "EMPTY_PROVENANCE_LINK",
119
+ "ACTION_NO_EVIDENCE",
120
+ "RESPONSE_MISSING_GROUNDED_STEP",
121
+ "STEP_DERIVED_REF_FORBIDDEN",
122
+ "UNKNOWN_RULE_ID",
123
+ "UNKNOWN_METHOD_ID",
124
+ "DISALLOWED_EVIDENCE_SOURCE",
125
+ ]);
126
+ function isHardFailure(code) {
127
+ return HARD_FAILURE_CODES.has(code);
128
+ }
129
+ //# sourceMappingURL=rpp.failures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpp.failures.js","sourceRoot":"","sources":["../../src/rpp/rpp.failures.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAqI1B,sCAEC;AA7HY,QAAA,wBAAwB,GAAkD;IACrF,sDAAsD;IACtD,aAAa,EAAE;QACb,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,4GAA4G;QACzH,OAAO,EAAE,8FAA8F;KACxG;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,+FAA+F;QAC5G,OAAO,EAAE,iFAAiF;KAC3F;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,2FAA2F;QACxG,OAAO,EAAE,6EAA6E;KACvF;IACD,oBAAoB,EAAE;QACpB,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,2MAA2M;QACxN,OAAO,EAAE,iMAAiM;KAC3M;IACD,oBAAoB,EAAE;QACpB,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,sGAAsG;QACnH,OAAO,EAAE,sGAAsG;KAChH;IACD,iBAAiB,EAAE;QACjB,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,4FAA4F;QACzG,OAAO,EAAE,kHAAkH;KAC5H;IAED,iEAAiE;IACjE,iBAAiB,EAAE;QACjB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,0FAA0F;QACvG,OAAO,EAAE,yGAAyG;KACnH;IACD,iBAAiB,EAAE;QACjB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,6FAA6F;QAC1G,OAAO,EAAE,4HAA4H;KACtI;IACD,kBAAkB,EAAE;QAClB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,+JAA+J;QAC5K,OAAO,EAAE,mIAAmI;KAC7I;IACD,wBAAwB,EAAE;QACxB,Q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BAAsB;IACtB,mBAAmB;IACnB,0BAA0B;IAC1B,uBAAuB;IACvB,oBAAoB;IACpB,gCAAgC;IAChC,4BAA4B;IAC5B,iBAAiB;IACjB,mBAAmB;IACnB,4BAA4B;CAC7B,CAAC,CAAA;AAEF,SAAgB,aAAa,CAAC,IAAoB;IAChD,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACrC,CAAC"}
@@ -0,0 +1,82 @@
1
+ export type EvidenceRef = {
2
+ type: "evidence";
3
+ source: string;
4
+ locator: string;
5
+ supports: string;
6
+ };
7
+ export type RuleRef = {
8
+ type: "rule";
9
+ rule_id: string;
10
+ supports: string;
11
+ };
12
+ export type MethodRef = {
13
+ type: "method";
14
+ method_id: string;
15
+ supports: string;
16
+ };
17
+ /**
18
+ * DerivedRef: structural claim that this content is derived from specific
19
+ * prior steps in the same RPP record. `from_steps` must list the step ids
20
+ * of the steps this content is derived from — the gate validates that every
21
+ * listed id exists in record.steps and that those steps have references.
22
+ *
23
+ * This replaces fragile keyword matching with a machine-checkable provenance
24
+ * graph edge: response → step(s) → references → evidence/rule/method.
25
+ */
26
+ export type DerivedRef = {
27
+ type: "derived";
28
+ from_steps: string[];
29
+ supports: string;
30
+ };
31
+ export type Reference = EvidenceRef | RuleRef | MethodRef | DerivedRef;
32
+ export type CognitiveStep = {
33
+ id?: string;
34
+ stage: "interpretation" | "reasoning" | "decision" | "action";
35
+ content: string[];
36
+ references: Reference[];
37
+ method_refs?: MethodRef[];
38
+ uncertainties?: string[];
39
+ };
40
+ export type ResponseStep = {
41
+ content: string[];
42
+ references: Reference[];
43
+ };
44
+ export type RPPRecord = {
45
+ call_id: string;
46
+ session_id?: string;
47
+ call_sequence?: number;
48
+ steps: CognitiveStep[];
49
+ response: ResponseStep;
50
+ };
51
+ export type RPPFailureCode = "MISSING_STAGE" | "EMPTY_CONTENT" | "NO_REFERENCES" | "UNSUPPORTED_CLAIM" | "INFERENCE_AS_FACT" | "UNTRACEABLE_RESPONSE" | "UNJUSTIFIED_DECISION" | "ACTION_SCOPE_VIOLATION" | "METHOD_NOT_ACTUALLY_USED" | "INVALID_REFERENCE" | "SUPPORTS_TOO_VAGUE" | "CIRCULAR_REFERENCE" | "DANGLING_PROVENANCE_LINK" | "EMPTY_PROVENANCE_LINK" | "ACTION_NO_EVIDENCE" | "RESPONSE_MISSING_GROUNDED_STEP" | "STEP_DERIVED_REF_FORBIDDEN" | "UNKNOWN_RULE_ID" | "UNKNOWN_METHOD_ID" | "DISALLOWED_EVIDENCE_SOURCE";
52
+ export type RPPFailure = {
53
+ code: RPPFailureCode;
54
+ stage?: CognitiveStep["stage"] | "response";
55
+ detail: string;
56
+ };
57
+ export type RPPValidationResult = {
58
+ overall_status: "valid" | "weakly_supported" | "invalid";
59
+ failures: RPPFailure[];
60
+ warnings: RPPFailure[];
61
+ };
62
+ /**
63
+ * RPPPolicy: project-level policy configuration for validateRPP.
64
+ * All fields are optional. When no policy is provided, validateRPP behaves
65
+ * identically to the no-policy baseline.
66
+ */
67
+ export type RPPPolicy = {
68
+ /** If specified, every rule_id in any RuleRef must appear in this list (UNKNOWN_RULE_ID). */
69
+ allowed_rule_ids?: string[];
70
+ /** If specified, every method_id in any MethodRef must appear in this list (UNKNOWN_METHOD_ID). */
71
+ allowed_method_ids?: string[];
72
+ /** Override the default hard/soft severity for specific failure codes. */
73
+ severity_overrides?: Partial<Record<RPPFailureCode, "hard" | "soft">>;
74
+ /** If specified, every evidence source in action-stage EvidenceRefs must appear in this list (DISALLOWED_EVIDENCE_SOURCE). */
75
+ action_evidence_sources?: string[];
76
+ /**
77
+ * Stages that the response DerivedRef must include at least one of.
78
+ * Defaults to ["decision", "action"] when not specified.
79
+ */
80
+ response_must_reference_stages?: Array<"interpretation" | "reasoning" | "decision" | "action">;
81
+ };
82
+ //# sourceMappingURL=rpp.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpp.types.d.ts","sourceRoot":"","sources":["../../src/rpp/rpp.types.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pp/rpp.types.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=rpp.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpp.types.js","sourceRoot":"","sources":["../../src/rpp/rpp.types.ts"],"names":[],"mappings":";AAAA,uBAAuB"}
@@ -0,0 +1,3 @@
1
+ import { RPPRecord, RPPValidationResult, RPPPolicy } from "./rpp.types.js";
2
+ export declare function validateRPP(record: RPPRecord, policy?: RPPPolicy): RPPValidationResult;
3
+ //# sourceMappingURL=rpp.validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpp.validate.d.ts","sourceRoot":"","sources":["../../src/rpp/rpp.validate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA8B,mBAAmB,EAAE,SAAS,EAA4B,MAAM,gBAAgB,CAAA;AAyDhI,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,mBAAmB,CAwStF"}
@@ -0,0 +1,336 @@
1
+ "use strict";
2
+ // src/rpp/rpp.validate.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.validateRPP = validateRPP;
5
+ const rpp_failures_js_1 = require("./rpp.failures.js");
6
+ const REQUIRED_STAGES = [
7
+ "interpretation",
8
+ "reasoning",
9
+ "decision",
10
+ "action",
11
+ ];
12
+ const RULE_METHOD_ID_PATTERN = /^[A-Z]+-\d+$/;
13
+ const CERTAINTY_WORDS = [
14
+ "is definitely",
15
+ "always",
16
+ "never",
17
+ "must be",
18
+ "certainly",
19
+ ];
20
+ function validateReference(ref, stage) {
21
+ if (ref.type === "rule") {
22
+ if (!RULE_METHOD_ID_PATTERN.test(ref.rule_id)) {
23
+ return {
24
+ code: "INVALID_REFERENCE",
25
+ stage,
26
+ detail: `RuleRef has invalid rule_id: "${ref.rule_id}". Must match /^[A-Z]+-\\d+$/.`,
27
+ };
28
+ }
29
+ }
30
+ else if (ref.type === "method") {
31
+ if (!RULE_METHOD_ID_PATTERN.test(ref.method_id)) {
32
+ return {
33
+ code: "INVALID_REFERENCE",
34
+ stage,
35
+ detail: `MethodRef has invalid method_id: "${ref.method_id}". Must match /^[A-Z]+-\\d+$/.`,
36
+ };
37
+ }
38
+ }
39
+ else if (ref.type === "evidence") {
40
+ if (!ref.source || typeof ref.source !== "string" || ref.source.trim() === "") {
41
+ return {
42
+ code: "INVALID_REFERENCE",
43
+ stage,
44
+ detail: `EvidenceRef has empty or missing 'source' field.`,
45
+ };
46
+ }
47
+ if (!ref.locator || typeof ref.locator !== "string" || ref.locator.trim() === "") {
48
+ return {
49
+ code: "INVALID_REFERENCE",
50
+ stage,
51
+ detail: `EvidenceRef has empty or missing 'locator' field.`,
52
+ };
53
+ }
54
+ }
55
+ // derived refs: no structural fields beyond 'supports' — validated by SUPPORTS_EMPTY below
56
+ return null;
57
+ }
58
+ function validateRPP(record, policy) {
59
+ const allIssues = [];
60
+ // --- Check 1: MISSING_STAGE ---
61
+ const presentStages = new Set(record.steps.map((s) => s.stage));
62
+ for (const required of REQUIRED_STAGES) {
63
+ if (!presentStages.has(required)) {
64
+ allIssues.push({
65
+ code: "MISSING_STAGE",
66
+ stage: required,
67
+ detail: `Required stage "${required}" is missing from the RPP record.`,
68
+ });
69
+ }
70
+ }
71
+ // For checks 2–5, iterate over present steps only
72
+ for (const step of record.steps) {
73
+ const stage = step.stage;
74
+ // --- Check 2: EMPTY_CONTENT ---
75
+ if (!step.content || step.content.length < 1) {
76
+ allIssues.push({
77
+ code: "EMPTY_CONTENT",
78
+ stage,
79
+ detail: `Stage "${stage}" has empty content array.`,
80
+ });
81
+ }
82
+ // --- Check 3: NO_REFERENCES ---
83
+ if (!step.references || step.references.length < 1) {
84
+ allIssues.push({
85
+ code: "NO_REFERENCES",
86
+ stage,
87
+ detail: `Stage "${stage}" has no references.`,
88
+ });
89
+ }
90
+ // --- Check 4: SUPPORTS_TOO_VAGUE (warning) ---
91
+ // Checks structural completeness: supports must be a non-empty string.
92
+ // Does NOT check character count — length-based thresholds are string heuristics,
93
+ // not semantic validation. A one-word supports field is valid; an empty one is not.
94
+ for (const ref of step.references ?? []) {
95
+ if (!ref.supports || ref.supports.trim() === "") {
96
+ allIssues.push({
97
+ code: "SUPPORTS_TOO_VAGUE",
98
+ stage,
99
+ detail: `Reference in stage "${stage}" has an empty 'supports' field. State what claim this reference supports.`,
100
+ });
101
+ }
102
+ }
103
+ // --- Check 5: INVALID_REFERENCE ---
104
+ for (const ref of step.references ?? []) {
105
+ const failure = validateReference(ref, stage);
106
+ if (failure) {
107
+ allIssues.push(failure);
108
+ }
109
+ }
110
+ // --- Check 10: STEP_DERIVED_REF_FORBIDDEN ---
111
+ for (const ref of step.references ?? []) {
112
+ if (ref.type === "derived") {
113
+ allIssues.push({
114
+ code: "STEP_DERIVED_REF_FORBIDDEN",
115
+ stage,
116
+ detail: `Stage "${stage}" contains a reference of type "derived". DerivedRef is only valid in response.references. Use evidence, rule, or method references within steps.`,
117
+ });
118
+ }
119
+ }
120
+ }
121
+ // --- Check 6a: ACTION_NO_EVIDENCE ---
122
+ // The action stage must have at least one evidence reference.
123
+ // A rule or method justifies *why* an action is taken; evidence grounds *what*
124
+ // observable reality it acts on. Without evidence, action is unjustified in fact.
125
+ const actionStep = record.steps.find((s) => s.stage === "action");
126
+ if (actionStep) {
127
+ const hasEvidence = (actionStep.references ?? []).some((r) => r.type === "evidence");
128
+ if (!hasEvidence) {
129
+ allIssues.push({
130
+ code: "ACTION_NO_EVIDENCE",
131
+ stage: "action",
132
+ detail: `Action stage has no evidence reference. Actions must be grounded in observable reality (file, tool_result, log, etc.) — a rule or method alone does not suffice.`,
133
+ });
134
+ }
135
+ }
136
+ // --- Check 6: UNJUSTIFIED_DECISION ---
137
+ const decisionStep = record.steps.find((s) => s.stage === "decision");
138
+ if (decisionStep) {
139
+ const hasRuleOrMethod = decisionStep.references.some((ref) => ref.type === "rule" || ref.type === "method");
140
+ if (!hasRuleOrMethod) {
141
+ allIssues.push({
142
+ code: "UNJUSTIFIED_DECISION",
143
+ stage: "decision",
144
+ detail: `Decision stage has no rule or method reference to justify the decision.`,
145
+ });
146
+ }
147
+ }
148
+ // --- Check 7: INFERENCE_AS_FACT (warning) ---
149
+ const reasoningStep = record.steps.find((s) => s.stage === "reasoning");
150
+ if (reasoningStep) {
151
+ const hasEvidenceRef = reasoningStep.references.some((ref) => ref.type === "evidence");
152
+ if (!hasEvidenceRef) {
153
+ for (const contentItem of reasoningStep.content ?? []) {
154
+ const lower = contentItem.toLowerCase();
155
+ const hasCertaintyWord = CERTAINTY_WORDS.some((word) => lower.includes(word));
156
+ if (hasCertaintyWord) {
157
+ allIssues.push({
158
+ code: "INFERENCE_AS_FACT",
159
+ stage: "reasoning",
160
+ detail: `Reasoning stage content uses certainty language ("${CERTAINTY_WORDS.find((w) => lower.includes(w))}") without any evidence reference: "${contentItem.slice(0, 80)}${contentItem.length > 80 ? "..." : ""}"`,
161
+ });
162
+ }
163
+ }
164
+ }
165
+ }
166
+ // --- Check 8: UNTRACEABLE_RESPONSE ---
167
+ // Structural check: response must contain at least one DerivedRef.
168
+ // DerivedRef is the provenance graph edge: response → step(s) → references.
169
+ if (record.response.references.length === 0) {
170
+ allIssues.push({
171
+ code: "UNTRACEABLE_RESPONSE",
172
+ stage: "response",
173
+ detail: `Response has no references. Add at least one { type: "derived", from_steps: [...], supports: "..." } to establish the provenance chain.`,
174
+ });
175
+ }
176
+ else {
177
+ const hasDerived = record.response.references.some((ref) => ref.type === "derived");
178
+ if (!hasDerived) {
179
+ allIssues.push({
180
+ code: "UNTRACEABLE_RESPONSE",
181
+ stage: "response",
182
+ detail: `Response references contain no "derived" type. Add { type: "derived", from_steps: [...], supports: "..." } to link the response to the prior reasoning steps.`,
183
+ });
184
+ }
185
+ }
186
+ // --- Check 9: DANGLING_PROVENANCE_LINK ---
187
+ // When a DerivedRef lists from_steps, each listed step id must exist in the
188
+ // record and that step must have at least one reference (otherwise the chain
189
+ // terminates in a step with no evidence, which is not a valid provenance node).
190
+ //
191
+ // Backward compat: if all steps lack ids, from_steps cannot be validated and
192
+ // this check is skipped. Verification only fires when step ids are present.
193
+ const stepById = new Map();
194
+ for (const step of record.steps) {
195
+ if (step.id)
196
+ stepById.set(step.id, step);
197
+ }
198
+ // --- Check 8b: RESPONSE_MISSING_GROUNDED_STEP ---
199
+ // When step ids are present, the response derived ref must include at least
200
+ // one step that is a decision or action stage. Tracing only to interpretation
201
+ // or reasoning means the response is grounded in "I thought about it" but not
202
+ // in "I decided" or "I acted" — which is insufficient for an action-authorizing response.
203
+ //
204
+ // Only enforced when step ids exist (backward compat) and a derived ref is present.
205
+ const requiredStages = policy?.response_must_reference_stages ?? ["decision", "action"];
206
+ if (stepById.size > 0) {
207
+ for (const ref of record.response.references) {
208
+ if (ref.type !== "derived" || ref.from_steps.length === 0)
209
+ continue;
210
+ const hasRequiredStage = ref.from_steps.some((id) => {
211
+ const s = stepById.get(id);
212
+ return s !== undefined && requiredStages.includes(s.stage);
213
+ });
214
+ if (!hasRequiredStage) {
215
+ allIssues.push({
216
+ code: "RESPONSE_MISSING_GROUNDED_STEP",
217
+ stage: "response",
218
+ detail: `Response DerivedRef.from_steps [${ref.from_steps.join(", ")}] does not include a step with stage in [${requiredStages.join(", ")}]. The response must trace to one of these stages.`,
219
+ });
220
+ }
221
+ }
222
+ }
223
+ for (const ref of record.response.references) {
224
+ if (ref.type !== "derived")
225
+ continue;
226
+ // --- Check 9a: EMPTY_PROVENANCE_LINK ---
227
+ // from_steps must name at least one step. An empty array is a self-claim:
228
+ // it declares derivation but points to nothing — equivalent to no chain at all.
229
+ if (ref.from_steps.length === 0) {
230
+ allIssues.push({
231
+ code: "EMPTY_PROVENANCE_LINK",
232
+ stage: "response",
233
+ detail: `DerivedRef.from_steps is empty. List at least one step id that this response derives from.`,
234
+ });
235
+ continue;
236
+ }
237
+ // --- Check 9b: DANGLING_PROVENANCE_LINK ---
238
+ // When step ids are present in the record, each from_steps entry must:
239
+ // (1) resolve to an existing step
240
+ // (2) that step must have at least one non-derived reference
241
+ // (evidence / rule / method) — otherwise the chain terminates in
242
+ // another floating declaration, not in actual grounding.
243
+ //
244
+ // Backward compat: if no steps have ids, skip resolution check.
245
+ if (stepById.size > 0) {
246
+ for (const stepId of ref.from_steps) {
247
+ const target = stepById.get(stepId);
248
+ if (!target) {
249
+ allIssues.push({
250
+ code: "DANGLING_PROVENANCE_LINK",
251
+ stage: "response",
252
+ detail: `DerivedRef.from_steps references step id "${stepId}" which does not exist in this RPP record.`,
253
+ });
254
+ }
255
+ else {
256
+ const hasGroundedRef = (target.references ?? []).some((r) => r.type === "evidence" || r.type === "rule" || r.type === "method");
257
+ if (!hasGroundedRef) {
258
+ allIssues.push({
259
+ code: "DANGLING_PROVENANCE_LINK",
260
+ stage: "response",
261
+ detail: `DerivedRef.from_steps references step "${stepId}" (stage: "${target.stage}") which has no evidence/rule/method references — the provenance chain terminates in an ungrounded step.`,
262
+ });
263
+ }
264
+ }
265
+ }
266
+ }
267
+ }
268
+ // --- Policy checks (only when policy is provided) ---
269
+ if (policy) {
270
+ // UNKNOWN_RULE_ID: rule_id must be in allowed_rule_ids
271
+ if (policy.allowed_rule_ids && policy.allowed_rule_ids.length > 0) {
272
+ for (const step of record.steps) {
273
+ for (const ref of step.references ?? []) {
274
+ if (ref.type === "rule" && !policy.allowed_rule_ids.includes(ref.rule_id)) {
275
+ allIssues.push({
276
+ code: "UNKNOWN_RULE_ID",
277
+ stage: step.stage,
278
+ detail: `rule_id "${ref.rule_id}" is not in the project's allowed_rule_ids list: [${policy.allowed_rule_ids.join(", ")}].`,
279
+ });
280
+ }
281
+ }
282
+ }
283
+ }
284
+ // UNKNOWN_METHOD_ID: method_id must be in allowed_method_ids
285
+ if (policy.allowed_method_ids && policy.allowed_method_ids.length > 0) {
286
+ for (const step of record.steps) {
287
+ for (const ref of step.references ?? []) {
288
+ if (ref.type === "method" && !policy.allowed_method_ids.includes(ref.method_id)) {
289
+ allIssues.push({
290
+ code: "UNKNOWN_METHOD_ID",
291
+ stage: step.stage,
292
+ detail: `method_id "${ref.method_id}" is not in the project's allowed_method_ids list: [${policy.allowed_method_ids.join(", ")}].`,
293
+ });
294
+ }
295
+ }
296
+ }
297
+ }
298
+ // DISALLOWED_EVIDENCE_SOURCE: action step evidence sources must be in action_evidence_sources
299
+ if (policy.action_evidence_sources && policy.action_evidence_sources.length > 0) {
300
+ const actionStep = record.steps.find((s) => s.stage === "action");
301
+ if (actionStep) {
302
+ for (const ref of actionStep.references ?? []) {
303
+ if (ref.type === "evidence" && !policy.action_evidence_sources.includes(ref.source)) {
304
+ allIssues.push({
305
+ code: "DISALLOWED_EVIDENCE_SOURCE",
306
+ stage: "action",
307
+ detail: `Evidence source "${ref.source}" in action stage is not in the project's allowed action_evidence_sources list: [${policy.action_evidence_sources.join(", ")}].`,
308
+ });
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
314
+ // --- Compute overall_status ---
315
+ // severity_overrides can promote soft failures to hard or demote hard failures to soft.
316
+ const overrides = policy?.severity_overrides ?? {};
317
+ const isEffectivelyHard = (code) => {
318
+ if (code in overrides)
319
+ return overrides[code] === "hard";
320
+ return (0, rpp_failures_js_1.isHardFailure)(code);
321
+ };
322
+ const failures = allIssues.filter((issue) => isEffectivelyHard(issue.code));
323
+ const warnings = allIssues.filter((issue) => !isEffectivelyHard(issue.code));
324
+ let overall_status;
325
+ if (failures.length > 0) {
326
+ overall_status = "invalid";
327
+ }
328
+ else if (warnings.length > 0) {
329
+ overall_status = "weakly_supported";
330
+ }
331
+ else {
332
+ overall_status = "valid";
333
+ }
334
+ return { overall_status, failures, warnings };
335
+ }
336
+ //# sourceMappingURL=rpp.validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpp.validate.js","sourceRoot":"","sources":["../../src/rpp/rpp.validate.ts"],"names":[],"mappings":";AAAA,0BAA0B;;AA2D1B,kCAwSC;AAhWD,uDAAiD;AAEjD,MAAM,eAAe,GAAkC;IAC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MAAM,SAAS,GAAG,MAAM,EAAE,kBAAkB,IAAI,EAAE,CAAA;IAClD,MAAM,iBAAiB,GAAG,CAAC,IAAoB,EAAW,EAAE;QAC1D,IAAI,IAAI,IAAI,SAAS;YAAE,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,MAAM,CAAA;QACxD,OAAO,IAAA,+BAAa,EAAC,IAAI,CAAC,CAAA;IAC5B,CAAC,CAAA;IACD,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3E,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IAE5E,IAAI,cAAqD,CAAA;IACzD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,cAAc,GAAG,SAAS,CAAA;IAC5B,CAAC;SAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,cAAc,GAAG,kBAAkB,CAAA;IACrC,CAAC;SAAM,CAAC;QACN,cAAc,GAAG,OAAO,CAAA;IAC1B,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AAC/C,CAAC"}
package/package.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
2
  "name": "jingu-protocol",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Shared protocol types for the Jingu system — RPP (Reasoning Provenance Protocol) and related definitions",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
7
7
  "types": "./dist/src/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "require": "./dist/src/index.js",
10
+ "require": "./dist-cjs/index.js",
11
11
  "import": "./dist/src/index.js",
12
12
  "types": "./dist/src/index.d.ts"
13
13
  }
14
14
  },
15
15
  "files": [
16
- "dist/src"
16
+ "dist/src",
17
+ "dist-cjs"
17
18
  ],
18
19
  "scripts": {
19
20
  "build": "tsc -p tsconfig.json",
21
+ "build:cjs": "tsc -p tsconfig.cjs.json",
22
+ "build:all": "npm run build && npm run build:cjs",
20
23
  "test": "node --test dist/src/**/*.test.js"
21
24
  },
22
25
  "devDependencies": {