@lucern/contracts 0.1.2-alpha.1 → 0.1.2-alpha.3

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.
@@ -39,6 +39,7 @@ type CreateBeliefInput = {
39
39
  layer?: EpistemicLayer;
40
40
  domain?: string;
41
41
  nodeType?: string;
42
+ baseRate: number;
42
43
  };
43
44
  /** Result of createBelief() */
44
45
  type BeliefResult = {
@@ -314,6 +315,19 @@ type LucernGraphMethods = {
314
315
  userId: string;
315
316
  }>;
316
317
  }>;
318
+ getOpinionHistory(client: LucernClient, nodeId: string): Promise<Array<{
319
+ t: number;
320
+ b: number;
321
+ d: number;
322
+ u: number;
323
+ a: number;
324
+ P: number;
325
+ trigger: string;
326
+ triggeringRef?: {
327
+ kind: "evidence" | "worktree";
328
+ id: string;
329
+ };
330
+ }>>;
317
331
  getAuditTrail(client: LucernClient, nodeId: string, limit?: number): Promise<{
318
332
  entries: Array<{
319
333
  action: string;
@@ -10,13 +10,17 @@ var LENS_PERSPECTIVE_TYPES = [
10
10
  // src/mcp-tools.contract.ts
11
11
  var CREATE_BELIEF = {
12
12
  name: "create_belief",
13
- description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object. The belief starts as unscored (draft). Score it with modulate_confidence to freeze the formulation.",
13
+ description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a mandatory prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; use modulate_confidence to record the first evidential update.",
14
14
  parameters: {
15
15
  canonicalText: {
16
16
  type: "string",
17
17
  description: "The belief statement \u2014 what the agent holds to be true"
18
18
  },
19
19
  topicId: { type: "string", description: "Topic scope for the belief" },
20
+ baseRate: {
21
+ type: "number",
22
+ description: "Required prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time."
23
+ },
20
24
  beliefType: {
21
25
  type: "string",
22
26
  description: "Belief type (e.g., hypothesis, belief, principle, invariant, tenet, forecast). Validated against schemaEnumConfig."
@@ -26,7 +30,7 @@ var CREATE_BELIEF = {
26
30
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
27
31
  }
28
32
  },
29
- required: ["canonicalText", "topicId"],
33
+ required: ["canonicalText", "topicId", "baseRate"],
30
34
  response: {
31
35
  description: "The created canonical belief record",
32
36
  fields: {
@@ -89,17 +93,43 @@ var REFINE_BELIEF = {
89
93
  };
90
94
  var MODULATE_CONFIDENCE = {
91
95
  name: "modulate_confidence",
92
- description: "Record a confidence change for a belief. Like `git commit` to the credence log \u2014 an atomic, append-only write. Each modulation is a new entry in the history, not an overwrite. Scoring happens via merge; this tool records the individual data points. Triggers: evidence_added, contradiction_detected, merge_outcome, manual, decay.",
96
+ description: "Record a confidence change for a belief. Like `git commit` to the credence log \u2014 an atomic, append-only write. Each modulation is a new entry in the history, not an overwrite. Scoring happens via merge; this tool records the individual data points. Pass the full subjective-logic tuple (`belief`, `disbelief`, `uncertainty`, `baseRate`) directly. If a caller only has a scalar probability, use `@lucern/sdk` helpers `opinionFromBaseRate`, `opinionFromDogmatic`, or `opinionFromProjected` to name the intended interpretation before calling this tool. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction, manual, decay.",
93
97
  parameters: {
94
98
  nodeId: { type: "string", description: "The belief to score" },
95
- confidence: { type: "number", description: "Confidence level in [0, 1]" },
99
+ belief: {
100
+ type: "number",
101
+ description: "Subjective-logic belief mass `b` in [0, 1]"
102
+ },
103
+ disbelief: {
104
+ type: "number",
105
+ description: "Subjective-logic disbelief mass `d` in [0, 1]"
106
+ },
107
+ uncertainty: {
108
+ type: "number",
109
+ description: "Subjective-logic uncertainty mass `u` in [0, 1]"
110
+ },
111
+ baseRate: {
112
+ type: "number",
113
+ description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
114
+ },
115
+ confidence: {
116
+ type: "number",
117
+ description: "Deprecated scalar confidence value in [0, 1]. Scalar-only payloads are rejected as AMBIGUOUS_SCALAR."
118
+ },
96
119
  trigger: {
97
120
  type: "string",
98
121
  description: "What caused this confidence change",
99
122
  enum: [
100
123
  "evidence_added",
124
+ "evidence_removed",
101
125
  "contradiction_detected",
102
- "merge_outcome",
126
+ "contradiction_resolved",
127
+ "agent_assessment",
128
+ "worktree_outcome",
129
+ "worktree_completed",
130
+ "fusion",
131
+ "discount",
132
+ "deduction",
103
133
  "manual",
104
134
  "decay"
105
135
  ]
@@ -109,7 +139,7 @@ var MODULATE_CONFIDENCE = {
109
139
  description: "Human-readable explanation of why confidence changed"
110
140
  }
111
141
  },
112
- required: ["nodeId", "confidence", "trigger", "rationale"],
142
+ required: ["nodeId", "trigger", "rationale"],
113
143
  response: {
114
144
  description: "Confidence modulation result",
115
145
  fields: {
@@ -751,7 +781,7 @@ var RECORD_JUDGMENT = {
751
781
  status: "string \u2014 'issued'"
752
782
  }
753
783
  },
754
- ownerModule: "decision-state",
784
+ ownerModule: "decisions",
755
785
  ontologyPrimitive: "judgment",
756
786
  tier: "showcase"
757
787
  };
@@ -2020,7 +2050,7 @@ var INGEST_OBSERVATION = {
2020
2050
  contextResourceUri: "string"
2021
2051
  }
2022
2052
  },
2023
- ownerModule: "agent-harness",
2053
+ ownerModule: "agent-frameworks",
2024
2054
  ontologyPrimitive: "graph",
2025
2055
  tier: "workhorse"
2026
2056
  };
@@ -2050,7 +2080,7 @@ var GET_OBSERVATION_CONTEXT = {
2050
2080
  generatedAt: "number"
2051
2081
  }
2052
2082
  },
2053
- ownerModule: "agent-harness",
2083
+ ownerModule: "agent-frameworks",
2054
2084
  ontologyPrimitive: "graph",
2055
2085
  tier: "workhorse"
2056
2086
  };
@@ -3548,7 +3578,7 @@ var CREATE_BELIEF_CONDITIONAL = {
3548
3578
  targetBeliefId: "string"
3549
3579
  }
3550
3580
  },
3551
- ownerModule: "graph-primitives",
3581
+ ownerModule: "edges",
3552
3582
  ontologyPrimitive: "edge",
3553
3583
  tier: "sdk-only"
3554
3584
  };