@qmilab/lodestar-core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/schemas/action.js +1 -1
- package/dist/schemas/action.js.map +1 -1
- package/dist/schemas/actor.js +1 -1
- package/dist/schemas/actor.js.map +1 -1
- package/dist/schemas/belief.js +1 -1
- package/dist/schemas/belief.js.map +1 -1
- package/dist/schemas/claim.js +1 -1
- package/dist/schemas/claim.js.map +1 -1
- package/dist/schemas/decision.js +1 -1
- package/dist/schemas/decision.js.map +1 -1
- package/dist/schemas/event.js +2 -2
- package/dist/schemas/event.js.map +1 -1
- package/dist/schemas/observation.js +1 -1
- package/dist/schemas/observation.js.map +1 -1
- package/dist/schemas/revision.js +1 -1
- package/dist/schemas/revision.js.map +1 -1
- package/package.json +7 -4
- package/src/index.ts +32 -0
- package/src/registry.ts +68 -0
- package/src/schemas/action.ts +147 -0
- package/src/schemas/actor.ts +53 -0
- package/src/schemas/belief.ts +135 -0
- package/src/schemas/claim.ts +102 -0
- package/src/schemas/common.ts +56 -0
- package/src/schemas/decision.ts +40 -0
- package/src/schemas/event.ts +58 -0
- package/src/schemas/observation.ts +42 -0
- package/src/schemas/revision.ts +80 -0
package/dist/index.d.ts
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
* The governance surfaces (Memory Firewall, Policy Kernel, Action Kernel,
|
|
11
11
|
* Harness) consume and protect these primitives.
|
|
12
12
|
*/
|
|
13
|
-
export * from "./schemas/common";
|
|
14
|
-
export * from "./schemas/actor";
|
|
15
|
-
export * from "./schemas/observation";
|
|
16
|
-
export * from "./schemas/claim";
|
|
17
|
-
export * from "./schemas/belief";
|
|
18
|
-
export * from "./schemas/decision";
|
|
19
|
-
export * from "./schemas/action";
|
|
20
|
-
export * from "./schemas/revision";
|
|
21
|
-
export * from "./schemas/event";
|
|
22
|
-
export * as registry from "./registry";
|
|
13
|
+
export * from "./schemas/common.js";
|
|
14
|
+
export * from "./schemas/actor.js";
|
|
15
|
+
export * from "./schemas/observation.js";
|
|
16
|
+
export * from "./schemas/claim.js";
|
|
17
|
+
export * from "./schemas/belief.js";
|
|
18
|
+
export * from "./schemas/decision.js";
|
|
19
|
+
export * from "./schemas/action.js";
|
|
20
|
+
export * from "./schemas/revision.js";
|
|
21
|
+
export * from "./schemas/event.js";
|
|
22
|
+
export * as registry from "./registry.js";
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,qBAAqB,CAAA;AAGnC,cAAc,oBAAoB,CAAA;AAGlC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AAGrC,cAAc,oBAAoB,CAAA;AAGlC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
* Harness) consume and protect these primitives.
|
|
12
12
|
*/
|
|
13
13
|
// Common
|
|
14
|
-
export * from "./schemas/common";
|
|
14
|
+
export * from "./schemas/common.js";
|
|
15
15
|
// Identity
|
|
16
|
-
export * from "./schemas/actor";
|
|
16
|
+
export * from "./schemas/actor.js";
|
|
17
17
|
// Epistemic chain
|
|
18
|
-
export * from "./schemas/observation";
|
|
19
|
-
export * from "./schemas/claim";
|
|
20
|
-
export * from "./schemas/belief";
|
|
21
|
-
export * from "./schemas/decision";
|
|
22
|
-
export * from "./schemas/action";
|
|
23
|
-
export * from "./schemas/revision";
|
|
18
|
+
export * from "./schemas/observation.js";
|
|
19
|
+
export * from "./schemas/claim.js";
|
|
20
|
+
export * from "./schemas/belief.js";
|
|
21
|
+
export * from "./schemas/decision.js";
|
|
22
|
+
export * from "./schemas/action.js";
|
|
23
|
+
export * from "./schemas/revision.js";
|
|
24
24
|
// Event log envelope
|
|
25
|
-
export * from "./schemas/event";
|
|
25
|
+
export * from "./schemas/event.js";
|
|
26
26
|
// Schema registry
|
|
27
|
-
export * as registry from "./registry";
|
|
27
|
+
export * as registry from "./registry.js";
|
|
28
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,SAAS;AACT,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,SAAS;AACT,cAAc,qBAAqB,CAAA;AAEnC,WAAW;AACX,cAAc,oBAAoB,CAAA;AAElC,kBAAkB;AAClB,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AAErC,qBAAqB;AACrB,cAAc,oBAAoB,CAAA;AAElC,kBAAkB;AAClB,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA"}
|
package/dist/schemas/action.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,M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+1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ResourceScopeSchema, SensitivitySchema, TimestampSchema } from "./common";
|
|
2
|
+
import { ResourceScopeSchema, SensitivitySchema, TimestampSchema } from "./common.js";
|
|
3
3
|
/**
|
|
4
4
|
* Kinds of actor that can produce events in the system.
|
|
5
5
|
* Every Observation, Claim, Decision, Action, and Revision records its actor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../src/schemas/actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../src/schemas/actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAErF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;IACR,UAAU;CACX,CAAC,CAAA;AAGF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACjD,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IAC9F,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IACxF,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC9E,qBAAqB,EAAE,iBAAiB,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAC1F,UAAU,EAAE,eAAe;CAC5B,CAAC,CAAA;AAGF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACxD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IACjE,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC/B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IAChE,EAAE,EAAE,eAAe;CACpB,CAAC,CAAA"}
|
package/dist/schemas/belief.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { DurationSchema, ResourceScopeSchema, SensitivitySchema, TimestampSchema, } from "./common";
|
|
2
|
+
import { DurationSchema, ResourceScopeSchema, SensitivitySchema, TimestampSchema, } from "./common.js";
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
4
|
// Orthogonal lifecycle axes
|
|
5
5
|
//
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"belief.js","sourceRoot":"","sources":["../../src/schemas/belief.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,GAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"belief.js","sourceRoot":"","sources":["../../src/schemas/belief.ts"],"names":[],"mappings":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C,CAAC,OAAO,EAAE;CAC5C,CAAC,CAAA;AAGF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,sBAAsB,EAAE,CAAC,WAAW,CAAC;IACrC,0BAA0B,EAAE,CAAC,QAAQ,CAAC;IACtC,yBAAyB,EAAE,CAAC,OAAO,CAAC;IACpC,iBAAiB,EAAE,MAAM;IACzB,mBAAmB,EAAE,UAAU;IAC/B,sBAAsB,EAAE,IAAI;IAC5B,qBAAqB,EAAE,IAAI;IAC3B,8BAA8B,EAAE,IAAI;IACpC,4BAA4B,EAAE,IAAI;IAClC,8BAA8B,EAAE,IAAI;CACrC,CAAA"}
|
package/dist/schemas/claim.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { PredicateSchema, ResourceScopeSchema, SensitivitySchema, TimestampSchema } from "./common";
|
|
2
|
+
import { PredicateSchema, ResourceScopeSchema, SensitivitySchema, TimestampSchema } from "./common.js";
|
|
3
3
|
/**
|
|
4
4
|
* How a claim was extracted from observation(s).
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/schemas/claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/schemas/claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEtG;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,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AAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC9E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC9E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;IACxC,OAAO,EAAE,eAAe;CACzB,CAAC,CAAA"}
|
package/dist/schemas/event.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { SignatureSchema } from "./actor";
|
|
3
|
-
import { TimestampSchema } from "./common";
|
|
2
|
+
import { SignatureSchema } from "./actor.js";
|
|
3
|
+
import { TimestampSchema } from "./common.js";
|
|
4
4
|
/**
|
|
5
5
|
* Version metadata attached to every event.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../src/schemas/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../src/schemas/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IAC/D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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as/observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"observation.js","sourceRoot":"","sources":["../../src/schemas/observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAA;AAG/E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAChE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,WAAW,EAAE,eAAe;KAC7B,CAAC;IACF,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;KACrB,CAAC;IACF,KAAK,EAAE,sBAAsB;IAC7B,WAAW,EAAE,iBAAiB;CAC/B,CAAC,CAAA"}
|
package/dist/schemas/revision.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revision.js","sourceRoot":"","sources":["../../src/schemas/revision.ts"],"names":[],"mappings":"A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AAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAA;AAGxF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,YAAY,EAAE,wBAAwB;IACtC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,QAAQ,EAAE,yBAAyB;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACpD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC3D,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACjE,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC1E,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC1E,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACzE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;IAC7C,EAAE,EAAE,eAAe;CACpB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qmilab/lodestar-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Schemas and types for the Lodestar epistemic chain. Part of Lodestar, the trust layer for AI agents.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "QMI Lab <hello@qmilab.com>",
|
|
@@ -28,12 +28,15 @@
|
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
+
"bun": "./src/index.ts",
|
|
31
32
|
"types": "./dist/index.d.ts",
|
|
32
|
-
"import": "./dist/index.js"
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"default": "./dist/index.js"
|
|
33
35
|
}
|
|
34
36
|
},
|
|
35
37
|
"files": [
|
|
36
38
|
"dist",
|
|
39
|
+
"src",
|
|
37
40
|
"README.md",
|
|
38
41
|
"LICENSE"
|
|
39
42
|
],
|
|
@@ -42,8 +45,8 @@
|
|
|
42
45
|
"provenance": true
|
|
43
46
|
},
|
|
44
47
|
"scripts": {
|
|
45
|
-
"build": "tsc -
|
|
46
|
-
"typecheck": "tsc
|
|
48
|
+
"build": "tsc -b",
|
|
49
|
+
"typecheck": "tsc -b"
|
|
47
50
|
},
|
|
48
51
|
"dependencies": {
|
|
49
52
|
"zod": "^3.23.8"
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @qmilab/lodestar-core
|
|
3
|
+
*
|
|
4
|
+
* Epistemic chain primitives and schemas. Everything else in Lodestar
|
|
5
|
+
* depends on this package.
|
|
6
|
+
*
|
|
7
|
+
* The chain:
|
|
8
|
+
* Observation → Claim → EvidenceSet → Belief → Decision → Action → Outcome → Revision
|
|
9
|
+
*
|
|
10
|
+
* The governance surfaces (Memory Firewall, Policy Kernel, Action Kernel,
|
|
11
|
+
* Harness) consume and protect these primitives.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// Common
|
|
15
|
+
export * from "./schemas/common.js"
|
|
16
|
+
|
|
17
|
+
// Identity
|
|
18
|
+
export * from "./schemas/actor.js"
|
|
19
|
+
|
|
20
|
+
// Epistemic chain
|
|
21
|
+
export * from "./schemas/observation.js"
|
|
22
|
+
export * from "./schemas/claim.js"
|
|
23
|
+
export * from "./schemas/belief.js"
|
|
24
|
+
export * from "./schemas/decision.js"
|
|
25
|
+
export * from "./schemas/action.js"
|
|
26
|
+
export * from "./schemas/revision.js"
|
|
27
|
+
|
|
28
|
+
// Event log envelope
|
|
29
|
+
export * from "./schemas/event.js"
|
|
30
|
+
|
|
31
|
+
// Schema registry
|
|
32
|
+
export * as registry from "./registry.js"
|
package/src/registry.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { z } from "zod"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Registry of observation schemas.
|
|
5
|
+
*
|
|
6
|
+
* Every tool that emits observations registers its output schema here.
|
|
7
|
+
* The Action Kernel validates tool outputs against the registry before
|
|
8
|
+
* they become `validated` observations and enter the cognitive core.
|
|
9
|
+
*
|
|
10
|
+
* Schema keys follow the pattern `<namespace>.<name>@<version>`,
|
|
11
|
+
* e.g. `git.status@1`, `github.pr@2`.
|
|
12
|
+
*
|
|
13
|
+
* Schemas may not be replaced after registration; bump the version
|
|
14
|
+
* suffix and register the new schema alongside the old one. This
|
|
15
|
+
* preserves replay compatibility for events that referenced the old key.
|
|
16
|
+
*/
|
|
17
|
+
const registry = new Map<string, z.ZodTypeAny>()
|
|
18
|
+
|
|
19
|
+
export function register(key: string, schema: z.ZodTypeAny): void {
|
|
20
|
+
if (registry.has(key)) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`schema registry: key '${key}' is already registered; bump the version and register a new key`,
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
// Validate key shape
|
|
26
|
+
if (!/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*@\d+$/.test(key)) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
`schema registry: key '${key}' must match <namespace>.<name>@<version>, e.g. 'git.status@1'`,
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
registry.set(key, schema)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function lookup(key: string): z.ZodTypeAny | undefined {
|
|
35
|
+
return registry.get(key)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function has(key: string): boolean {
|
|
39
|
+
return registry.has(key)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function keys(): string[] {
|
|
43
|
+
return Array.from(registry.keys()).sort()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* For replay safety: returns a content hash of the registry state.
|
|
48
|
+
* Replays can compare this against the value stored in EventVersions.
|
|
49
|
+
*
|
|
50
|
+
* Uses Node's built-in crypto so the registry can be used in Bun and
|
|
51
|
+
* Node alike. Bun's web-standard crypto is also available, but Node's
|
|
52
|
+
* createHash is the most portable.
|
|
53
|
+
*/
|
|
54
|
+
export function fingerprint(): string {
|
|
55
|
+
const sorted = keys().join(",")
|
|
56
|
+
// sha-256 hex digest of the sorted keys
|
|
57
|
+
// node:crypto is available in both Bun and Node
|
|
58
|
+
const crypto = require("node:crypto") as typeof import("node:crypto")
|
|
59
|
+
return crypto.createHash("sha256").update(sorted).digest("hex")
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* For tests only. Resets the registry between test cases.
|
|
64
|
+
* Do NOT call this from production code.
|
|
65
|
+
*/
|
|
66
|
+
export function _resetForTests(): void {
|
|
67
|
+
registry.clear()
|
|
68
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { ResourceScopeSchema, TimestampSchema } from "./common.js"
|
|
3
|
+
|
|
4
|
+
// -----------------------------------------------------------------------------
|
|
5
|
+
// Trust ladder
|
|
6
|
+
//
|
|
7
|
+
// L0: observe only — read state; never write or execute
|
|
8
|
+
// L1: suggest only — produce proposals; nothing reaches the world
|
|
9
|
+
// L2: isolated artifact — generate in tempfs; no effect on project state
|
|
10
|
+
// L3: local reversible — modify project state with notification
|
|
11
|
+
// L4: external/shared — requires approval (network, credentials, deploy, push)
|
|
12
|
+
// L5: prohibited — cannot run in this context, ever
|
|
13
|
+
// -----------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
export const TrustLevelSchema = z.number().int().min(0).max(5)
|
|
16
|
+
export type TrustLevel = z.infer<typeof TrustLevelSchema>
|
|
17
|
+
|
|
18
|
+
export const BlastRadiusSchema = z.enum(["self", "session", "project", "external"])
|
|
19
|
+
export type BlastRadius = z.infer<typeof BlastRadiusSchema>
|
|
20
|
+
|
|
21
|
+
export const ReversibilitySchema = z.enum(["reversible", "compensable", "irreversible"])
|
|
22
|
+
export type Reversibility = z.infer<typeof ReversibilitySchema>
|
|
23
|
+
|
|
24
|
+
export const DataSensitivityForActionSchema = z.enum(["public", "private", "secret"])
|
|
25
|
+
export type DataSensitivityForAction = z.infer<typeof DataSensitivityForActionSchema>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A precondition that must hold for an action to execute safely.
|
|
29
|
+
*
|
|
30
|
+
* Two-phase execution: preconditions are recorded at proposal time
|
|
31
|
+
* (`expected_at_approval`) and re-checked at execution time
|
|
32
|
+
* (`must_revalidate_at_execution`). If the world has changed between
|
|
33
|
+
* approval and execution, the kernel re-arbitrates or rejects.
|
|
34
|
+
*
|
|
35
|
+
* This closes the TOCTOU gap that pure approval-then-execute leaves open.
|
|
36
|
+
*/
|
|
37
|
+
export const ActionPreconditionSchema = z.object({
|
|
38
|
+
check_id: z.string().describe("e.g. 'git.head_unchanged'"),
|
|
39
|
+
parameters: z.unknown(),
|
|
40
|
+
expected_at_approval: z.unknown(),
|
|
41
|
+
must_revalidate_at_execution: z.boolean(),
|
|
42
|
+
})
|
|
43
|
+
export type ActionPrecondition = z.infer<typeof ActionPreconditionSchema>
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The contract that gates an action through the policy kernel.
|
|
47
|
+
*
|
|
48
|
+
* In v0, anything with network effect, credential use, publication,
|
|
49
|
+
* deploy, push, PR creation, or signing defaults to L4.
|
|
50
|
+
*/
|
|
51
|
+
export const ActionContractSchema = z.object({
|
|
52
|
+
required_level: TrustLevelSchema,
|
|
53
|
+
blast_radius: BlastRadiusSchema,
|
|
54
|
+
reversibility: ReversibilitySchema,
|
|
55
|
+
scope: ResourceScopeSchema,
|
|
56
|
+
data_sensitivity: DataSensitivityForActionSchema,
|
|
57
|
+
preconditions: z.array(ActionPreconditionSchema),
|
|
58
|
+
})
|
|
59
|
+
export type ActionContract = z.infer<typeof ActionContractSchema>
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Phases an action passes through.
|
|
63
|
+
*/
|
|
64
|
+
export const ActionPhaseSchema = z.enum([
|
|
65
|
+
"proposed",
|
|
66
|
+
"arbitrating",
|
|
67
|
+
"approved",
|
|
68
|
+
"rejected",
|
|
69
|
+
"executing",
|
|
70
|
+
"completed",
|
|
71
|
+
"failed",
|
|
72
|
+
"halted",
|
|
73
|
+
])
|
|
74
|
+
export type ActionPhase = z.infer<typeof ActionPhaseSchema>
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Approval event from a human or policy reviewer.
|
|
78
|
+
*/
|
|
79
|
+
export const ApprovalEventSchema = z.object({
|
|
80
|
+
approver_id: z.string().describe("actor_id"),
|
|
81
|
+
approved: z.boolean(),
|
|
82
|
+
reason: z.string().optional(),
|
|
83
|
+
at: TimestampSchema,
|
|
84
|
+
})
|
|
85
|
+
export type ApprovalEvent = z.infer<typeof ApprovalEventSchema>
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Audit trail entry for an action.
|
|
89
|
+
*/
|
|
90
|
+
export const AuditEventSchema = z.object({
|
|
91
|
+
phase: ActionPhaseSchema,
|
|
92
|
+
by_actor_id: z.string(),
|
|
93
|
+
at: TimestampSchema,
|
|
94
|
+
detail: z.string().optional(),
|
|
95
|
+
})
|
|
96
|
+
export type AuditEvent = z.infer<typeof AuditEventSchema>
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A proposed or executed side-effectful operation.
|
|
100
|
+
*
|
|
101
|
+
* Actions are the seventh link in the epistemic chain.
|
|
102
|
+
* The phase field tracks the action through propose → arbitrate
|
|
103
|
+
* → approved/rejected → executing → completed/failed/halted.
|
|
104
|
+
*
|
|
105
|
+
* Every Action carries an ActionContract. The Policy Kernel evaluates
|
|
106
|
+
* the contract against current trust assignments and approval requirements
|
|
107
|
+
* before phase advances past `arbitrating`.
|
|
108
|
+
*/
|
|
109
|
+
export const ActionSchema = z.object({
|
|
110
|
+
id: z.string(),
|
|
111
|
+
decision_id: z.string().optional().describe("optional link to the deciding context"),
|
|
112
|
+
intent: z.string(),
|
|
113
|
+
tool: z.string().describe("tool registry key, e.g. 'git.push'"),
|
|
114
|
+
inputs: z.unknown().describe("validated against the tool's input schema"),
|
|
115
|
+
contract: ActionContractSchema,
|
|
116
|
+
phase: ActionPhaseSchema,
|
|
117
|
+
approval: ApprovalEventSchema.optional(),
|
|
118
|
+
audit: z.array(AuditEventSchema),
|
|
119
|
+
outcome_id: z.string().optional(),
|
|
120
|
+
proposed_at: TimestampSchema,
|
|
121
|
+
proposed_by: z.string().describe("actor_id"),
|
|
122
|
+
})
|
|
123
|
+
export type Action = z.infer<typeof ActionSchema>
|
|
124
|
+
|
|
125
|
+
// -----------------------------------------------------------------------------
|
|
126
|
+
// Outcome
|
|
127
|
+
// -----------------------------------------------------------------------------
|
|
128
|
+
|
|
129
|
+
export const OutcomeResultSchema = z.enum(["success", "failure", "partial", "unknown"])
|
|
130
|
+
export type OutcomeResult = z.infer<typeof OutcomeResultSchema>
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* What happened when an action executed.
|
|
134
|
+
*
|
|
135
|
+
* Outcomes generate new observations that re-enter the cognitive core.
|
|
136
|
+
* Calibrators consume outcomes to update per-class confidence calibration.
|
|
137
|
+
*/
|
|
138
|
+
export const OutcomeSchema = z.object({
|
|
139
|
+
id: z.string(),
|
|
140
|
+
action_id: z.string(),
|
|
141
|
+
result: OutcomeResultSchema,
|
|
142
|
+
effect_observation_ids: z.array(z.string()).describe("observations capturing the effect"),
|
|
143
|
+
side_effects_observed: z.array(z.string()),
|
|
144
|
+
duration_ms: z.number().int().nonnegative(),
|
|
145
|
+
observed_at: TimestampSchema,
|
|
146
|
+
})
|
|
147
|
+
export type Outcome = z.infer<typeof OutcomeSchema>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { ResourceScopeSchema, SensitivitySchema, TimestampSchema } from "./common.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Kinds of actor that can produce events in the system.
|
|
6
|
+
* Every Observation, Claim, Decision, Action, and Revision records its actor.
|
|
7
|
+
*/
|
|
8
|
+
export const ActorKindSchema = z.enum([
|
|
9
|
+
"human",
|
|
10
|
+
"agent",
|
|
11
|
+
"tool",
|
|
12
|
+
"probe",
|
|
13
|
+
"sentinel",
|
|
14
|
+
"system",
|
|
15
|
+
"imported",
|
|
16
|
+
])
|
|
17
|
+
export type ActorKind = z.infer<typeof ActorKindSchema>
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Identity record for any entity that can act in the system.
|
|
21
|
+
*
|
|
22
|
+
* Sensitivity clearance bounds what content the actor may handle.
|
|
23
|
+
* Trust baseline is the default credibility weight for assertions
|
|
24
|
+
* by this actor; the Calibrator can adjust per-class trust over time.
|
|
25
|
+
*/
|
|
26
|
+
export const ActorSchema = z.object({
|
|
27
|
+
id: z.string().describe("uuid-shaped identifier"),
|
|
28
|
+
kind: ActorKindSchema,
|
|
29
|
+
display_name: z.string(),
|
|
30
|
+
authority_scope: z.array(ResourceScopeSchema).describe("scopes this actor may operate within"),
|
|
31
|
+
signing_key_id: z.string().optional().describe("present for actors that sign artifacts"),
|
|
32
|
+
trust_baseline: z.number().min(0).max(1).describe("default credibility [0,1]"),
|
|
33
|
+
sensitivity_clearance: SensitivitySchema.describe("max sensitivity this actor may handle"),
|
|
34
|
+
created_at: TimestampSchema,
|
|
35
|
+
})
|
|
36
|
+
export type Actor = z.infer<typeof ActorSchema>
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Ed25519 signature over a canonical payload.
|
|
40
|
+
*
|
|
41
|
+
* v0 scope: signatures are required for skills, policy versions,
|
|
42
|
+
* external imports, and secret-signing events. Routine internal
|
|
43
|
+
* events rely on the append-only log and content hashes, not
|
|
44
|
+
* cryptographic signatures.
|
|
45
|
+
*/
|
|
46
|
+
export const SignatureSchema = z.object({
|
|
47
|
+
signer_id: z.string().describe("actor_id of the signer"),
|
|
48
|
+
payload_hash: z.string().describe("sha-256 of canonical payload"),
|
|
49
|
+
algorithm: z.literal("ed25519"),
|
|
50
|
+
signature: z.string().describe("base64-encoded signature bytes"),
|
|
51
|
+
at: TimestampSchema,
|
|
52
|
+
})
|
|
53
|
+
export type Signature = z.infer<typeof SignatureSchema>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import {
|
|
3
|
+
DurationSchema,
|
|
4
|
+
ResourceScopeSchema,
|
|
5
|
+
SensitivitySchema,
|
|
6
|
+
TimestampSchema,
|
|
7
|
+
} from "./common.js"
|
|
8
|
+
|
|
9
|
+
// -----------------------------------------------------------------------------
|
|
10
|
+
// Orthogonal lifecycle axes
|
|
11
|
+
//
|
|
12
|
+
// A belief's state is described by four independent dimensions. Collapsing
|
|
13
|
+
// them into a single enum is the wrong abstraction: a belief can be
|
|
14
|
+
// "supported but stale", "supported but quarantined", "contradicted but
|
|
15
|
+
// fresh", and so on. The axes are independently updated and independently
|
|
16
|
+
// gate retrieval.
|
|
17
|
+
// -----------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
export const TruthStatusSchema = z.enum(["unverified", "supported", "contradicted", "superseded"])
|
|
20
|
+
export type TruthStatus = z.infer<typeof TruthStatusSchema>
|
|
21
|
+
|
|
22
|
+
export const RetrievalStatusSchema = z.enum(["hidden", "restricted", "normal", "privileged_only", "blocked"])
|
|
23
|
+
export type RetrievalStatus = z.infer<typeof RetrievalStatusSchema>
|
|
24
|
+
|
|
25
|
+
export const SecurityStatusSchema = z.enum(["clean", "suspicious", "quarantined", "malicious"])
|
|
26
|
+
export type SecurityStatus = z.infer<typeof SecurityStatusSchema>
|
|
27
|
+
|
|
28
|
+
export const FreshnessStatusSchema = z.enum(["fresh", "stale", "expired"])
|
|
29
|
+
export type FreshnessStatus = z.infer<typeof FreshnessStatusSchema>
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* How a belief came to be adopted.
|
|
33
|
+
*
|
|
34
|
+
* - observed: derived from tool observations
|
|
35
|
+
* - inferred: derived by an LLM from other context
|
|
36
|
+
* - user_asserted: user said so directly
|
|
37
|
+
* - policy_asserted: policy configuration (e.g. "do not push to main")
|
|
38
|
+
* - imported: from an external knowledge import
|
|
39
|
+
* - synthetic: from a probe; never affects real reasoning
|
|
40
|
+
*
|
|
41
|
+
* user_asserted and policy_asserted beliefs do NOT decay like
|
|
42
|
+
* observations. They expire only via explicit revision.
|
|
43
|
+
*/
|
|
44
|
+
export const BeliefAuthoritySchema = z.enum([
|
|
45
|
+
"observed",
|
|
46
|
+
"inferred",
|
|
47
|
+
"user_asserted",
|
|
48
|
+
"policy_asserted",
|
|
49
|
+
"imported",
|
|
50
|
+
"synthetic",
|
|
51
|
+
])
|
|
52
|
+
export type BeliefAuthority = z.infer<typeof BeliefAuthoritySchema>
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A claim the system has provisionally adopted.
|
|
56
|
+
*
|
|
57
|
+
* Every belief points to a claim (`claim_id`). The belief carries
|
|
58
|
+
* lifecycle state, confidence, calibration class, scope, sensitivity,
|
|
59
|
+
* and authority. The claim carries the statement itself.
|
|
60
|
+
*
|
|
61
|
+
* Confidence is the agent's stated confidence. The Calibrator measures
|
|
62
|
+
* empirical accuracy per calibration_class and can require the Policy
|
|
63
|
+
* Kernel to downweight confidence in classes where the agent is
|
|
64
|
+
* historically overconfident.
|
|
65
|
+
*/
|
|
66
|
+
export const BeliefSchema = z.object({
|
|
67
|
+
id: z.string(),
|
|
68
|
+
claim_id: z.string(),
|
|
69
|
+
|
|
70
|
+
confidence: z.number().min(0).max(1),
|
|
71
|
+
calibration_class: z.string().describe("groups similar beliefs for calibrator"),
|
|
72
|
+
scope: ResourceScopeSchema,
|
|
73
|
+
sensitivity: SensitivitySchema,
|
|
74
|
+
authority: BeliefAuthoritySchema,
|
|
75
|
+
|
|
76
|
+
// Orthogonal lifecycle axes
|
|
77
|
+
truth_status: TruthStatusSchema,
|
|
78
|
+
retrieval_status: RetrievalStatusSchema,
|
|
79
|
+
security_status: SecurityStatusSchema,
|
|
80
|
+
freshness_status: FreshnessStatusSchema,
|
|
81
|
+
|
|
82
|
+
observed_at: TimestampSchema,
|
|
83
|
+
last_verified_at: TimestampSchema.optional(),
|
|
84
|
+
expires_at: TimestampSchema.optional(),
|
|
85
|
+
superseded_by: z.string().optional().describe("belief_id of successor"),
|
|
86
|
+
})
|
|
87
|
+
export type Belief = z.infer<typeof BeliefSchema>
|
|
88
|
+
|
|
89
|
+
// -----------------------------------------------------------------------------
|
|
90
|
+
// ContextPolicy
|
|
91
|
+
//
|
|
92
|
+
// What the cognitive core may load into model context. Without an explicit
|
|
93
|
+
// policy, "the planner used a stale belief" or "the explanation leaked a
|
|
94
|
+
// secret claim" become invisible bugs. With it, those become testable
|
|
95
|
+
// invariants.
|
|
96
|
+
// -----------------------------------------------------------------------------
|
|
97
|
+
|
|
98
|
+
export const ContextPolicySchema = z.object({
|
|
99
|
+
// Which lifecycle states may be loaded
|
|
100
|
+
allowed_truth_statuses: z.array(TruthStatusSchema),
|
|
101
|
+
allowed_retrieval_statuses: z.array(RetrievalStatusSchema),
|
|
102
|
+
allowed_security_statuses: z.array(SecurityStatusSchema),
|
|
103
|
+
|
|
104
|
+
// Freshness gate
|
|
105
|
+
freshness_max_age: DurationSchema.optional(),
|
|
106
|
+
|
|
107
|
+
// Sensitivity ceiling for what can enter context
|
|
108
|
+
sensitivity_ceiling: SensitivitySchema,
|
|
109
|
+
|
|
110
|
+
// What the planner sees
|
|
111
|
+
include_contradictions: z.boolean(),
|
|
112
|
+
include_uncertainties: z.boolean(),
|
|
113
|
+
require_evidence_for_decisions: z.boolean(),
|
|
114
|
+
|
|
115
|
+
// Authority handling
|
|
116
|
+
user_asserted_takes_priority: z.boolean(),
|
|
117
|
+
policy_asserted_takes_priority: z.boolean(),
|
|
118
|
+
})
|
|
119
|
+
export type ContextPolicy = z.infer<typeof ContextPolicySchema>
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Conservative v0 default. Tightens up as the system proves itself.
|
|
123
|
+
*/
|
|
124
|
+
export const DEFAULT_CONTEXT_POLICY: ContextPolicy = {
|
|
125
|
+
allowed_truth_statuses: ["supported"],
|
|
126
|
+
allowed_retrieval_statuses: ["normal"],
|
|
127
|
+
allowed_security_statuses: ["clean"],
|
|
128
|
+
freshness_max_age: "P30D",
|
|
129
|
+
sensitivity_ceiling: "internal",
|
|
130
|
+
include_contradictions: true,
|
|
131
|
+
include_uncertainties: true,
|
|
132
|
+
require_evidence_for_decisions: true,
|
|
133
|
+
user_asserted_takes_priority: true,
|
|
134
|
+
policy_asserted_takes_priority: true,
|
|
135
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { PredicateSchema, ResourceScopeSchema, SensitivitySchema, TimestampSchema } from "./common.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How a claim was extracted from observation(s).
|
|
6
|
+
*/
|
|
7
|
+
export const ExtractionMethodSchema = z.enum(["tool", "llm", "human", "import"])
|
|
8
|
+
export type ExtractionMethod = z.infer<typeof ExtractionMethodSchema>
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Lifecycle of a claim before it becomes a belief.
|
|
12
|
+
*/
|
|
13
|
+
export const ClaimStatusSchema = z.enum(["extracted", "contested", "accepted", "rejected"])
|
|
14
|
+
export type ClaimStatus = z.infer<typeof ClaimStatusSchema>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Dissent recorded against a claim. Reserved for multi-agent futures;
|
|
18
|
+
* v0 captures it but the resolution algorithm is deferred.
|
|
19
|
+
*/
|
|
20
|
+
export const DissentSchema = z.object({
|
|
21
|
+
by_actor_id: z.string(),
|
|
22
|
+
reason: z.string(),
|
|
23
|
+
at: TimestampSchema,
|
|
24
|
+
})
|
|
25
|
+
export type Dissent = z.infer<typeof DissentSchema>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A statement extracted from one or more observations.
|
|
29
|
+
*
|
|
30
|
+
* Claims are the second link in the epistemic chain. Every claim
|
|
31
|
+
* records its extraction method and the actor that extracted it,
|
|
32
|
+
* so the source of an eventual belief can always be traced back to
|
|
33
|
+
* the original observation(s).
|
|
34
|
+
*/
|
|
35
|
+
export const ClaimSchema = z.object({
|
|
36
|
+
id: z.string(),
|
|
37
|
+
statement: z.string().describe("human-readable claim"),
|
|
38
|
+
structured_predicate: PredicateSchema.optional().describe("for queryable claims"),
|
|
39
|
+
source_observation_ids: z.array(z.string()).min(1, "a claim must reference at least one observation"),
|
|
40
|
+
extraction_method: ExtractionMethodSchema,
|
|
41
|
+
extracted_by: z.string().describe("actor_id of the extractor"),
|
|
42
|
+
status: ClaimStatusSchema,
|
|
43
|
+
scope: ResourceScopeSchema,
|
|
44
|
+
sensitivity: SensitivitySchema,
|
|
45
|
+
authors: z.array(z.string()).describe("actor_ids; usually one in v0, multi for v1.5+"),
|
|
46
|
+
dissent: z.array(DissentSchema).optional(),
|
|
47
|
+
created_at: TimestampSchema,
|
|
48
|
+
})
|
|
49
|
+
export type Claim = z.infer<typeof ClaimSchema>
|
|
50
|
+
|
|
51
|
+
// -----------------------------------------------------------------------------
|
|
52
|
+
// Evidence
|
|
53
|
+
// -----------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Quality of a single piece of evidence.
|
|
57
|
+
*
|
|
58
|
+
* v0 uses a categorical taxonomy. A scalar evidence strength is
|
|
59
|
+
* deferred to later versions once enough data exists to calibrate
|
|
60
|
+
* a scoring function.
|
|
61
|
+
*/
|
|
62
|
+
export const EvidenceQualitySchema = z.enum([
|
|
63
|
+
"direct_observation", // tool output describing world state
|
|
64
|
+
"tool_result", // computed result from a tool
|
|
65
|
+
"human_assertion", // user said so
|
|
66
|
+
"model_inference", // an LLM concluded so from other context
|
|
67
|
+
"external_document", // file, webpage, email — high risk for poisoning
|
|
68
|
+
"synthetic_probe", // from a Harness probe; never affects real beliefs
|
|
69
|
+
])
|
|
70
|
+
export type EvidenceQuality = z.infer<typeof EvidenceQualitySchema>
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* One piece of evidence for or against a claim.
|
|
74
|
+
*
|
|
75
|
+
* `independence_group` is used by aggregators: items in the same group
|
|
76
|
+
* are NOT independent. This matters because three citations to the same
|
|
77
|
+
* source are not three independent supporting items.
|
|
78
|
+
*/
|
|
79
|
+
export const EvidenceItemSchema = z.object({
|
|
80
|
+
source_id: z.string().describe("observation_id, belief_id, or external ref"),
|
|
81
|
+
relation: z.enum(["supports", "contradicts", "contextualizes"]),
|
|
82
|
+
quality: EvidenceQualitySchema,
|
|
83
|
+
independence_group: z.string().optional(),
|
|
84
|
+
freshness: z.enum(["fresh", "stale", "unknown"]),
|
|
85
|
+
notes: z.string().optional(),
|
|
86
|
+
})
|
|
87
|
+
export type EvidenceItem = z.infer<typeof EvidenceItemSchema>
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Set of evidence assessed against a claim.
|
|
91
|
+
*
|
|
92
|
+
* No scalar `strength` field in v0. Strength is computed lazily by
|
|
93
|
+
* an aggregator that may evolve as data accumulates.
|
|
94
|
+
*/
|
|
95
|
+
export const EvidenceSetSchema = z.object({
|
|
96
|
+
id: z.string(),
|
|
97
|
+
claim_id: z.string(),
|
|
98
|
+
items: z.array(EvidenceItemSchema),
|
|
99
|
+
assessed_by: z.string().describe("actor_id of the assessor"),
|
|
100
|
+
assessed_at: TimestampSchema,
|
|
101
|
+
})
|
|
102
|
+
export type EvidenceSet = z.infer<typeof EvidenceSetSchema>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sensitivity of content. Affects retrieval, explanation generation,
|
|
5
|
+
* OTel export, and final reports.
|
|
6
|
+
*
|
|
7
|
+
* Sensitivity is a content attribute. It is NOT a lifecycle axis —
|
|
8
|
+
* truth/retrieval/security/freshness describe the *state* of a belief,
|
|
9
|
+
* sensitivity describes its *content*.
|
|
10
|
+
*/
|
|
11
|
+
export const SensitivitySchema = z.enum(["public", "internal", "confidential", "secret"])
|
|
12
|
+
export type Sensitivity = z.infer<typeof SensitivitySchema>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Scope a claim, belief, memory, or action applies to. Hierarchical
|
|
16
|
+
* from broadest (global) to narrowest (session).
|
|
17
|
+
*/
|
|
18
|
+
export const ResourceScopeSchema = z.object({
|
|
19
|
+
level: z.enum(["global", "organization", "user", "project", "repo", "session"]),
|
|
20
|
+
identifier: z.string().describe("identifier within the scope level, e.g. project_id"),
|
|
21
|
+
}).describe("Scope that bounds where a claim, belief, or memory applies")
|
|
22
|
+
export type ResourceScope = z.infer<typeof ResourceScopeSchema>
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Structured predicate for queryable claims and beliefs.
|
|
26
|
+
* Free-form for v0; refined in later versions as the planner matures.
|
|
27
|
+
*/
|
|
28
|
+
export const PredicateSchema = z.object({
|
|
29
|
+
subject: z.string(),
|
|
30
|
+
relation: z.string(),
|
|
31
|
+
object: z.unknown(),
|
|
32
|
+
}).describe("Structured form of a claim suitable for queries")
|
|
33
|
+
export type Predicate = z.infer<typeof PredicateSchema>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* ISO 8601 timestamp string.
|
|
37
|
+
*/
|
|
38
|
+
export const TimestampSchema = z.string().datetime({ offset: true })
|
|
39
|
+
export type Timestamp = z.infer<typeof TimestampSchema>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* ISO 8601 duration string (e.g. "P30D", "PT1H").
|
|
43
|
+
*/
|
|
44
|
+
export const DurationSchema = z.string().regex(/^P(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?)?$/)
|
|
45
|
+
export type Duration = z.infer<typeof DurationSchema>
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Generic Source reference used in evidence and explanations.
|
|
49
|
+
* Points to an observation, belief, or external identifier.
|
|
50
|
+
*/
|
|
51
|
+
export const SourceSchema = z.object({
|
|
52
|
+
type: z.enum(["observation", "belief", "claim", "memory", "skill", "external"]),
|
|
53
|
+
id: z.string(),
|
|
54
|
+
uri: z.string().optional().describe("optional external URI, for type=external"),
|
|
55
|
+
})
|
|
56
|
+
export type Source = z.infer<typeof SourceSchema>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { TimestampSchema } from "./common.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One option in a decision.
|
|
6
|
+
*/
|
|
7
|
+
export const DecisionOptionSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
description: z.string(),
|
|
10
|
+
expected_outcome: z.string().optional(),
|
|
11
|
+
estimated_cost: z.string().optional().describe("free-form for v0; e.g. 'low', 'medium', 'high'"),
|
|
12
|
+
estimated_risk: z.string().optional(),
|
|
13
|
+
})
|
|
14
|
+
export type DecisionOption = z.infer<typeof DecisionOptionSchema>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A choice among options, justified by beliefs.
|
|
18
|
+
*
|
|
19
|
+
* Decisions sit between Belief and Action in the epistemic chain.
|
|
20
|
+
* Every Decision records its belief_dependencies — the policy can
|
|
21
|
+
* reject Decisions that lack supporting beliefs (governed by
|
|
22
|
+
* ContextPolicy.require_evidence_for_decisions).
|
|
23
|
+
*
|
|
24
|
+
* The rationale_id points to an Explanation generated alongside
|
|
25
|
+
* the decision. This is how the system stays auditable: every
|
|
26
|
+
* decision has a stored reasoning trail, not just a regenerable one.
|
|
27
|
+
*/
|
|
28
|
+
export const DecisionSchema = z.object({
|
|
29
|
+
id: z.string(),
|
|
30
|
+
question: z.string().describe("human-readable question this decision answers"),
|
|
31
|
+
options: z.array(DecisionOptionSchema).min(1),
|
|
32
|
+
selected_option_id: z.string(),
|
|
33
|
+
rationale_id: z.string().describe("Explanation id"),
|
|
34
|
+
belief_dependencies: z.array(z.string()).describe("belief_ids consulted"),
|
|
35
|
+
policy_dependencies: z.array(z.string()).describe("policy versions consulted"),
|
|
36
|
+
outcome_id: z.string().optional().describe("populated after Action completes"),
|
|
37
|
+
made_by: z.string().describe("actor_id"),
|
|
38
|
+
made_at: TimestampSchema,
|
|
39
|
+
})
|
|
40
|
+
export type Decision = z.infer<typeof DecisionSchema>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { SignatureSchema } from "./actor.js"
|
|
3
|
+
import { TimestampSchema } from "./common.js"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Version metadata attached to every event.
|
|
7
|
+
*
|
|
8
|
+
* Replay-grade events need to know which model, prompt, tool version,
|
|
9
|
+
* skill version, policy version, and memory snapshot were in effect
|
|
10
|
+
* when the event was produced. Without this, replays cannot reproduce
|
|
11
|
+
* the original conditions.
|
|
12
|
+
*/
|
|
13
|
+
export const EventVersionsSchema = z.object({
|
|
14
|
+
model: z.string().optional().describe("e.g. 'claude-opus-4-7'"),
|
|
15
|
+
prompt_hash: z.string().optional(),
|
|
16
|
+
tool_version: z.string().optional(),
|
|
17
|
+
skill_hash: z.string().optional(),
|
|
18
|
+
policy_version: z.string().optional(),
|
|
19
|
+
memory_snapshot_id: z.string().optional(),
|
|
20
|
+
schema_registry_version: z.string().optional(),
|
|
21
|
+
})
|
|
22
|
+
export type EventVersions = z.infer<typeof EventVersionsSchema>
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The envelope every event in Lodestar is wrapped in.
|
|
26
|
+
*
|
|
27
|
+
* Append-only. NDJSON-friendly. Replay-grade.
|
|
28
|
+
*
|
|
29
|
+
* - `seq` is a monotonic per-partition sequence number; used for
|
|
30
|
+
* deterministic replay ordering.
|
|
31
|
+
* - `logical_clock` is a Lamport-style counter; used to reason about
|
|
32
|
+
* causality across actors within a session.
|
|
33
|
+
* - `causal_parent_ids` form a DAG that lets the harness reconstruct
|
|
34
|
+
* why an event happened.
|
|
35
|
+
* - `payload_hash` is sha-256 of the canonical payload; gives
|
|
36
|
+
* tamper-evidence without requiring per-event signatures.
|
|
37
|
+
* - `signature` is OPTIONAL in v0. Routine internal events rely on
|
|
38
|
+
* the hash + append-only log. Signatures are required only for
|
|
39
|
+
* skills, policy versions, external imports, and secret-signing
|
|
40
|
+
* events. Adding a signature field for every event is overkill in v0.
|
|
41
|
+
*/
|
|
42
|
+
export const EventEnvelopeSchema = z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
seq: z.number().int().nonnegative(),
|
|
45
|
+
type: z.string().describe("e.g. 'action.approved', 'memory.promoted'"),
|
|
46
|
+
schema_version: z.string().describe("semver of this event type"),
|
|
47
|
+
project_id: z.string(),
|
|
48
|
+
session_id: z.string(),
|
|
49
|
+
actor_id: z.string(),
|
|
50
|
+
timestamp: TimestampSchema,
|
|
51
|
+
logical_clock: z.number().int().nonnegative(),
|
|
52
|
+
causal_parent_ids: z.array(z.string()),
|
|
53
|
+
payload_hash: z.string().describe("sha-256 hex"),
|
|
54
|
+
payload: z.unknown(),
|
|
55
|
+
versions: EventVersionsSchema,
|
|
56
|
+
signature: SignatureSchema.optional(),
|
|
57
|
+
})
|
|
58
|
+
export type EventEnvelope = z.infer<typeof EventEnvelopeSchema>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { SensitivitySchema, TimestampSchema } from "./common.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Trust level of an observation's source.
|
|
6
|
+
*
|
|
7
|
+
* - "raw": just arrived from a tool, not yet validated by schema registry
|
|
8
|
+
* - "validated": validated against its registered schema, ready for cognition
|
|
9
|
+
* - "synthetic": produced by a probe; must not pollute real memory
|
|
10
|
+
*/
|
|
11
|
+
export const ObservationTrustSchema = z.enum(["raw", "validated", "synthetic"])
|
|
12
|
+
export type ObservationTrust = z.infer<typeof ObservationTrustSchema>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The first link in the epistemic chain.
|
|
16
|
+
*
|
|
17
|
+
* An Observation is a schema-typed structured input produced by a tool.
|
|
18
|
+
* Free-form strings from a tool are NOT observations until they have
|
|
19
|
+
* been validated against a registered schema.
|
|
20
|
+
*
|
|
21
|
+
* The `schema` field references the registry entry (e.g. "git.status@1").
|
|
22
|
+
* The kernel validates `payload` against that schema before this becomes
|
|
23
|
+
* a `validated` observation.
|
|
24
|
+
*/
|
|
25
|
+
export const ObservationSchema = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
schema: z.string().describe("registry key, e.g. 'git.status@1'"),
|
|
28
|
+
payload: z.unknown(),
|
|
29
|
+
source: z.object({
|
|
30
|
+
tool: z.string(),
|
|
31
|
+
invocation_id: z.string(),
|
|
32
|
+
captured_at: TimestampSchema,
|
|
33
|
+
}),
|
|
34
|
+
context: z.object({
|
|
35
|
+
session_id: z.string(),
|
|
36
|
+
project_id: z.string(),
|
|
37
|
+
actor_id: z.string(),
|
|
38
|
+
}),
|
|
39
|
+
trust: ObservationTrustSchema,
|
|
40
|
+
sensitivity: SensitivitySchema,
|
|
41
|
+
})
|
|
42
|
+
export type Observation = z.infer<typeof ObservationSchema>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { TimestampSchema } from "./common.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Update to a claim, belief, or decision when evidence shifts.
|
|
6
|
+
*
|
|
7
|
+
* Revisions are the eighth (and cyclic) link in the epistemic chain.
|
|
8
|
+
* They make beliefs defeasible: when new observations contradict an
|
|
9
|
+
* adopted belief, a Revision event records the change and points to
|
|
10
|
+
* the Explanation that justifies it.
|
|
11
|
+
*/
|
|
12
|
+
export const RevisionSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
target_type: z.enum(["claim", "belief", "decision"]),
|
|
15
|
+
target_id: z.string(),
|
|
16
|
+
changes: z.array(z.object({
|
|
17
|
+
field: z.string(),
|
|
18
|
+
old_value: z.unknown(),
|
|
19
|
+
new_value: z.unknown(),
|
|
20
|
+
})),
|
|
21
|
+
triggered_by: z.string().describe("actor_id or event_id"),
|
|
22
|
+
rationale_id: z.string().describe("Explanation id"),
|
|
23
|
+
at: TimestampSchema,
|
|
24
|
+
})
|
|
25
|
+
export type Revision = z.infer<typeof RevisionSchema>
|
|
26
|
+
|
|
27
|
+
// -----------------------------------------------------------------------------
|
|
28
|
+
// Explanation
|
|
29
|
+
// -----------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Subject types an Explanation can address.
|
|
33
|
+
*
|
|
34
|
+
* Every governance event in the system produces an Explanation.
|
|
35
|
+
* This is what makes the system auditable in a way that traces alone
|
|
36
|
+
* cannot match: traces show what happened, explanations show why.
|
|
37
|
+
*/
|
|
38
|
+
export const ExplanationSubjectSchema = z.enum([
|
|
39
|
+
"action_approval",
|
|
40
|
+
"action_rejection",
|
|
41
|
+
"memory_promotion",
|
|
42
|
+
"memory_quarantine",
|
|
43
|
+
"confidence_downweight",
|
|
44
|
+
"decision_rationale",
|
|
45
|
+
"claim_acceptance",
|
|
46
|
+
"claim_rejection",
|
|
47
|
+
"belief_revision",
|
|
48
|
+
])
|
|
49
|
+
export type ExplanationSubject = z.infer<typeof ExplanationSubjectSchema>
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Audience an Explanation is generated for. Affects redaction:
|
|
53
|
+
* an Explanation targeting `human` redacts content above the
|
|
54
|
+
* recipient's sensitivity clearance.
|
|
55
|
+
*/
|
|
56
|
+
export const ExplanationAudienceSchema = z.enum(["human", "agent", "audit", "research"])
|
|
57
|
+
export type ExplanationAudience = z.infer<typeof ExplanationAudienceSchema>
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Structured rationale for any governance event.
|
|
61
|
+
*
|
|
62
|
+
* An Explanation must reference its inputs (claims_used, evidence_used)
|
|
63
|
+
* so that a replay can verify the rationale was grounded in real data
|
|
64
|
+
* rather than post-hoc fabrication.
|
|
65
|
+
*/
|
|
66
|
+
export const ExplanationSchema = z.object({
|
|
67
|
+
id: z.string(),
|
|
68
|
+
subject_type: ExplanationSubjectSchema,
|
|
69
|
+
subject_id: z.string(),
|
|
70
|
+
audience: ExplanationAudienceSchema,
|
|
71
|
+
summary: z.string().describe("one-sentence summary"),
|
|
72
|
+
full_text: z.string().describe("multi-paragraph rationale"),
|
|
73
|
+
claims_used: z.array(z.string()).describe("claim_ids referenced"),
|
|
74
|
+
evidence_used: z.array(z.string()).describe("evidence_set_ids referenced"),
|
|
75
|
+
uncertainties: z.array(z.string()).describe("known unknowns acknowledged"),
|
|
76
|
+
counterarguments: z.array(z.string()).describe("opposing considerations"),
|
|
77
|
+
generated_by: z.string().describe("actor_id"),
|
|
78
|
+
at: TimestampSchema,
|
|
79
|
+
})
|
|
80
|
+
export type Explanation = z.infer<typeof ExplanationSchema>
|