@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/outbox.js
CHANGED
|
@@ -546,7 +546,7 @@ var SEARCH_EVIDENCE = {
|
|
|
546
546
|
};
|
|
547
547
|
var CREATE_EVIDENCE = {
|
|
548
548
|
name: "create_evidence",
|
|
549
|
-
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.",
|
|
549
|
+
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.",
|
|
550
550
|
parameters: {
|
|
551
551
|
topicId: { type: "string", description: "Topic scope" },
|
|
552
552
|
text: { type: "string", description: "Canonical evidence text" },
|
|
@@ -557,7 +557,20 @@ var CREATE_EVIDENCE = {
|
|
|
557
557
|
},
|
|
558
558
|
weight: {
|
|
559
559
|
type: "number",
|
|
560
|
-
description: "
|
|
560
|
+
description: "Optional support weight: -1.0 (contradicts) to +1.0 (supports). If omitted, evidenceRelation + confidence determine the weight."
|
|
561
|
+
},
|
|
562
|
+
evidenceRelation: {
|
|
563
|
+
type: "string",
|
|
564
|
+
enum: ["supports", "contradicts"],
|
|
565
|
+
description: "Canonical relation to targetId/linkedBeliefNodeId. Prefer this over relying on signed weight inference."
|
|
566
|
+
},
|
|
567
|
+
confidence: {
|
|
568
|
+
type: "number",
|
|
569
|
+
description: "Confidence in the evidence relation, 0.0 to 1.0"
|
|
570
|
+
},
|
|
571
|
+
beliefRelations: {
|
|
572
|
+
type: "array",
|
|
573
|
+
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."
|
|
561
574
|
},
|
|
562
575
|
metadata: {
|
|
563
576
|
type: "object",
|
|
@@ -667,7 +680,7 @@ var LINK_EVIDENCE = {
|
|
|
667
680
|
};
|
|
668
681
|
var LINK_EVIDENCE_TO_BELIEF = {
|
|
669
682
|
name: "link_evidence_to_belief",
|
|
670
|
-
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).",
|
|
683
|
+
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.",
|
|
671
684
|
parameters: {
|
|
672
685
|
evidenceId: { type: "string", description: "The evidence node ID" },
|
|
673
686
|
beliefId: { type: "string", description: "The belief node ID" },
|
|
@@ -675,9 +688,18 @@ var LINK_EVIDENCE_TO_BELIEF = {
|
|
|
675
688
|
type: "number",
|
|
676
689
|
description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
|
|
677
690
|
},
|
|
691
|
+
evidenceRelation: {
|
|
692
|
+
type: "string",
|
|
693
|
+
enum: ["supports", "contradicts"],
|
|
694
|
+
description: "Canonical semantic relation. If omitted, the sign of weight is used."
|
|
695
|
+
},
|
|
696
|
+
confidence: {
|
|
697
|
+
type: "number",
|
|
698
|
+
description: "Confidence in this evidence-to-belief relation, 0.0 to 1.0"
|
|
699
|
+
},
|
|
678
700
|
rationale: { type: "string", description: "Why this evidence is relevant" }
|
|
679
701
|
},
|
|
680
|
-
required: ["evidenceId", "beliefId"
|
|
702
|
+
required: ["evidenceId", "beliefId"],
|
|
681
703
|
response: {
|
|
682
704
|
description: "The created edge linking evidence to belief",
|
|
683
705
|
fields: {
|
|
@@ -695,7 +717,7 @@ var LINK_EVIDENCE_TO_BELIEF = {
|
|
|
695
717
|
// ../contracts/src/tool-contracts.lifecycle.ts
|
|
696
718
|
var CREATE_BELIEF = {
|
|
697
719
|
name: "create_belief",
|
|
698
|
-
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)`;
|
|
720
|
+
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.",
|
|
699
721
|
parameters: {
|
|
700
722
|
canonicalText: {
|
|
701
723
|
type: "string",
|
|
@@ -781,7 +803,7 @@ var REFINE_BELIEF = {
|
|
|
781
803
|
};
|
|
782
804
|
var MODULATE_CONFIDENCE = {
|
|
783
805
|
name: "modulate_confidence",
|
|
784
|
-
description: "
|
|
806
|
+
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.",
|
|
785
807
|
parameters: {
|
|
786
808
|
nodeId: { type: "string", description: "The belief to score" },
|
|
787
809
|
belief: {
|
|
@@ -1430,6 +1452,60 @@ var REMOVE_LENS_FROM_TOPIC = {
|
|
|
1430
1452
|
tier: "workhorse"
|
|
1431
1453
|
};
|
|
1432
1454
|
|
|
1455
|
+
// ../contracts/src/tool-contracts.context-orientation.ts
|
|
1456
|
+
var LUCERN_ORIENT = {
|
|
1457
|
+
name: "lucern_orient",
|
|
1458
|
+
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.",
|
|
1459
|
+
parameters: {
|
|
1460
|
+
audience: {
|
|
1461
|
+
type: "string",
|
|
1462
|
+
description: "Audience for the primer: agent, human, operator, or developer.",
|
|
1463
|
+
enum: ["agent", "human", "operator", "developer"]
|
|
1464
|
+
},
|
|
1465
|
+
depth: {
|
|
1466
|
+
type: "string",
|
|
1467
|
+
description: "Orientation depth: quick, standard, or deep.",
|
|
1468
|
+
enum: ["quick", "standard", "deep"]
|
|
1469
|
+
},
|
|
1470
|
+
situation: {
|
|
1471
|
+
type: "string",
|
|
1472
|
+
description: "Optional task or query context used to tailor suggested next calls."
|
|
1473
|
+
},
|
|
1474
|
+
includeExamples: {
|
|
1475
|
+
type: "boolean",
|
|
1476
|
+
description: "Whether to include concrete tool-call examples."
|
|
1477
|
+
},
|
|
1478
|
+
includeToolMap: {
|
|
1479
|
+
type: "boolean",
|
|
1480
|
+
description: "Whether to include situation-to-tool routing guidance."
|
|
1481
|
+
},
|
|
1482
|
+
includeFuture: {
|
|
1483
|
+
type: "boolean",
|
|
1484
|
+
description: "Whether to include future exemplar, gauntlet, and training-data capabilities."
|
|
1485
|
+
}
|
|
1486
|
+
},
|
|
1487
|
+
required: [],
|
|
1488
|
+
response: {
|
|
1489
|
+
description: "Canonical operator primer for Lucern's git-shaped reasoning substrate.",
|
|
1490
|
+
fields: {
|
|
1491
|
+
schemaVersion: "string - lucern_orientation.v1",
|
|
1492
|
+
canonicalMentalModel: "object - concise model of Lucern as git-shaped reasoning state",
|
|
1493
|
+
workflow: "array - recommended branch -> investigate -> prove gate -> merge workflow",
|
|
1494
|
+
grammarMap: "array - primitive-to-git-analogy map for topics, campaigns, worktrees, beliefs, questions, evidence, edges, contradictions, and gates",
|
|
1495
|
+
firstMoves: "array - recommended first tools for a cold-start agent",
|
|
1496
|
+
receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, narrativeCoverage, synthesisLints, and noDefaultGlobalScan",
|
|
1497
|
+
safetyRules: "array - mutation and completion rules that preserve reasoning lineage",
|
|
1498
|
+
toolMap: "array | undefined - situation-to-tool routing map when requested",
|
|
1499
|
+
examples: "array | undefined - concrete tool-call examples when requested",
|
|
1500
|
+
futureCapabilities: "array | undefined - exemplar, gauntlet, trace-corpus, and native-model-training capabilities when requested",
|
|
1501
|
+
suggestedNextCalls: "array - safe next tool calls for the current situation"
|
|
1502
|
+
}
|
|
1503
|
+
},
|
|
1504
|
+
ownerModule: "reasoning-kernel",
|
|
1505
|
+
ontologyPrimitive: "graph",
|
|
1506
|
+
tier: "showcase"
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1433
1509
|
// ../contracts/src/tool-contracts.ontology.ts
|
|
1434
1510
|
var MANAGE_WRITE_POLICY = {
|
|
1435
1511
|
name: "manage_write_policy",
|
|
@@ -3939,10 +4015,34 @@ var COMPILE_CONTEXT = {
|
|
|
3939
4015
|
type: "string",
|
|
3940
4016
|
description: "Optional source kind used as a resolver signal, such as cli, worktree, commit, or docs."
|
|
3941
4017
|
},
|
|
4018
|
+
campaign: {
|
|
4019
|
+
type: "number",
|
|
4020
|
+
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."
|
|
4021
|
+
},
|
|
4022
|
+
lane: {
|
|
4023
|
+
type: "string",
|
|
4024
|
+
description: "Optional lane dimension seed. When supplied without topicId, the compiler reads all matching worktrees and their carrier topics."
|
|
4025
|
+
},
|
|
4026
|
+
status: {
|
|
4027
|
+
type: "string",
|
|
4028
|
+
description: "Optional state/status dimension seed for worktrees and graph rows."
|
|
4029
|
+
},
|
|
4030
|
+
principalId: {
|
|
4031
|
+
type: "string",
|
|
4032
|
+
description: "Optional principal seed for work authored, touched, or owned by a human, agent, group, or service principal."
|
|
4033
|
+
},
|
|
4034
|
+
workspaceId: {
|
|
4035
|
+
type: "string",
|
|
4036
|
+
description: "Optional workspace seed used by hosted MCP and SDK clients when compiling tenant-scoped context."
|
|
4037
|
+
},
|
|
3942
4038
|
budget: {
|
|
3943
4039
|
type: "number",
|
|
3944
4040
|
description: "Token budget for prompt injection planning"
|
|
3945
4041
|
},
|
|
4042
|
+
tokenBudget: {
|
|
4043
|
+
type: "number",
|
|
4044
|
+
description: "Compatibility alias for budget. External MCP clients may send tokenBudget when requesting prompt injection planning."
|
|
4045
|
+
},
|
|
3946
4046
|
ranking: {
|
|
3947
4047
|
type: "string",
|
|
3948
4048
|
description: "Ranking profile for context ordering",
|
|
@@ -3978,7 +4078,9 @@ var COMPILE_CONTEXT = {
|
|
|
3978
4078
|
recentEvidence: "array \u2014 recent evidence ranked for this query",
|
|
3979
4079
|
contradictions: "array \u2014 unresolved contradiction records",
|
|
3980
4080
|
relatedEntities: "array | undefined \u2014 ranked ontological entities in scope",
|
|
3981
|
-
contextNarrative: "array \u2014
|
|
4081
|
+
contextNarrative: "array \u2014 ordered synthesis blocks with kind/text, starting with executive_summary and canonical narrative blocks before raw objects",
|
|
4082
|
+
retrievalReceipt: "object \u2014 candidateCounts, coverageWarning, narrativeCoverage, synthesisLints, and suggestedNextActions",
|
|
4083
|
+
narrativeCoverage: "object \u2014 recordsSynthesized, recordsNamed, recordsOmitted, and blocksEmitted for the narrative",
|
|
3982
4084
|
injectionPolicy: "object \u2014 token-budgeted section selections",
|
|
3983
4085
|
diagnostics: "object \u2014 scoring and utilization telemetry"
|
|
3984
4086
|
}
|
|
@@ -4633,6 +4735,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
4633
4735
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
4634
4736
|
identity_whoami: IDENTITY_WHOAMI,
|
|
4635
4737
|
resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
|
|
4738
|
+
lucern_orient: LUCERN_ORIENT,
|
|
4636
4739
|
compile_context: COMPILE_CONTEXT,
|
|
4637
4740
|
record_scope_learning: RECORD_SCOPE_LEARNING,
|
|
4638
4741
|
pipeline_snapshot: PIPELINE_SNAPSHOT,
|
|
@@ -10439,6 +10542,20 @@ async function emitDomainEvent(invokeMutation, input) {
|
|
|
10439
10542
|
return await invokeMutation("events:recordEvent", input);
|
|
10440
10543
|
}
|
|
10441
10544
|
|
|
10545
|
+
// ../contracts/src/ids.contract.ts
|
|
10546
|
+
var PREFIXED_ID_PATTERN = /^([a-z][a-z0-9]*)_(.+)$/;
|
|
10547
|
+
function decodePrefixedId(id) {
|
|
10548
|
+
const normalized = id.trim();
|
|
10549
|
+
const match = PREFIXED_ID_PATTERN.exec(normalized);
|
|
10550
|
+
if (!match) {
|
|
10551
|
+
throw new Error(`Invalid prefixed ID: ${id}`);
|
|
10552
|
+
}
|
|
10553
|
+
return {
|
|
10554
|
+
prefix: match[1],
|
|
10555
|
+
value: match[2]
|
|
10556
|
+
};
|
|
10557
|
+
}
|
|
10558
|
+
|
|
10442
10559
|
// ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
|
|
10443
10560
|
var NODE_TYPES = [
|
|
10444
10561
|
"decision",
|
|
@@ -11554,6 +11671,23 @@ function defineProjection(def) {
|
|
|
11554
11671
|
|
|
11555
11672
|
// ../contracts/src/projections/create-evidence.projection.ts
|
|
11556
11673
|
var jsonRecordSchema = z.record(z.unknown());
|
|
11674
|
+
var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
|
|
11675
|
+
var evidenceRelationAliasSchema = z.enum([
|
|
11676
|
+
"supports",
|
|
11677
|
+
"contradicts",
|
|
11678
|
+
"supporting",
|
|
11679
|
+
"contradicting"
|
|
11680
|
+
]);
|
|
11681
|
+
var beliefRelationSchema = z.object({
|
|
11682
|
+
beliefId: z.string().optional(),
|
|
11683
|
+
beliefNodeId: z.string().optional(),
|
|
11684
|
+
targetId: z.string().optional(),
|
|
11685
|
+
relation: evidenceRelationAliasSchema.optional(),
|
|
11686
|
+
evidenceRelation: evidenceRelationSchema.optional(),
|
|
11687
|
+
confidence: z.number().optional(),
|
|
11688
|
+
weight: z.number().optional(),
|
|
11689
|
+
rationale: z.string().optional()
|
|
11690
|
+
});
|
|
11557
11691
|
var createEvidenceInputSchemaBase = z.object({
|
|
11558
11692
|
projectId: z.string().optional(),
|
|
11559
11693
|
topicId: z.string().optional(),
|
|
@@ -11575,7 +11709,8 @@ var createEvidenceInputSchemaBase = z.object({
|
|
|
11575
11709
|
targetId: z.string().optional(),
|
|
11576
11710
|
targetNodeId: z.string().optional(),
|
|
11577
11711
|
linkedBeliefNodeId: z.string().optional(),
|
|
11578
|
-
evidenceRelation:
|
|
11712
|
+
evidenceRelation: evidenceRelationSchema.optional(),
|
|
11713
|
+
beliefRelations: z.array(beliefRelationSchema).optional(),
|
|
11579
11714
|
confidence: z.number().optional(),
|
|
11580
11715
|
weight: z.number().optional(),
|
|
11581
11716
|
reasoning: z.string().optional(),
|
|
@@ -11601,15 +11736,103 @@ function isRecord(value) {
|
|
|
11601
11736
|
function recordValue(value) {
|
|
11602
11737
|
return isRecord(value) ? value : {};
|
|
11603
11738
|
}
|
|
11739
|
+
function normalizeTopicIdForKernel(topicId) {
|
|
11740
|
+
const normalized = topicId?.trim();
|
|
11741
|
+
if (!normalized) {
|
|
11742
|
+
return void 0;
|
|
11743
|
+
}
|
|
11744
|
+
try {
|
|
11745
|
+
const decoded = decodePrefixedId(normalized);
|
|
11746
|
+
return decoded.prefix === "top" ? decoded.value : normalized;
|
|
11747
|
+
} catch {
|
|
11748
|
+
return normalized;
|
|
11749
|
+
}
|
|
11750
|
+
}
|
|
11751
|
+
function normalizeWorktreeId(value) {
|
|
11752
|
+
const normalized = value?.trim();
|
|
11753
|
+
if (!normalized) {
|
|
11754
|
+
return void 0;
|
|
11755
|
+
}
|
|
11756
|
+
if (normalized.startsWith("wt_")) {
|
|
11757
|
+
return normalized.slice("wt_".length);
|
|
11758
|
+
}
|
|
11759
|
+
return normalized;
|
|
11760
|
+
}
|
|
11761
|
+
function targetKind(targetId) {
|
|
11762
|
+
const normalized = targetId?.trim();
|
|
11763
|
+
if (!normalized) {
|
|
11764
|
+
return "unknown";
|
|
11765
|
+
}
|
|
11766
|
+
if (normalized.startsWith("wt_") || /^tn[a-z0-9]+$/i.test(normalized)) {
|
|
11767
|
+
return "worktree";
|
|
11768
|
+
}
|
|
11769
|
+
if (normalized.startsWith("que_")) {
|
|
11770
|
+
return "question";
|
|
11771
|
+
}
|
|
11772
|
+
if (normalized.startsWith("bel_")) {
|
|
11773
|
+
return "belief";
|
|
11774
|
+
}
|
|
11775
|
+
return "unknown";
|
|
11776
|
+
}
|
|
11777
|
+
function normalizeRelation(value, weight) {
|
|
11778
|
+
if (value === "supports" || value === "supporting") {
|
|
11779
|
+
return "supports";
|
|
11780
|
+
}
|
|
11781
|
+
if (value === "contradicts" || value === "contradicting") {
|
|
11782
|
+
return "contradicts";
|
|
11783
|
+
}
|
|
11784
|
+
if (weight === void 0) {
|
|
11785
|
+
return void 0;
|
|
11786
|
+
}
|
|
11787
|
+
return weight < 0 ? "contradicts" : "supports";
|
|
11788
|
+
}
|
|
11789
|
+
function normalizeConfidence(confidence, weight) {
|
|
11790
|
+
if (confidence !== void 0) {
|
|
11791
|
+
return Math.min(1, Math.max(0, confidence));
|
|
11792
|
+
}
|
|
11793
|
+
if (weight === void 0) {
|
|
11794
|
+
return void 0;
|
|
11795
|
+
}
|
|
11796
|
+
return Math.min(1, Math.max(0, Math.abs(weight)));
|
|
11797
|
+
}
|
|
11798
|
+
function normalizeBeliefRelation(relation) {
|
|
11799
|
+
const beliefNodeId = relation.beliefNodeId ?? relation.beliefId ?? relation.targetId;
|
|
11800
|
+
if (!beliefNodeId) {
|
|
11801
|
+
return void 0;
|
|
11802
|
+
}
|
|
11803
|
+
const weight = typeof relation.weight === "number" ? relation.weight : void 0;
|
|
11804
|
+
const evidenceRelation = normalizeRelation(
|
|
11805
|
+
relation.evidenceRelation ?? relation.relation,
|
|
11806
|
+
weight
|
|
11807
|
+
);
|
|
11808
|
+
if (!evidenceRelation) {
|
|
11809
|
+
return void 0;
|
|
11810
|
+
}
|
|
11811
|
+
return compactRecord({
|
|
11812
|
+
beliefNodeId,
|
|
11813
|
+
relation: evidenceRelation,
|
|
11814
|
+
confidence: normalizeConfidence(relation.confidence, weight),
|
|
11815
|
+
rationale: relation.rationale
|
|
11816
|
+
});
|
|
11817
|
+
}
|
|
11604
11818
|
var createEvidenceProjection = defineProjection({
|
|
11605
11819
|
contractName: "create_evidence",
|
|
11606
11820
|
inputSchema: createEvidenceInputSchema,
|
|
11607
11821
|
project: (input) => {
|
|
11608
11822
|
const text = input.text ?? input.canonicalText;
|
|
11609
11823
|
const weight = typeof input.weight === "number" ? input.weight : void 0;
|
|
11824
|
+
const target = input.targetId ?? input.targetNodeId;
|
|
11825
|
+
const kind = targetKind(target);
|
|
11826
|
+
const linkedWorktreeId = kind === "worktree" ? normalizeWorktreeId(target) : void 0;
|
|
11827
|
+
const linkedBeliefNodeId = input.linkedBeliefNodeId ?? (kind === "belief" || kind === "unknown" ? input.targetNodeId ?? input.targetId : void 0);
|
|
11828
|
+
const evidenceRelation = linkedBeliefNodeId ? normalizeRelation(input.evidenceRelation, weight) : void 0;
|
|
11829
|
+
const confidence = evidenceRelation ? normalizeConfidence(input.confidence, weight) : void 0;
|
|
11830
|
+
const beliefRelations = input.beliefRelations?.map(normalizeBeliefRelation).filter(
|
|
11831
|
+
(relation) => relation !== void 0
|
|
11832
|
+
);
|
|
11610
11833
|
return compactRecord({
|
|
11611
11834
|
projectId: input.projectId,
|
|
11612
|
-
topicId: input.topicId,
|
|
11835
|
+
topicId: normalizeTopicIdForKernel(input.topicId),
|
|
11613
11836
|
text,
|
|
11614
11837
|
title: input.title ?? text,
|
|
11615
11838
|
content: input.content ?? text,
|
|
@@ -11628,13 +11851,16 @@ var createEvidenceProjection = defineProjection({
|
|
|
11628
11851
|
source: input.source,
|
|
11629
11852
|
targetId: input.targetId,
|
|
11630
11853
|
targetNodeId: input.targetNodeId,
|
|
11854
|
+
targetKind: kind === "unknown" ? void 0 : kind,
|
|
11855
|
+
linkedWorktreeId,
|
|
11631
11856
|
weight,
|
|
11632
11857
|
reasoning: input.reasoning,
|
|
11633
11858
|
rationale: input.rationale
|
|
11634
11859
|
}),
|
|
11635
|
-
linkedBeliefNodeId
|
|
11636
|
-
evidenceRelation
|
|
11637
|
-
confidence
|
|
11860
|
+
linkedBeliefNodeId,
|
|
11861
|
+
evidenceRelation,
|
|
11862
|
+
confidence,
|
|
11863
|
+
beliefRelations: beliefRelations && beliefRelations.length > 0 ? beliefRelations : void 0,
|
|
11638
11864
|
rationale: input.rationale,
|
|
11639
11865
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
11640
11866
|
});
|
|
@@ -11663,6 +11889,16 @@ var createEvidenceProjection = defineProjection({
|
|
|
11663
11889
|
v.literal("contradicts")
|
|
11664
11890
|
)
|
|
11665
11891
|
),
|
|
11892
|
+
beliefRelations: v.optional(
|
|
11893
|
+
v.array(
|
|
11894
|
+
v.object({
|
|
11895
|
+
beliefNodeId: v.string(),
|
|
11896
|
+
relation: v.union(v.literal("supports"), v.literal("contradicts")),
|
|
11897
|
+
confidence: v.optional(v.number()),
|
|
11898
|
+
rationale: v.optional(v.string())
|
|
11899
|
+
})
|
|
11900
|
+
)
|
|
11901
|
+
),
|
|
11666
11902
|
confidence: v.optional(v.number()),
|
|
11667
11903
|
rationale: v.string(),
|
|
11668
11904
|
trustedBypassAccessCheck: v.optional(v.boolean())
|
|
@@ -11896,6 +12132,12 @@ var internalSystem = {
|
|
|
11896
12132
|
mcp: "internal",
|
|
11897
12133
|
cli: "internal"
|
|
11898
12134
|
};
|
|
12135
|
+
var internalSdkRestOnly = {
|
|
12136
|
+
sdk: "internal",
|
|
12137
|
+
rest: "internal",
|
|
12138
|
+
mcp: "none",
|
|
12139
|
+
cli: "none"
|
|
12140
|
+
};
|
|
11899
12141
|
var publicWithInternalMcp = {
|
|
11900
12142
|
sdk: "public",
|
|
11901
12143
|
rest: "public",
|
|
@@ -11935,6 +12177,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
|
|
|
11935
12177
|
);
|
|
11936
12178
|
}
|
|
11937
12179
|
var MCP_CORE_OPERATION_NAMES = [
|
|
12180
|
+
"lucern_orient",
|
|
11938
12181
|
"compile_context",
|
|
11939
12182
|
"identity_whoami",
|
|
11940
12183
|
"resolve_interactive_principal",
|
|
@@ -11944,7 +12187,6 @@ var MCP_CORE_OPERATION_NAMES = [
|
|
|
11944
12187
|
"get_belief",
|
|
11945
12188
|
"list_beliefs",
|
|
11946
12189
|
"refine_belief",
|
|
11947
|
-
"modulate_confidence",
|
|
11948
12190
|
"fork_belief",
|
|
11949
12191
|
"archive_belief",
|
|
11950
12192
|
"search_beliefs",
|
|
@@ -12212,6 +12454,13 @@ var LUCERN_OPERATION_MANIFEST = {
|
|
|
12212
12454
|
internalSystem,
|
|
12213
12455
|
"Lucern system/background operation. Available to platform code paths, hidden from public MCP discovery."
|
|
12214
12456
|
),
|
|
12457
|
+
modulate_confidence: {
|
|
12458
|
+
name: "modulate_confidence",
|
|
12459
|
+
surfaceClass: "platform_internal",
|
|
12460
|
+
surfaceIntent: "system",
|
|
12461
|
+
surfaces: internalSdkRestOnly,
|
|
12462
|
+
rationale: "Internal SL ledger append primitive. Public callers attach evidence or contradiction relations; confidence is derived algorithmically."
|
|
12463
|
+
},
|
|
12215
12464
|
...entries(
|
|
12216
12465
|
LEGACY_COMPAT_OPERATION_NAMES,
|
|
12217
12466
|
"legacy_compat",
|
|
@@ -12563,6 +12812,14 @@ var observationContextArgs = z.object({
|
|
|
12563
12812
|
limit: z.number().optional().describe("Maximum observations to return."),
|
|
12564
12813
|
status: z.string().optional().describe("Observation status filter.")
|
|
12565
12814
|
});
|
|
12815
|
+
var lucernOrientArgs = z.object({
|
|
12816
|
+
audience: z.enum(["agent", "human", "operator", "developer"]).optional().describe("Audience for the orientation primer."),
|
|
12817
|
+
depth: z.enum(["quick", "standard", "deep"]).optional().describe("How much orientation detail to include."),
|
|
12818
|
+
situation: z.string().optional().describe("Optional task or query context for suggested next calls."),
|
|
12819
|
+
includeExamples: z.boolean().optional().describe("Include concrete tool-call examples."),
|
|
12820
|
+
includeToolMap: z.boolean().optional().describe("Include situation-to-tool routing guidance."),
|
|
12821
|
+
includeFuture: z.boolean().optional().describe("Include future training and pedagogy capabilities.")
|
|
12822
|
+
});
|
|
12566
12823
|
function isRecord2(value) {
|
|
12567
12824
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
12568
12825
|
}
|
|
@@ -12590,6 +12847,20 @@ var observationInput = (input, context) => withUserId(
|
|
|
12590
12847
|
context
|
|
12591
12848
|
);
|
|
12592
12849
|
var contextContracts = [
|
|
12850
|
+
surfaceContract({
|
|
12851
|
+
name: "lucern_orient",
|
|
12852
|
+
kind: "query",
|
|
12853
|
+
domain: "context",
|
|
12854
|
+
surfaceClass: "platform_public",
|
|
12855
|
+
path: "/context/orient",
|
|
12856
|
+
sdkNamespace: "context",
|
|
12857
|
+
sdkMethod: "lucernOrient",
|
|
12858
|
+
summary: "Return the canonical Lucern operator orientation primer.",
|
|
12859
|
+
gateway: {
|
|
12860
|
+
handler: "context.lucernOrient"
|
|
12861
|
+
},
|
|
12862
|
+
args: lucernOrientArgs
|
|
12863
|
+
}),
|
|
12593
12864
|
surfaceContract({
|
|
12594
12865
|
name: "compile_context",
|
|
12595
12866
|
kind: "query",
|
|
@@ -12893,11 +13164,11 @@ var beliefsContracts = [
|
|
|
12893
13164
|
name: "modulate_confidence",
|
|
12894
13165
|
kind: "mutation",
|
|
12895
13166
|
domain: "beliefs",
|
|
12896
|
-
surfaceClass: "
|
|
13167
|
+
surfaceClass: "platform_internal",
|
|
12897
13168
|
path: "/beliefs/confidence",
|
|
12898
13169
|
sdkNamespace: "beliefs",
|
|
12899
13170
|
sdkMethod: "modulateConfidence",
|
|
12900
|
-
summary: "
|
|
13171
|
+
summary: "Internal SL ledger append. Public callers should attach evidence or contradiction relations instead.",
|
|
12901
13172
|
convex: {
|
|
12902
13173
|
module: "beliefs",
|
|
12903
13174
|
functionName: "modulateConfidence",
|
|
@@ -13003,15 +13274,28 @@ var beliefsContracts = [
|
|
|
13003
13274
|
})
|
|
13004
13275
|
];
|
|
13005
13276
|
var jsonRecordSchema4 = z.record(z.unknown());
|
|
13006
|
-
var
|
|
13277
|
+
var evidenceRelationSchema2 = z.enum(["supports", "contradicts"]);
|
|
13278
|
+
var beliefRelationSchema2 = z.object({
|
|
13279
|
+
beliefId: z.string().optional().describe("Belief ID this evidence bears on."),
|
|
13280
|
+
beliefNodeId: z.string().optional().describe("Belief node ID this evidence bears on."),
|
|
13281
|
+
targetId: z.string().optional().describe("Belief target ID alias for beliefId/beliefNodeId."),
|
|
13282
|
+
relation: z.enum(["supports", "contradicts", "supporting", "contradicting"]).optional().describe("Relation alias for how the evidence bears on the belief."),
|
|
13283
|
+
evidenceRelation: evidenceRelationSchema2.optional().describe("Canonical relation: supports or contradicts."),
|
|
13284
|
+
confidence: z.number().optional().describe("Confidence in this evidence-to-belief relation."),
|
|
13285
|
+
weight: z.number().optional().describe("Support weight from -1.0 to +1.0 for this belief."),
|
|
13286
|
+
rationale: z.string().optional().describe("Why this relation exists.")
|
|
13287
|
+
});
|
|
13007
13288
|
var createEvidenceArgs = z.object({
|
|
13008
13289
|
topicId: z.string().optional().describe("Topic scope for the evidence."),
|
|
13009
13290
|
text: z.string().describe("Canonical evidence text."),
|
|
13010
13291
|
source: z.string().optional().describe("Source URL or source label."),
|
|
13011
13292
|
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
13012
|
-
targetId: z.string().optional().describe("Belief or
|
|
13293
|
+
targetId: z.string().optional().describe("Belief, question, or worktree identifier to link or preserve on the evidence record."),
|
|
13013
13294
|
linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
|
|
13014
|
-
evidenceRelation:
|
|
13295
|
+
evidenceRelation: evidenceRelationSchema2.optional().describe("How the evidence relates to the linked belief."),
|
|
13296
|
+
beliefRelations: z.array(beliefRelationSchema2).optional().describe(
|
|
13297
|
+
"Additional belief relations for one evidence record. Use when the same evidence supports or contradicts multiple beliefs."
|
|
13298
|
+
),
|
|
13015
13299
|
confidence: z.number().optional().describe("Confidence in the evidence relation."),
|
|
13016
13300
|
weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
|
|
13017
13301
|
metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
|
|
@@ -13042,11 +13326,6 @@ var addEvidenceArgs = z.object({
|
|
|
13042
13326
|
contentType: z.string().optional().describe("Content format or MIME hint."),
|
|
13043
13327
|
metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
|
|
13044
13328
|
});
|
|
13045
|
-
var evidenceIdInput = (input) => compactRecord4({
|
|
13046
|
-
evidenceId: input.evidenceId,
|
|
13047
|
-
insightId: input.insightId,
|
|
13048
|
-
nodeId: input.nodeId ?? input.id ?? input.evidenceId
|
|
13049
|
-
});
|
|
13050
13329
|
var createEvidenceInput = (input, context) => {
|
|
13051
13330
|
const parsed = createEvidenceProjection.inputSchema.safeParse(input);
|
|
13052
13331
|
if (!parsed.success) {
|
|
@@ -13059,6 +13338,30 @@ var createEvidenceInput = (input, context) => {
|
|
|
13059
13338
|
context
|
|
13060
13339
|
);
|
|
13061
13340
|
};
|
|
13341
|
+
function relationWeight(input) {
|
|
13342
|
+
if (typeof input.weight === "number") {
|
|
13343
|
+
return input.weight;
|
|
13344
|
+
}
|
|
13345
|
+
const confidence = typeof input.confidence === "number" ? Math.max(0, Math.min(1, input.confidence)) : 0.7;
|
|
13346
|
+
const relation = String(
|
|
13347
|
+
input.evidenceRelation ?? input.relation ?? input.type ?? ""
|
|
13348
|
+
);
|
|
13349
|
+
return relation === "contradicts" || relation === "contradicting" ? -confidence : confidence;
|
|
13350
|
+
}
|
|
13351
|
+
var linkEvidenceToBeliefInput = (input, context) => {
|
|
13352
|
+
const weight = relationWeight(input);
|
|
13353
|
+
return withUserId(
|
|
13354
|
+
compactRecord4({
|
|
13355
|
+
beliefNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
|
|
13356
|
+
insightId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
|
|
13357
|
+
type: weight < 0 ? "contradicting" : "supporting",
|
|
13358
|
+
confidence: Math.min(1, Math.abs(weight)),
|
|
13359
|
+
rationale: input.rationale ?? input.context,
|
|
13360
|
+
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
13361
|
+
}),
|
|
13362
|
+
context
|
|
13363
|
+
);
|
|
13364
|
+
};
|
|
13062
13365
|
var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
|
|
13063
13366
|
compactRecord4({
|
|
13064
13367
|
fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
|
|
@@ -13160,11 +13463,8 @@ var evidenceContracts = [
|
|
|
13160
13463
|
sdkNamespace: "evidence",
|
|
13161
13464
|
sdkMethod: "getEvidence",
|
|
13162
13465
|
summary: "Get evidence.",
|
|
13163
|
-
|
|
13164
|
-
|
|
13165
|
-
functionName: "getById",
|
|
13166
|
-
kind: "query",
|
|
13167
|
-
inputProjection: evidenceIdInput
|
|
13466
|
+
gateway: {
|
|
13467
|
+
handler: "evidence.get"
|
|
13168
13468
|
}
|
|
13169
13469
|
}),
|
|
13170
13470
|
surfaceContract({
|
|
@@ -13190,17 +13490,8 @@ var evidenceContracts = [
|
|
|
13190
13490
|
sdkNamespace: "evidence",
|
|
13191
13491
|
sdkMethod: "searchEvidence",
|
|
13192
13492
|
summary: "Search evidence.",
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
functionName: "search",
|
|
13196
|
-
kind: "query",
|
|
13197
|
-
inputProjection: (input) => compactRecord4({
|
|
13198
|
-
searchQuery: input.searchQuery ?? input.q ?? input.query,
|
|
13199
|
-
projectId: input.projectId,
|
|
13200
|
-
topicId: input.topicId,
|
|
13201
|
-
nodeType: "evidence",
|
|
13202
|
-
limit: input.limit
|
|
13203
|
-
})
|
|
13493
|
+
gateway: {
|
|
13494
|
+
handler: "evidence.search"
|
|
13204
13495
|
}
|
|
13205
13496
|
}),
|
|
13206
13497
|
surfaceContract({
|
|
@@ -13213,10 +13504,10 @@ var evidenceContracts = [
|
|
|
13213
13504
|
sdkMethod: "linkEvidenceToBelief",
|
|
13214
13505
|
summary: "Link evidence to a belief.",
|
|
13215
13506
|
convex: {
|
|
13216
|
-
module: "
|
|
13217
|
-
functionName: "
|
|
13507
|
+
module: "beliefs",
|
|
13508
|
+
functionName: "linkEvidence",
|
|
13218
13509
|
kind: "mutation",
|
|
13219
|
-
inputProjection:
|
|
13510
|
+
inputProjection: linkEvidenceToBeliefInput
|
|
13220
13511
|
}
|
|
13221
13512
|
}),
|
|
13222
13513
|
surfaceContract({
|
|
@@ -13788,10 +14079,8 @@ var topicsContracts = [
|
|
|
13788
14079
|
sdkNamespace: "topics",
|
|
13789
14080
|
sdkMethod: "getTopicGraphSpine",
|
|
13790
14081
|
summary: "Verify topic nodes and parent-child graph edges.",
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
functionName: "getTopicGraphSpine",
|
|
13794
|
-
kind: "query"
|
|
14082
|
+
gateway: {
|
|
14083
|
+
handler: "topics.graphSpine"
|
|
13795
14084
|
},
|
|
13796
14085
|
args: getTopicGraphSpineArgs
|
|
13797
14086
|
})
|
|
@@ -15498,10 +15787,8 @@ var graphContracts = [
|
|
|
15498
15787
|
sdkNamespace: "graphAnalysis",
|
|
15499
15788
|
sdkMethod: "listGraphIntelligenceQueries",
|
|
15500
15789
|
summary: "List Graph Intelligence query catalog entries.",
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
functionName: "listGraphIntelligenceQueries",
|
|
15504
|
-
kind: "query"
|
|
15790
|
+
gateway: {
|
|
15791
|
+
handler: "graph.listIntelligenceQueries"
|
|
15505
15792
|
},
|
|
15506
15793
|
args: graphIntelligenceCatalogArgs
|
|
15507
15794
|
}),
|