@lucern/events 1.0.11 → 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/types.js
CHANGED
|
@@ -1430,6 +1430,59 @@ var REMOVE_LENS_FROM_TOPIC = {
|
|
|
1430
1430
|
tier: "workhorse"
|
|
1431
1431
|
};
|
|
1432
1432
|
|
|
1433
|
+
// ../contracts/src/tool-contracts.context-orientation.ts
|
|
1434
|
+
var LUCERN_ORIENT = {
|
|
1435
|
+
name: "lucern_orient",
|
|
1436
|
+
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.",
|
|
1437
|
+
parameters: {
|
|
1438
|
+
audience: {
|
|
1439
|
+
type: "string",
|
|
1440
|
+
description: "Audience for the primer: agent, human, operator, or developer.",
|
|
1441
|
+
enum: ["agent", "human", "operator", "developer"]
|
|
1442
|
+
},
|
|
1443
|
+
depth: {
|
|
1444
|
+
type: "string",
|
|
1445
|
+
description: "Orientation depth: quick, standard, or deep.",
|
|
1446
|
+
enum: ["quick", "standard", "deep"]
|
|
1447
|
+
},
|
|
1448
|
+
situation: {
|
|
1449
|
+
type: "string",
|
|
1450
|
+
description: "Optional task or query context used to tailor suggested next calls."
|
|
1451
|
+
},
|
|
1452
|
+
includeExamples: {
|
|
1453
|
+
type: "boolean",
|
|
1454
|
+
description: "Whether to include concrete tool-call examples."
|
|
1455
|
+
},
|
|
1456
|
+
includeToolMap: {
|
|
1457
|
+
type: "boolean",
|
|
1458
|
+
description: "Whether to include situation-to-tool routing guidance."
|
|
1459
|
+
},
|
|
1460
|
+
includeFuture: {
|
|
1461
|
+
type: "boolean",
|
|
1462
|
+
description: "Whether to include future exemplar, gauntlet, and training-data capabilities."
|
|
1463
|
+
}
|
|
1464
|
+
},
|
|
1465
|
+
required: [],
|
|
1466
|
+
response: {
|
|
1467
|
+
description: "Canonical operator primer for Lucern's git-shaped reasoning substrate.",
|
|
1468
|
+
fields: {
|
|
1469
|
+
schemaVersion: "string - lucern_orientation.v1",
|
|
1470
|
+
canonicalMentalModel: "object - concise model of Lucern as git-shaped reasoning state",
|
|
1471
|
+
workflow: "array - recommended branch -> investigate -> prove gate -> merge workflow",
|
|
1472
|
+
grammarMap: "array - primitive-to-git-analogy map for topics, campaigns, worktrees, beliefs, questions, evidence, edges, contradictions, and gates",
|
|
1473
|
+
firstMoves: "array - recommended first tools for a cold-start agent",
|
|
1474
|
+
receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, and noDefaultGlobalScan",
|
|
1475
|
+
safetyRules: "array - mutation and completion rules that preserve reasoning lineage",
|
|
1476
|
+
toolMap: "array | undefined - situation-to-tool routing map when requested",
|
|
1477
|
+
examples: "array | undefined - concrete tool-call examples when requested",
|
|
1478
|
+
suggestedNextCalls: "array - safe next tool calls for the current situation"
|
|
1479
|
+
}
|
|
1480
|
+
},
|
|
1481
|
+
ownerModule: "reasoning-kernel",
|
|
1482
|
+
ontologyPrimitive: "graph",
|
|
1483
|
+
tier: "showcase"
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1433
1486
|
// ../contracts/src/tool-contracts.ontology.ts
|
|
1434
1487
|
var MANAGE_WRITE_POLICY = {
|
|
1435
1488
|
name: "manage_write_policy",
|
|
@@ -3939,10 +3992,34 @@ var COMPILE_CONTEXT = {
|
|
|
3939
3992
|
type: "string",
|
|
3940
3993
|
description: "Optional source kind used as a resolver signal, such as cli, worktree, commit, or docs."
|
|
3941
3994
|
},
|
|
3995
|
+
campaign: {
|
|
3996
|
+
type: "number",
|
|
3997
|
+
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."
|
|
3998
|
+
},
|
|
3999
|
+
lane: {
|
|
4000
|
+
type: "string",
|
|
4001
|
+
description: "Optional lane dimension seed. When supplied without topicId, the compiler reads all matching worktrees and their carrier topics."
|
|
4002
|
+
},
|
|
4003
|
+
status: {
|
|
4004
|
+
type: "string",
|
|
4005
|
+
description: "Optional state/status dimension seed for worktrees and graph rows."
|
|
4006
|
+
},
|
|
4007
|
+
principalId: {
|
|
4008
|
+
type: "string",
|
|
4009
|
+
description: "Optional principal seed for work authored, touched, or owned by a human, agent, group, or service principal."
|
|
4010
|
+
},
|
|
4011
|
+
workspaceId: {
|
|
4012
|
+
type: "string",
|
|
4013
|
+
description: "Optional workspace seed used by hosted MCP and SDK clients when compiling tenant-scoped context."
|
|
4014
|
+
},
|
|
3942
4015
|
budget: {
|
|
3943
4016
|
type: "number",
|
|
3944
4017
|
description: "Token budget for prompt injection planning"
|
|
3945
4018
|
},
|
|
4019
|
+
tokenBudget: {
|
|
4020
|
+
type: "number",
|
|
4021
|
+
description: "Compatibility alias for budget. External MCP clients may send tokenBudget when requesting prompt injection planning."
|
|
4022
|
+
},
|
|
3946
4023
|
ranking: {
|
|
3947
4024
|
type: "string",
|
|
3948
4025
|
description: "Ranking profile for context ordering",
|
|
@@ -4633,6 +4710,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
4633
4710
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
4634
4711
|
identity_whoami: IDENTITY_WHOAMI,
|
|
4635
4712
|
resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
|
|
4713
|
+
lucern_orient: LUCERN_ORIENT,
|
|
4636
4714
|
compile_context: COMPILE_CONTEXT,
|
|
4637
4715
|
record_scope_learning: RECORD_SCOPE_LEARNING,
|
|
4638
4716
|
pipeline_snapshot: PIPELINE_SNAPSHOT,
|
|
@@ -10387,6 +10465,20 @@ var DOMAIN_EVENT_TYPES = [
|
|
|
10387
10465
|
"webhook.test"
|
|
10388
10466
|
];
|
|
10389
10467
|
|
|
10468
|
+
// ../contracts/src/ids.contract.ts
|
|
10469
|
+
var PREFIXED_ID_PATTERN = /^([a-z][a-z0-9]*)_(.+)$/;
|
|
10470
|
+
function decodePrefixedId(id) {
|
|
10471
|
+
const normalized = id.trim();
|
|
10472
|
+
const match = PREFIXED_ID_PATTERN.exec(normalized);
|
|
10473
|
+
if (!match) {
|
|
10474
|
+
throw new Error(`Invalid prefixed ID: ${id}`);
|
|
10475
|
+
}
|
|
10476
|
+
return {
|
|
10477
|
+
prefix: match[1],
|
|
10478
|
+
value: match[2]
|
|
10479
|
+
};
|
|
10480
|
+
}
|
|
10481
|
+
|
|
10390
10482
|
// ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
|
|
10391
10483
|
var NODE_TYPES = [
|
|
10392
10484
|
"decision",
|
|
@@ -11549,15 +11641,57 @@ function isRecord(value) {
|
|
|
11549
11641
|
function recordValue(value) {
|
|
11550
11642
|
return isRecord(value) ? value : {};
|
|
11551
11643
|
}
|
|
11644
|
+
function normalizeTopicIdForKernel(topicId) {
|
|
11645
|
+
const normalized = topicId?.trim();
|
|
11646
|
+
if (!normalized) {
|
|
11647
|
+
return void 0;
|
|
11648
|
+
}
|
|
11649
|
+
try {
|
|
11650
|
+
const decoded = decodePrefixedId(normalized);
|
|
11651
|
+
return decoded.prefix === "top" ? decoded.value : normalized;
|
|
11652
|
+
} catch {
|
|
11653
|
+
return normalized;
|
|
11654
|
+
}
|
|
11655
|
+
}
|
|
11656
|
+
function normalizeWorktreeId(value) {
|
|
11657
|
+
const normalized = value?.trim();
|
|
11658
|
+
if (!normalized) {
|
|
11659
|
+
return void 0;
|
|
11660
|
+
}
|
|
11661
|
+
if (normalized.startsWith("wt_")) {
|
|
11662
|
+
return normalized.slice("wt_".length);
|
|
11663
|
+
}
|
|
11664
|
+
return normalized;
|
|
11665
|
+
}
|
|
11666
|
+
function targetKind(targetId) {
|
|
11667
|
+
const normalized = targetId?.trim();
|
|
11668
|
+
if (!normalized) {
|
|
11669
|
+
return "unknown";
|
|
11670
|
+
}
|
|
11671
|
+
if (normalized.startsWith("wt_") || /^tn[a-z0-9]+$/i.test(normalized)) {
|
|
11672
|
+
return "worktree";
|
|
11673
|
+
}
|
|
11674
|
+
if (normalized.startsWith("que_")) {
|
|
11675
|
+
return "question";
|
|
11676
|
+
}
|
|
11677
|
+
if (normalized.startsWith("bel_")) {
|
|
11678
|
+
return "belief";
|
|
11679
|
+
}
|
|
11680
|
+
return "unknown";
|
|
11681
|
+
}
|
|
11552
11682
|
var createEvidenceProjection = defineProjection({
|
|
11553
11683
|
contractName: "create_evidence",
|
|
11554
11684
|
inputSchema: createEvidenceInputSchema,
|
|
11555
11685
|
project: (input) => {
|
|
11556
11686
|
const text = input.text ?? input.canonicalText;
|
|
11557
11687
|
const weight = typeof input.weight === "number" ? input.weight : void 0;
|
|
11688
|
+
const target = input.targetId ?? input.targetNodeId;
|
|
11689
|
+
const kind = targetKind(target);
|
|
11690
|
+
const linkedWorktreeId = kind === "worktree" ? normalizeWorktreeId(target) : void 0;
|
|
11691
|
+
const linkedBeliefNodeId = input.linkedBeliefNodeId ?? (kind === "belief" || kind === "unknown" ? input.targetNodeId ?? input.targetId : void 0);
|
|
11558
11692
|
return compactRecord({
|
|
11559
11693
|
projectId: input.projectId,
|
|
11560
|
-
topicId: input.topicId,
|
|
11694
|
+
topicId: normalizeTopicIdForKernel(input.topicId),
|
|
11561
11695
|
text,
|
|
11562
11696
|
title: input.title ?? text,
|
|
11563
11697
|
content: input.content ?? text,
|
|
@@ -11576,11 +11710,13 @@ var createEvidenceProjection = defineProjection({
|
|
|
11576
11710
|
source: input.source,
|
|
11577
11711
|
targetId: input.targetId,
|
|
11578
11712
|
targetNodeId: input.targetNodeId,
|
|
11713
|
+
targetKind: kind === "unknown" ? void 0 : kind,
|
|
11714
|
+
linkedWorktreeId,
|
|
11579
11715
|
weight,
|
|
11580
11716
|
reasoning: input.reasoning,
|
|
11581
11717
|
rationale: input.rationale
|
|
11582
11718
|
}),
|
|
11583
|
-
linkedBeliefNodeId
|
|
11719
|
+
linkedBeliefNodeId,
|
|
11584
11720
|
evidenceRelation: input.evidenceRelation ?? (weight === void 0 ? void 0 : weight < 0 ? "contradicts" : "supports"),
|
|
11585
11721
|
confidence: input.confidence ?? (weight === void 0 ? void 0 : Math.min(1, Math.max(0, Math.abs(weight)))),
|
|
11586
11722
|
rationale: input.rationale,
|
|
@@ -11883,6 +12019,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
|
|
|
11883
12019
|
);
|
|
11884
12020
|
}
|
|
11885
12021
|
var MCP_CORE_OPERATION_NAMES = [
|
|
12022
|
+
"lucern_orient",
|
|
11886
12023
|
"compile_context",
|
|
11887
12024
|
"identity_whoami",
|
|
11888
12025
|
"resolve_interactive_principal",
|
|
@@ -12511,6 +12648,14 @@ var observationContextArgs = z.object({
|
|
|
12511
12648
|
limit: z.number().optional().describe("Maximum observations to return."),
|
|
12512
12649
|
status: z.string().optional().describe("Observation status filter.")
|
|
12513
12650
|
});
|
|
12651
|
+
var lucernOrientArgs = z.object({
|
|
12652
|
+
audience: z.enum(["agent", "human", "operator", "developer"]).optional().describe("Audience for the orientation primer."),
|
|
12653
|
+
depth: z.enum(["quick", "standard", "deep"]).optional().describe("How much orientation detail to include."),
|
|
12654
|
+
situation: z.string().optional().describe("Optional task or query context for suggested next calls."),
|
|
12655
|
+
includeExamples: z.boolean().optional().describe("Include concrete tool-call examples."),
|
|
12656
|
+
includeToolMap: z.boolean().optional().describe("Include situation-to-tool routing guidance."),
|
|
12657
|
+
includeFuture: z.boolean().optional().describe("Include future training and pedagogy capabilities.")
|
|
12658
|
+
});
|
|
12514
12659
|
function isRecord2(value) {
|
|
12515
12660
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
12516
12661
|
}
|
|
@@ -12538,6 +12683,20 @@ var observationInput = (input, context) => withUserId(
|
|
|
12538
12683
|
context
|
|
12539
12684
|
);
|
|
12540
12685
|
var contextContracts = [
|
|
12686
|
+
surfaceContract({
|
|
12687
|
+
name: "lucern_orient",
|
|
12688
|
+
kind: "query",
|
|
12689
|
+
domain: "context",
|
|
12690
|
+
surfaceClass: "platform_public",
|
|
12691
|
+
path: "/context/orient",
|
|
12692
|
+
sdkNamespace: "context",
|
|
12693
|
+
sdkMethod: "lucernOrient",
|
|
12694
|
+
summary: "Return the canonical Lucern operator orientation primer.",
|
|
12695
|
+
gateway: {
|
|
12696
|
+
handler: "context.lucernOrient"
|
|
12697
|
+
},
|
|
12698
|
+
args: lucernOrientArgs
|
|
12699
|
+
}),
|
|
12541
12700
|
surfaceContract({
|
|
12542
12701
|
name: "compile_context",
|
|
12543
12702
|
kind: "query",
|
|
@@ -12957,7 +13116,7 @@ var createEvidenceArgs = z.object({
|
|
|
12957
13116
|
text: z.string().describe("Canonical evidence text."),
|
|
12958
13117
|
source: z.string().optional().describe("Source URL or source label."),
|
|
12959
13118
|
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
12960
|
-
targetId: z.string().optional().describe("Belief or
|
|
13119
|
+
targetId: z.string().optional().describe("Belief, question, or worktree identifier to link or preserve on the evidence record."),
|
|
12961
13120
|
linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
|
|
12962
13121
|
evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
|
|
12963
13122
|
confidence: z.number().optional().describe("Confidence in the evidence relation."),
|
|
@@ -12990,11 +13149,6 @@ var addEvidenceArgs = z.object({
|
|
|
12990
13149
|
contentType: z.string().optional().describe("Content format or MIME hint."),
|
|
12991
13150
|
metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
|
|
12992
13151
|
});
|
|
12993
|
-
var evidenceIdInput = (input) => compactRecord4({
|
|
12994
|
-
evidenceId: input.evidenceId,
|
|
12995
|
-
insightId: input.insightId,
|
|
12996
|
-
nodeId: input.nodeId ?? input.id ?? input.evidenceId
|
|
12997
|
-
});
|
|
12998
13152
|
var createEvidenceInput = (input, context) => {
|
|
12999
13153
|
const parsed = createEvidenceProjection.inputSchema.safeParse(input);
|
|
13000
13154
|
if (!parsed.success) {
|
|
@@ -13108,11 +13262,8 @@ var evidenceContracts = [
|
|
|
13108
13262
|
sdkNamespace: "evidence",
|
|
13109
13263
|
sdkMethod: "getEvidence",
|
|
13110
13264
|
summary: "Get evidence.",
|
|
13111
|
-
|
|
13112
|
-
|
|
13113
|
-
functionName: "getById",
|
|
13114
|
-
kind: "query",
|
|
13115
|
-
inputProjection: evidenceIdInput
|
|
13265
|
+
gateway: {
|
|
13266
|
+
handler: "evidence.get"
|
|
13116
13267
|
}
|
|
13117
13268
|
}),
|
|
13118
13269
|
surfaceContract({
|
|
@@ -13138,17 +13289,8 @@ var evidenceContracts = [
|
|
|
13138
13289
|
sdkNamespace: "evidence",
|
|
13139
13290
|
sdkMethod: "searchEvidence",
|
|
13140
13291
|
summary: "Search evidence.",
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
functionName: "search",
|
|
13144
|
-
kind: "query",
|
|
13145
|
-
inputProjection: (input) => compactRecord4({
|
|
13146
|
-
searchQuery: input.searchQuery ?? input.q ?? input.query,
|
|
13147
|
-
projectId: input.projectId,
|
|
13148
|
-
topicId: input.topicId,
|
|
13149
|
-
nodeType: "evidence",
|
|
13150
|
-
limit: input.limit
|
|
13151
|
-
})
|
|
13292
|
+
gateway: {
|
|
13293
|
+
handler: "evidence.search"
|
|
13152
13294
|
}
|
|
13153
13295
|
}),
|
|
13154
13296
|
surfaceContract({
|
|
@@ -13736,10 +13878,8 @@ var topicsContracts = [
|
|
|
13736
13878
|
sdkNamespace: "topics",
|
|
13737
13879
|
sdkMethod: "getTopicGraphSpine",
|
|
13738
13880
|
summary: "Verify topic nodes and parent-child graph edges.",
|
|
13739
|
-
|
|
13740
|
-
|
|
13741
|
-
functionName: "getTopicGraphSpine",
|
|
13742
|
-
kind: "query"
|
|
13881
|
+
gateway: {
|
|
13882
|
+
handler: "topics.graphSpine"
|
|
13743
13883
|
},
|
|
13744
13884
|
args: getTopicGraphSpineArgs
|
|
13745
13885
|
})
|
|
@@ -15446,10 +15586,8 @@ var graphContracts = [
|
|
|
15446
15586
|
sdkNamespace: "graphAnalysis",
|
|
15447
15587
|
sdkMethod: "listGraphIntelligenceQueries",
|
|
15448
15588
|
summary: "List Graph Intelligence query catalog entries.",
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
functionName: "listGraphIntelligenceQueries",
|
|
15452
|
-
kind: "query"
|
|
15589
|
+
gateway: {
|
|
15590
|
+
handler: "graph.listIntelligenceQueries"
|
|
15453
15591
|
},
|
|
15454
15592
|
args: graphIntelligenceCatalogArgs
|
|
15455
15593
|
}),
|