@lucern/events 1.0.13 → 1.0.15
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 +65 -12
- package/dist/index.js.map +1 -1
- package/dist/outbox.js +65 -12
- package/dist/outbox.js.map +1 -1
- package/dist/proof-attestation.json +1 -1
- package/dist/types.js +65 -12
- package/dist/types.js.map +1 -1
- package/dist/webhook-delivery-machine.js +65 -12
- package/dist/webhook-delivery-machine.js.map +1 -1
- package/dist/webhooks.js +65 -12
- package/dist/webhooks.js.map +1 -1
- package/package.json +2 -2
package/dist/outbox.js
CHANGED
|
@@ -11718,11 +11718,55 @@ var createEvidenceInputSchemaBase = z.object({
|
|
|
11718
11718
|
metadata: jsonRecordSchema.optional(),
|
|
11719
11719
|
trustedBypassAccessCheck: z.boolean().optional()
|
|
11720
11720
|
}).passthrough();
|
|
11721
|
-
|
|
11722
|
-
(
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11721
|
+
function hasNonzeroWeight(value) {
|
|
11722
|
+
return typeof value === "number" && Number.isFinite(value) && value !== 0;
|
|
11723
|
+
}
|
|
11724
|
+
function hasRelationSignal(value, weight) {
|
|
11725
|
+
return Boolean(normalizeRelation(value, weight));
|
|
11726
|
+
}
|
|
11727
|
+
var createEvidenceInputSchema = createEvidenceInputSchemaBase.superRefine(
|
|
11728
|
+
(input, ctx) => {
|
|
11729
|
+
if (!input.text && !input.canonicalText) {
|
|
11730
|
+
ctx.addIssue({
|
|
11731
|
+
code: z.ZodIssueCode.custom,
|
|
11732
|
+
message: "create_evidence requires text",
|
|
11733
|
+
path: ["text"]
|
|
11734
|
+
});
|
|
11735
|
+
}
|
|
11736
|
+
const target = input.targetId ?? input.targetNodeId;
|
|
11737
|
+
const kind = targetKind(target);
|
|
11738
|
+
const linksPrimaryBelief = Boolean(
|
|
11739
|
+
input.linkedBeliefNodeId || kind === "belief" || kind === "unknown" && target
|
|
11740
|
+
);
|
|
11741
|
+
const weight = typeof input.weight === "number" ? input.weight : void 0;
|
|
11742
|
+
if (linksPrimaryBelief && !hasRelationSignal(input.evidenceRelation, weight)) {
|
|
11743
|
+
ctx.addIssue({
|
|
11744
|
+
code: z.ZodIssueCode.custom,
|
|
11745
|
+
message: "belief-targeted evidence requires evidenceRelation='supports'|'contradicts' or a nonzero signed weight",
|
|
11746
|
+
path: ["evidenceRelation"]
|
|
11747
|
+
});
|
|
11748
|
+
}
|
|
11749
|
+
input.beliefRelations?.forEach((relation, index) => {
|
|
11750
|
+
const beliefNodeId = relation.beliefNodeId ?? relation.beliefId ?? relation.targetId;
|
|
11751
|
+
if (!beliefNodeId) {
|
|
11752
|
+
ctx.addIssue({
|
|
11753
|
+
code: z.ZodIssueCode.custom,
|
|
11754
|
+
message: "beliefRelations entries require beliefId, beliefNodeId, or targetId",
|
|
11755
|
+
path: ["beliefRelations", index, "beliefNodeId"]
|
|
11756
|
+
});
|
|
11757
|
+
}
|
|
11758
|
+
const relationWeight2 = typeof relation.weight === "number" ? relation.weight : void 0;
|
|
11759
|
+
if (beliefNodeId && !hasRelationSignal(
|
|
11760
|
+
relation.evidenceRelation ?? relation.relation,
|
|
11761
|
+
relationWeight2
|
|
11762
|
+
)) {
|
|
11763
|
+
ctx.addIssue({
|
|
11764
|
+
code: z.ZodIssueCode.custom,
|
|
11765
|
+
message: "beliefRelations entries require evidenceRelation='supports'|'contradicts' or a nonzero signed weight",
|
|
11766
|
+
path: ["beliefRelations", index, "evidenceRelation"]
|
|
11767
|
+
});
|
|
11768
|
+
}
|
|
11769
|
+
});
|
|
11726
11770
|
}
|
|
11727
11771
|
);
|
|
11728
11772
|
function compactRecord(input) {
|
|
@@ -11781,7 +11825,7 @@ function normalizeRelation(value, weight) {
|
|
|
11781
11825
|
if (value === "contradicts" || value === "contradicting") {
|
|
11782
11826
|
return "contradicts";
|
|
11783
11827
|
}
|
|
11784
|
-
if (weight === void 0) {
|
|
11828
|
+
if (weight === void 0 || !hasNonzeroWeight(weight)) {
|
|
11785
11829
|
return void 0;
|
|
11786
11830
|
}
|
|
11787
11831
|
return weight < 0 ? "contradicts" : "supports";
|
|
@@ -13290,14 +13334,18 @@ var createEvidenceArgs = z.object({
|
|
|
13290
13334
|
text: z.string().describe("Canonical evidence text."),
|
|
13291
13335
|
source: z.string().optional().describe("Source URL or source label."),
|
|
13292
13336
|
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
13293
|
-
targetId: z.string().optional().describe(
|
|
13337
|
+
targetId: z.string().optional().describe(
|
|
13338
|
+
"Belief, question, or worktree identifier to link or preserve on the evidence record. Belief targets require evidenceRelation or a nonzero signed weight."
|
|
13339
|
+
),
|
|
13294
13340
|
linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
|
|
13295
|
-
evidenceRelation: evidenceRelationSchema2.optional().describe(
|
|
13341
|
+
evidenceRelation: evidenceRelationSchema2.optional().describe(
|
|
13342
|
+
"How the evidence relates to the linked belief. Use supports for proof/fixes; use contradicts for bugs, regressions, or falsifying observations."
|
|
13343
|
+
),
|
|
13296
13344
|
beliefRelations: z.array(beliefRelationSchema2).optional().describe(
|
|
13297
13345
|
"Additional belief relations for one evidence record. Use when the same evidence supports or contradicts multiple beliefs."
|
|
13298
13346
|
),
|
|
13299
13347
|
confidence: z.number().optional().describe("Confidence in the evidence relation."),
|
|
13300
|
-
weight: z.number().optional().describe("
|
|
13348
|
+
weight: z.number().optional().describe("Nonzero support weight from -1.0 to +1.0."),
|
|
13301
13349
|
metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
|
|
13302
13350
|
rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
|
|
13303
13351
|
reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
|
|
@@ -13339,13 +13387,18 @@ var createEvidenceInput = (input, context) => {
|
|
|
13339
13387
|
);
|
|
13340
13388
|
};
|
|
13341
13389
|
function relationWeight(input) {
|
|
13342
|
-
if (typeof input.weight === "number") {
|
|
13390
|
+
if (typeof input.weight === "number" && Number.isFinite(input.weight) && input.weight !== 0) {
|
|
13343
13391
|
return input.weight;
|
|
13344
13392
|
}
|
|
13345
|
-
const confidence = typeof input.confidence === "number" ? Math.max(0, Math.min(1, input.confidence)) : 0.7;
|
|
13346
13393
|
const relation = String(
|
|
13347
13394
|
input.evidenceRelation ?? input.relation ?? input.type ?? ""
|
|
13348
13395
|
);
|
|
13396
|
+
if (relation !== "supports" && relation !== "supporting" && relation !== "contradicts" && relation !== "contradicting") {
|
|
13397
|
+
throw new Error(
|
|
13398
|
+
"Belief evidence links require evidenceRelation='supports'|'contradicts' or a nonzero signed weight."
|
|
13399
|
+
);
|
|
13400
|
+
}
|
|
13401
|
+
const confidence = typeof input.confidence === "number" ? Math.max(0, Math.min(1, input.confidence)) : 0.7;
|
|
13349
13402
|
return relation === "contradicts" || relation === "contradicting" ? -confidence : confidence;
|
|
13350
13403
|
}
|
|
13351
13404
|
var linkEvidenceToBeliefInput = (input, context) => {
|
|
@@ -13372,7 +13425,7 @@ var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
|
|
|
13372
13425
|
)}:${String(
|
|
13373
13426
|
input.beliefNodeId ?? input.beliefId ?? input.targetId
|
|
13374
13427
|
)}:informs`,
|
|
13375
|
-
weight:
|
|
13428
|
+
weight: relationWeight(input),
|
|
13376
13429
|
context: input.rationale ?? input.context,
|
|
13377
13430
|
skipLayerValidation: true,
|
|
13378
13431
|
topicId: input.topicId,
|