@lucern/graph-primitives 0.3.0-alpha.16 → 0.3.0-alpha.2

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.
Files changed (123) hide show
  1. package/dist/{beliefDecay-DZ6tkLYq.d.ts → beliefDecay-Q_26RTc-.d.ts} +1 -1
  2. package/dist/beliefDecay.d.ts +1 -1
  3. package/dist/beliefDecay.js +47 -158
  4. package/dist/beliefDecay.js.map +1 -1
  5. package/dist/{beliefEvidenceLinks-CWOXxxJg.d.ts → beliefEvidenceLinks-42FlR48t.d.ts} +1 -1
  6. package/dist/beliefEvidenceLinks.d.ts +1 -1
  7. package/dist/beliefEvidenceLinks.js +45 -141
  8. package/dist/beliefEvidenceLinks.js.map +1 -1
  9. package/dist/{beliefLifecycle-y8WLXqQj.d.ts → beliefLifecycle-C-AehZgF.d.ts} +1 -1
  10. package/dist/beliefLifecycle.d.ts +1 -1
  11. package/dist/confidencePropagationDispatch.d.ts +1 -1
  12. package/dist/confidencePropagationDispatch.js +3 -1
  13. package/dist/confidencePropagationDispatch.js.map +1 -1
  14. package/dist/{contradictions-51VLsESq.d.ts → contradictions-Hdwl7zid.d.ts} +1 -1
  15. package/dist/contradictions.d.ts +1 -1
  16. package/dist/contradictions.js +8 -67
  17. package/dist/contradictions.js.map +1 -1
  18. package/dist/edges/contradicts.js.map +1 -1
  19. package/dist/edges/dependsOn.js.map +1 -1
  20. package/dist/edges/elaborates.js.map +1 -1
  21. package/dist/edges/index.js +3 -1
  22. package/dist/edges/index.js.map +1 -1
  23. package/dist/edges/informs.js +3 -1
  24. package/dist/edges/informs.js.map +1 -1
  25. package/dist/edges/refutes.js +3 -1
  26. package/dist/edges/refutes.js.map +1 -1
  27. package/dist/edges/supports.js.map +1 -1
  28. package/dist/edges/utils.d.ts +3 -3
  29. package/dist/edges/utils.js +4 -2
  30. package/dist/edges/utils.js.map +1 -1
  31. package/dist/embeddingTrigger.js +1 -21
  32. package/dist/embeddingTrigger.js.map +1 -1
  33. package/dist/entityBridge.js +1 -1
  34. package/dist/entityBridge.js.map +1 -1
  35. package/dist/{entityLifecycle-CvgSK5FV.d.ts → entityLifecycle-BkhRJ-XI.d.ts} +1 -1
  36. package/dist/entityLifecycle.d.ts +1 -1
  37. package/dist/entityLifecycle.js +47 -134
  38. package/dist/entityLifecycle.js.map +1 -1
  39. package/dist/{epistemicAnswers-C5ib4z6_.d.ts → epistemicAnswers-DSP1slZ9.d.ts} +1 -1
  40. package/dist/epistemicAnswers.d.ts +1 -1
  41. package/dist/epistemicAnswers.js +8 -67
  42. package/dist/epistemicAnswers.js.map +1 -1
  43. package/dist/{epistemicBeliefs-DzKjZAeC.d.ts → epistemicBeliefs-DtFVTp-k.d.ts} +3 -3
  44. package/dist/epistemicBeliefs.d.ts +2 -2
  45. package/dist/epistemicBeliefs.js +114 -289
  46. package/dist/epistemicBeliefs.js.map +1 -1
  47. package/dist/epistemicContracts.d.ts +1 -1
  48. package/dist/epistemicContracts.js +115 -297
  49. package/dist/epistemicContracts.js.map +1 -1
  50. package/dist/{epistemicEdges-CvlKnEyy.d.ts → epistemicEdges-DcA8ErUG.d.ts} +1 -1
  51. package/dist/epistemicEdges.d.ts +1 -1
  52. package/dist/epistemicEdges.js +60 -192
  53. package/dist/epistemicEdges.js.map +1 -1
  54. package/dist/{epistemicEvidence-xw6UUrwh.d.ts → epistemicEvidence-Bo638XDP.d.ts} +1 -1
  55. package/dist/epistemicEvidence.d.ts +1 -1
  56. package/dist/epistemicEvidence.js +49 -163
  57. package/dist/epistemicEvidence.js.map +1 -1
  58. package/dist/{epistemicHelpers-DevrYgPN.d.ts → epistemicHelpers-Bd9xbaib.d.ts} +1 -1
  59. package/dist/epistemicHelpers.d.ts +1 -1
  60. package/dist/{epistemicLinking-CfE00tHJ.d.ts → epistemicLinking-CyeLOIzN.d.ts} +1 -1
  61. package/dist/epistemicLinking.d.ts +1 -1
  62. package/dist/epistemicLinking.js +1 -1
  63. package/dist/{epistemicNodes-DjSUfvyD.d.ts → epistemicNodes-BpD6Koud.d.ts} +1 -1
  64. package/dist/epistemicNodes.d.ts +1 -1
  65. package/dist/epistemicNodes.js +33 -163
  66. package/dist/epistemicNodes.js.map +1 -1
  67. package/dist/{epistemicQuestions-B_nUclrH.d.ts → epistemicQuestions-CmEeY6zQ.d.ts} +1 -1
  68. package/dist/epistemicQuestions.d.ts +1 -1
  69. package/dist/epistemicQuestions.js +62 -311
  70. package/dist/epistemicQuestions.js.map +1 -1
  71. package/dist/{epistemicSources-dlKj58Jp.d.ts → epistemicSources-ZazxHOK1.d.ts} +1 -1
  72. package/dist/epistemicSources.d.ts +1 -1
  73. package/dist/epistemicSources.js +8 -65
  74. package/dist/epistemicSources.js.map +1 -1
  75. package/dist/evaluators/index.js +115 -297
  76. package/dist/evaluators/index.js.map +1 -1
  77. package/dist/evaluators/lintCheckerEvaluator.js.map +1 -1
  78. package/dist/evaluators/sentryCheckerEvaluator.js.map +1 -1
  79. package/dist/evaluators/shared.js +1 -20
  80. package/dist/evaluators/shared.js.map +1 -1
  81. package/dist/evaluators/testRunnerEvaluator.js +1 -20
  82. package/dist/evaluators/testRunnerEvaluator.js.map +1 -1
  83. package/dist/evaluators/tscCheckerEvaluator.js.map +1 -1
  84. package/dist/index.d.ts +20 -20
  85. package/dist/index.js +206 -729
  86. package/dist/index.js.map +1 -1
  87. package/dist/{ontology-matching-C6rrz2VP.d.ts → ontology-matching-Buhu23ss.d.ts} +1 -1
  88. package/dist/ontology-matching.d.ts +1 -1
  89. package/dist/{ontologyApproval-CFYmqKmk.d.ts → ontologyApproval-Ba0Jjk1k.d.ts} +1 -1
  90. package/dist/ontologyApproval.d.ts +1 -1
  91. package/dist/ontologyDefinitions.js +3 -4
  92. package/dist/ontologyDefinitions.js.map +1 -1
  93. package/dist/ontologyHelpers.d.ts +1 -1
  94. package/dist/ontologyHelpers.js +3 -4
  95. package/dist/ontologyHelpers.js.map +1 -1
  96. package/dist/{projectionReconciliation-jww2fBI0.d.ts → projectionReconciliation-CxrXYGaB.d.ts} +1 -1
  97. package/dist/projectionReconciliation.d.ts +1 -1
  98. package/dist/projectionReconciliation.js +20 -14
  99. package/dist/projectionReconciliation.js.map +1 -1
  100. package/dist/{projectionStaleness-CmdbpjVK.d.ts → projectionStaleness-CAdpIsaW.d.ts} +1 -1
  101. package/dist/projectionStaleness.d.ts +1 -1
  102. package/dist/{questionEvidenceLinks-DFlyPpAj.d.ts → questionEvidenceLinks-BdQD0TkM.d.ts} +1 -1
  103. package/dist/questionEvidenceLinks.d.ts +1 -1
  104. package/dist/questionEvidenceLinks.js +45 -144
  105. package/dist/questionEvidenceLinks.js.map +1 -1
  106. package/dist/resolvers.js +37 -86
  107. package/dist/resolvers.js.map +1 -1
  108. package/dist/scopeResolverCompat.js +7 -64
  109. package/dist/scopeResolverCompat.js.map +1 -1
  110. package/dist/{text-matching-DNg4M5Wd.d.ts → text-matching-CMn2WnVD.d.ts} +1 -1
  111. package/dist/text-matching.d.ts +1 -1
  112. package/dist/topicProjectOverlay.js +13 -56
  113. package/dist/topicProjectOverlay.js.map +1 -1
  114. package/dist/topicScope.js +6 -55
  115. package/dist/topicScope.js.map +1 -1
  116. package/dist/workflowBridge.js +6 -55
  117. package/dist/workflowBridge.js.map +1 -1
  118. package/dist/workspaceIsolation.js +6 -55
  119. package/dist/workspaceIsolation.js.map +1 -1
  120. package/package.json +5 -5
  121. package/dist/debug.d.ts +0 -4
  122. package/dist/debug.js +0 -34
  123. package/dist/debug.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { v } from 'convex/values';
2
- import { componentsGeneric, anyApi, mutationGeneric, queryGeneric } from 'convex/server';
2
+ import { componentsGeneric, mutationGeneric, queryGeneric, anyApi } from 'convex/server';
3
3
  import { checkProjectAccess } from '@lucern/access-control/access';
4
4
  import { permissiveReturn } from '@lucern/contracts/schema-helpers/validators';
5
5
 
@@ -41,20 +41,6 @@ componentsGeneric();
41
41
  var internal = anyApi;
42
42
  var mutation = mutationGeneric;
43
43
  var query = queryGeneric;
44
-
45
- // src/debug.ts
46
- function isGraphPrimitiveDebugEnabled() {
47
- const env = globalThis.process?.env;
48
- return env?.LUCERN_COMPAT_FALLBACK_DEBUG === "1" || env?.LUCERN_GRAPH_DEBUG === "1";
49
- }
50
- function debugGraphPrimitiveFallback(message, context) {
51
- if (!isGraphPrimitiveDebugEnabled()) {
52
- return;
53
- }
54
- console.debug(message, context ?? {});
55
- }
56
-
57
- // src/topicScope.ts
58
44
  var LEGACY_SCOPE_FIELD = "graphScopeProjectId";
59
45
  function asMappedProjectId(topic) {
60
46
  if (!topic) {
@@ -96,14 +82,7 @@ async function findTopicsByScopeAlias(ctx, scopeId) {
96
82
  "by_graph_scope_project",
97
83
  (q) => q.eq(LEGACY_SCOPE_FIELD, scopeId)
98
84
  ).collect();
99
- } catch (error) {
100
- debugGraphPrimitiveFallback(
101
- "[topicScope] Failed to resolve scope alias via index",
102
- {
103
- error,
104
- scopeId
105
- }
106
- );
85
+ } catch {
107
86
  const topics = await ctx.db.query("topics").collect();
108
87
  return topics.filter((topic) => {
109
88
  const normalizedGlobalId = normalizeScopeValue(topic.globalId);
@@ -120,14 +99,7 @@ async function tryResolveHostTopicById(ctx, topicId) {
120
99
  return await ctx.runQuery(api.topics.get, {
121
100
  id: topicId
122
101
  }) ?? null;
123
- } catch (error) {
124
- debugGraphPrimitiveFallback(
125
- "[topicScope] Failed to resolve topic by host query",
126
- {
127
- error,
128
- topicId
129
- }
130
- );
102
+ } catch {
131
103
  return null;
132
104
  }
133
105
  }
@@ -139,14 +111,7 @@ async function tryResolveHostTopicByLegacyScope(ctx, legacyScopeId) {
139
111
  return await ctx.runQuery(api.topics.getByLegacyScopeId, {
140
112
  projectId: legacyScopeId
141
113
  }) ?? null;
142
- } catch (error) {
143
- debugGraphPrimitiveFallback(
144
- "[topicScope] Failed to resolve topic by legacy scope",
145
- {
146
- error,
147
- legacyScopeId
148
- }
149
- );
114
+ } catch {
150
115
  return null;
151
116
  }
152
117
  }
@@ -175,17 +140,8 @@ async function resolveTopicProjectScope(ctx, args) {
175
140
  if (args.topicId) {
176
141
  let topic = null;
177
142
  try {
178
- topic = await ctx.db.get(
179
- args.topicId
180
- );
181
- } catch (error) {
182
- debugGraphPrimitiveFallback(
183
- "[topicScope] Failed to load topic by direct id",
184
- {
185
- error,
186
- topicId: args.topicId
187
- }
188
- );
143
+ topic = await ctx.db.get(args.topicId);
144
+ } catch {
189
145
  }
190
146
  if (!topic) {
191
147
  topic = await tryResolveHostTopicById(ctx, String(args.topicId));
@@ -222,14 +178,7 @@ async function resolveTopicProjectScope(ctx, args) {
222
178
  directTopic = await ctx.db.get(
223
179
  args.projectId
224
180
  );
225
- } catch (error) {
226
- debugGraphPrimitiveFallback(
227
- "[topicScope] Failed to load direct project topic",
228
- {
229
- error,
230
- projectId: args.projectId
231
- }
232
- );
181
+ } catch {
233
182
  }
234
183
  if (directTopic) {
235
184
  const inherited = await resolveInheritedWorkspaceScope(ctx, directTopic);
@@ -299,15 +248,7 @@ async function resolveScope(ctx, args) {
299
248
  topicId,
300
249
  projectId
301
250
  });
302
- } catch (error) {
303
- debugGraphPrimitiveFallback(
304
- "[scopeResolverCompat] Failed to resolve scope",
305
- {
306
- error,
307
- topicId,
308
- projectId
309
- }
310
- );
251
+ } catch {
311
252
  return null;
312
253
  }
313
254
  }
@@ -376,37 +317,19 @@ function isProjectLikeTopic(topic) {
376
317
  return topic.type === "theme" || topic.type === "thematic" || topic.type === "deal" || topic.type === "monitoring" || readLegacyProjectId(topic) !== void 0 || readNonEmptyString(metadata.projectType) !== void 0;
377
318
  }
378
319
  function isMissingLucernChildComponentError(error) {
379
- const message = getErrorMessage(error);
320
+ const message = error instanceof Error ? error.message : String(error);
380
321
  return message.includes(
381
322
  'Child component ComponentName(Identifier("lucern")) not found'
382
323
  ) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
383
324
  }
384
- function getErrorMessage(error) {
385
- if (error instanceof Error) {
386
- return error.message;
387
- }
388
- if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
389
- return error.message;
390
- }
391
- return "unknown error";
392
- }
393
325
  async function resolveTopicDoc(ctx, scopeId) {
394
326
  if (ctx?.db && typeof ctx.db.get === "function") {
395
327
  try {
396
- const directTopic = await ctx.db.get(
397
- scopeId
398
- );
328
+ const directTopic = await ctx.db.get(scopeId);
399
329
  if (directTopic) {
400
330
  return directTopic;
401
331
  }
402
- } catch (error) {
403
- debugGraphPrimitiveFallback(
404
- "[topicProjectOverlay] Failed to resolve topic by direct ID",
405
- {
406
- error,
407
- scopeId
408
- }
409
- );
332
+ } catch {
410
333
  }
411
334
  }
412
335
  if (typeof ctx.runQuery !== "function") {
@@ -419,14 +342,7 @@ async function resolveTopicDoc(ctx, scopeId) {
419
342
  if (topic?.name !== void 0 && topic?.type !== void 0) {
420
343
  return topic;
421
344
  }
422
- } catch (error) {
423
- debugGraphPrimitiveFallback(
424
- "[topicProjectOverlay] Failed to resolve topic by ID query",
425
- {
426
- error,
427
- scopeId
428
- }
429
- );
345
+ } catch {
430
346
  }
431
347
  try {
432
348
  const topic = await ctx.runQuery(api.topics.getByLegacyScopeId, {
@@ -435,11 +351,7 @@ async function resolveTopicDoc(ctx, scopeId) {
435
351
  if (topic?.name !== void 0 && topic?.type !== void 0) {
436
352
  return topic;
437
353
  }
438
- } catch (error) {
439
- debugGraphPrimitiveFallback(
440
- "[topicProjectOverlay] Failed to resolve topic by legacy scope ID",
441
- { error, scopeId }
442
- );
354
+ } catch {
443
355
  }
444
356
  return null;
445
357
  }
@@ -493,11 +405,7 @@ async function listTopicProjectOverlays(ctx, options = {}) {
493
405
  if (ctx?.db?.query && typeof ctx.db.query === "function") {
494
406
  try {
495
407
  allTopics = await ctx.db.query("topics").collect();
496
- } catch (error) {
497
- debugGraphPrimitiveFallback(
498
- "[topicProjectOverlay] Failed to read topics table; falling back to API",
499
- { error }
500
- );
408
+ } catch {
501
409
  allTopics = [];
502
410
  }
503
411
  }
@@ -592,28 +500,19 @@ async function patchTopicProjectOverlay(ctx, scopeId, value) {
592
500
  "Cannot patch topic without component adapter (ctx.runMutation unavailable)"
593
501
  );
594
502
  }
595
- return materializeTopicProjectOverlay({
596
- ...topic,
597
- ...patch,
598
- metadata: nextMetadata
599
- });
503
+ return materializeTopicProjectOverlay(
504
+ {
505
+ ...topic,
506
+ ...patch,
507
+ metadata: nextMetadata
508
+ }
509
+ );
600
510
  }
601
511
 
602
512
  // src/resolvers.ts
603
513
  function isMissingLucernChildComponentError2(error) {
604
- const message = getErrorMessage2(error);
605
- return message.includes(
606
- 'Child component ComponentName(Identifier("lucern")) not found'
607
- ) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
608
- }
609
- function getErrorMessage2(error) {
610
- if (error instanceof Error) {
611
- return error.message;
612
- }
613
- if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
614
- return error.message;
615
- }
616
- return "unknown error";
514
+ const message = error instanceof Error ? error.message : String(error);
515
+ return message.includes('Child component ComponentName(Identifier("lucern")) not found') || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
617
516
  }
618
517
  function isAdvisoryTopicPatch(value) {
619
518
  const advisoryKeys = /* @__PURE__ */ new Set(["lastActivityAt", "updatedAt"]);
@@ -627,27 +526,32 @@ async function patchProjectWithTolerance(ctx, projectId, value) {
627
526
  if (!isAdvisoryTopicPatch(value) || !isMissingLucernChildComponentError2(error)) {
628
527
  throw error;
629
528
  }
630
- console.warn(
631
- "[lucern graph-primitives] Non-fatal advisory topic patch failure",
632
- {
633
- projectId,
634
- keys: Object.keys(value),
635
- error: getErrorMessage2(error)
636
- }
637
- );
529
+ console.warn("[lucern graph-primitives] Non-fatal advisory topic patch failure", {
530
+ projectId,
531
+ keys: Object.keys(value),
532
+ error: error instanceof Error ? error.message : error
533
+ });
638
534
  }
639
535
  }
640
536
  function defaultResolvers() {
641
537
  return {
642
- getProject: (ctx, projectId) => resolveTopicProjectOverlay(ctx, projectId, {
643
- idMode: "legacy",
644
- projectLikeOnly: false
645
- }),
646
- patchProject: (ctx, projectId, value) => patchProjectWithTolerance(ctx, projectId, value),
647
- listTopics: (ctx) => listTopicProjectOverlays(ctx, {
648
- idMode: "legacy"
649
- }),
650
- getFinalArtifact: (ctx, artifactId) => ctx.db.get(artifactId)
538
+ async getProject(ctx, projectId) {
539
+ return await resolveTopicProjectOverlay(ctx, projectId, {
540
+ idMode: "legacy",
541
+ projectLikeOnly: false
542
+ });
543
+ },
544
+ async patchProject(ctx, projectId, value) {
545
+ await patchProjectWithTolerance(ctx, projectId, value);
546
+ },
547
+ async listTopics(ctx) {
548
+ return await listTopicProjectOverlays(ctx, {
549
+ idMode: "legacy"
550
+ });
551
+ },
552
+ async getFinalArtifact(ctx, artifactId) {
553
+ return await ctx.db.get(artifactId);
554
+ }
651
555
  };
652
556
  }
653
557
  var resolverOverrides = {};