@lucern/events 1.0.10 → 1.0.12
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 +170 -32
- package/dist/index.js.map +1 -1
- package/dist/outbox.js +170 -32
- package/dist/outbox.js.map +1 -1
- package/dist/proof-attestation.json +1 -1
- package/dist/types.js +170 -32
- package/dist/types.js.map +1 -1
- package/dist/webhook-delivery-machine.js +170 -32
- package/dist/webhook-delivery-machine.js.map +1 -1
- package/dist/webhooks.js +170 -32
- package/dist/webhooks.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1456,6 +1456,59 @@ var REMOVE_LENS_FROM_TOPIC = {
|
|
|
1456
1456
|
tier: "workhorse"
|
|
1457
1457
|
};
|
|
1458
1458
|
|
|
1459
|
+
// ../contracts/src/tool-contracts.context-orientation.ts
|
|
1460
|
+
var LUCERN_ORIENT = {
|
|
1461
|
+
name: "lucern_orient",
|
|
1462
|
+
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.",
|
|
1463
|
+
parameters: {
|
|
1464
|
+
audience: {
|
|
1465
|
+
type: "string",
|
|
1466
|
+
description: "Audience for the primer: agent, human, operator, or developer.",
|
|
1467
|
+
enum: ["agent", "human", "operator", "developer"]
|
|
1468
|
+
},
|
|
1469
|
+
depth: {
|
|
1470
|
+
type: "string",
|
|
1471
|
+
description: "Orientation depth: quick, standard, or deep.",
|
|
1472
|
+
enum: ["quick", "standard", "deep"]
|
|
1473
|
+
},
|
|
1474
|
+
situation: {
|
|
1475
|
+
type: "string",
|
|
1476
|
+
description: "Optional task or query context used to tailor suggested next calls."
|
|
1477
|
+
},
|
|
1478
|
+
includeExamples: {
|
|
1479
|
+
type: "boolean",
|
|
1480
|
+
description: "Whether to include concrete tool-call examples."
|
|
1481
|
+
},
|
|
1482
|
+
includeToolMap: {
|
|
1483
|
+
type: "boolean",
|
|
1484
|
+
description: "Whether to include situation-to-tool routing guidance."
|
|
1485
|
+
},
|
|
1486
|
+
includeFuture: {
|
|
1487
|
+
type: "boolean",
|
|
1488
|
+
description: "Whether to include future exemplar, gauntlet, and training-data capabilities."
|
|
1489
|
+
}
|
|
1490
|
+
},
|
|
1491
|
+
required: [],
|
|
1492
|
+
response: {
|
|
1493
|
+
description: "Canonical operator primer for Lucern's git-shaped reasoning substrate.",
|
|
1494
|
+
fields: {
|
|
1495
|
+
schemaVersion: "string - lucern_orientation.v1",
|
|
1496
|
+
canonicalMentalModel: "object - concise model of Lucern as git-shaped reasoning state",
|
|
1497
|
+
workflow: "array - recommended branch -> investigate -> prove gate -> merge workflow",
|
|
1498
|
+
grammarMap: "array - primitive-to-git-analogy map for topics, campaigns, worktrees, beliefs, questions, evidence, edges, contradictions, and gates",
|
|
1499
|
+
firstMoves: "array - recommended first tools for a cold-start agent",
|
|
1500
|
+
receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, and noDefaultGlobalScan",
|
|
1501
|
+
safetyRules: "array - mutation and completion rules that preserve reasoning lineage",
|
|
1502
|
+
toolMap: "array | undefined - situation-to-tool routing map when requested",
|
|
1503
|
+
examples: "array | undefined - concrete tool-call examples when requested",
|
|
1504
|
+
suggestedNextCalls: "array - safe next tool calls for the current situation"
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
1507
|
+
ownerModule: "reasoning-kernel",
|
|
1508
|
+
ontologyPrimitive: "graph",
|
|
1509
|
+
tier: "showcase"
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1459
1512
|
// ../contracts/src/tool-contracts.ontology.ts
|
|
1460
1513
|
var MANAGE_WRITE_POLICY = {
|
|
1461
1514
|
name: "manage_write_policy",
|
|
@@ -3965,10 +4018,34 @@ var COMPILE_CONTEXT = {
|
|
|
3965
4018
|
type: "string",
|
|
3966
4019
|
description: "Optional source kind used as a resolver signal, such as cli, worktree, commit, or docs."
|
|
3967
4020
|
},
|
|
4021
|
+
campaign: {
|
|
4022
|
+
type: "number",
|
|
4023
|
+
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."
|
|
4024
|
+
},
|
|
4025
|
+
lane: {
|
|
4026
|
+
type: "string",
|
|
4027
|
+
description: "Optional lane dimension seed. When supplied without topicId, the compiler reads all matching worktrees and their carrier topics."
|
|
4028
|
+
},
|
|
4029
|
+
status: {
|
|
4030
|
+
type: "string",
|
|
4031
|
+
description: "Optional state/status dimension seed for worktrees and graph rows."
|
|
4032
|
+
},
|
|
4033
|
+
principalId: {
|
|
4034
|
+
type: "string",
|
|
4035
|
+
description: "Optional principal seed for work authored, touched, or owned by a human, agent, group, or service principal."
|
|
4036
|
+
},
|
|
4037
|
+
workspaceId: {
|
|
4038
|
+
type: "string",
|
|
4039
|
+
description: "Optional workspace seed used by hosted MCP and SDK clients when compiling tenant-scoped context."
|
|
4040
|
+
},
|
|
3968
4041
|
budget: {
|
|
3969
4042
|
type: "number",
|
|
3970
4043
|
description: "Token budget for prompt injection planning"
|
|
3971
4044
|
},
|
|
4045
|
+
tokenBudget: {
|
|
4046
|
+
type: "number",
|
|
4047
|
+
description: "Compatibility alias for budget. External MCP clients may send tokenBudget when requesting prompt injection planning."
|
|
4048
|
+
},
|
|
3972
4049
|
ranking: {
|
|
3973
4050
|
type: "string",
|
|
3974
4051
|
description: "Ranking profile for context ordering",
|
|
@@ -4659,6 +4736,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
4659
4736
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
4660
4737
|
identity_whoami: IDENTITY_WHOAMI,
|
|
4661
4738
|
resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
|
|
4739
|
+
lucern_orient: LUCERN_ORIENT,
|
|
4662
4740
|
compile_context: COMPILE_CONTEXT,
|
|
4663
4741
|
record_scope_learning: RECORD_SCOPE_LEARNING,
|
|
4664
4742
|
pipeline_snapshot: PIPELINE_SNAPSHOT,
|
|
@@ -10504,6 +10582,20 @@ async function emitDomainEvent(invokeMutation, input) {
|
|
|
10504
10582
|
return await invokeMutation("events:recordEvent", input);
|
|
10505
10583
|
}
|
|
10506
10584
|
|
|
10585
|
+
// ../contracts/src/ids.contract.ts
|
|
10586
|
+
var PREFIXED_ID_PATTERN = /^([a-z][a-z0-9]*)_(.+)$/;
|
|
10587
|
+
function decodePrefixedId(id) {
|
|
10588
|
+
const normalized = id.trim();
|
|
10589
|
+
const match = PREFIXED_ID_PATTERN.exec(normalized);
|
|
10590
|
+
if (!match) {
|
|
10591
|
+
throw new Error(`Invalid prefixed ID: ${id}`);
|
|
10592
|
+
}
|
|
10593
|
+
return {
|
|
10594
|
+
prefix: match[1],
|
|
10595
|
+
value: match[2]
|
|
10596
|
+
};
|
|
10597
|
+
}
|
|
10598
|
+
|
|
10507
10599
|
// ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
|
|
10508
10600
|
var NODE_TYPES = [
|
|
10509
10601
|
"decision",
|
|
@@ -11666,15 +11758,57 @@ function isRecord(value) {
|
|
|
11666
11758
|
function recordValue(value) {
|
|
11667
11759
|
return isRecord(value) ? value : {};
|
|
11668
11760
|
}
|
|
11761
|
+
function normalizeTopicIdForKernel(topicId) {
|
|
11762
|
+
const normalized = topicId?.trim();
|
|
11763
|
+
if (!normalized) {
|
|
11764
|
+
return void 0;
|
|
11765
|
+
}
|
|
11766
|
+
try {
|
|
11767
|
+
const decoded = decodePrefixedId(normalized);
|
|
11768
|
+
return decoded.prefix === "top" ? decoded.value : normalized;
|
|
11769
|
+
} catch {
|
|
11770
|
+
return normalized;
|
|
11771
|
+
}
|
|
11772
|
+
}
|
|
11773
|
+
function normalizeWorktreeId(value) {
|
|
11774
|
+
const normalized = value?.trim();
|
|
11775
|
+
if (!normalized) {
|
|
11776
|
+
return void 0;
|
|
11777
|
+
}
|
|
11778
|
+
if (normalized.startsWith("wt_")) {
|
|
11779
|
+
return normalized.slice("wt_".length);
|
|
11780
|
+
}
|
|
11781
|
+
return normalized;
|
|
11782
|
+
}
|
|
11783
|
+
function targetKind(targetId) {
|
|
11784
|
+
const normalized = targetId?.trim();
|
|
11785
|
+
if (!normalized) {
|
|
11786
|
+
return "unknown";
|
|
11787
|
+
}
|
|
11788
|
+
if (normalized.startsWith("wt_") || /^tn[a-z0-9]+$/i.test(normalized)) {
|
|
11789
|
+
return "worktree";
|
|
11790
|
+
}
|
|
11791
|
+
if (normalized.startsWith("que_")) {
|
|
11792
|
+
return "question";
|
|
11793
|
+
}
|
|
11794
|
+
if (normalized.startsWith("bel_")) {
|
|
11795
|
+
return "belief";
|
|
11796
|
+
}
|
|
11797
|
+
return "unknown";
|
|
11798
|
+
}
|
|
11669
11799
|
var createEvidenceProjection = defineProjection({
|
|
11670
11800
|
contractName: "create_evidence",
|
|
11671
11801
|
inputSchema: createEvidenceInputSchema,
|
|
11672
11802
|
project: (input) => {
|
|
11673
11803
|
const text = input.text ?? input.canonicalText;
|
|
11674
11804
|
const weight = typeof input.weight === "number" ? input.weight : void 0;
|
|
11805
|
+
const target = input.targetId ?? input.targetNodeId;
|
|
11806
|
+
const kind = targetKind(target);
|
|
11807
|
+
const linkedWorktreeId = kind === "worktree" ? normalizeWorktreeId(target) : void 0;
|
|
11808
|
+
const linkedBeliefNodeId = input.linkedBeliefNodeId ?? (kind === "belief" || kind === "unknown" ? input.targetNodeId ?? input.targetId : void 0);
|
|
11675
11809
|
return compactRecord({
|
|
11676
11810
|
projectId: input.projectId,
|
|
11677
|
-
topicId: input.topicId,
|
|
11811
|
+
topicId: normalizeTopicIdForKernel(input.topicId),
|
|
11678
11812
|
text,
|
|
11679
11813
|
title: input.title ?? text,
|
|
11680
11814
|
content: input.content ?? text,
|
|
@@ -11693,11 +11827,13 @@ var createEvidenceProjection = defineProjection({
|
|
|
11693
11827
|
source: input.source,
|
|
11694
11828
|
targetId: input.targetId,
|
|
11695
11829
|
targetNodeId: input.targetNodeId,
|
|
11830
|
+
targetKind: kind === "unknown" ? void 0 : kind,
|
|
11831
|
+
linkedWorktreeId,
|
|
11696
11832
|
weight,
|
|
11697
11833
|
reasoning: input.reasoning,
|
|
11698
11834
|
rationale: input.rationale
|
|
11699
11835
|
}),
|
|
11700
|
-
linkedBeliefNodeId
|
|
11836
|
+
linkedBeliefNodeId,
|
|
11701
11837
|
evidenceRelation: input.evidenceRelation ?? (weight === void 0 ? void 0 : weight < 0 ? "contradicts" : "supports"),
|
|
11702
11838
|
confidence: input.confidence ?? (weight === void 0 ? void 0 : Math.min(1, Math.max(0, Math.abs(weight)))),
|
|
11703
11839
|
rationale: input.rationale,
|
|
@@ -12000,6 +12136,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
|
|
|
12000
12136
|
);
|
|
12001
12137
|
}
|
|
12002
12138
|
var MCP_CORE_OPERATION_NAMES = [
|
|
12139
|
+
"lucern_orient",
|
|
12003
12140
|
"compile_context",
|
|
12004
12141
|
"identity_whoami",
|
|
12005
12142
|
"resolve_interactive_principal",
|
|
@@ -12628,6 +12765,14 @@ var observationContextArgs = z.object({
|
|
|
12628
12765
|
limit: z.number().optional().describe("Maximum observations to return."),
|
|
12629
12766
|
status: z.string().optional().describe("Observation status filter.")
|
|
12630
12767
|
});
|
|
12768
|
+
var lucernOrientArgs = z.object({
|
|
12769
|
+
audience: z.enum(["agent", "human", "operator", "developer"]).optional().describe("Audience for the orientation primer."),
|
|
12770
|
+
depth: z.enum(["quick", "standard", "deep"]).optional().describe("How much orientation detail to include."),
|
|
12771
|
+
situation: z.string().optional().describe("Optional task or query context for suggested next calls."),
|
|
12772
|
+
includeExamples: z.boolean().optional().describe("Include concrete tool-call examples."),
|
|
12773
|
+
includeToolMap: z.boolean().optional().describe("Include situation-to-tool routing guidance."),
|
|
12774
|
+
includeFuture: z.boolean().optional().describe("Include future training and pedagogy capabilities.")
|
|
12775
|
+
});
|
|
12631
12776
|
function isRecord2(value) {
|
|
12632
12777
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
12633
12778
|
}
|
|
@@ -12655,6 +12800,20 @@ var observationInput = (input, context) => withUserId(
|
|
|
12655
12800
|
context
|
|
12656
12801
|
);
|
|
12657
12802
|
var contextContracts = [
|
|
12803
|
+
surfaceContract({
|
|
12804
|
+
name: "lucern_orient",
|
|
12805
|
+
kind: "query",
|
|
12806
|
+
domain: "context",
|
|
12807
|
+
surfaceClass: "platform_public",
|
|
12808
|
+
path: "/context/orient",
|
|
12809
|
+
sdkNamespace: "context",
|
|
12810
|
+
sdkMethod: "lucernOrient",
|
|
12811
|
+
summary: "Return the canonical Lucern operator orientation primer.",
|
|
12812
|
+
gateway: {
|
|
12813
|
+
handler: "context.lucernOrient"
|
|
12814
|
+
},
|
|
12815
|
+
args: lucernOrientArgs
|
|
12816
|
+
}),
|
|
12658
12817
|
surfaceContract({
|
|
12659
12818
|
name: "compile_context",
|
|
12660
12819
|
kind: "query",
|
|
@@ -13074,7 +13233,7 @@ var createEvidenceArgs = z.object({
|
|
|
13074
13233
|
text: z.string().describe("Canonical evidence text."),
|
|
13075
13234
|
source: z.string().optional().describe("Source URL or source label."),
|
|
13076
13235
|
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
13077
|
-
targetId: z.string().optional().describe("Belief or
|
|
13236
|
+
targetId: z.string().optional().describe("Belief, question, or worktree identifier to link or preserve on the evidence record."),
|
|
13078
13237
|
linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
|
|
13079
13238
|
evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
|
|
13080
13239
|
confidence: z.number().optional().describe("Confidence in the evidence relation."),
|
|
@@ -13107,11 +13266,6 @@ var addEvidenceArgs = z.object({
|
|
|
13107
13266
|
contentType: z.string().optional().describe("Content format or MIME hint."),
|
|
13108
13267
|
metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
|
|
13109
13268
|
});
|
|
13110
|
-
var evidenceIdInput = (input) => compactRecord4({
|
|
13111
|
-
evidenceId: input.evidenceId,
|
|
13112
|
-
insightId: input.insightId,
|
|
13113
|
-
nodeId: input.nodeId ?? input.id ?? input.evidenceId
|
|
13114
|
-
});
|
|
13115
13269
|
var createEvidenceInput = (input, context) => {
|
|
13116
13270
|
const parsed = createEvidenceProjection.inputSchema.safeParse(input);
|
|
13117
13271
|
if (!parsed.success) {
|
|
@@ -13225,11 +13379,8 @@ var evidenceContracts = [
|
|
|
13225
13379
|
sdkNamespace: "evidence",
|
|
13226
13380
|
sdkMethod: "getEvidence",
|
|
13227
13381
|
summary: "Get evidence.",
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
functionName: "getById",
|
|
13231
|
-
kind: "query",
|
|
13232
|
-
inputProjection: evidenceIdInput
|
|
13382
|
+
gateway: {
|
|
13383
|
+
handler: "evidence.get"
|
|
13233
13384
|
}
|
|
13234
13385
|
}),
|
|
13235
13386
|
surfaceContract({
|
|
@@ -13255,17 +13406,8 @@ var evidenceContracts = [
|
|
|
13255
13406
|
sdkNamespace: "evidence",
|
|
13256
13407
|
sdkMethod: "searchEvidence",
|
|
13257
13408
|
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
|
-
})
|
|
13409
|
+
gateway: {
|
|
13410
|
+
handler: "evidence.search"
|
|
13269
13411
|
}
|
|
13270
13412
|
}),
|
|
13271
13413
|
surfaceContract({
|
|
@@ -13853,10 +13995,8 @@ var topicsContracts = [
|
|
|
13853
13995
|
sdkNamespace: "topics",
|
|
13854
13996
|
sdkMethod: "getTopicGraphSpine",
|
|
13855
13997
|
summary: "Verify topic nodes and parent-child graph edges.",
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
functionName: "getTopicGraphSpine",
|
|
13859
|
-
kind: "query"
|
|
13998
|
+
gateway: {
|
|
13999
|
+
handler: "topics.graphSpine"
|
|
13860
14000
|
},
|
|
13861
14001
|
args: getTopicGraphSpineArgs
|
|
13862
14002
|
})
|
|
@@ -15563,10 +15703,8 @@ var graphContracts = [
|
|
|
15563
15703
|
sdkNamespace: "graphAnalysis",
|
|
15564
15704
|
sdkMethod: "listGraphIntelligenceQueries",
|
|
15565
15705
|
summary: "List Graph Intelligence query catalog entries.",
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
functionName: "listGraphIntelligenceQueries",
|
|
15569
|
-
kind: "query"
|
|
15706
|
+
gateway: {
|
|
15707
|
+
handler: "graph.listIntelligenceQueries"
|
|
15570
15708
|
},
|
|
15571
15709
|
args: graphIntelligenceCatalogArgs
|
|
15572
15710
|
}),
|