@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,7 +1,7 @@
1
1
  import { v } from 'convex/values';
2
2
  import { checkProjectAccess } from '@lucern/access-control/access';
3
3
  import { permissiveReturn } from '@lucern/contracts/schema-helpers/validators';
4
- import { componentsGeneric, mutationGeneric, anyApi, queryGeneric } from 'convex/server';
4
+ import { componentsGeneric, mutationGeneric, queryGeneric, anyApi } from 'convex/server';
5
5
 
6
6
  // src/questionEvidenceLinks.ts
7
7
  var api = anyApi;
@@ -10,18 +10,6 @@ var internal = anyApi;
10
10
  var mutation = mutationGeneric;
11
11
  var query = queryGeneric;
12
12
 
13
- // src/debug.ts
14
- function isGraphPrimitiveDebugEnabled() {
15
- const env = globalThis.process?.env;
16
- return env?.LUCERN_COMPAT_FALLBACK_DEBUG === "1" || env?.LUCERN_GRAPH_DEBUG === "1";
17
- }
18
- function debugGraphPrimitiveFallback(message, context) {
19
- if (!isGraphPrimitiveDebugEnabled()) {
20
- return;
21
- }
22
- console.debug(message, context ?? {});
23
- }
24
-
25
13
  // src/matcherFeedbackUtils.ts
26
14
  function isOperationalLinkStatus(status) {
27
15
  return status !== "suggested" && status !== "dismissed";
@@ -99,37 +87,19 @@ function isProjectLikeTopic(topic) {
99
87
  return topic.type === "theme" || topic.type === "thematic" || topic.type === "deal" || topic.type === "monitoring" || readLegacyProjectId(topic) !== void 0 || readNonEmptyString(metadata.projectType) !== void 0;
100
88
  }
101
89
  function isMissingLucernChildComponentError(error) {
102
- const message = getErrorMessage(error);
90
+ const message = error instanceof Error ? error.message : String(error);
103
91
  return message.includes(
104
92
  'Child component ComponentName(Identifier("lucern")) not found'
105
93
  ) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
106
94
  }
107
- function getErrorMessage(error) {
108
- if (error instanceof Error) {
109
- return error.message;
110
- }
111
- if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
112
- return error.message;
113
- }
114
- return "unknown error";
115
- }
116
95
  async function resolveTopicDoc(ctx, scopeId) {
117
96
  if (ctx?.db && typeof ctx.db.get === "function") {
118
97
  try {
119
- const directTopic = await ctx.db.get(
120
- scopeId
121
- );
98
+ const directTopic = await ctx.db.get(scopeId);
122
99
  if (directTopic) {
123
100
  return directTopic;
124
101
  }
125
- } catch (error) {
126
- debugGraphPrimitiveFallback(
127
- "[topicProjectOverlay] Failed to resolve topic by direct ID",
128
- {
129
- error,
130
- scopeId
131
- }
132
- );
102
+ } catch {
133
103
  }
134
104
  }
135
105
  if (typeof ctx.runQuery !== "function") {
@@ -142,14 +112,7 @@ async function resolveTopicDoc(ctx, scopeId) {
142
112
  if (topic?.name !== void 0 && topic?.type !== void 0) {
143
113
  return topic;
144
114
  }
145
- } catch (error) {
146
- debugGraphPrimitiveFallback(
147
- "[topicProjectOverlay] Failed to resolve topic by ID query",
148
- {
149
- error,
150
- scopeId
151
- }
152
- );
115
+ } catch {
153
116
  }
154
117
  try {
155
118
  const topic = await ctx.runQuery(api.topics.getByLegacyScopeId, {
@@ -158,11 +121,7 @@ async function resolveTopicDoc(ctx, scopeId) {
158
121
  if (topic?.name !== void 0 && topic?.type !== void 0) {
159
122
  return topic;
160
123
  }
161
- } catch (error) {
162
- debugGraphPrimitiveFallback(
163
- "[topicProjectOverlay] Failed to resolve topic by legacy scope ID",
164
- { error, scopeId }
165
- );
124
+ } catch {
166
125
  }
167
126
  return null;
168
127
  }
@@ -216,11 +175,7 @@ async function listTopicProjectOverlays(ctx, options = {}) {
216
175
  if (ctx?.db?.query && typeof ctx.db.query === "function") {
217
176
  try {
218
177
  allTopics = await ctx.db.query("topics").collect();
219
- } catch (error) {
220
- debugGraphPrimitiveFallback(
221
- "[topicProjectOverlay] Failed to read topics table; falling back to API",
222
- { error }
223
- );
178
+ } catch {
224
179
  allTopics = [];
225
180
  }
226
181
  }
@@ -315,28 +270,19 @@ async function patchTopicProjectOverlay(ctx, scopeId, value) {
315
270
  "Cannot patch topic without component adapter (ctx.runMutation unavailable)"
316
271
  );
317
272
  }
318
- return materializeTopicProjectOverlay({
319
- ...topic,
320
- ...patch,
321
- metadata: nextMetadata
322
- });
273
+ return materializeTopicProjectOverlay(
274
+ {
275
+ ...topic,
276
+ ...patch,
277
+ metadata: nextMetadata
278
+ }
279
+ );
323
280
  }
324
281
 
325
282
  // src/resolvers.ts
326
283
  function isMissingLucernChildComponentError2(error) {
327
- const message = getErrorMessage2(error);
328
- return message.includes(
329
- 'Child component ComponentName(Identifier("lucern")) not found'
330
- ) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
331
- }
332
- function getErrorMessage2(error) {
333
- if (error instanceof Error) {
334
- return error.message;
335
- }
336
- if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
337
- return error.message;
338
- }
339
- return "unknown error";
284
+ const message = error instanceof Error ? error.message : String(error);
285
+ return message.includes('Child component ComponentName(Identifier("lucern")) not found') || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
340
286
  }
341
287
  function isAdvisoryTopicPatch(value) {
342
288
  const advisoryKeys = /* @__PURE__ */ new Set(["lastActivityAt", "updatedAt"]);
@@ -350,27 +296,32 @@ async function patchProjectWithTolerance(ctx, projectId, value) {
350
296
  if (!isAdvisoryTopicPatch(value) || !isMissingLucernChildComponentError2(error)) {
351
297
  throw error;
352
298
  }
353
- console.warn(
354
- "[lucern graph-primitives] Non-fatal advisory topic patch failure",
355
- {
356
- projectId,
357
- keys: Object.keys(value),
358
- error: getErrorMessage2(error)
359
- }
360
- );
299
+ console.warn("[lucern graph-primitives] Non-fatal advisory topic patch failure", {
300
+ projectId,
301
+ keys: Object.keys(value),
302
+ error: error instanceof Error ? error.message : error
303
+ });
361
304
  }
362
305
  }
363
306
  function defaultResolvers() {
364
307
  return {
365
- getProject: (ctx, projectId) => resolveTopicProjectOverlay(ctx, projectId, {
366
- idMode: "legacy",
367
- projectLikeOnly: false
368
- }),
369
- patchProject: (ctx, projectId, value) => patchProjectWithTolerance(ctx, projectId, value),
370
- listTopics: (ctx) => listTopicProjectOverlays(ctx, {
371
- idMode: "legacy"
372
- }),
373
- getFinalArtifact: (ctx, artifactId) => ctx.db.get(artifactId)
308
+ async getProject(ctx, projectId) {
309
+ return await resolveTopicProjectOverlay(ctx, projectId, {
310
+ idMode: "legacy",
311
+ projectLikeOnly: false
312
+ });
313
+ },
314
+ async patchProject(ctx, projectId, value) {
315
+ await patchProjectWithTolerance(ctx, projectId, value);
316
+ },
317
+ async listTopics(ctx) {
318
+ return await listTopicProjectOverlays(ctx, {
319
+ idMode: "legacy"
320
+ });
321
+ },
322
+ async getFinalArtifact(ctx, artifactId) {
323
+ return await ctx.db.get(artifactId);
324
+ }
374
325
  };
375
326
  }
376
327
  var resolverOverrides = {};
@@ -421,14 +372,7 @@ async function findTopicsByScopeAlias(ctx, scopeId) {
421
372
  "by_graph_scope_project",
422
373
  (q) => q.eq(LEGACY_SCOPE_FIELD2, scopeId)
423
374
  ).collect();
424
- } catch (error) {
425
- debugGraphPrimitiveFallback(
426
- "[topicScope] Failed to resolve scope alias via index",
427
- {
428
- error,
429
- scopeId
430
- }
431
- );
375
+ } catch {
432
376
  const topics = await ctx.db.query("topics").collect();
433
377
  return topics.filter((topic) => {
434
378
  const normalizedGlobalId = normalizeScopeValue(topic.globalId);
@@ -445,14 +389,7 @@ async function tryResolveHostTopicById(ctx, topicId) {
445
389
  return await ctx.runQuery(api.topics.get, {
446
390
  id: topicId
447
391
  }) ?? null;
448
- } catch (error) {
449
- debugGraphPrimitiveFallback(
450
- "[topicScope] Failed to resolve topic by host query",
451
- {
452
- error,
453
- topicId
454
- }
455
- );
392
+ } catch {
456
393
  return null;
457
394
  }
458
395
  }
@@ -464,14 +401,7 @@ async function tryResolveHostTopicByLegacyScope(ctx, legacyScopeId) {
464
401
  return await ctx.runQuery(api.topics.getByLegacyScopeId, {
465
402
  projectId: legacyScopeId
466
403
  }) ?? null;
467
- } catch (error) {
468
- debugGraphPrimitiveFallback(
469
- "[topicScope] Failed to resolve topic by legacy scope",
470
- {
471
- error,
472
- legacyScopeId
473
- }
474
- );
404
+ } catch {
475
405
  return null;
476
406
  }
477
407
  }
@@ -500,17 +430,8 @@ async function resolveTopicProjectScope(ctx, args) {
500
430
  if (args.topicId) {
501
431
  let topic = null;
502
432
  try {
503
- topic = await ctx.db.get(
504
- args.topicId
505
- );
506
- } catch (error) {
507
- debugGraphPrimitiveFallback(
508
- "[topicScope] Failed to load topic by direct id",
509
- {
510
- error,
511
- topicId: args.topicId
512
- }
513
- );
433
+ topic = await ctx.db.get(args.topicId);
434
+ } catch {
514
435
  }
515
436
  if (!topic) {
516
437
  topic = await tryResolveHostTopicById(ctx, String(args.topicId));
@@ -547,14 +468,7 @@ async function resolveTopicProjectScope(ctx, args) {
547
468
  directTopic = await ctx.db.get(
548
469
  args.projectId
549
470
  );
550
- } catch (error) {
551
- debugGraphPrimitiveFallback(
552
- "[topicScope] Failed to load direct project topic",
553
- {
554
- error,
555
- projectId: args.projectId
556
- }
557
- );
471
+ } catch {
558
472
  }
559
473
  if (directTopic) {
560
474
  const inherited = await resolveInheritedWorkspaceScope(ctx, directTopic);
@@ -1105,20 +1019,7 @@ var getByProject = query({
1105
1019
  if (!hasAccess) {
1106
1020
  return [];
1107
1021
  }
1108
- let scope;
1109
- try {
1110
- scope = await resolveTopicProjectScope(ctx, args);
1111
- } catch (error) {
1112
- debugGraphPrimitiveFallback(
1113
- "[questionEvidenceLinks] Failed to resolve topic scope",
1114
- {
1115
- error,
1116
- projectId: args.projectId,
1117
- topicId: args.topicId
1118
- }
1119
- );
1120
- scope = null;
1121
- }
1022
+ const scope = await resolveTopicProjectScope(ctx, args).catch(() => null);
1122
1023
  if (!scope) {
1123
1024
  return [];
1124
1025
  }