@lucern/contracts 1.0.12 → 1.0.14

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 (81) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/function-registry/beliefs.js +48 -11
  3. package/dist/function-registry/beliefs.js.map +1 -1
  4. package/dist/function-registry/coding.js +46 -9
  5. package/dist/function-registry/coding.js.map +1 -1
  6. package/dist/function-registry/context.js +46 -9
  7. package/dist/function-registry/context.js.map +1 -1
  8. package/dist/function-registry/contracts.js +46 -9
  9. package/dist/function-registry/contracts.js.map +1 -1
  10. package/dist/function-registry/coordination.js +46 -9
  11. package/dist/function-registry/coordination.js.map +1 -1
  12. package/dist/function-registry/edges.js +46 -9
  13. package/dist/function-registry/edges.js.map +1 -1
  14. package/dist/function-registry/evidence.js +227 -25
  15. package/dist/function-registry/evidence.js.map +1 -1
  16. package/dist/function-registry/graph.js +46 -9
  17. package/dist/function-registry/graph.js.map +1 -1
  18. package/dist/function-registry/helpers.js +46 -9
  19. package/dist/function-registry/helpers.js.map +1 -1
  20. package/dist/function-registry/identity.js +46 -9
  21. package/dist/function-registry/identity.js.map +1 -1
  22. package/dist/function-registry/index.js +46 -9
  23. package/dist/function-registry/index.js.map +1 -1
  24. package/dist/function-registry/judgments.js +46 -9
  25. package/dist/function-registry/judgments.js.map +1 -1
  26. package/dist/function-registry/legacy.js +46 -9
  27. package/dist/function-registry/legacy.js.map +1 -1
  28. package/dist/function-registry/lenses.js +46 -9
  29. package/dist/function-registry/lenses.js.map +1 -1
  30. package/dist/function-registry/manifest.d.ts +10 -4
  31. package/dist/function-registry/manifest.js +13 -1
  32. package/dist/function-registry/manifest.js.map +1 -1
  33. package/dist/function-registry/nodes.js +46 -9
  34. package/dist/function-registry/nodes.js.map +1 -1
  35. package/dist/function-registry/ontologies.js +46 -9
  36. package/dist/function-registry/ontologies.js.map +1 -1
  37. package/dist/function-registry/pipeline.js +46 -9
  38. package/dist/function-registry/pipeline.js.map +1 -1
  39. package/dist/function-registry/questions.js +46 -9
  40. package/dist/function-registry/questions.js.map +1 -1
  41. package/dist/function-registry/tasks.js +46 -9
  42. package/dist/function-registry/tasks.js.map +1 -1
  43. package/dist/function-registry/topics.js +46 -9
  44. package/dist/function-registry/topics.js.map +1 -1
  45. package/dist/function-registry/worktrees.js +46 -9
  46. package/dist/function-registry/worktrees.js.map +1 -1
  47. package/dist/index.js +160 -16
  48. package/dist/index.js.map +1 -1
  49. package/dist/manifests/invariants/index.js +24 -5
  50. package/dist/manifests/invariants/index.js.map +1 -1
  51. package/dist/manifests/invariants/inv-1-beliefs-append-only.js +24 -5
  52. package/dist/manifests/invariants/inv-1-beliefs-append-only.js.map +1 -1
  53. package/dist/projections/check-convex-args-shape.js +127 -8
  54. package/dist/projections/check-convex-args-shape.js.map +1 -1
  55. package/dist/projections/create-evidence.projection.d.ts +168 -0
  56. package/dist/projections/create-evidence.projection.js +127 -8
  57. package/dist/projections/create-evidence.projection.js.map +1 -1
  58. package/dist/projections/index.d.ts +28 -0
  59. package/dist/projections/index.js +127 -8
  60. package/dist/projections/index.js.map +1 -1
  61. package/dist/proof-attestation.json +1 -1
  62. package/dist/sdk-methods.contract.d.ts +3 -2
  63. package/dist/sdk-tools.contract.js +33 -8
  64. package/dist/sdk-tools.contract.js.map +1 -1
  65. package/dist/sdk-tools.contract.registry.js +33 -8
  66. package/dist/sdk-tools.contract.registry.js.map +1 -1
  67. package/dist/sdk-tools.contract.values.js +33 -8
  68. package/dist/sdk-tools.contract.values.js.map +1 -1
  69. package/dist/tool-contracts.context-orientation.js +2 -1
  70. package/dist/tool-contracts.context-orientation.js.map +1 -1
  71. package/dist/tool-contracts.intelligence-evidence.js +26 -4
  72. package/dist/tool-contracts.intelligence-evidence.js.map +1 -1
  73. package/dist/tool-contracts.js +33 -8
  74. package/dist/tool-contracts.js.map +1 -1
  75. package/dist/tool-contracts.lifecycle.js +2 -2
  76. package/dist/tool-contracts.lifecycle.js.map +1 -1
  77. package/dist/tool-contracts.questions-listing.js +3 -1
  78. package/dist/tool-contracts.questions-listing.js.map +1 -1
  79. package/dist/tool-contracts.values.js +33 -8
  80. package/dist/tool-contracts.values.js.map +1 -1
  81. package/package.json +1 -1
@@ -5,7 +5,7 @@ import { z } from 'zod';
5
5
  // src/tool-contracts.lifecycle.ts
6
6
  var CREATE_BELIEF = {
7
7
  name: "create_belief",
8
- description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; use modulate_confidence to record the first evidential update.",
8
+ description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; attach supporting or contradicting evidence with create_evidence or link_evidence_to_belief to record evidential updates.",
9
9
  parameters: {
10
10
  canonicalText: {
11
11
  type: "string",
@@ -91,7 +91,7 @@ var REFINE_BELIEF = {
91
91
  };
92
92
  var MODULATE_CONFIDENCE = {
93
93
  name: "modulate_confidence",
94
- 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. Every modulation must cite a truth-bearing artifact: triggeringEvidenceId, triggeringQuestionId, triggeringAnswerId, triggeringContradictionId, or triggeringWorktreeId. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction.",
94
+ description: "Internal-only subjective-logic ledger append. Like `git commit` to the credence log for the scoring engine \u2014 never an operator-facing way to assert confidence. Agents, SDK callers, CLI users, and MCP clients must instead create or link evidence with `evidenceRelation: supports|contradicts`; the kernel derives the next opinion from that evidence. This compatibility primitive is reserved for governed system scoring paths that already hold a full subjective-logic tuple and truth-bearing provenance.",
95
95
  parameters: {
96
96
  nodeId: { type: "string", description: "The belief to score" },
97
97
  belief: {
@@ -1699,10 +1699,11 @@ var LUCERN_ORIENT = {
1699
1699
  workflow: "array - recommended branch -> investigate -> prove gate -> merge workflow",
1700
1700
  grammarMap: "array - primitive-to-git-analogy map for topics, campaigns, worktrees, beliefs, questions, evidence, edges, contradictions, and gates",
1701
1701
  firstMoves: "array - recommended first tools for a cold-start agent",
1702
- receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, and noDefaultGlobalScan",
1702
+ receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, narrativeCoverage, synthesisLints, and noDefaultGlobalScan",
1703
1703
  safetyRules: "array - mutation and completion rules that preserve reasoning lineage",
1704
1704
  toolMap: "array | undefined - situation-to-tool routing map when requested",
1705
1705
  examples: "array | undefined - concrete tool-call examples when requested",
1706
+ futureCapabilities: "array | undefined - exemplar, gauntlet, trace-corpus, and native-model-training capabilities when requested",
1706
1707
  suggestedNextCalls: "array - safe next tool calls for the current situation"
1707
1708
  }
1708
1709
  },
@@ -1865,7 +1866,7 @@ var SEARCH_EVIDENCE = {
1865
1866
  };
1866
1867
  var CREATE_EVIDENCE = {
1867
1868
  name: "create_evidence",
1868
- description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs. Optionally links the evidence to a belief or question in the same operation.",
1869
+ description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs. Optionally links the evidence to a belief or question in the same operation. When evidence bears on beliefs, state whether it supports or contradicts; SL confidence is derived from these evidence relations.",
1869
1870
  parameters: {
1870
1871
  topicId: { type: "string", description: "Topic scope" },
1871
1872
  text: { type: "string", description: "Canonical evidence text" },
@@ -1876,7 +1877,20 @@ var CREATE_EVIDENCE = {
1876
1877
  },
1877
1878
  weight: {
1878
1879
  type: "number",
1879
- description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
1880
+ description: "Optional support weight: -1.0 (contradicts) to +1.0 (supports). If omitted, evidenceRelation + confidence determine the weight."
1881
+ },
1882
+ evidenceRelation: {
1883
+ type: "string",
1884
+ enum: ["supports", "contradicts"],
1885
+ description: "Canonical relation to targetId/linkedBeliefNodeId. Prefer this over relying on signed weight inference."
1886
+ },
1887
+ confidence: {
1888
+ type: "number",
1889
+ description: "Confidence in the evidence relation, 0.0 to 1.0"
1890
+ },
1891
+ beliefRelations: {
1892
+ type: "array",
1893
+ description: "Optional additional belief relations: [{ beliefId|beliefNodeId|targetId, evidenceRelation|relation, confidence?, weight?, rationale? }]. Use one evidence node with multiple relations when the same fact supports or contradicts several beliefs."
1880
1894
  },
1881
1895
  metadata: {
1882
1896
  type: "object",
@@ -1986,7 +2000,7 @@ var LINK_EVIDENCE = {
1986
2000
  };
1987
2001
  var LINK_EVIDENCE_TO_BELIEF = {
1988
2002
  name: "link_evidence_to_belief",
1989
- description: "Link evidence to a belief with a support weight. Like `git add` \u2014 stages evidence in support of (or against) a belief. The weight ranges from -1.0 (strongly contradicts) to +1.0 (strongly supports).",
2003
+ description: "Link evidence to a belief with a support weight. Like `git add` \u2014 stages evidence in support of (or against) a belief. The weight ranges from -1.0 (strongly contradicts) to +1.0 (strongly supports). This relation appends to the SL confidence ledger; do not hand-write confidence separately.",
1990
2004
  parameters: {
1991
2005
  evidenceId: { type: "string", description: "The evidence node ID" },
1992
2006
  beliefId: { type: "string", description: "The belief node ID" },
@@ -1994,9 +2008,18 @@ var LINK_EVIDENCE_TO_BELIEF = {
1994
2008
  type: "number",
1995
2009
  description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
1996
2010
  },
2011
+ evidenceRelation: {
2012
+ type: "string",
2013
+ enum: ["supports", "contradicts"],
2014
+ description: "Canonical semantic relation. If omitted, the sign of weight is used."
2015
+ },
2016
+ confidence: {
2017
+ type: "number",
2018
+ description: "Confidence in this evidence-to-belief relation, 0.0 to 1.0"
2019
+ },
1997
2020
  rationale: { type: "string", description: "Why this evidence is relevant" }
1998
2021
  },
1999
- required: ["evidenceId", "beliefId", "weight"],
2022
+ required: ["evidenceId", "beliefId"],
2000
2023
  response: {
2001
2024
  description: "The created edge linking evidence to belief",
2002
2025
  fields: {
@@ -2824,7 +2847,9 @@ var COMPILE_CONTEXT = {
2824
2847
  recentEvidence: "array \u2014 recent evidence ranked for this query",
2825
2848
  contradictions: "array \u2014 unresolved contradiction records",
2826
2849
  relatedEntities: "array | undefined \u2014 ranked ontological entities in scope",
2827
- contextNarrative: "array \u2014 guidance for prompt assembly",
2850
+ contextNarrative: "array \u2014 ordered synthesis blocks with kind/text, starting with executive_summary and canonical narrative blocks before raw objects",
2851
+ retrievalReceipt: "object \u2014 candidateCounts, coverageWarning, narrativeCoverage, synthesisLints, and suggestedNextActions",
2852
+ narrativeCoverage: "object \u2014 recordsSynthesized, recordsNamed, recordsOmitted, and blocksEmitted for the narrative",
2828
2853
  injectionPolicy: "object \u2014 token-budgeted section selections",
2829
2854
  diagnostics: "object \u2014 scoring and utilization telemetry"
2830
2855
  }
@@ -4772,6 +4797,12 @@ var internalSystem = {
4772
4797
  mcp: "internal",
4773
4798
  cli: "internal"
4774
4799
  };
4800
+ var internalSdkRestOnly = {
4801
+ sdk: "internal",
4802
+ rest: "internal",
4803
+ mcp: "none",
4804
+ cli: "none"
4805
+ };
4775
4806
  var publicWithInternalMcp = {
4776
4807
  sdk: "public",
4777
4808
  rest: "public",
@@ -4821,7 +4852,6 @@ var MCP_CORE_OPERATION_NAMES = [
4821
4852
  "get_belief",
4822
4853
  "list_beliefs",
4823
4854
  "refine_belief",
4824
- "modulate_confidence",
4825
4855
  "fork_belief",
4826
4856
  "archive_belief",
4827
4857
  "search_beliefs",
@@ -5089,6 +5119,13 @@ var LUCERN_OPERATION_MANIFEST = {
5089
5119
  internalSystem,
5090
5120
  "Lucern system/background operation. Available to platform code paths, hidden from public MCP discovery."
5091
5121
  ),
5122
+ modulate_confidence: {
5123
+ name: "modulate_confidence",
5124
+ surfaceClass: "platform_internal",
5125
+ surfaceIntent: "system",
5126
+ surfaces: internalSdkRestOnly,
5127
+ rationale: "Internal SL ledger append primitive. Public callers attach evidence or contradiction relations; confidence is derived algorithmically."
5128
+ },
5092
5129
  ...entries(
5093
5130
  LEGACY_COMPAT_OPERATION_NAMES,
5094
5131
  "legacy_compat",