@qmilab/lodestar-core 0.1.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.
Files changed (47) hide show
  1. package/LICENSE +216 -0
  2. package/README.md +87 -0
  3. package/dist/index.d.ts +23 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +28 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/registry.d.ts +20 -0
  8. package/dist/registry.d.ts.map +1 -0
  9. package/dist/registry.js +57 -0
  10. package/dist/registry.js.map +1 -0
  11. package/dist/schemas/action.d.ts +378 -0
  12. package/dist/schemas/action.d.ts.map +1 -0
  13. package/dist/schemas/action.js +122 -0
  14. package/dist/schemas/action.js.map +1 -0
  15. package/dist/schemas/actor.d.ts +87 -0
  16. package/dist/schemas/actor.d.ts.map +1 -0
  17. package/dist/schemas/actor.js +48 -0
  18. package/dist/schemas/actor.js.map +1 -0
  19. package/dist/schemas/belief.d.ts +141 -0
  20. package/dist/schemas/belief.d.ts.map +1 -0
  21. package/dist/schemas/belief.js +107 -0
  22. package/dist/schemas/belief.js.map +1 -0
  23. package/dist/schemas/claim.d.ts +234 -0
  24. package/dist/schemas/claim.d.ts.map +1 -0
  25. package/dist/schemas/claim.js +88 -0
  26. package/dist/schemas/claim.js.map +1 -0
  27. package/dist/schemas/common.d.ts +73 -0
  28. package/dist/schemas/common.d.ts.map +1 -0
  29. package/dist/schemas/common.js +45 -0
  30. package/dist/schemas/common.js.map +1 -0
  31. package/dist/schemas/decision.d.ts +102 -0
  32. package/dist/schemas/decision.d.ts.map +1 -0
  33. package/dist/schemas/decision.js +37 -0
  34. package/dist/schemas/decision.js.map +1 -0
  35. package/dist/schemas/event.d.ts +171 -0
  36. package/dist/schemas/event.d.ts.map +1 -0
  37. package/dist/schemas/event.js +55 -0
  38. package/dist/schemas/event.js.map +1 -0
  39. package/dist/schemas/observation.d.ts +88 -0
  40. package/dist/schemas/observation.d.ts.map +1 -0
  41. package/dist/schemas/observation.js +39 -0
  42. package/dist/schemas/observation.js.map +1 -0
  43. package/dist/schemas/revision.d.ts +120 -0
  44. package/dist/schemas/revision.d.ts.map +1 -0
  45. package/dist/schemas/revision.js +72 -0
  46. package/dist/schemas/revision.js.map +1 -0
  47. package/package.json +54 -0
@@ -0,0 +1,120 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Update to a claim, belief, or decision when evidence shifts.
4
+ *
5
+ * Revisions are the eighth (and cyclic) link in the epistemic chain.
6
+ * They make beliefs defeasible: when new observations contradict an
7
+ * adopted belief, a Revision event records the change and points to
8
+ * the Explanation that justifies it.
9
+ */
10
+ export declare const RevisionSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ target_type: z.ZodEnum<["claim", "belief", "decision"]>;
13
+ target_id: z.ZodString;
14
+ changes: z.ZodArray<z.ZodObject<{
15
+ field: z.ZodString;
16
+ old_value: z.ZodUnknown;
17
+ new_value: z.ZodUnknown;
18
+ }, "strip", z.ZodTypeAny, {
19
+ field: string;
20
+ old_value?: unknown;
21
+ new_value?: unknown;
22
+ }, {
23
+ field: string;
24
+ old_value?: unknown;
25
+ new_value?: unknown;
26
+ }>, "many">;
27
+ triggered_by: z.ZodString;
28
+ rationale_id: z.ZodString;
29
+ at: z.ZodString;
30
+ }, "strip", z.ZodTypeAny, {
31
+ at: string;
32
+ id: string;
33
+ rationale_id: string;
34
+ target_type: "belief" | "claim" | "decision";
35
+ target_id: string;
36
+ changes: {
37
+ field: string;
38
+ old_value?: unknown;
39
+ new_value?: unknown;
40
+ }[];
41
+ triggered_by: string;
42
+ }, {
43
+ at: string;
44
+ id: string;
45
+ rationale_id: string;
46
+ target_type: "belief" | "claim" | "decision";
47
+ target_id: string;
48
+ changes: {
49
+ field: string;
50
+ old_value?: unknown;
51
+ new_value?: unknown;
52
+ }[];
53
+ triggered_by: string;
54
+ }>;
55
+ export type Revision = z.infer<typeof RevisionSchema>;
56
+ /**
57
+ * Subject types an Explanation can address.
58
+ *
59
+ * Every governance event in the system produces an Explanation.
60
+ * This is what makes the system auditable in a way that traces alone
61
+ * cannot match: traces show what happened, explanations show why.
62
+ */
63
+ export declare const ExplanationSubjectSchema: z.ZodEnum<["action_approval", "action_rejection", "memory_promotion", "memory_quarantine", "confidence_downweight", "decision_rationale", "claim_acceptance", "claim_rejection", "belief_revision"]>;
64
+ export type ExplanationSubject = z.infer<typeof ExplanationSubjectSchema>;
65
+ /**
66
+ * Audience an Explanation is generated for. Affects redaction:
67
+ * an Explanation targeting `human` redacts content above the
68
+ * recipient's sensitivity clearance.
69
+ */
70
+ export declare const ExplanationAudienceSchema: z.ZodEnum<["human", "agent", "audit", "research"]>;
71
+ export type ExplanationAudience = z.infer<typeof ExplanationAudienceSchema>;
72
+ /**
73
+ * Structured rationale for any governance event.
74
+ *
75
+ * An Explanation must reference its inputs (claims_used, evidence_used)
76
+ * so that a replay can verify the rationale was grounded in real data
77
+ * rather than post-hoc fabrication.
78
+ */
79
+ export declare const ExplanationSchema: z.ZodObject<{
80
+ id: z.ZodString;
81
+ subject_type: z.ZodEnum<["action_approval", "action_rejection", "memory_promotion", "memory_quarantine", "confidence_downweight", "decision_rationale", "claim_acceptance", "claim_rejection", "belief_revision"]>;
82
+ subject_id: z.ZodString;
83
+ audience: z.ZodEnum<["human", "agent", "audit", "research"]>;
84
+ summary: z.ZodString;
85
+ full_text: z.ZodString;
86
+ claims_used: z.ZodArray<z.ZodString, "many">;
87
+ evidence_used: z.ZodArray<z.ZodString, "many">;
88
+ uncertainties: z.ZodArray<z.ZodString, "many">;
89
+ counterarguments: z.ZodArray<z.ZodString, "many">;
90
+ generated_by: z.ZodString;
91
+ at: z.ZodString;
92
+ }, "strip", z.ZodTypeAny, {
93
+ at: string;
94
+ id: string;
95
+ subject_type: "action_approval" | "action_rejection" | "memory_promotion" | "memory_quarantine" | "confidence_downweight" | "decision_rationale" | "claim_acceptance" | "claim_rejection" | "belief_revision";
96
+ subject_id: string;
97
+ audience: "human" | "agent" | "audit" | "research";
98
+ summary: string;
99
+ full_text: string;
100
+ claims_used: string[];
101
+ evidence_used: string[];
102
+ uncertainties: string[];
103
+ counterarguments: string[];
104
+ generated_by: string;
105
+ }, {
106
+ at: string;
107
+ id: string;
108
+ subject_type: "action_approval" | "action_rejection" | "memory_promotion" | "memory_quarantine" | "confidence_downweight" | "decision_rationale" | "claim_acceptance" | "claim_rejection" | "belief_revision";
109
+ subject_id: string;
110
+ audience: "human" | "agent" | "audit" | "research";
111
+ summary: string;
112
+ full_text: string;
113
+ claims_used: string[];
114
+ evidence_used: string[];
115
+ uncertainties: string[];
116
+ counterarguments: string[];
117
+ generated_by: string;
118
+ }>;
119
+ export type Explanation = z.infer<typeof ExplanationSchema>;
120
+ //# sourceMappingURL=revision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revision.d.ts","sourceRoot":"","sources":["../../src/schemas/revision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYzB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAMrD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,sMAUnC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,oDAAkD,CAAA;AACxF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
@@ -0,0 +1,72 @@
1
+ import { z } from "zod";
2
+ import { TimestampSchema } from "./common";
3
+ /**
4
+ * Update to a claim, belief, or decision when evidence shifts.
5
+ *
6
+ * Revisions are the eighth (and cyclic) link in the epistemic chain.
7
+ * They make beliefs defeasible: when new observations contradict an
8
+ * adopted belief, a Revision event records the change and points to
9
+ * the Explanation that justifies it.
10
+ */
11
+ export const RevisionSchema = z.object({
12
+ id: z.string(),
13
+ target_type: z.enum(["claim", "belief", "decision"]),
14
+ target_id: z.string(),
15
+ changes: z.array(z.object({
16
+ field: z.string(),
17
+ old_value: z.unknown(),
18
+ new_value: z.unknown(),
19
+ })),
20
+ triggered_by: z.string().describe("actor_id or event_id"),
21
+ rationale_id: z.string().describe("Explanation id"),
22
+ at: TimestampSchema,
23
+ });
24
+ // -----------------------------------------------------------------------------
25
+ // Explanation
26
+ // -----------------------------------------------------------------------------
27
+ /**
28
+ * Subject types an Explanation can address.
29
+ *
30
+ * Every governance event in the system produces an Explanation.
31
+ * This is what makes the system auditable in a way that traces alone
32
+ * cannot match: traces show what happened, explanations show why.
33
+ */
34
+ export const ExplanationSubjectSchema = z.enum([
35
+ "action_approval",
36
+ "action_rejection",
37
+ "memory_promotion",
38
+ "memory_quarantine",
39
+ "confidence_downweight",
40
+ "decision_rationale",
41
+ "claim_acceptance",
42
+ "claim_rejection",
43
+ "belief_revision",
44
+ ]);
45
+ /**
46
+ * Audience an Explanation is generated for. Affects redaction:
47
+ * an Explanation targeting `human` redacts content above the
48
+ * recipient's sensitivity clearance.
49
+ */
50
+ export const ExplanationAudienceSchema = z.enum(["human", "agent", "audit", "research"]);
51
+ /**
52
+ * Structured rationale for any governance event.
53
+ *
54
+ * An Explanation must reference its inputs (claims_used, evidence_used)
55
+ * so that a replay can verify the rationale was grounded in real data
56
+ * rather than post-hoc fabrication.
57
+ */
58
+ export const ExplanationSchema = z.object({
59
+ id: z.string(),
60
+ subject_type: ExplanationSubjectSchema,
61
+ subject_id: z.string(),
62
+ audience: ExplanationAudienceSchema,
63
+ summary: z.string().describe("one-sentence summary"),
64
+ full_text: z.string().describe("multi-paragraph rationale"),
65
+ claims_used: z.array(z.string()).describe("claim_ids referenced"),
66
+ evidence_used: z.array(z.string()).describe("evidence_set_ids referenced"),
67
+ uncertainties: z.array(z.string()).describe("known unknowns acknowledged"),
68
+ counterarguments: z.array(z.string()).describe("opposing considerations"),
69
+ generated_by: z.string().describe("actor_id"),
70
+ at: TimestampSchema,
71
+ });
72
+ //# sourceMappingURL=revision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revision.js","sourceRoot":"","sources":["../../src/schemas/revision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACxB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;QACtB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;KACvB,CAAC,CAAC;IACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACzD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACnD,EAAE,EAAE,eAAe;CACpB,CAAC,CAAA;AAGF,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF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,CAAC;IAC7C,EAAE,EAAE,eAAe;CACpB,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@qmilab/lodestar-core",
3
+ "version": "0.1.0",
4
+ "description": "Schemas and types for the Lodestar epistemic chain. Part of Lodestar, the trust layer for AI agents.",
5
+ "license": "Apache-2.0",
6
+ "author": "QMI Lab <hello@qmilab.com>",
7
+ "homepage": "https://qmilab.com/lodestar",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/qmilab/lodestar.git",
11
+ "directory": "packages/core"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/qmilab/lodestar/issues"
15
+ },
16
+ "keywords": [
17
+ "ai-agents",
18
+ "trust",
19
+ "epistemic",
20
+ "audit",
21
+ "agent-governance",
22
+ "lodestar",
23
+ "schemas",
24
+ "types"
25
+ ],
26
+ "type": "module",
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md",
38
+ "LICENSE"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public",
42
+ "provenance": true
43
+ },
44
+ "scripts": {
45
+ "build": "tsc -p tsconfig.json",
46
+ "typecheck": "tsc --noEmit"
47
+ },
48
+ "dependencies": {
49
+ "zod": "^3.23.8"
50
+ },
51
+ "devDependencies": {
52
+ "typescript": "5.6.3"
53
+ }
54
+ }