kibi-cli 0.16.1 → 0.17.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/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/sync/manifest.d.ts +12 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +22 -5
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +18 -1
- package/dist/extractors/markdown.d.ts +9 -1
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +12 -0
- package/dist/logic/ir.d.ts +112 -0
- package/dist/logic/ir.d.ts.map +1 -0
- package/dist/logic/ir.js +729 -0
- package/dist/operations/modeling/logic-modeling.d.ts +22 -0
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -0
- package/dist/operations/modeling/logic-modeling.js +111 -0
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +56 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +15 -2
- package/dist/operations/modeling/predicate-inference.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-inference.js +17 -2
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +6 -0
- package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-ranker.js +40 -2
- package/dist/operations/modeling/predicate-types.d.ts +3 -0
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/requirement-types.d.ts +12 -0
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +8 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +3 -0
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +68 -3
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts +2 -2
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +23 -15
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +435 -13
- package/dist/operations/semantic-advisor/observation-plan.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/observation-plan.js +15 -3
- package/dist/operations/semantic-advisor/shared.d.ts +1 -0
- package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/shared.js +1 -1
- package/dist/operations/semantic-advisor/types.d.ts +61 -1
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +11 -1
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +7 -2
- package/dist/public/operations/catalog.d.ts +85 -6
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/index.d.ts +1 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +1 -0
- package/dist/public/operations/specs/check.d.ts +2 -2
- package/dist/public/operations/specs/check.d.ts.map +1 -1
- package/dist/public/operations/specs/check.js +4 -1
- package/dist/public/operations/specs/modeling.d.ts +16 -0
- package/dist/public/operations/specs/modeling.d.ts.map +1 -1
- package/dist/public/operations/specs/modeling.js +16 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts +37 -2
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +27 -0
- package/dist/public/operations/specs/semantic.d.ts +30 -2
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +34 -2
- package/dist/public/operations/specs/upsert.d.ts +37 -2
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +290 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -0
- package/dist/public/skills/kibi-usage/SKILL.md +35 -9
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +11 -1
- package/dist/public/skills/kibi-usage/resources/logic-ir.md +43 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +19 -19
- package/dist/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +21 -6
- package/dist/public/symbol-granularity.d.ts +9 -0
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.js +16 -0
- package/dist/schemas/entity.schema.json +306 -3
- package/dist/traceability/staged-diagnostics.d.ts +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +17 -10
- package/dist/traceability/staged-impact-contract.js +1 -1
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +28 -10
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +13 -0
- package/dist/types/relationships.d.ts +1 -1
- package/dist/types/relationships.d.ts.map +1 -1
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.js +18 -0
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.js +1 -1
- package/package.json +6 -2
- package/src/public/operations/index.ts +1 -0
- package/src/public/operations/specs/check.ts +4 -1
- package/src/public/operations/specs/modeling.ts +20 -0
- package/src/public/operations/specs/mutation-schemas.ts +30 -0
- package/src/public/operations/specs/semantic.ts +41 -2
- package/src/public/schemas/entity.ts +297 -1
- package/src/public/schemas/relationship.ts +1 -0
- package/src/public/skills/kibi-usage/SKILL.md +35 -9
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +11 -1
- package/src/public/skills/kibi-usage/resources/logic-ir.md +43 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +19 -19
- package/src/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +21 -6
- package/src/public/symbol-granularity.ts +25 -0
- package/src/schemas/entity.schema.json +306 -3
- package/src/schemas/relationship.schema.json +1 -0
|
@@ -21,11 +21,39 @@ export declare const semanticAdvisorSpec: {
|
|
|
21
21
|
};
|
|
22
22
|
readonly description: "Optional complete list of atomic requirement clauses supplied by the caller. Use this for compound prose so every normative clause receives a stable claim key and independent grounding review.";
|
|
23
23
|
};
|
|
24
|
+
readonly interpretations: {
|
|
25
|
+
readonly type: "array";
|
|
26
|
+
readonly maxItems: 3;
|
|
27
|
+
readonly description: "Optional host-LLM typed kibi.logic.v1 interpretations. Kibi validates and canonicalizes them; raw Prolog is not accepted.";
|
|
28
|
+
readonly items: {
|
|
29
|
+
readonly type: "object";
|
|
30
|
+
readonly required: readonly ["claim_key", "claim_text", "ir"];
|
|
31
|
+
readonly properties: {
|
|
32
|
+
readonly claim_key: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
};
|
|
35
|
+
readonly claim_text: {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
};
|
|
38
|
+
readonly confidence: {
|
|
39
|
+
readonly type: "number";
|
|
40
|
+
readonly minimum: 0;
|
|
41
|
+
readonly maximum: 1;
|
|
42
|
+
};
|
|
43
|
+
readonly span: {
|
|
44
|
+
readonly type: "object";
|
|
45
|
+
};
|
|
46
|
+
readonly ir: {
|
|
47
|
+
readonly type: "object";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
24
52
|
readonly type: {
|
|
25
53
|
readonly type: "string";
|
|
26
|
-
readonly enum: readonly ["req"];
|
|
54
|
+
readonly enum: readonly ["req", "scenario", "test", "adr", "flag", "event", "symbol", "fact"];
|
|
27
55
|
readonly default: "req";
|
|
28
|
-
readonly description: "Entity type context for analysis.
|
|
56
|
+
readonly description: "Entity type context for analysis. Requirement, domain-fact, and supporting prose all receive a proposition ledger; only requirements receive deterministic modeling suggestions.";
|
|
29
57
|
};
|
|
30
58
|
readonly id: {
|
|
31
59
|
readonly type: "string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/semantic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,8BAA8B,EAC/B,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAmB5D,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,mBAAmB,EACzB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC,8BAA8B,CAAC,
|
|
1
|
+
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/semantic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,8BAA8B,EAC/B,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAmB5D,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,mBAAmB,EACzB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC,8BAA8B,CAAC,CA8BzC;AAED,iBAAe,2BAA2B,CACxC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACxC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,8BAA8B,CAAC,CAiCzC;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EE,CAAC"}
|
|
@@ -28,6 +28,9 @@ export async function executeSemanticAdvisor(args, _context) {
|
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
...(args.clauses !== undefined ? { clauses: args.clauses } : {}),
|
|
31
|
+
...(args.interpretations !== undefined
|
|
32
|
+
? { interpretations: args.interpretations }
|
|
33
|
+
: {}),
|
|
31
34
|
});
|
|
32
35
|
return {
|
|
33
36
|
content: [
|
|
@@ -48,6 +51,9 @@ async function executeSemanticAdvisorInput(input, context) {
|
|
|
48
51
|
const clauses = Array.isArray(input.clauses)
|
|
49
52
|
? input.clauses.filter((value) => typeof value === "string")
|
|
50
53
|
: undefined;
|
|
54
|
+
const interpretations = Array.isArray(input.interpretations)
|
|
55
|
+
? input.interpretations.filter((value) => typeof value === "object" && value !== null)
|
|
56
|
+
: undefined;
|
|
51
57
|
return executeSemanticAdvisor({
|
|
52
58
|
text: requiredText(input.text),
|
|
53
59
|
...(type ? { type } : {}),
|
|
@@ -56,6 +62,7 @@ async function executeSemanticAdvisorInput(input, context) {
|
|
|
56
62
|
...(source ? { source } : {}),
|
|
57
63
|
...(status ? { status } : {}),
|
|
58
64
|
...(clauses !== undefined ? { clauses } : {}),
|
|
65
|
+
...(interpretations !== undefined ? { interpretations } : {}),
|
|
59
66
|
}, context);
|
|
60
67
|
}
|
|
61
68
|
export const semanticAdvisorSpec = {
|
|
@@ -75,11 +82,36 @@ export const semanticAdvisorSpec = {
|
|
|
75
82
|
items: { type: "string" },
|
|
76
83
|
description: "Optional complete list of atomic requirement clauses supplied by the caller. Use this for compound prose so every normative clause receives a stable claim key and independent grounding review.",
|
|
77
84
|
},
|
|
85
|
+
interpretations: {
|
|
86
|
+
type: "array",
|
|
87
|
+
maxItems: 3,
|
|
88
|
+
description: "Optional host-LLM typed kibi.logic.v1 interpretations. Kibi validates and canonicalizes them; raw Prolog is not accepted.",
|
|
89
|
+
items: {
|
|
90
|
+
type: "object",
|
|
91
|
+
required: ["claim_key", "claim_text", "ir"],
|
|
92
|
+
properties: {
|
|
93
|
+
claim_key: { type: "string" },
|
|
94
|
+
claim_text: { type: "string" },
|
|
95
|
+
confidence: { type: "number", minimum: 0, maximum: 1 },
|
|
96
|
+
span: { type: "object" },
|
|
97
|
+
ir: { type: "object" },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
78
101
|
type: {
|
|
79
102
|
type: "string",
|
|
80
|
-
enum: [
|
|
103
|
+
enum: [
|
|
104
|
+
"req",
|
|
105
|
+
"scenario",
|
|
106
|
+
"test",
|
|
107
|
+
"adr",
|
|
108
|
+
"flag",
|
|
109
|
+
"event",
|
|
110
|
+
"symbol",
|
|
111
|
+
"fact",
|
|
112
|
+
],
|
|
81
113
|
default: "req",
|
|
82
|
-
description: "Entity type context for analysis.
|
|
114
|
+
description: "Entity type context for analysis. Requirement, domain-fact, and supporting prose all receive a proposition ledger; only requirements receive deterministic modeling suggestions.",
|
|
83
115
|
},
|
|
84
116
|
id: {
|
|
85
117
|
type: "string",
|
|
@@ -98,7 +98,7 @@ export declare const upsertSpec: {
|
|
|
98
98
|
};
|
|
99
99
|
readonly fact_kind: {
|
|
100
100
|
readonly type: "string";
|
|
101
|
-
readonly enum: readonly ["subject", "property_value", "observation", "meta", "predicate_schema", "predicate"];
|
|
101
|
+
readonly enum: readonly ["subject", "property_value", "observation", "meta", "predicate_schema", "predicate", "rule_schema", "rule"];
|
|
102
102
|
readonly description: "Optional fact lane kind for fact entities. Strict lane uses 'subject' and 'property_value'; context lane uses 'observation' or 'meta'; ontology lane uses 'predicate_schema' or 'predicate'. Use kb_model_requirement or kb_suggest_predicates when starting from prose.";
|
|
103
103
|
};
|
|
104
104
|
readonly subject_key: {
|
|
@@ -220,6 +220,41 @@ export declare const upsertSpec: {
|
|
|
220
220
|
};
|
|
221
221
|
readonly description: "Optional ground-term examples for a predicate schema.";
|
|
222
222
|
};
|
|
223
|
+
readonly semantic_inventory: {
|
|
224
|
+
readonly type: "array";
|
|
225
|
+
readonly description: "Requirement proposition ledger returned by kb_semantic_advisor; preserve entries while modeling each assertive span.";
|
|
226
|
+
readonly items: {
|
|
227
|
+
readonly type: "object";
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
readonly rule_ir: {
|
|
231
|
+
readonly type: "object";
|
|
232
|
+
readonly description: "Schema-validated kibi.logic.v1 rule IR. It is persisted as data and never executed as caller-supplied Prolog.";
|
|
233
|
+
};
|
|
234
|
+
readonly rule_hash: {
|
|
235
|
+
readonly type: "string";
|
|
236
|
+
readonly description: "Deterministic hash of canonical rule_ir.";
|
|
237
|
+
};
|
|
238
|
+
readonly rule_schema_id: {
|
|
239
|
+
readonly type: "string";
|
|
240
|
+
readonly description: "Rule schema fact ID used to validate this rule.";
|
|
241
|
+
};
|
|
242
|
+
readonly rule_name: {
|
|
243
|
+
readonly type: "string";
|
|
244
|
+
readonly description: "Stable rule schema name.";
|
|
245
|
+
};
|
|
246
|
+
readonly semantic_key: {
|
|
247
|
+
readonly type: "string";
|
|
248
|
+
readonly description: "Canonical semantic identity of the normalized logical model.";
|
|
249
|
+
};
|
|
250
|
+
readonly claim_span_start: {
|
|
251
|
+
readonly type: "integer";
|
|
252
|
+
readonly minimum: 0;
|
|
253
|
+
};
|
|
254
|
+
readonly claim_span_end: {
|
|
255
|
+
readonly type: "integer";
|
|
256
|
+
readonly minimum: 0;
|
|
257
|
+
};
|
|
223
258
|
};
|
|
224
259
|
readonly allOf: readonly [Record<string, unknown>];
|
|
225
260
|
readonly required: readonly ["title", "status"];
|
|
@@ -233,7 +268,7 @@ export declare const upsertSpec: {
|
|
|
233
268
|
readonly properties: {
|
|
234
269
|
readonly type: {
|
|
235
270
|
readonly type: "string";
|
|
236
|
-
readonly enum: readonly ["depends_on", "specified_by", "verified_by", "validates", "implements", "covered_by", "executable_for", "constrained_by", "constrains", "requires_property", "requires_predicate", "guards", "publishes", "consumes", "supersedes", "relates_to"];
|
|
271
|
+
readonly enum: readonly ["depends_on", "specified_by", "verified_by", "validates", "implements", "covered_by", "executable_for", "constrained_by", "constrains", "requires_property", "requires_predicate", "requires_rule", "guards", "publishes", "consumes", "supersedes", "relates_to"];
|
|
237
272
|
readonly description: "Relationship type enum. Use only supported values. Direction semantics follow KB model (e.g., implements symbol->req, verified_by req/scenario->test, executable_for symbol->test).";
|
|
238
273
|
};
|
|
239
274
|
readonly from: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/upsert.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAQvE,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/upsert.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAQvE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BuC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AAuTA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAmRzC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -59,6 +59,30 @@ const factConditionals = JSON.parse(`[
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
+
{
|
|
63
|
+
"if": {
|
|
64
|
+
"properties": {
|
|
65
|
+
"type": { "const": "fact" },
|
|
66
|
+
"fact_kind": { "const": "rule_schema" }
|
|
67
|
+
},
|
|
68
|
+
"required": ["type", "fact_kind"]
|
|
69
|
+
},
|
|
70
|
+
"then": {
|
|
71
|
+
"required": ["rule_name", "argument_names", "argument_types"]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"if": {
|
|
76
|
+
"properties": {
|
|
77
|
+
"type": { "const": "fact" },
|
|
78
|
+
"fact_kind": { "const": "rule" }
|
|
79
|
+
},
|
|
80
|
+
"required": ["type", "fact_kind"]
|
|
81
|
+
},
|
|
82
|
+
"then": {
|
|
83
|
+
"required": ["rule_ir", "rule_hash", "rule_schema_id", "rule_name", "semantic_key"]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
62
86
|
{
|
|
63
87
|
"if": {
|
|
64
88
|
"properties": {
|
|
@@ -74,10 +98,205 @@ const factConditionals = JSON.parse(`[
|
|
|
74
98
|
}
|
|
75
99
|
}
|
|
76
100
|
]`);
|
|
101
|
+
// The persisted rule payload is still data, but its shape is constrained at
|
|
102
|
+
// the JSON boundary as well as by validateLogicIr. Keeping this vocabulary
|
|
103
|
+
// closed prevents a raw_goal/raw Prolog field from entering an upsert payload.
|
|
104
|
+
const logicTermSchema = {
|
|
105
|
+
oneOf: [
|
|
106
|
+
{
|
|
107
|
+
type: "object",
|
|
108
|
+
required: ["kind", "name", "type"],
|
|
109
|
+
properties: {
|
|
110
|
+
kind: { const: "var" },
|
|
111
|
+
name: { type: "string", pattern: "^[A-Z][A-Za-z0-9_]*$" },
|
|
112
|
+
type: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
|
|
113
|
+
},
|
|
114
|
+
additionalProperties: false,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: "object",
|
|
118
|
+
required: ["kind", "value"],
|
|
119
|
+
properties: {
|
|
120
|
+
kind: { const: "const" },
|
|
121
|
+
value: { type: "string", minLength: 1 },
|
|
122
|
+
type: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
|
|
123
|
+
},
|
|
124
|
+
additionalProperties: false,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: "object",
|
|
128
|
+
required: ["kind", "value"],
|
|
129
|
+
properties: {
|
|
130
|
+
kind: { const: "number" },
|
|
131
|
+
value: { type: "number" },
|
|
132
|
+
unit: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
|
|
133
|
+
},
|
|
134
|
+
additionalProperties: false,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
type: "object",
|
|
138
|
+
required: ["kind", "value", "unit"],
|
|
139
|
+
properties: {
|
|
140
|
+
kind: { const: "duration" },
|
|
141
|
+
value: { type: "number", minimum: 0 },
|
|
142
|
+
unit: { type: "string", enum: ["ms", "s", "m", "h", "d", "w"] },
|
|
143
|
+
},
|
|
144
|
+
additionalProperties: false,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: "object",
|
|
148
|
+
required: ["kind", "value"],
|
|
149
|
+
properties: {
|
|
150
|
+
kind: { const: "timestamp" },
|
|
151
|
+
value: { type: "string" },
|
|
152
|
+
},
|
|
153
|
+
additionalProperties: false,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
type: "object",
|
|
157
|
+
required: ["kind", "start", "end"],
|
|
158
|
+
properties: {
|
|
159
|
+
kind: { const: "interval" },
|
|
160
|
+
start: { type: "string" },
|
|
161
|
+
end: { type: "string" },
|
|
162
|
+
},
|
|
163
|
+
additionalProperties: false,
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
};
|
|
167
|
+
const logicAtomSchema = {
|
|
168
|
+
type: "object",
|
|
169
|
+
required: ["kind", "name", "args"],
|
|
170
|
+
properties: {
|
|
171
|
+
kind: { const: "atom" },
|
|
172
|
+
namespace: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
|
|
173
|
+
name: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
|
|
174
|
+
args: {
|
|
175
|
+
type: "array",
|
|
176
|
+
maxItems: 8,
|
|
177
|
+
items: { $ref: "#/$defs/logicTerm" },
|
|
178
|
+
},
|
|
179
|
+
polarity: { enum: ["positive", "negative"] },
|
|
180
|
+
closedWorld: { type: "boolean" },
|
|
181
|
+
},
|
|
182
|
+
additionalProperties: false,
|
|
183
|
+
};
|
|
184
|
+
const logicExpressionSchema = {
|
|
185
|
+
oneOf: [
|
|
186
|
+
{ $ref: "#/$defs/logicAtom" },
|
|
187
|
+
{
|
|
188
|
+
type: "object",
|
|
189
|
+
required: ["kind", "items"],
|
|
190
|
+
properties: {
|
|
191
|
+
kind: { enum: ["all", "any"] },
|
|
192
|
+
items: {
|
|
193
|
+
type: "array",
|
|
194
|
+
minItems: 1,
|
|
195
|
+
maxItems: 32,
|
|
196
|
+
items: { $ref: "#/$defs/logicExpression" },
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
additionalProperties: false,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
type: "object",
|
|
203
|
+
required: ["kind", "item"],
|
|
204
|
+
properties: {
|
|
205
|
+
kind: { const: "not" },
|
|
206
|
+
item: { $ref: "#/$defs/logicAtom" },
|
|
207
|
+
},
|
|
208
|
+
additionalProperties: false,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
type: "object",
|
|
212
|
+
required: ["kind", "operator", "left", "right"],
|
|
213
|
+
properties: {
|
|
214
|
+
kind: { const: "compare" },
|
|
215
|
+
operator: { enum: ["eq", "neq", "lt", "lte", "gt", "gte"] },
|
|
216
|
+
left: { $ref: "#/$defs/logicTerm" },
|
|
217
|
+
right: { $ref: "#/$defs/logicTerm" },
|
|
218
|
+
},
|
|
219
|
+
additionalProperties: false,
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
type: "object",
|
|
223
|
+
required: ["kind", "atom", "operator", "value"],
|
|
224
|
+
properties: {
|
|
225
|
+
kind: { const: "count" },
|
|
226
|
+
atom: { $ref: "#/$defs/logicAtom" },
|
|
227
|
+
operator: { enum: ["eq", "neq", "lt", "lte", "gt", "gte"] },
|
|
228
|
+
value: { type: "integer", minimum: 0 },
|
|
229
|
+
},
|
|
230
|
+
additionalProperties: false,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
type: "object",
|
|
234
|
+
required: ["kind", "relation", "left", "right"],
|
|
235
|
+
properties: {
|
|
236
|
+
kind: { const: "temporal" },
|
|
237
|
+
relation: {
|
|
238
|
+
enum: ["before", "after", "during", "overlaps", "starts", "finishes"],
|
|
239
|
+
},
|
|
240
|
+
left: { $ref: "#/$defs/logicTerm" },
|
|
241
|
+
right: { $ref: "#/$defs/logicTerm" },
|
|
242
|
+
},
|
|
243
|
+
additionalProperties: false,
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
};
|
|
247
|
+
const logicRuleSchema = {
|
|
248
|
+
type: "object",
|
|
249
|
+
required: ["version", "kind", "modality"],
|
|
250
|
+
properties: {
|
|
251
|
+
version: { const: "kibi.logic.v1" },
|
|
252
|
+
kind: { enum: ["atom", "rule", "constraint"] },
|
|
253
|
+
modality: { enum: ["assert", "deny", "oblige", "permit", "forbid"] },
|
|
254
|
+
head: { $ref: "#/$defs/logicAtom" },
|
|
255
|
+
body: { $ref: "#/$defs/logicExpression" },
|
|
256
|
+
variables: {
|
|
257
|
+
type: "array",
|
|
258
|
+
maxItems: 32,
|
|
259
|
+
items: {
|
|
260
|
+
type: "object",
|
|
261
|
+
required: ["name", "type"],
|
|
262
|
+
properties: {
|
|
263
|
+
name: { type: "string", pattern: "^[A-Z][A-Za-z0-9_]*$" },
|
|
264
|
+
type: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
|
|
265
|
+
quantifier: { enum: ["forall", "exists"] },
|
|
266
|
+
},
|
|
267
|
+
additionalProperties: false,
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
exceptions: {
|
|
271
|
+
type: "array",
|
|
272
|
+
maxItems: 16,
|
|
273
|
+
items: { $ref: "#/$defs/logicExpression" },
|
|
274
|
+
},
|
|
275
|
+
scope: {
|
|
276
|
+
type: "object",
|
|
277
|
+
properties: {
|
|
278
|
+
authority: { type: "string" },
|
|
279
|
+
name: { type: "string" },
|
|
280
|
+
tags: { type: "array", items: { type: "string" } },
|
|
281
|
+
},
|
|
282
|
+
additionalProperties: false,
|
|
283
|
+
},
|
|
284
|
+
validFrom: { type: "string" },
|
|
285
|
+
validTo: { type: "string" },
|
|
286
|
+
ruleSchemaId: { type: "string", minLength: 1 },
|
|
287
|
+
},
|
|
288
|
+
additionalProperties: false,
|
|
289
|
+
};
|
|
77
290
|
const entitySchema = {
|
|
78
291
|
$id: "entity.schema.json",
|
|
79
292
|
title: "Entity",
|
|
80
293
|
type: "object",
|
|
294
|
+
$defs: {
|
|
295
|
+
logicTerm: logicTermSchema,
|
|
296
|
+
logicAtom: logicAtomSchema,
|
|
297
|
+
logicExpression: logicExpressionSchema,
|
|
298
|
+
logicRule: logicRuleSchema,
|
|
299
|
+
},
|
|
81
300
|
properties: {
|
|
82
301
|
id: { type: "string" },
|
|
83
302
|
title: { type: "string" },
|
|
@@ -120,6 +339,53 @@ const entitySchema = {
|
|
|
120
339
|
uniqueItems: true,
|
|
121
340
|
items: { type: "string", pattern: "^CLAIM-[A-F0-9]{16}$" },
|
|
122
341
|
},
|
|
342
|
+
semantic_inventory: {
|
|
343
|
+
type: "array",
|
|
344
|
+
items: {
|
|
345
|
+
type: "object",
|
|
346
|
+
required: ["claim_key", "claim_text", "role", "status", "span"],
|
|
347
|
+
properties: {
|
|
348
|
+
claim_key: { type: "string", pattern: "^CLAIM-[A-F0-9]{16}$" },
|
|
349
|
+
claim_text: { type: "string", minLength: 1 },
|
|
350
|
+
role: {
|
|
351
|
+
type: "string",
|
|
352
|
+
enum: [
|
|
353
|
+
"normative",
|
|
354
|
+
"definition",
|
|
355
|
+
"descriptive",
|
|
356
|
+
"condition",
|
|
357
|
+
"exception",
|
|
358
|
+
"rationale",
|
|
359
|
+
"example",
|
|
360
|
+
"subjective",
|
|
361
|
+
],
|
|
362
|
+
},
|
|
363
|
+
status: {
|
|
364
|
+
type: "string",
|
|
365
|
+
enum: [
|
|
366
|
+
"modeled",
|
|
367
|
+
"ambiguous",
|
|
368
|
+
"ontology_gap",
|
|
369
|
+
"nonlogical",
|
|
370
|
+
"missing",
|
|
371
|
+
],
|
|
372
|
+
},
|
|
373
|
+
span: {
|
|
374
|
+
type: "object",
|
|
375
|
+
required: ["start", "end"],
|
|
376
|
+
properties: {
|
|
377
|
+
start: { type: "integer", minimum: 0 },
|
|
378
|
+
end: { type: "integer", minimum: 0 },
|
|
379
|
+
},
|
|
380
|
+
additionalProperties: false,
|
|
381
|
+
},
|
|
382
|
+
semantic_key: { type: "string" },
|
|
383
|
+
payload_hash: { type: "string" },
|
|
384
|
+
reason: { type: "string" },
|
|
385
|
+
},
|
|
386
|
+
additionalProperties: false,
|
|
387
|
+
},
|
|
388
|
+
},
|
|
123
389
|
sourceFile: { type: "string" },
|
|
124
390
|
granularity_reason: {
|
|
125
391
|
type: "string",
|
|
@@ -165,6 +431,8 @@ const entitySchema = {
|
|
|
165
431
|
"meta",
|
|
166
432
|
"predicate_schema",
|
|
167
433
|
"predicate",
|
|
434
|
+
"rule_schema",
|
|
435
|
+
"rule",
|
|
168
436
|
],
|
|
169
437
|
},
|
|
170
438
|
subject_key: { type: "string" },
|
|
@@ -196,6 +464,13 @@ const entitySchema = {
|
|
|
196
464
|
aliases: { type: "array", items: { type: "string" } },
|
|
197
465
|
examples: { type: "array", items: { type: "string" } },
|
|
198
466
|
predicate_args: { type: "array", items: { type: "string" } },
|
|
467
|
+
rule_ir: { $ref: "#/$defs/logicRule" },
|
|
468
|
+
rule_hash: { type: "string", pattern: "^[a-f0-9]{64}$" },
|
|
469
|
+
rule_schema_id: { type: "string", minLength: 1 },
|
|
470
|
+
rule_name: { type: "string", minLength: 1 },
|
|
471
|
+
semantic_key: { type: "string", pattern: "^SEM-[A-F0-9]{24}$" },
|
|
472
|
+
claim_span_start: { type: "integer", minimum: 0 },
|
|
473
|
+
claim_span_end: { type: "integer", minimum: 0 },
|
|
199
474
|
},
|
|
200
475
|
required: [
|
|
201
476
|
"id",
|
|
@@ -252,6 +527,13 @@ const entitySchema = {
|
|
|
252
527
|
{ required: ["aliases"] },
|
|
253
528
|
{ required: ["examples"] },
|
|
254
529
|
{ required: ["predicate_args"] },
|
|
530
|
+
{ required: ["rule_ir"] },
|
|
531
|
+
{ required: ["rule_hash"] },
|
|
532
|
+
{ required: ["rule_schema_id"] },
|
|
533
|
+
{ required: ["rule_name"] },
|
|
534
|
+
{ required: ["semantic_key"] },
|
|
535
|
+
{ required: ["claim_span_start"] },
|
|
536
|
+
{ required: ["claim_span_end"] },
|
|
255
537
|
],
|
|
256
538
|
},
|
|
257
539
|
},
|
|
@@ -269,6 +551,14 @@ const entitySchema = {
|
|
|
269
551
|
},
|
|
270
552
|
},
|
|
271
553
|
},
|
|
554
|
+
{
|
|
555
|
+
if: {
|
|
556
|
+
properties: { type: { const: "req" } },
|
|
557
|
+
},
|
|
558
|
+
else: {
|
|
559
|
+
not: { required: ["semantic_inventory"] },
|
|
560
|
+
},
|
|
561
|
+
},
|
|
272
562
|
...factConditionals,
|
|
273
563
|
],
|
|
274
564
|
additionalProperties: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|