@decisiongraph/core 0.2.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 (54) hide show
  1. package/README.md +2 -0
  2. package/dist/domain/ids.d.ts +12 -0
  3. package/dist/domain/ids.d.ts.map +1 -0
  4. package/dist/domain/ids.js +5 -0
  5. package/dist/domain/ids.js.map +1 -0
  6. package/dist/domain/time.d.ts +3 -0
  7. package/dist/domain/time.d.ts.map +1 -0
  8. package/dist/domain/time.js +5 -0
  9. package/dist/domain/time.js.map +1 -0
  10. package/dist/domain/types.d.ts +61 -0
  11. package/dist/domain/types.d.ts.map +1 -0
  12. package/dist/domain/types.js +2 -0
  13. package/dist/domain/types.js.map +1 -0
  14. package/dist/index.d.ts +6 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +6 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/kernel/apply.d.ts +19 -0
  19. package/dist/kernel/apply.d.ts.map +1 -0
  20. package/dist/kernel/apply.js +60 -0
  21. package/dist/kernel/apply.js.map +1 -0
  22. package/dist/kernel/diff.d.ts +11 -0
  23. package/dist/kernel/diff.d.ts.map +1 -0
  24. package/dist/kernel/diff.js +17 -0
  25. package/dist/kernel/diff.js.map +1 -0
  26. package/dist/kernel/errors.d.ts +8 -0
  27. package/dist/kernel/errors.d.ts.map +1 -0
  28. package/dist/kernel/errors.js +5 -0
  29. package/dist/kernel/errors.js.map +1 -0
  30. package/dist/kernel/index.d.ts +6 -0
  31. package/dist/kernel/index.d.ts.map +1 -0
  32. package/dist/kernel/index.js +6 -0
  33. package/dist/kernel/index.js.map +1 -0
  34. package/dist/kernel/lint.d.ts +10 -0
  35. package/dist/kernel/lint.d.ts.map +1 -0
  36. package/dist/kernel/lint.js +13 -0
  37. package/dist/kernel/lint.js.map +1 -0
  38. package/dist/kernel/replay.d.ts +5 -0
  39. package/dist/kernel/replay.d.ts.map +1 -0
  40. package/dist/kernel/replay.js +17 -0
  41. package/dist/kernel/replay.js.map +1 -0
  42. package/dist/policy/constitutional.d.ts +7 -0
  43. package/dist/policy/constitutional.d.ts.map +1 -0
  44. package/dist/policy/constitutional.js +137 -0
  45. package/dist/policy/constitutional.js.map +1 -0
  46. package/dist/policy/index.d.ts +3 -0
  47. package/dist/policy/index.d.ts.map +1 -0
  48. package/dist/policy/index.js +3 -0
  49. package/dist/policy/index.js.map +1 -0
  50. package/dist/policy/policy.d.ts +6 -0
  51. package/dist/policy/policy.d.ts.map +1 -0
  52. package/dist/policy/policy.js +2 -0
  53. package/dist/policy/policy.js.map +1 -0
  54. package/package.json +34 -0
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # @decisiongraph/core
2
+ Pure deterministic kernel. No IO, no random IDs, no JSON schema deps.
@@ -0,0 +1,12 @@
1
+ export type Brand<T, B extends string> = T & {
2
+ readonly __brand: B;
3
+ };
4
+ export type NodeId = Brand<string, "NodeId">;
5
+ export type EdgeId = Brand<string, "EdgeId">;
6
+ export type AuthorId = Brand<string, "AuthorId">;
7
+ export type CommitId = Brand<string, "CommitId">;
8
+ export declare const asNodeId: (s: string) => NodeId;
9
+ export declare const asEdgeId: (s: string) => EdgeId;
10
+ export declare const asAuthorId: (s: string) => AuthorId;
11
+ export declare const asCommitId: (s: string) => CommitId;
12
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/domain/ids.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC7C,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC7C,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACjD,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAEjD,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,MAAqB,CAAC;AAC3D,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,MAAqB,CAAC;AAC3D,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,KAAG,QAAyB,CAAC;AACjE,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,KAAG,QAAyB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export const asNodeId = (s) => s;
2
+ export const asEdgeId = (s) => s;
3
+ export const asAuthorId = (s) => s;
4
+ export const asCommitId = (s) => s;
5
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/domain/ids.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAW,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAW,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAS,EAAY,EAAE,CAAC,CAAa,CAAC;AACjE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAS,EAAY,EAAE,CAAC,CAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type IsoTimestamp = string;
2
+ export declare const isIsoTimestamp: (s: string) => boolean;
3
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/domain/time.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,KAAG,OAG1C,CAAC"}
@@ -0,0 +1,5 @@
1
+ export const isIsoTimestamp = (s) => {
2
+ // minimal check; stricter validation can live in schema/io layer
3
+ return typeof s === "string" && s.includes("T") && s.endsWith("Z");
4
+ };
5
+ //# sourceMappingURL=time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/domain/time.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAS,EAAW,EAAE;IACnD,iEAAiE;IACjE,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACrE,CAAC,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { AuthorId, CommitId, EdgeId, NodeId } from "./ids.js";
2
+ import type { IsoTimestamp } from "./time.js";
3
+ export type NodeStatus = "Active" | "Superseded" | "Deprecated";
4
+ export type EdgeStatus = "Active" | "Superseded" | "Deprecated";
5
+ export type EdgeType = "depends_on" | "supports" | "refutes" | "overrides" | "supersedes";
6
+ export type ViolationSeverity = "ERROR" | "WARN" | "INFO";
7
+ export type Node = {
8
+ id: NodeId;
9
+ kind: string;
10
+ status: NodeStatus;
11
+ createdAt: IsoTimestamp;
12
+ author: AuthorId;
13
+ payload?: unknown;
14
+ };
15
+ export type Edge = {
16
+ id: EdgeId;
17
+ type: EdgeType;
18
+ from: NodeId;
19
+ to: NodeId;
20
+ status: EdgeStatus;
21
+ createdAt: IsoTimestamp;
22
+ author: AuthorId;
23
+ payload?: unknown;
24
+ };
25
+ export type Commit = {
26
+ commitId: CommitId;
27
+ createdAt: IsoTimestamp;
28
+ author: AuthorId;
29
+ };
30
+ export type Graph = {
31
+ nodes: Record<string, Node>;
32
+ edges: Record<string, Edge>;
33
+ commits: Commit[];
34
+ };
35
+ export type AddNodeOp = {
36
+ type: "add_node";
37
+ node: Node;
38
+ };
39
+ export type AddEdgeOp = {
40
+ type: "add_edge";
41
+ edge: Edge;
42
+ };
43
+ export type SupersedeEdgeOp = {
44
+ type: "supersede_edge";
45
+ oldEdgeId: EdgeId;
46
+ newEdge: Edge;
47
+ };
48
+ export type CommitOp = {
49
+ type: "commit";
50
+ commitId: CommitId;
51
+ createdAt: IsoTimestamp;
52
+ author: AuthorId;
53
+ };
54
+ export type Operation = AddNodeOp | AddEdgeOp | SupersedeEdgeOp | CommitOp;
55
+ export type Violation = {
56
+ code: string;
57
+ message: string;
58
+ severity: ViolationSeverity;
59
+ path?: string;
60
+ };
61
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/domain/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAChE,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAChE,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;AAE1F,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAA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,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/domain/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export * from "./domain/ids.js";
2
+ export * from "./domain/time.js";
3
+ export * from "./domain/types.js";
4
+ export * from "./policy/index.js";
5
+ export * from "./kernel/index.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./domain/ids.js";
2
+ export * from "./domain/time.js";
3
+ export * from "./domain/types.js";
4
+ export * from "./policy/index.js";
5
+ export * from "./kernel/index.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Graph, Operation } from "../domain/types.js";
2
+ import type { Policy } from "../policy/policy.js";
3
+ import { type KernelError } from "./errors.js";
4
+ export type ApplyEvent = {
5
+ type: "applied";
6
+ opType: Operation["type"];
7
+ } | {
8
+ type: "rejected";
9
+ opType: Operation["type"];
10
+ error: KernelError;
11
+ };
12
+ export type ApplyResult = {
13
+ graph: Graph;
14
+ events: ApplyEvent[];
15
+ };
16
+ export declare const emptyGraph: () => Graph;
17
+ export declare function apply(graph: Graph, op: Operation, policy: Policy): ApplyResult;
18
+ export declare function applyBatch(graph: Graph, ops: Operation[], policy: Policy): ApplyResult;
19
+ //# sourceMappingURL=apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/kernel/apply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAAC;AAExE,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAEjE,eAAO,MAAM,UAAU,QAAO,KAAgD,CAAC;AAI/E,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CA4C9E;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAStF"}
@@ -0,0 +1,60 @@
1
+ import { ConstitutionalPolicy } from "../policy/constitutional.js";
2
+ import { policyError } from "./errors.js";
3
+ export const emptyGraph = () => ({ nodes: {}, edges: {}, commits: [] });
4
+ const constitutionalPolicy = new ConstitutionalPolicy();
5
+ export function apply(graph, op, policy) {
6
+ // Non-bypassable constitutional enforcement (runs regardless of caller policy)
7
+ const constitutional = constitutionalPolicy.validateOperation(graph, op);
8
+ if (constitutional.length > 0) {
9
+ return {
10
+ graph,
11
+ events: [{ type: "rejected", opType: op.type, error: policyError(constitutional) }]
12
+ };
13
+ }
14
+ const violations = policy.validateOperation(graph, op);
15
+ if (violations.length > 0) {
16
+ return {
17
+ graph,
18
+ events: [{ type: "rejected", opType: op.type, error: policyError(violations) }]
19
+ };
20
+ }
21
+ const next = {
22
+ nodes: { ...graph.nodes },
23
+ edges: { ...graph.edges },
24
+ commits: [...graph.commits]
25
+ };
26
+ if (op.type === "add_node") {
27
+ next.nodes[String(op.node.id)] = op.node;
28
+ }
29
+ else if (op.type === "add_edge") {
30
+ next.edges[String(op.edge.id)] = op.edge;
31
+ }
32
+ else if (op.type === "supersede_edge") {
33
+ const old = next.edges[String(op.oldEdgeId)];
34
+ if (old) {
35
+ next.edges[String(op.oldEdgeId)] = { ...old, status: "Superseded" };
36
+ }
37
+ next.edges[String(op.newEdge.id)] = op.newEdge;
38
+ }
39
+ else if (op.type === "commit") {
40
+ next.commits.push({ commitId: op.commitId, createdAt: op.createdAt, author: op.author });
41
+ }
42
+ else {
43
+ return {
44
+ graph,
45
+ events: [{ type: "rejected", opType: op.type ?? "unknown", error: { kind: "UnknownOperation", message: "unknown operation" } }]
46
+ };
47
+ }
48
+ return { graph: next, events: [{ type: "applied", opType: op.type }] };
49
+ }
50
+ export function applyBatch(graph, ops, policy) {
51
+ let g = graph;
52
+ const events = [];
53
+ for (const op of ops) {
54
+ const r = apply(g, op, policy);
55
+ g = r.graph;
56
+ events.push(...r.events);
57
+ }
58
+ return { graph: g, events };
59
+ }
60
+ //# sourceMappingURL=apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/kernel/apply.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAoB,MAAM,a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AI,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAY,EAAE,GAAgB,EAAE,MAAc;IACvE,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Graph } from "../domain/types.js";
2
+ export type DiffResult = {
3
+ addedNodes: string[];
4
+ removedNodes: string[];
5
+ addedEdges: string[];
6
+ removedEdges: string[];
7
+ changedNodes: string[];
8
+ changedEdges: string[];
9
+ };
10
+ export declare function diff(a: Graph, b: Graph): DiffResult;
11
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/kernel/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAIF,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,UAAU,CAiBnD"}
@@ -0,0 +1,17 @@
1
+ const keys = (o) => Object.keys(o).sort();
2
+ export function diff(a, b) {
3
+ const aN = keys(a.nodes);
4
+ const bN = keys(b.nodes);
5
+ const aE = keys(a.edges);
6
+ const bE = keys(b.edges);
7
+ const setA = new Set(aN), setB = new Set(bN);
8
+ const addedNodes = bN.filter(k => !setA.has(k));
9
+ const removedNodes = aN.filter(k => !setB.has(k));
10
+ const changedNodes = aN.filter(k => setB.has(k) && JSON.stringify(a.nodes[k]) !== JSON.stringify(b.nodes[k]));
11
+ const setAE = new Set(aE), setBE = new Set(bE);
12
+ const addedEdges = bE.filter(k => !setAE.has(k));
13
+ const removedEdges = aE.filter(k => !setBE.has(k));
14
+ const changedEdges = aE.filter(k => setBE.has(k) && JSON.stringify(a.edges[k]) !== JSON.stringify(b.edges[k]));
15
+ return { addedNodes, removedNodes, addedEdges, removedEdges, changedNodes, changedEdges };
16
+ }
17
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/kernel/diff.ts"],"names":[],"mappings":"AAWA,MAAM,IAAI,GAAG,CAAC,CAA0B,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAEnE,MAAM,UAAU,IAAI,CAAC,CAAQ,EAAE,CAAQ;IACrC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACzB,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACzB,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACzB,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEzB,MAAM,IAAI,GAAG,IAAI,GAAG,CA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AE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Violation } from "../domain/types.js";
2
+ export type KernelError = {
3
+ kind: "PolicyViolation" | "UnknownOperation";
4
+ violations?: Violation[];
5
+ message?: string;
6
+ };
7
+ export declare const policyError: (violations: Violation[]) => KernelError;
8
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/kernel/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;IAC7C,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,YAAY,SAAS,EAAE,KAAG,WAGpD,CAAC"}
@@ -0,0 +1,5 @@
1
+ export const policyError = (violations) => ({
2
+ kind: "PolicyViolation",
3
+ violations
4
+ });
5
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/kernel/errors.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,UAAuB,EAAe,EAAE,CAAC,CAAC;IACpE,IAAI,EAAE,iBAAiB;IACvB,UAAU;CACX,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./apply.js";
2
+ export * from "./lint.js";
3
+ export * from "./replay.js";
4
+ export * from "./diff.js";
5
+ export * from "./errors.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kernel/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./apply.js";
2
+ export * from "./lint.js";
3
+ export * from "./replay.js";
4
+ export * from "./diff.js";
5
+ export * from "./errors.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kernel/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Graph, Violation } from "../domain/types.js";
2
+ import type { Policy } from "../policy/policy.js";
3
+ export type LintResult = {
4
+ ok: true;
5
+ } | {
6
+ ok: false;
7
+ violations: Violation[];
8
+ };
9
+ export declare function lint(graph: Graph, policy: Policy): LintResult;
10
+ //# sourceMappingURL=lint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/kernel/lint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,MAAM,MAAM,UAAU,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC;AAI/E,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAa7D"}
@@ -0,0 +1,13 @@
1
+ import { ConstitutionalPolicy } from "../policy/constitutional.js";
2
+ const constitutionalPolicy = new ConstitutionalPolicy();
3
+ export function lint(graph, policy) {
4
+ // Non-bypassable constitutional lint + caller policy lint
5
+ const constitutional = constitutionalPolicy.validateGraph(graph);
6
+ const violations = [...constitutional, ...policy.validateGraph(graph)];
7
+ if (violations.length > 0) {
8
+ violations.sort((a, b) => (a.code + (a.path ?? "")).localeCompare(b.code + (b.path ?? "")));
9
+ return { ok: false, violations };
10
+ }
11
+ return { ok: true };
12
+ }
13
+ //# sourceMappingURL=lint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/kernel/lint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAInE,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAExD,MAAM,UAAU,IAAI,CAAC,KAAY,EAAE,MAAc;IAC/C,0DAA0D;IAC1D,MAAM,cAAc,GAAG,oBAAoB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,CAAC,GAAG,cAAc,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAEvE,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACvB,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CACjE,CAAC;QACF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Graph, Operation } from "../domain/types.js";
2
+ import type { Policy } from "../policy/policy.js";
3
+ export declare function replay(ops: Operation[], policy: Policy): Graph;
4
+ export declare function replayAt(ops: Operation[], commitId: string, policy: Policy): Graph;
5
+ //# sourceMappingURL=replay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/kernel/replay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,wBAAgB,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAE9D;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAUlF"}
@@ -0,0 +1,17 @@
1
+ import { applyBatch, emptyGraph } from "./apply.js";
2
+ export function replay(ops, policy) {
3
+ return applyBatch(emptyGraph(), ops, policy).graph;
4
+ }
5
+ export function replayAt(ops, commitId, policy) {
6
+ // replay until matching commitId applied (inclusive)
7
+ const g0 = emptyGraph();
8
+ let g = g0;
9
+ for (const op of ops) {
10
+ const r = applyBatch(g, [op], policy);
11
+ g = r.graph;
12
+ if (op.type === "commit" && String(op.commitId) === commitId)
13
+ break;
14
+ }
15
+ return g;
16
+ }
17
+ //# sourceMappingURL=replay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.js","sourceRoot":"","sources":["../../src/kernel/replay.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,UAAU,MAAM,CAAC,GAAgB,EAAE,MAAc;IACrD,OAAO,UAAU,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAgB,EAAE,QAAgB,EAAE,MAAc;IACzE,qDAAqD;IACrD,MAAM,EAAE,GAAG,UAAU,EAAE,CAAC;IACxB,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;QACZ,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,QAAQ;YAAE,MAAM;IACtE,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Policy } from "./policy.js";
2
+ import type { Graph, Operation, Violation } from "../domain/types.js";
3
+ export declare class ConstitutionalPolicy implements Policy {
4
+ validateOperation(graph: Graph, op: Operation): Violation[];
5
+ validateGraph(graph: Graph): Violation[];
6
+ }
7
+ //# sourceMappingURL=constitutional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constitutional.d.ts","sourceRoot":"","sources":["../../src/policy/constitutional.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAetE,qBAAa,oBAAqB,YAAW,MAAM;IACjD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,GAAG,SAAS,EAAE;IA+E3D,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE;CAkDzC"}
@@ -0,0 +1,137 @@
1
+ const v = (code, message, path, severity = "ERROR") => (path === undefined ? { code, message, severity } : { code, message, severity, path });
2
+ const isValidNodeStatus = (x) => x === "Active" || x === "Superseded" || x === "Deprecated";
3
+ const isValidEdgeStatus = (x) => x === "Active" || x === "Superseded" || x === "Deprecated";
4
+ const isValidEdgeType = (x) => x === "depends_on" || x === "supports" || x === "refutes" || x === "overrides" || x === "supersedes";
5
+ const isActive = (x) => x === "Active";
6
+ export class ConstitutionalPolicy {
7
+ validateOperation(graph, op) {
8
+ const violations = [];
9
+ const hasCommit = graph.commits.length > 0;
10
+ // ---- Mutations forbidden after first commit (current Constitution v0.2 in this repo)
11
+ const mutationOps = ["add_node", "add_edge", "supersede_edge"];
12
+ if (hasCommit && mutationOps.includes(op.type)) {
13
+ violations.push(v("IMMUTABLE_AFTER_COMMIT", "graph is immutable after commit", "graph.commits"));
14
+ }
15
+ if (hasCommit && op.type === "commit") {
16
+ violations.push(v("COMMIT_ALREADY_EXISTS", "commit already exists", "graph.commits"));
17
+ }
18
+ // ---- Author required on ops that carry author fields
19
+ if (op.type === "add_node") {
20
+ if (!op.node.author)
21
+ violations.push(v("AUTHOR_REQUIRED", "author is required", "op.node.author"));
22
+ if (!op.node.id)
23
+ violations.push(v("NODE_ID_REQUIRED", "node id is required", "op.node.id"));
24
+ if (graph.nodes[String(op.node.id)]) {
25
+ violations.push(v("NODE_ID_DUP", "node id already exists", "op.node.id"));
26
+ }
27
+ if (!isValidNodeStatus(op.node.status))
28
+ violations.push(v("INVALID_NODE_STATUS", "invalid node status", "op.node.status"));
29
+ }
30
+ if (op.type === "add_edge") {
31
+ if (!op.edge.author)
32
+ violations.push(v("AUTHOR_REQUIRED", "author is required", "op.edge.author"));
33
+ if (!op.edge.id)
34
+ violations.push(v("EDGE_ID_REQUIRED", "edge id is required", "op.edge.id"));
35
+ if (graph.edges[String(op.edge.id)]) {
36
+ violations.push(v("EDGE_ID_DUP", "edge id already exists", "op.edge.id"));
37
+ }
38
+ if (!isValidEdgeType(op.edge.type))
39
+ violations.push(v("INVALID_EDGE_TYPE", "invalid edge type", "op.edge.type"));
40
+ if (!isValidEdgeStatus(op.edge.status))
41
+ violations.push(v("INVALID_EDGE_STATUS", "invalid edge status", "op.edge.status"));
42
+ }
43
+ if (op.type === "supersede_edge") {
44
+ if (!op.newEdge.author)
45
+ violations.push(v("AUTHOR_REQUIRED", "author is required", "op.newEdge.author"));
46
+ // old edge must exist
47
+ const oldEdge = graph.edges[String(op.oldEdgeId)];
48
+ if (!oldEdge) {
49
+ violations.push(v("EDGE_NOT_FOUND", "oldEdgeId not found", "op.oldEdgeId"));
50
+ }
51
+ else if (!isActive(oldEdge.status)) {
52
+ violations.push(v("EDGE_NOT_ACTIVE", "old edge must be Active to supersede", "op.oldEdgeId"));
53
+ }
54
+ // new edge id must be different (prevents overwrite)
55
+ if (String(op.newEdge.id) === String(op.oldEdgeId)) {
56
+ violations.push(v("SUPERSEDE_REQUIRES_NEW_EDGE_ID", "newEdge.id must differ from oldEdgeId", "op.newEdge.id"));
57
+ }
58
+ if (!op.newEdge.id)
59
+ violations.push(v("EDGE_ID_REQUIRED", "edge id is required", "op.newEdge.id"));
60
+ if (graph.edges[String(op.newEdge.id)]) {
61
+ violations.push(v("EDGE_ID_DUP", "edge id already exists", "op.newEdge.id"));
62
+ }
63
+ if (!isValidEdgeType(op.newEdge.type))
64
+ violations.push(v("INVALID_EDGE_TYPE", "invalid edge type", "op.newEdge.type"));
65
+ if (!isValidEdgeStatus(op.newEdge.status))
66
+ violations.push(v("INVALID_EDGE_STATUS", "invalid edge status", "op.newEdge.status"));
67
+ if (!isActive(op.newEdge.status)) {
68
+ violations.push(v("NEW_EDGE_NOT_ACTIVE", "new edge must be Active", "op.newEdge.status"));
69
+ }
70
+ }
71
+ if (op.type === "commit") {
72
+ if (!op.author)
73
+ violations.push(v("AUTHOR_REQUIRED", "author is required", "op.author"));
74
+ // only one commit allowed; commitId must be unique
75
+ if (graph.commits.some(c => String(c.commitId) === String(op.commitId))) {
76
+ violations.push(v("COMMIT_ID_DUP", "commitId already exists", "op.commitId"));
77
+ }
78
+ }
79
+ // deterministic order
80
+ violations.sort((a, b) => (a.code + (a.path ?? "")).localeCompare(b.code + (b.path ?? "")));
81
+ return violations;
82
+ }
83
+ validateGraph(graph) {
84
+ const violations = [];
85
+ // Minimal runtime vocabulary checks (JS inputs may bypass TS)
86
+ const seenNodeIds = new Set();
87
+ const seenEdgeIds = new Set();
88
+ const seenCommitIds = new Set();
89
+ for (const [id, n] of Object.entries(graph.nodes)) {
90
+ if (!n.author)
91
+ violations.push(v("AUTHOR_REQUIRED", "author is required", `nodes.${id}.author`));
92
+ if (!n.id)
93
+ violations.push(v("NODE_ID_REQUIRED", "node id is required", `nodes.${id}.id`));
94
+ const nodeId = String(n.id);
95
+ if (seenNodeIds.has(nodeId)) {
96
+ violations.push(v("NODE_ID_DUP", "node id already exists", `nodes.${id}.id`));
97
+ }
98
+ else {
99
+ seenNodeIds.add(nodeId);
100
+ }
101
+ if (!isValidNodeStatus(n.status))
102
+ violations.push(v("INVALID_NODE_STATUS", "invalid node status", `nodes.${id}.status`));
103
+ }
104
+ for (const [id, e] of Object.entries(graph.edges)) {
105
+ if (!e.author)
106
+ violations.push(v("AUTHOR_REQUIRED", "author is required", `edges.${id}.author`));
107
+ if (!e.id)
108
+ violations.push(v("EDGE_ID_REQUIRED", "edge id is required", `edges.${id}.id`));
109
+ const edgeId = String(e.id);
110
+ if (seenEdgeIds.has(edgeId)) {
111
+ violations.push(v("EDGE_ID_DUP", "edge id already exists", `edges.${id}.id`));
112
+ }
113
+ else {
114
+ seenEdgeIds.add(edgeId);
115
+ }
116
+ if (!isValidEdgeType(e.type))
117
+ violations.push(v("INVALID_EDGE_TYPE", "invalid edge type", `edges.${id}.type`));
118
+ if (!isValidEdgeStatus(e.status))
119
+ violations.push(v("INVALID_EDGE_STATUS", "invalid edge status", `edges.${id}.status`));
120
+ }
121
+ for (const [idx, c] of graph.commits.entries()) {
122
+ const cid = String(c.commitId);
123
+ if (seenCommitIds.has(cid)) {
124
+ violations.push(v("COMMIT_ID_DUP", "commitId already exists", `commits.${idx}.commitId`));
125
+ }
126
+ else {
127
+ seenCommitIds.add(cid);
128
+ }
129
+ }
130
+ if (graph.commits.length > 1) {
131
+ violations.push(v("MULTIPLE_COMMITS", "only one commit is allowed", "graph.commits"));
132
+ }
133
+ violations.sort((a, b) => (a.code + (a.path ?? "")).localeCompare(b.code + (b.path ?? "")));
134
+ return violations;
135
+ }
136
+ }
137
+ //# sourceMappingURL=constitutional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constitutional.js","sourceRoot":"","sources":["../../src/policy/constitutional.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,GAAG,CACR,IAAY,EACZ,OAAe,EACf,IAAa,EACb,WAAkC,OAAO,EAC9B,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvG,MAAM,iBAAiB,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,YAAY,IAAI,CAAC,KAAK,YAAY,CAAC;AACrG,MAAM,iBAAiB,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,YAAY,IAAI,CAAC,KAAK,YAAY,CAAC;AACrG,MAAM,eAAe,GAAG,CAAC,CAAU,EAAE,EAAE,CACrC,CAAC,KAAK,YAAY,IAAI,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,YAAY,CAAC;AACvG,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC;AAEhD,MAAM,OAAO,oBAAoB;IAC/B,iBAAiB,CAAC,KAAY,EAAE,EAAa;QAC3C,MAAM,UAAU,GAAgB,EAAE,CAAC;QACnC,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,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IAAI,CAAC,CAAC,CAAC,kBAAkB,EAAE,4BAA4B,EAAE,eAAe,CAAC,CAAC,CAAC;QACxF,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5F,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export * from "./policy.js";
2
+ export * from "./constitutional.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./policy.js";
2
+ export * from "./constitutional.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Graph, Operation, Violation } from "../domain/types.js";
2
+ export interface Policy {
3
+ validateOperation(graph: Graph, op: Operation): Violation[];
4
+ validateGraph(graph: Graph): Violation[];
5
+ }
6
+ //# sourceMappingURL=policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/policy/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,MAAM,WAAW,MAAM;IACrB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAC5D,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,CAAC;CAC1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/policy/policy.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@decisiongraph/core",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": ["dist"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/izumix77/decisiongraph-core.git",
13
+ "directory": "packages/core"
14
+ },
15
+ "homepage": "https://github.com/izumix77/decisiongraph-core#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/izumix77/decisiongraph-core/issues"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc -b tsconfig.build.json",
24
+ "clean": "tsc -b tsconfig.build.json --clean",
25
+ "test": "vitest run",
26
+ "typecheck": "tsc -p tsconfig.json --noEmit"
27
+ },
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ }
33
+ }
34
+ }