@lucern/graph-primitives 1.0.54 → 1.0.56

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.
@@ -7,3 +7,4 @@ import 'convex/values';
7
7
  import './convex.js';
8
8
  import '@lucern/access-control/convex';
9
9
  import '@lucern/contracts/convex/unsafeAnyApi';
10
+ import '@lucern/contracts/schema-helpers/evidenceAdmission';
@@ -1,4 +1,5 @@
1
1
  import { canAudienceClassAccess, normalizeAudienceKey, classFromAudienceKey } from '@lucern/access-control/audience';
2
+ import { normalizeEvidenceKind, normalizeEvidenceSourceType } from '@lucern/contracts/schema-helpers/evidenceAdmission';
2
3
  import { unsafeConvexAnyApi } from '@lucern/contracts/convex/unsafeAnyApi';
3
4
  import { componentsGeneric, mutationGeneric, internalMutationGeneric, queryGeneric, internalQueryGeneric } from 'convex/server';
4
5
  import { v } from 'convex/values';
@@ -522,24 +523,10 @@ function generateContentHash(text) {
522
523
  return Math.abs(hash).toString(16).padStart(8, "0");
523
524
  }
524
525
  function normalizeKind(kind) {
525
- if (!kind) {
526
- return "observation";
527
- }
528
- const validKinds = [
529
- "fact",
530
- "observation",
531
- "claim",
532
- "quote",
533
- "statistic",
534
- "signal"
535
- ];
536
- return validKinds.find((k) => kind.toLowerCase() === k) || "observation";
526
+ return normalizeEvidenceKind(kind, "evidence.kind");
537
527
  }
538
528
  function normalizeSourceType(sourceType) {
539
- if (sourceType === "proprietary" || sourceType === "verified") {
540
- return sourceType;
541
- }
542
- return "ai_generated";
529
+ return normalizeEvidenceSourceType(sourceType, "evidence.sourceType");
543
530
  }
544
531
  async function markProjectGraphDirty(ctx, projectId, topicId) {
545
532
  const normalizedProjectId = typeof projectId === "string" && projectId.trim().length > 0 ? projectId : void 0;
@@ -1,11 +1,12 @@
1
1
  import * as _lucern_access_control_convex_js from '@lucern/access-control/convex.js';
2
2
  import { r as resolveTopicProjectScope, T as TopicProjectScope } from './topicScope-CL1IVOmv.js';
3
3
  import * as convex_values from 'convex/values';
4
+ import { EvidenceKind, EvidenceSourceType } from '@lucern/contracts/schema-helpers/evidenceAdmission';
5
+ export { EvidenceKind, EvidenceSourceType } from '@lucern/contracts/schema-helpers/evidenceAdmission';
4
6
  import { Doc, QueryCtx, MutationCtx } from './convex.js';
5
7
  import '@lucern/access-control/convex';
6
8
  import '@lucern/contracts/convex/unsafeAnyApi';
7
9
 
8
- type EvidenceKind = "fact" | "observation" | "claim" | "quote" | "statistic" | "signal";
9
10
  type AudienceClass = "internal" | "restricted_external" | "public";
10
11
  interface EvidenceScopeArgs {
11
12
  projectId?: string | null;
@@ -18,7 +19,7 @@ declare const optionalEvidenceScopeArgs: {
18
19
  };
19
20
  declare function generateContentHash(text: string): string;
20
21
  declare function normalizeKind(kind?: string): EvidenceKind;
21
- declare function normalizeSourceType(sourceType?: string): "proprietary" | "verified" | "ai_generated";
22
+ declare function normalizeSourceType(sourceType?: string): EvidenceSourceType;
22
23
  declare function markProjectGraphDirty(ctx: QueryCtx | MutationCtx, projectId: string | undefined | null, topicId?: string | undefined | null): Promise<void>;
23
24
  declare function clampEvidenceLimit(limit: number | undefined, fallback?: number): number;
24
25
  declare function dedupeEvidenceNodes(nodes: EvidenceNodeDoc[]): EvidenceNodeDoc[];
@@ -84,4 +85,4 @@ declare function formatEvidenceNode(n: {
84
85
  updatedAt: number;
85
86
  };
86
87
 
87
- export { type AudienceClass, type EvidenceKind, type EvidenceNodeDoc, type EvidenceScopeArgs, clampEvidenceLimit, createEvidenceAudienceResolver, dedupeEvidenceNodes, evidenceMatchesScope, flattenEvidenceNode, formatEvidenceNode, generateContentHash, getEvidenceNodesForScope, markProjectGraphDirty, normalizeKind, normalizeSourceType, optionalEvidenceScopeArgs, resolveEvidenceLinkedWorktreeId, resolveEvidenceScopeOrNull };
88
+ export { type AudienceClass, type EvidenceNodeDoc, type EvidenceScopeArgs, clampEvidenceLimit, createEvidenceAudienceResolver, dedupeEvidenceNodes, evidenceMatchesScope, flattenEvidenceNode, formatEvidenceNode, generateContentHash, getEvidenceNodesForScope, markProjectGraphDirty, normalizeKind, normalizeSourceType, optionalEvidenceScopeArgs, resolveEvidenceLinkedWorktreeId, resolveEvidenceScopeOrNull };
@@ -1,4 +1,5 @@
1
1
  import { normalizeAudienceKey, classFromAudienceKey } from '@lucern/access-control/audience';
2
+ import { normalizeEvidenceKind, normalizeEvidenceSourceType } from '@lucern/contracts/schema-helpers/evidenceAdmission';
2
3
  import { unsafeConvexAnyApi } from '@lucern/contracts/convex/unsafeAnyApi';
3
4
  import { componentsGeneric } from 'convex/server';
4
5
  import { v } from 'convex/values';
@@ -511,24 +512,10 @@ function generateContentHash(text) {
511
512
  return Math.abs(hash).toString(16).padStart(8, "0");
512
513
  }
513
514
  function normalizeKind(kind) {
514
- if (!kind) {
515
- return "observation";
516
- }
517
- const validKinds = [
518
- "fact",
519
- "observation",
520
- "claim",
521
- "quote",
522
- "statistic",
523
- "signal"
524
- ];
525
- return validKinds.find((k) => kind.toLowerCase() === k) || "observation";
515
+ return normalizeEvidenceKind(kind, "evidence.kind");
526
516
  }
527
517
  function normalizeSourceType(sourceType) {
528
- if (sourceType === "proprietary" || sourceType === "verified") {
529
- return sourceType;
530
- }
531
- return "ai_generated";
518
+ return normalizeEvidenceSourceType(sourceType, "evidence.sourceType");
532
519
  }
533
520
  async function markProjectGraphDirty(ctx, projectId, topicId) {
534
521
  const normalizedProjectId = typeof projectId === "string" && projectId.trim().length > 0 ? projectId : void 0;
@@ -5,6 +5,7 @@ import { v } from 'convex/values';
5
5
  import { unsafeConvexAnyApi } from '@lucern/contracts/convex/unsafeAnyApi';
6
6
  import { componentsGeneric, mutationGeneric, internalMutationGeneric } from 'convex/server';
7
7
  import '@lucern/access-control/audience';
8
+ import { normalizeEvidenceKind, normalizeEvidenceSourceType } from '@lucern/contracts/schema-helpers/evidenceAdmission';
8
9
  import { generateGlobalId, assertUuidV7Identity, assertUuidV7Reference, assertStorageEdgeVocabulary, assertUuidShapedEdgeEndpoint, isUuidV7 } from '@lucern/contracts/ids';
9
10
  import { assertEdgePolicyAllowed } from '@lucern/contracts/manifests/edge-policy-manifest';
10
11
  import { edgePolicyManifest } from '@lucern/contracts/manifests/edge-policy-manifest.data';
@@ -542,24 +543,10 @@ function generateContentHash(text) {
542
543
  return Math.abs(hash).toString(16).padStart(8, "0");
543
544
  }
544
545
  function normalizeKind(kind) {
545
- if (!kind) {
546
- return "observation";
547
- }
548
- const validKinds = [
549
- "fact",
550
- "observation",
551
- "claim",
552
- "quote",
553
- "statistic",
554
- "signal"
555
- ];
556
- return validKinds.find((k) => kind.toLowerCase() === k) || "observation";
546
+ return normalizeEvidenceKind(kind, "evidence.kind");
557
547
  }
558
548
  function normalizeSourceType(sourceType) {
559
- if (sourceType === "proprietary" || sourceType === "verified") {
560
- return sourceType;
561
- }
562
- return "ai_generated";
549
+ return normalizeEvidenceSourceType(sourceType, "evidence.sourceType");
563
550
  }
564
551
  async function markProjectGraphDirty(ctx, projectId, topicId) {
565
552
  const normalizedProjectId = typeof projectId === "string" && projectId.trim().length > 0 ? projectId : void 0;
@@ -5,6 +5,7 @@ import { permissiveReturn } from '@lucern/contracts/schema-helpers/validators';
5
5
  import { v } from 'convex/values';
6
6
  import { unsafeConvexAnyApi } from '@lucern/contracts/convex/unsafeAnyApi';
7
7
  import { componentsGeneric, queryGeneric, internalQueryGeneric } from 'convex/server';
8
+ import '@lucern/contracts/schema-helpers/evidenceAdmission';
8
9
  import { isUuidV7 } from '@lucern/contracts/ids';
9
10
  import '@lucern/contracts/schema-helpers/spine/tables/epistemicNodes';
10
11
 
package/dist/index.d.ts CHANGED
@@ -49,6 +49,7 @@ import './epistemicEdges.mutations.js';
49
49
  import './epistemicEdges.queries.js';
50
50
  import './epistemicEvidenceHelpers.js';
51
51
  import '@lucern/access-control/convex.js';
52
+ import '@lucern/contracts/schema-helpers/evidenceAdmission';
52
53
  import './epistemicEvidenceMutations.js';
53
54
  import './epistemicEvidenceQueries.js';
54
55
  import './epistemicNodes.queries.js';
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import { assertEdgePolicyAllowed } from '@lucern/contracts/manifests/edge-policy
14
14
  import { edgePolicyManifest } from '@lucern/contracts/manifests/edge-policy-manifest.data';
15
15
  import { listAudienceRegistryRows } from '@lucern/access-control/audienceRegistry';
16
16
  import { REASONING_METHODS } from '@lucern/contracts/types/reasoning-method';
17
+ import { normalizeEvidenceKind, normalizeEvidenceSourceType } from '@lucern/contracts/schema-helpers/evidenceAdmission';
17
18
  import { EVIDENCE_SOURCE_QUALITY_VALUES, EVIDENCE_METHODOLOGY_VALUES, EVIDENCE_INFORMATION_ASYMMETRY_VALUES } from '@lucern/contracts/evidence-taxonomy-target-scope.contract';
18
19
  import { scoreEntityTypeMatch, scoreEntityConnection, rankEntityTypeMatches, rankEntityConnections } from '@lucern/contracts/v1/ontologies/v1';
19
20
  import { wordTokenize, wordOverlapScore, tokenizeSearchText, tokenOverlapScore, stemToken, scoreLexicalSignals, scoreLexicalSignal, rerankLexicalWindow, rankWindowScore, prepareLexicalQuery, jaccardSimilarity, bigramTokenize } from '@lucern/contracts/text-matching.contract';
@@ -14311,24 +14312,10 @@ function generateContentHash5(text) {
14311
14312
  return Math.abs(hash).toString(16).padStart(8, "0");
14312
14313
  }
14313
14314
  function normalizeKind(kind) {
14314
- if (!kind) {
14315
- return "observation";
14316
- }
14317
- const validKinds = [
14318
- "fact",
14319
- "observation",
14320
- "claim",
14321
- "quote",
14322
- "statistic",
14323
- "signal"
14324
- ];
14325
- return validKinds.find((k) => kind.toLowerCase() === k) || "observation";
14315
+ return normalizeEvidenceKind(kind, "evidence.kind");
14326
14316
  }
14327
14317
  function normalizeSourceType(sourceType) {
14328
- if (sourceType === "proprietary" || sourceType === "verified") {
14329
- return sourceType;
14330
- }
14331
- return "ai_generated";
14318
+ return normalizeEvidenceSourceType(sourceType, "evidence.sourceType");
14332
14319
  }
14333
14320
  async function markProjectGraphDirty2(ctx, projectId, topicId2) {
14334
14321
  const normalizedProjectId = typeof projectId === "string" && projectId.trim().length > 0 ? projectId : void 0;
@@ -41,5 +41,5 @@
41
41
  "convex-validators",
42
42
  "proof-attestation"
43
43
  ],
44
- "signedAt": 1782813065869
44
+ "signedAt": 1782994689967
45
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucern/graph-primitives",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -32,9 +32,9 @@
32
32
  "typecheck": "tsc --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@lucern/access-control": "1.0.54",
36
- "@lucern/confidence": "1.0.54",
37
- "@lucern/contracts": "1.0.54",
35
+ "@lucern/access-control": "1.0.56",
36
+ "@lucern/confidence": "1.0.56",
37
+ "@lucern/contracts": "1.0.56",
38
38
  "convex": "^1.39.1"
39
39
  },
40
40
  "devDependencies": {