@lucern/events 1.0.11 → 1.0.13
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.js +337 -50
- package/dist/index.js.map +1 -1
- package/dist/outbox.js +337 -50
- package/dist/outbox.js.map +1 -1
- package/dist/proof-attestation.json +1 -1
- package/dist/types.js +337 -50
- package/dist/types.js.map +1 -1
- package/dist/webhook-delivery-machine.js +337 -50
- package/dist/webhook-delivery-machine.js.map +1 -1
- package/dist/webhooks.js +337 -50
- package/dist/webhooks.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -572,7 +572,7 @@ var SEARCH_EVIDENCE = {
|
|
|
572
572
|
};
|
|
573
573
|
var CREATE_EVIDENCE = {
|
|
574
574
|
name: "create_evidence",
|
|
575
|
-
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.",
|
|
575
|
+
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.",
|
|
576
576
|
parameters: {
|
|
577
577
|
topicId: { type: "string", description: "Topic scope" },
|
|
578
578
|
text: { type: "string", description: "Canonical evidence text" },
|
|
@@ -583,7 +583,20 @@ var CREATE_EVIDENCE = {
|
|
|
583
583
|
},
|
|
584
584
|
weight: {
|
|
585
585
|
type: "number",
|
|
586
|
-
description: "
|
|
586
|
+
description: "Optional support weight: -1.0 (contradicts) to +1.0 (supports). If omitted, evidenceRelation + confidence determine the weight."
|
|
587
|
+
},
|
|
588
|
+
evidenceRelation: {
|
|
589
|
+
type: "string",
|
|
590
|
+
enum: ["supports", "contradicts"],
|
|
591
|
+
description: "Canonical relation to targetId/linkedBeliefNodeId. Prefer this over relying on signed weight inference."
|
|
592
|
+
},
|
|
593
|
+
confidence: {
|
|
594
|
+
type: "number",
|
|
595
|
+
description: "Confidence in the evidence relation, 0.0 to 1.0"
|
|
596
|
+
},
|
|
597
|
+
beliefRelations: {
|
|
598
|
+
type: "array",
|
|
599
|
+
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."
|
|
587
600
|
},
|
|
588
601
|
metadata: {
|
|
589
602
|
type: "object",
|
|
@@ -693,7 +706,7 @@ var LINK_EVIDENCE = {
|
|
|
693
706
|
};
|
|
694
707
|
var LINK_EVIDENCE_TO_BELIEF = {
|
|
695
708
|
name: "link_evidence_to_belief",
|
|
696
|
-
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).",
|
|
709
|
+
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.",
|
|
697
710
|
parameters: {
|
|
698
711
|
evidenceId: { type: "string", description: "The evidence node ID" },
|
|
699
712
|
beliefId: { type: "string", description: "The belief node ID" },
|
|
@@ -701,9 +714,18 @@ var LINK_EVIDENCE_TO_BELIEF = {
|
|
|
701
714
|
type: "number",
|
|
702
715
|
description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
|
|
703
716
|
},
|
|
717
|
+
evidenceRelation: {
|
|
718
|
+
type: "string",
|
|
719
|
+
enum: ["supports", "contradicts"],
|
|
720
|
+
description: "Canonical semantic relation. If omitted, the sign of weight is used."
|
|
721
|
+
},
|
|
722
|
+
confidence: {
|
|
723
|
+
type: "number",
|
|
724
|
+
description: "Confidence in this evidence-to-belief relation, 0.0 to 1.0"
|
|
725
|
+
},
|
|
704
726
|
rationale: { type: "string", description: "Why this evidence is relevant" }
|
|
705
727
|
},
|
|
706
|
-
required: ["evidenceId", "beliefId"
|
|
728
|
+
required: ["evidenceId", "beliefId"],
|
|
707
729
|
response: {
|
|
708
730
|
description: "The created edge linking evidence to belief",
|
|
709
731
|
fields: {
|
|
@@ -721,7 +743,7 @@ var LINK_EVIDENCE_TO_BELIEF = {
|
|
|
721
743
|
// ../contracts/src/tool-contracts.lifecycle.ts
|
|
722
744
|
var CREATE_BELIEF = {
|
|
723
745
|
name: "create_belief",
|
|
724
|
-
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)`;
|
|
746
|
+
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.",
|
|
725
747
|
parameters: {
|
|
726
748
|
canonicalText: {
|
|
727
749
|
type: "string",
|
|
@@ -807,7 +829,7 @@ var REFINE_BELIEF = {
|
|
|
807
829
|
};
|
|
808
830
|
var MODULATE_CONFIDENCE = {
|
|
809
831
|
name: "modulate_confidence",
|
|
810
|
-
description: "
|
|
832
|
+
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.",
|
|
811
833
|
parameters: {
|
|
812
834
|
nodeId: { type: "string", description: "The belief to score" },
|
|
813
835
|
belief: {
|
|
@@ -1456,6 +1478,60 @@ var REMOVE_LENS_FROM_TOPIC = {
|
|
|
1456
1478
|
tier: "workhorse"
|
|
1457
1479
|
};
|
|
1458
1480
|
|
|
1481
|
+
// ../contracts/src/tool-contracts.context-orientation.ts
|
|
1482
|
+
var LUCERN_ORIENT = {
|
|
1483
|
+
name: "lucern_orient",
|
|
1484
|
+
description: "Load the Lucern reasoning grammar before operating. Like `git help` plus a repository CONTRIBUTING guide for reasoning state - teaches the git-shaped model of topics, campaigns, lanes, worktrees, beliefs, questions, evidence, receipts, gates, and merges.",
|
|
1485
|
+
parameters: {
|
|
1486
|
+
audience: {
|
|
1487
|
+
type: "string",
|
|
1488
|
+
description: "Audience for the primer: agent, human, operator, or developer.",
|
|
1489
|
+
enum: ["agent", "human", "operator", "developer"]
|
|
1490
|
+
},
|
|
1491
|
+
depth: {
|
|
1492
|
+
type: "string",
|
|
1493
|
+
description: "Orientation depth: quick, standard, or deep.",
|
|
1494
|
+
enum: ["quick", "standard", "deep"]
|
|
1495
|
+
},
|
|
1496
|
+
situation: {
|
|
1497
|
+
type: "string",
|
|
1498
|
+
description: "Optional task or query context used to tailor suggested next calls."
|
|
1499
|
+
},
|
|
1500
|
+
includeExamples: {
|
|
1501
|
+
type: "boolean",
|
|
1502
|
+
description: "Whether to include concrete tool-call examples."
|
|
1503
|
+
},
|
|
1504
|
+
includeToolMap: {
|
|
1505
|
+
type: "boolean",
|
|
1506
|
+
description: "Whether to include situation-to-tool routing guidance."
|
|
1507
|
+
},
|
|
1508
|
+
includeFuture: {
|
|
1509
|
+
type: "boolean",
|
|
1510
|
+
description: "Whether to include future exemplar, gauntlet, and training-data capabilities."
|
|
1511
|
+
}
|
|
1512
|
+
},
|
|
1513
|
+
required: [],
|
|
1514
|
+
response: {
|
|
1515
|
+
description: "Canonical operator primer for Lucern's git-shaped reasoning substrate.",
|
|
1516
|
+
fields: {
|
|
1517
|
+
schemaVersion: "string - lucern_orientation.v1",
|
|
1518
|
+
canonicalMentalModel: "object - concise model of Lucern as git-shaped reasoning state",
|
|
1519
|
+
workflow: "array - recommended branch -> investigate -> prove gate -> merge workflow",
|
|
1520
|
+
grammarMap: "array - primitive-to-git-analogy map for topics, campaigns, worktrees, beliefs, questions, evidence, edges, contradictions, and gates",
|
|
1521
|
+
firstMoves: "array - recommended first tools for a cold-start agent",
|
|
1522
|
+
receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, narrativeCoverage, synthesisLints, and noDefaultGlobalScan",
|
|
1523
|
+
safetyRules: "array - mutation and completion rules that preserve reasoning lineage",
|
|
1524
|
+
toolMap: "array | undefined - situation-to-tool routing map when requested",
|
|
1525
|
+
examples: "array | undefined - concrete tool-call examples when requested",
|
|
1526
|
+
futureCapabilities: "array | undefined - exemplar, gauntlet, trace-corpus, and native-model-training capabilities when requested",
|
|
1527
|
+
suggestedNextCalls: "array - safe next tool calls for the current situation"
|
|
1528
|
+
}
|
|
1529
|
+
},
|
|
1530
|
+
ownerModule: "reasoning-kernel",
|
|
1531
|
+
ontologyPrimitive: "graph",
|
|
1532
|
+
tier: "showcase"
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1459
1535
|
// ../contracts/src/tool-contracts.ontology.ts
|
|
1460
1536
|
var MANAGE_WRITE_POLICY = {
|
|
1461
1537
|
name: "manage_write_policy",
|
|
@@ -3965,10 +4041,34 @@ var COMPILE_CONTEXT = {
|
|
|
3965
4041
|
type: "string",
|
|
3966
4042
|
description: "Optional source kind used as a resolver signal, such as cli, worktree, commit, or docs."
|
|
3967
4043
|
},
|
|
4044
|
+
campaign: {
|
|
4045
|
+
type: "number",
|
|
4046
|
+
description: "Optional campaign dimension seed. When supplied without topicId, the compiler fans out across all carrier topics for that campaign instead of resolving a single topic."
|
|
4047
|
+
},
|
|
4048
|
+
lane: {
|
|
4049
|
+
type: "string",
|
|
4050
|
+
description: "Optional lane dimension seed. When supplied without topicId, the compiler reads all matching worktrees and their carrier topics."
|
|
4051
|
+
},
|
|
4052
|
+
status: {
|
|
4053
|
+
type: "string",
|
|
4054
|
+
description: "Optional state/status dimension seed for worktrees and graph rows."
|
|
4055
|
+
},
|
|
4056
|
+
principalId: {
|
|
4057
|
+
type: "string",
|
|
4058
|
+
description: "Optional principal seed for work authored, touched, or owned by a human, agent, group, or service principal."
|
|
4059
|
+
},
|
|
4060
|
+
workspaceId: {
|
|
4061
|
+
type: "string",
|
|
4062
|
+
description: "Optional workspace seed used by hosted MCP and SDK clients when compiling tenant-scoped context."
|
|
4063
|
+
},
|
|
3968
4064
|
budget: {
|
|
3969
4065
|
type: "number",
|
|
3970
4066
|
description: "Token budget for prompt injection planning"
|
|
3971
4067
|
},
|
|
4068
|
+
tokenBudget: {
|
|
4069
|
+
type: "number",
|
|
4070
|
+
description: "Compatibility alias for budget. External MCP clients may send tokenBudget when requesting prompt injection planning."
|
|
4071
|
+
},
|
|
3972
4072
|
ranking: {
|
|
3973
4073
|
type: "string",
|
|
3974
4074
|
description: "Ranking profile for context ordering",
|
|
@@ -4004,7 +4104,9 @@ var COMPILE_CONTEXT = {
|
|
|
4004
4104
|
recentEvidence: "array \u2014 recent evidence ranked for this query",
|
|
4005
4105
|
contradictions: "array \u2014 unresolved contradiction records",
|
|
4006
4106
|
relatedEntities: "array | undefined \u2014 ranked ontological entities in scope",
|
|
4007
|
-
contextNarrative: "array \u2014
|
|
4107
|
+
contextNarrative: "array \u2014 ordered synthesis blocks with kind/text, starting with executive_summary and canonical narrative blocks before raw objects",
|
|
4108
|
+
retrievalReceipt: "object \u2014 candidateCounts, coverageWarning, narrativeCoverage, synthesisLints, and suggestedNextActions",
|
|
4109
|
+
narrativeCoverage: "object \u2014 recordsSynthesized, recordsNamed, recordsOmitted, and blocksEmitted for the narrative",
|
|
4008
4110
|
injectionPolicy: "object \u2014 token-budgeted section selections",
|
|
4009
4111
|
diagnostics: "object \u2014 scoring and utilization telemetry"
|
|
4010
4112
|
}
|
|
@@ -4659,6 +4761,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
4659
4761
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
4660
4762
|
identity_whoami: IDENTITY_WHOAMI,
|
|
4661
4763
|
resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
|
|
4764
|
+
lucern_orient: LUCERN_ORIENT,
|
|
4662
4765
|
compile_context: COMPILE_CONTEXT,
|
|
4663
4766
|
record_scope_learning: RECORD_SCOPE_LEARNING,
|
|
4664
4767
|
pipeline_snapshot: PIPELINE_SNAPSHOT,
|
|
@@ -10504,6 +10607,20 @@ async function emitDomainEvent(invokeMutation, input) {
|
|
|
10504
10607
|
return await invokeMutation("events:recordEvent", input);
|
|
10505
10608
|
}
|
|
10506
10609
|
|
|
10610
|
+
// ../contracts/src/ids.contract.ts
|
|
10611
|
+
var PREFIXED_ID_PATTERN = /^([a-z][a-z0-9]*)_(.+)$/;
|
|
10612
|
+
function decodePrefixedId(id) {
|
|
10613
|
+
const normalized = id.trim();
|
|
10614
|
+
const match = PREFIXED_ID_PATTERN.exec(normalized);
|
|
10615
|
+
if (!match) {
|
|
10616
|
+
throw new Error(`Invalid prefixed ID: ${id}`);
|
|
10617
|
+
}
|
|
10618
|
+
return {
|
|
10619
|
+
prefix: match[1],
|
|
10620
|
+
value: match[2]
|
|
10621
|
+
};
|
|
10622
|
+
}
|
|
10623
|
+
|
|
10507
10624
|
// ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
|
|
10508
10625
|
var NODE_TYPES = [
|
|
10509
10626
|
"decision",
|
|
@@ -11619,6 +11736,23 @@ function defineProjection(def) {
|
|
|
11619
11736
|
|
|
11620
11737
|
// ../contracts/src/projections/create-evidence.projection.ts
|
|
11621
11738
|
var jsonRecordSchema = z.record(z.unknown());
|
|
11739
|
+
var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
|
|
11740
|
+
var evidenceRelationAliasSchema = z.enum([
|
|
11741
|
+
"supports",
|
|
11742
|
+
"contradicts",
|
|
11743
|
+
"supporting",
|
|
11744
|
+
"contradicting"
|
|
11745
|
+
]);
|
|
11746
|
+
var beliefRelationSchema = z.object({
|
|
11747
|
+
beliefId: z.string().optional(),
|
|
11748
|
+
beliefNodeId: z.string().optional(),
|
|
11749
|
+
targetId: z.string().optional(),
|
|
11750
|
+
relation: evidenceRelationAliasSchema.optional(),
|
|
11751
|
+
evidenceRelation: evidenceRelationSchema.optional(),
|
|
11752
|
+
confidence: z.number().optional(),
|
|
11753
|
+
weight: z.number().optional(),
|
|
11754
|
+
rationale: z.string().optional()
|
|
11755
|
+
});
|
|
11622
11756
|
var createEvidenceInputSchemaBase = z.object({
|
|
11623
11757
|
projectId: z.string().optional(),
|
|
11624
11758
|
topicId: z.string().optional(),
|
|
@@ -11640,7 +11774,8 @@ var createEvidenceInputSchemaBase = z.object({
|
|
|
11640
11774
|
targetId: z.string().optional(),
|
|
11641
11775
|
targetNodeId: z.string().optional(),
|
|
11642
11776
|
linkedBeliefNodeId: z.string().optional(),
|
|
11643
|
-
evidenceRelation:
|
|
11777
|
+
evidenceRelation: evidenceRelationSchema.optional(),
|
|
11778
|
+
beliefRelations: z.array(beliefRelationSchema).optional(),
|
|
11644
11779
|
confidence: z.number().optional(),
|
|
11645
11780
|
weight: z.number().optional(),
|
|
11646
11781
|
reasoning: z.string().optional(),
|
|
@@ -11666,15 +11801,103 @@ function isRecord(value) {
|
|
|
11666
11801
|
function recordValue(value) {
|
|
11667
11802
|
return isRecord(value) ? value : {};
|
|
11668
11803
|
}
|
|
11804
|
+
function normalizeTopicIdForKernel(topicId) {
|
|
11805
|
+
const normalized = topicId?.trim();
|
|
11806
|
+
if (!normalized) {
|
|
11807
|
+
return void 0;
|
|
11808
|
+
}
|
|
11809
|
+
try {
|
|
11810
|
+
const decoded = decodePrefixedId(normalized);
|
|
11811
|
+
return decoded.prefix === "top" ? decoded.value : normalized;
|
|
11812
|
+
} catch {
|
|
11813
|
+
return normalized;
|
|
11814
|
+
}
|
|
11815
|
+
}
|
|
11816
|
+
function normalizeWorktreeId(value) {
|
|
11817
|
+
const normalized = value?.trim();
|
|
11818
|
+
if (!normalized) {
|
|
11819
|
+
return void 0;
|
|
11820
|
+
}
|
|
11821
|
+
if (normalized.startsWith("wt_")) {
|
|
11822
|
+
return normalized.slice("wt_".length);
|
|
11823
|
+
}
|
|
11824
|
+
return normalized;
|
|
11825
|
+
}
|
|
11826
|
+
function targetKind(targetId) {
|
|
11827
|
+
const normalized = targetId?.trim();
|
|
11828
|
+
if (!normalized) {
|
|
11829
|
+
return "unknown";
|
|
11830
|
+
}
|
|
11831
|
+
if (normalized.startsWith("wt_") || /^tn[a-z0-9]+$/i.test(normalized)) {
|
|
11832
|
+
return "worktree";
|
|
11833
|
+
}
|
|
11834
|
+
if (normalized.startsWith("que_")) {
|
|
11835
|
+
return "question";
|
|
11836
|
+
}
|
|
11837
|
+
if (normalized.startsWith("bel_")) {
|
|
11838
|
+
return "belief";
|
|
11839
|
+
}
|
|
11840
|
+
return "unknown";
|
|
11841
|
+
}
|
|
11842
|
+
function normalizeRelation(value, weight) {
|
|
11843
|
+
if (value === "supports" || value === "supporting") {
|
|
11844
|
+
return "supports";
|
|
11845
|
+
}
|
|
11846
|
+
if (value === "contradicts" || value === "contradicting") {
|
|
11847
|
+
return "contradicts";
|
|
11848
|
+
}
|
|
11849
|
+
if (weight === void 0) {
|
|
11850
|
+
return void 0;
|
|
11851
|
+
}
|
|
11852
|
+
return weight < 0 ? "contradicts" : "supports";
|
|
11853
|
+
}
|
|
11854
|
+
function normalizeConfidence(confidence, weight) {
|
|
11855
|
+
if (confidence !== void 0) {
|
|
11856
|
+
return Math.min(1, Math.max(0, confidence));
|
|
11857
|
+
}
|
|
11858
|
+
if (weight === void 0) {
|
|
11859
|
+
return void 0;
|
|
11860
|
+
}
|
|
11861
|
+
return Math.min(1, Math.max(0, Math.abs(weight)));
|
|
11862
|
+
}
|
|
11863
|
+
function normalizeBeliefRelation(relation) {
|
|
11864
|
+
const beliefNodeId = relation.beliefNodeId ?? relation.beliefId ?? relation.targetId;
|
|
11865
|
+
if (!beliefNodeId) {
|
|
11866
|
+
return void 0;
|
|
11867
|
+
}
|
|
11868
|
+
const weight = typeof relation.weight === "number" ? relation.weight : void 0;
|
|
11869
|
+
const evidenceRelation = normalizeRelation(
|
|
11870
|
+
relation.evidenceRelation ?? relation.relation,
|
|
11871
|
+
weight
|
|
11872
|
+
);
|
|
11873
|
+
if (!evidenceRelation) {
|
|
11874
|
+
return void 0;
|
|
11875
|
+
}
|
|
11876
|
+
return compactRecord({
|
|
11877
|
+
beliefNodeId,
|
|
11878
|
+
relation: evidenceRelation,
|
|
11879
|
+
confidence: normalizeConfidence(relation.confidence, weight),
|
|
11880
|
+
rationale: relation.rationale
|
|
11881
|
+
});
|
|
11882
|
+
}
|
|
11669
11883
|
var createEvidenceProjection = defineProjection({
|
|
11670
11884
|
contractName: "create_evidence",
|
|
11671
11885
|
inputSchema: createEvidenceInputSchema,
|
|
11672
11886
|
project: (input) => {
|
|
11673
11887
|
const text = input.text ?? input.canonicalText;
|
|
11674
11888
|
const weight = typeof input.weight === "number" ? input.weight : void 0;
|
|
11889
|
+
const target = input.targetId ?? input.targetNodeId;
|
|
11890
|
+
const kind = targetKind(target);
|
|
11891
|
+
const linkedWorktreeId = kind === "worktree" ? normalizeWorktreeId(target) : void 0;
|
|
11892
|
+
const linkedBeliefNodeId = input.linkedBeliefNodeId ?? (kind === "belief" || kind === "unknown" ? input.targetNodeId ?? input.targetId : void 0);
|
|
11893
|
+
const evidenceRelation = linkedBeliefNodeId ? normalizeRelation(input.evidenceRelation, weight) : void 0;
|
|
11894
|
+
const confidence = evidenceRelation ? normalizeConfidence(input.confidence, weight) : void 0;
|
|
11895
|
+
const beliefRelations = input.beliefRelations?.map(normalizeBeliefRelation).filter(
|
|
11896
|
+
(relation) => relation !== void 0
|
|
11897
|
+
);
|
|
11675
11898
|
return compactRecord({
|
|
11676
11899
|
projectId: input.projectId,
|
|
11677
|
-
topicId: input.topicId,
|
|
11900
|
+
topicId: normalizeTopicIdForKernel(input.topicId),
|
|
11678
11901
|
text,
|
|
11679
11902
|
title: input.title ?? text,
|
|
11680
11903
|
content: input.content ?? text,
|
|
@@ -11693,13 +11916,16 @@ var createEvidenceProjection = defineProjection({
|
|
|
11693
11916
|
source: input.source,
|
|
11694
11917
|
targetId: input.targetId,
|
|
11695
11918
|
targetNodeId: input.targetNodeId,
|
|
11919
|
+
targetKind: kind === "unknown" ? void 0 : kind,
|
|
11920
|
+
linkedWorktreeId,
|
|
11696
11921
|
weight,
|
|
11697
11922
|
reasoning: input.reasoning,
|
|
11698
11923
|
rationale: input.rationale
|
|
11699
11924
|
}),
|
|
11700
|
-
linkedBeliefNodeId
|
|
11701
|
-
evidenceRelation
|
|
11702
|
-
confidence
|
|
11925
|
+
linkedBeliefNodeId,
|
|
11926
|
+
evidenceRelation,
|
|
11927
|
+
confidence,
|
|
11928
|
+
beliefRelations: beliefRelations && beliefRelations.length > 0 ? beliefRelations : void 0,
|
|
11703
11929
|
rationale: input.rationale,
|
|
11704
11930
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
11705
11931
|
});
|
|
@@ -11728,6 +11954,16 @@ var createEvidenceProjection = defineProjection({
|
|
|
11728
11954
|
v.literal("contradicts")
|
|
11729
11955
|
)
|
|
11730
11956
|
),
|
|
11957
|
+
beliefRelations: v.optional(
|
|
11958
|
+
v.array(
|
|
11959
|
+
v.object({
|
|
11960
|
+
beliefNodeId: v.string(),
|
|
11961
|
+
relation: v.union(v.literal("supports"), v.literal("contradicts")),
|
|
11962
|
+
confidence: v.optional(v.number()),
|
|
11963
|
+
rationale: v.optional(v.string())
|
|
11964
|
+
})
|
|
11965
|
+
)
|
|
11966
|
+
),
|
|
11731
11967
|
confidence: v.optional(v.number()),
|
|
11732
11968
|
rationale: v.string(),
|
|
11733
11969
|
trustedBypassAccessCheck: v.optional(v.boolean())
|
|
@@ -11961,6 +12197,12 @@ var internalSystem = {
|
|
|
11961
12197
|
mcp: "internal",
|
|
11962
12198
|
cli: "internal"
|
|
11963
12199
|
};
|
|
12200
|
+
var internalSdkRestOnly = {
|
|
12201
|
+
sdk: "internal",
|
|
12202
|
+
rest: "internal",
|
|
12203
|
+
mcp: "none",
|
|
12204
|
+
cli: "none"
|
|
12205
|
+
};
|
|
11964
12206
|
var publicWithInternalMcp = {
|
|
11965
12207
|
sdk: "public",
|
|
11966
12208
|
rest: "public",
|
|
@@ -12000,6 +12242,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
|
|
|
12000
12242
|
);
|
|
12001
12243
|
}
|
|
12002
12244
|
var MCP_CORE_OPERATION_NAMES = [
|
|
12245
|
+
"lucern_orient",
|
|
12003
12246
|
"compile_context",
|
|
12004
12247
|
"identity_whoami",
|
|
12005
12248
|
"resolve_interactive_principal",
|
|
@@ -12009,7 +12252,6 @@ var MCP_CORE_OPERATION_NAMES = [
|
|
|
12009
12252
|
"get_belief",
|
|
12010
12253
|
"list_beliefs",
|
|
12011
12254
|
"refine_belief",
|
|
12012
|
-
"modulate_confidence",
|
|
12013
12255
|
"fork_belief",
|
|
12014
12256
|
"archive_belief",
|
|
12015
12257
|
"search_beliefs",
|
|
@@ -12277,6 +12519,13 @@ var LUCERN_OPERATION_MANIFEST = {
|
|
|
12277
12519
|
internalSystem,
|
|
12278
12520
|
"Lucern system/background operation. Available to platform code paths, hidden from public MCP discovery."
|
|
12279
12521
|
),
|
|
12522
|
+
modulate_confidence: {
|
|
12523
|
+
name: "modulate_confidence",
|
|
12524
|
+
surfaceClass: "platform_internal",
|
|
12525
|
+
surfaceIntent: "system",
|
|
12526
|
+
surfaces: internalSdkRestOnly,
|
|
12527
|
+
rationale: "Internal SL ledger append primitive. Public callers attach evidence or contradiction relations; confidence is derived algorithmically."
|
|
12528
|
+
},
|
|
12280
12529
|
...entries(
|
|
12281
12530
|
LEGACY_COMPAT_OPERATION_NAMES,
|
|
12282
12531
|
"legacy_compat",
|
|
@@ -12628,6 +12877,14 @@ var observationContextArgs = z.object({
|
|
|
12628
12877
|
limit: z.number().optional().describe("Maximum observations to return."),
|
|
12629
12878
|
status: z.string().optional().describe("Observation status filter.")
|
|
12630
12879
|
});
|
|
12880
|
+
var lucernOrientArgs = z.object({
|
|
12881
|
+
audience: z.enum(["agent", "human", "operator", "developer"]).optional().describe("Audience for the orientation primer."),
|
|
12882
|
+
depth: z.enum(["quick", "standard", "deep"]).optional().describe("How much orientation detail to include."),
|
|
12883
|
+
situation: z.string().optional().describe("Optional task or query context for suggested next calls."),
|
|
12884
|
+
includeExamples: z.boolean().optional().describe("Include concrete tool-call examples."),
|
|
12885
|
+
includeToolMap: z.boolean().optional().describe("Include situation-to-tool routing guidance."),
|
|
12886
|
+
includeFuture: z.boolean().optional().describe("Include future training and pedagogy capabilities.")
|
|
12887
|
+
});
|
|
12631
12888
|
function isRecord2(value) {
|
|
12632
12889
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
12633
12890
|
}
|
|
@@ -12655,6 +12912,20 @@ var observationInput = (input, context) => withUserId(
|
|
|
12655
12912
|
context
|
|
12656
12913
|
);
|
|
12657
12914
|
var contextContracts = [
|
|
12915
|
+
surfaceContract({
|
|
12916
|
+
name: "lucern_orient",
|
|
12917
|
+
kind: "query",
|
|
12918
|
+
domain: "context",
|
|
12919
|
+
surfaceClass: "platform_public",
|
|
12920
|
+
path: "/context/orient",
|
|
12921
|
+
sdkNamespace: "context",
|
|
12922
|
+
sdkMethod: "lucernOrient",
|
|
12923
|
+
summary: "Return the canonical Lucern operator orientation primer.",
|
|
12924
|
+
gateway: {
|
|
12925
|
+
handler: "context.lucernOrient"
|
|
12926
|
+
},
|
|
12927
|
+
args: lucernOrientArgs
|
|
12928
|
+
}),
|
|
12658
12929
|
surfaceContract({
|
|
12659
12930
|
name: "compile_context",
|
|
12660
12931
|
kind: "query",
|
|
@@ -12958,11 +13229,11 @@ var beliefsContracts = [
|
|
|
12958
13229
|
name: "modulate_confidence",
|
|
12959
13230
|
kind: "mutation",
|
|
12960
13231
|
domain: "beliefs",
|
|
12961
|
-
surfaceClass: "
|
|
13232
|
+
surfaceClass: "platform_internal",
|
|
12962
13233
|
path: "/beliefs/confidence",
|
|
12963
13234
|
sdkNamespace: "beliefs",
|
|
12964
13235
|
sdkMethod: "modulateConfidence",
|
|
12965
|
-
summary: "
|
|
13236
|
+
summary: "Internal SL ledger append. Public callers should attach evidence or contradiction relations instead.",
|
|
12966
13237
|
convex: {
|
|
12967
13238
|
module: "beliefs",
|
|
12968
13239
|
functionName: "modulateConfidence",
|
|
@@ -13068,15 +13339,28 @@ var beliefsContracts = [
|
|
|
13068
13339
|
})
|
|
13069
13340
|
];
|
|
13070
13341
|
var jsonRecordSchema4 = z.record(z.unknown());
|
|
13071
|
-
var
|
|
13342
|
+
var evidenceRelationSchema2 = z.enum(["supports", "contradicts"]);
|
|
13343
|
+
var beliefRelationSchema2 = z.object({
|
|
13344
|
+
beliefId: z.string().optional().describe("Belief ID this evidence bears on."),
|
|
13345
|
+
beliefNodeId: z.string().optional().describe("Belief node ID this evidence bears on."),
|
|
13346
|
+
targetId: z.string().optional().describe("Belief target ID alias for beliefId/beliefNodeId."),
|
|
13347
|
+
relation: z.enum(["supports", "contradicts", "supporting", "contradicting"]).optional().describe("Relation alias for how the evidence bears on the belief."),
|
|
13348
|
+
evidenceRelation: evidenceRelationSchema2.optional().describe("Canonical relation: supports or contradicts."),
|
|
13349
|
+
confidence: z.number().optional().describe("Confidence in this evidence-to-belief relation."),
|
|
13350
|
+
weight: z.number().optional().describe("Support weight from -1.0 to +1.0 for this belief."),
|
|
13351
|
+
rationale: z.string().optional().describe("Why this relation exists.")
|
|
13352
|
+
});
|
|
13072
13353
|
var createEvidenceArgs = z.object({
|
|
13073
13354
|
topicId: z.string().optional().describe("Topic scope for the evidence."),
|
|
13074
13355
|
text: z.string().describe("Canonical evidence text."),
|
|
13075
13356
|
source: z.string().optional().describe("Source URL or source label."),
|
|
13076
13357
|
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
13077
|
-
targetId: z.string().optional().describe("Belief or
|
|
13358
|
+
targetId: z.string().optional().describe("Belief, question, or worktree identifier to link or preserve on the evidence record."),
|
|
13078
13359
|
linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
|
|
13079
|
-
evidenceRelation:
|
|
13360
|
+
evidenceRelation: evidenceRelationSchema2.optional().describe("How the evidence relates to the linked belief."),
|
|
13361
|
+
beliefRelations: z.array(beliefRelationSchema2).optional().describe(
|
|
13362
|
+
"Additional belief relations for one evidence record. Use when the same evidence supports or contradicts multiple beliefs."
|
|
13363
|
+
),
|
|
13080
13364
|
confidence: z.number().optional().describe("Confidence in the evidence relation."),
|
|
13081
13365
|
weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
|
|
13082
13366
|
metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
|
|
@@ -13107,11 +13391,6 @@ var addEvidenceArgs = z.object({
|
|
|
13107
13391
|
contentType: z.string().optional().describe("Content format or MIME hint."),
|
|
13108
13392
|
metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
|
|
13109
13393
|
});
|
|
13110
|
-
var evidenceIdInput = (input) => compactRecord4({
|
|
13111
|
-
evidenceId: input.evidenceId,
|
|
13112
|
-
insightId: input.insightId,
|
|
13113
|
-
nodeId: input.nodeId ?? input.id ?? input.evidenceId
|
|
13114
|
-
});
|
|
13115
13394
|
var createEvidenceInput = (input, context) => {
|
|
13116
13395
|
const parsed = createEvidenceProjection.inputSchema.safeParse(input);
|
|
13117
13396
|
if (!parsed.success) {
|
|
@@ -13124,6 +13403,30 @@ var createEvidenceInput = (input, context) => {
|
|
|
13124
13403
|
context
|
|
13125
13404
|
);
|
|
13126
13405
|
};
|
|
13406
|
+
function relationWeight(input) {
|
|
13407
|
+
if (typeof input.weight === "number") {
|
|
13408
|
+
return input.weight;
|
|
13409
|
+
}
|
|
13410
|
+
const confidence = typeof input.confidence === "number" ? Math.max(0, Math.min(1, input.confidence)) : 0.7;
|
|
13411
|
+
const relation = String(
|
|
13412
|
+
input.evidenceRelation ?? input.relation ?? input.type ?? ""
|
|
13413
|
+
);
|
|
13414
|
+
return relation === "contradicts" || relation === "contradicting" ? -confidence : confidence;
|
|
13415
|
+
}
|
|
13416
|
+
var linkEvidenceToBeliefInput = (input, context) => {
|
|
13417
|
+
const weight = relationWeight(input);
|
|
13418
|
+
return withUserId(
|
|
13419
|
+
compactRecord4({
|
|
13420
|
+
beliefNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
|
|
13421
|
+
insightId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
|
|
13422
|
+
type: weight < 0 ? "contradicting" : "supporting",
|
|
13423
|
+
confidence: Math.min(1, Math.abs(weight)),
|
|
13424
|
+
rationale: input.rationale ?? input.context,
|
|
13425
|
+
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
13426
|
+
}),
|
|
13427
|
+
context
|
|
13428
|
+
);
|
|
13429
|
+
};
|
|
13127
13430
|
var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
|
|
13128
13431
|
compactRecord4({
|
|
13129
13432
|
fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
|
|
@@ -13225,11 +13528,8 @@ var evidenceContracts = [
|
|
|
13225
13528
|
sdkNamespace: "evidence",
|
|
13226
13529
|
sdkMethod: "getEvidence",
|
|
13227
13530
|
summary: "Get evidence.",
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
functionName: "getById",
|
|
13231
|
-
kind: "query",
|
|
13232
|
-
inputProjection: evidenceIdInput
|
|
13531
|
+
gateway: {
|
|
13532
|
+
handler: "evidence.get"
|
|
13233
13533
|
}
|
|
13234
13534
|
}),
|
|
13235
13535
|
surfaceContract({
|
|
@@ -13255,17 +13555,8 @@ var evidenceContracts = [
|
|
|
13255
13555
|
sdkNamespace: "evidence",
|
|
13256
13556
|
sdkMethod: "searchEvidence",
|
|
13257
13557
|
summary: "Search evidence.",
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
functionName: "search",
|
|
13261
|
-
kind: "query",
|
|
13262
|
-
inputProjection: (input) => compactRecord4({
|
|
13263
|
-
searchQuery: input.searchQuery ?? input.q ?? input.query,
|
|
13264
|
-
projectId: input.projectId,
|
|
13265
|
-
topicId: input.topicId,
|
|
13266
|
-
nodeType: "evidence",
|
|
13267
|
-
limit: input.limit
|
|
13268
|
-
})
|
|
13558
|
+
gateway: {
|
|
13559
|
+
handler: "evidence.search"
|
|
13269
13560
|
}
|
|
13270
13561
|
}),
|
|
13271
13562
|
surfaceContract({
|
|
@@ -13278,10 +13569,10 @@ var evidenceContracts = [
|
|
|
13278
13569
|
sdkMethod: "linkEvidenceToBelief",
|
|
13279
13570
|
summary: "Link evidence to a belief.",
|
|
13280
13571
|
convex: {
|
|
13281
|
-
module: "
|
|
13282
|
-
functionName: "
|
|
13572
|
+
module: "beliefs",
|
|
13573
|
+
functionName: "linkEvidence",
|
|
13283
13574
|
kind: "mutation",
|
|
13284
|
-
inputProjection:
|
|
13575
|
+
inputProjection: linkEvidenceToBeliefInput
|
|
13285
13576
|
}
|
|
13286
13577
|
}),
|
|
13287
13578
|
surfaceContract({
|
|
@@ -13853,10 +14144,8 @@ var topicsContracts = [
|
|
|
13853
14144
|
sdkNamespace: "topics",
|
|
13854
14145
|
sdkMethod: "getTopicGraphSpine",
|
|
13855
14146
|
summary: "Verify topic nodes and parent-child graph edges.",
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
functionName: "getTopicGraphSpine",
|
|
13859
|
-
kind: "query"
|
|
14147
|
+
gateway: {
|
|
14148
|
+
handler: "topics.graphSpine"
|
|
13860
14149
|
},
|
|
13861
14150
|
args: getTopicGraphSpineArgs
|
|
13862
14151
|
})
|
|
@@ -15563,10 +15852,8 @@ var graphContracts = [
|
|
|
15563
15852
|
sdkNamespace: "graphAnalysis",
|
|
15564
15853
|
sdkMethod: "listGraphIntelligenceQueries",
|
|
15565
15854
|
summary: "List Graph Intelligence query catalog entries.",
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
functionName: "listGraphIntelligenceQueries",
|
|
15569
|
-
kind: "query"
|
|
15855
|
+
gateway: {
|
|
15856
|
+
handler: "graph.listIntelligenceQueries"
|
|
15570
15857
|
},
|
|
15571
15858
|
args: graphIntelligenceCatalogArgs
|
|
15572
15859
|
}),
|