@lucern/graph-primitives 0.3.0-alpha.1 → 0.3.0-alpha.11
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/{beliefDecay-Q_26RTc-.d.ts → beliefDecay-DZ6tkLYq.d.ts} +1 -1
- package/dist/beliefDecay.d.ts +1 -1
- package/dist/beliefDecay.js +158 -47
- package/dist/beliefDecay.js.map +1 -1
- package/dist/{beliefEvidenceLinks-42FlR48t.d.ts → beliefEvidenceLinks-CWOXxxJg.d.ts} +1 -1
- package/dist/beliefEvidenceLinks.d.ts +1 -1
- package/dist/beliefEvidenceLinks.js +141 -45
- package/dist/beliefEvidenceLinks.js.map +1 -1
- package/dist/{beliefLifecycle-C-AehZgF.d.ts → beliefLifecycle-y8WLXqQj.d.ts} +1 -1
- package/dist/beliefLifecycle.d.ts +1 -1
- package/dist/confidencePropagationDispatch.d.ts +1 -1
- package/dist/confidencePropagationDispatch.js +1 -3
- package/dist/confidencePropagationDispatch.js.map +1 -1
- package/dist/{contradictions-Hdwl7zid.d.ts → contradictions-51VLsESq.d.ts} +1 -1
- package/dist/contradictions.d.ts +1 -1
- package/dist/contradictions.js +67 -8
- package/dist/contradictions.js.map +1 -1
- package/dist/debug.d.ts +4 -0
- package/dist/debug.js +34 -0
- package/dist/debug.js.map +1 -0
- package/dist/edges/contradicts.js.map +1 -1
- package/dist/edges/dependsOn.js.map +1 -1
- package/dist/edges/elaborates.js.map +1 -1
- package/dist/edges/index.js +1 -3
- package/dist/edges/index.js.map +1 -1
- package/dist/edges/informs.js +1 -3
- package/dist/edges/informs.js.map +1 -1
- package/dist/edges/refutes.js +1 -3
- package/dist/edges/refutes.js.map +1 -1
- package/dist/edges/supports.js.map +1 -1
- package/dist/edges/utils.d.ts +3 -3
- package/dist/edges/utils.js +2 -4
- package/dist/edges/utils.js.map +1 -1
- package/dist/embeddingTrigger.js +21 -1
- package/dist/embeddingTrigger.js.map +1 -1
- package/dist/entityBridge.js +1 -1
- package/dist/entityBridge.js.map +1 -1
- package/dist/{entityLifecycle-BkhRJ-XI.d.ts → entityLifecycle-CvgSK5FV.d.ts} +1 -1
- package/dist/entityLifecycle.d.ts +1 -1
- package/dist/entityLifecycle.js +134 -47
- package/dist/entityLifecycle.js.map +1 -1
- package/dist/{epistemicAnswers-DSP1slZ9.d.ts → epistemicAnswers-C5ib4z6_.d.ts} +1 -1
- package/dist/epistemicAnswers.d.ts +1 -1
- package/dist/epistemicAnswers.js +67 -8
- package/dist/epistemicAnswers.js.map +1 -1
- package/dist/{epistemicBeliefs-DtFVTp-k.d.ts → epistemicBeliefs-DzKjZAeC.d.ts} +3 -3
- package/dist/epistemicBeliefs.d.ts +2 -2
- package/dist/epistemicBeliefs.js +289 -114
- package/dist/epistemicBeliefs.js.map +1 -1
- package/dist/epistemicContracts.d.ts +1 -1
- package/dist/epistemicContracts.js +297 -115
- package/dist/epistemicContracts.js.map +1 -1
- package/dist/{epistemicEdges-DcA8ErUG.d.ts → epistemicEdges-CvlKnEyy.d.ts} +1 -1
- package/dist/epistemicEdges.d.ts +1 -1
- package/dist/epistemicEdges.js +192 -60
- package/dist/epistemicEdges.js.map +1 -1
- package/dist/{epistemicEvidence-Bo638XDP.d.ts → epistemicEvidence-xw6UUrwh.d.ts} +1 -1
- package/dist/epistemicEvidence.d.ts +1 -1
- package/dist/epistemicEvidence.js +163 -49
- package/dist/epistemicEvidence.js.map +1 -1
- package/dist/{epistemicHelpers-Bd9xbaib.d.ts → epistemicHelpers-DevrYgPN.d.ts} +1 -1
- package/dist/epistemicHelpers.d.ts +1 -1
- package/dist/{epistemicLinking-CyeLOIzN.d.ts → epistemicLinking-CfE00tHJ.d.ts} +1 -1
- package/dist/epistemicLinking.d.ts +1 -1
- package/dist/epistemicLinking.js +1 -1
- package/dist/{epistemicNodes-BpD6Koud.d.ts → epistemicNodes-DjSUfvyD.d.ts} +1 -1
- package/dist/epistemicNodes.d.ts +1 -1
- package/dist/epistemicNodes.js +163 -33
- package/dist/epistemicNodes.js.map +1 -1
- package/dist/{epistemicQuestions-CmEeY6zQ.d.ts → epistemicQuestions-B_nUclrH.d.ts} +1 -1
- package/dist/epistemicQuestions.d.ts +1 -1
- package/dist/epistemicQuestions.js +311 -62
- package/dist/epistemicQuestions.js.map +1 -1
- package/dist/{epistemicSources-ZazxHOK1.d.ts → epistemicSources-dlKj58Jp.d.ts} +1 -1
- package/dist/epistemicSources.d.ts +1 -1
- package/dist/epistemicSources.js +65 -8
- package/dist/epistemicSources.js.map +1 -1
- package/dist/evaluators/index.js +297 -115
- package/dist/evaluators/index.js.map +1 -1
- package/dist/evaluators/lintCheckerEvaluator.js.map +1 -1
- package/dist/evaluators/sentryCheckerEvaluator.js.map +1 -1
- package/dist/evaluators/shared.js +20 -1
- package/dist/evaluators/shared.js.map +1 -1
- package/dist/evaluators/testRunnerEvaluator.js +20 -1
- package/dist/evaluators/testRunnerEvaluator.js.map +1 -1
- package/dist/evaluators/tscCheckerEvaluator.js.map +1 -1
- package/dist/index.d.ts +20 -20
- package/dist/index.js +729 -206
- package/dist/index.js.map +1 -1
- package/dist/{ontology-matching-Buhu23ss.d.ts → ontology-matching-C6rrz2VP.d.ts} +1 -1
- package/dist/ontology-matching.d.ts +1 -1
- package/dist/{ontologyApproval-Ba0Jjk1k.d.ts → ontologyApproval-CFYmqKmk.d.ts} +1 -1
- package/dist/ontologyApproval.d.ts +1 -1
- package/dist/ontologyDefinitions.js +4 -3
- package/dist/ontologyDefinitions.js.map +1 -1
- package/dist/ontologyHelpers.d.ts +1 -1
- package/dist/ontologyHelpers.js +4 -3
- package/dist/ontologyHelpers.js.map +1 -1
- package/dist/{projectionReconciliation-CxrXYGaB.d.ts → projectionReconciliation-jww2fBI0.d.ts} +1 -1
- package/dist/projectionReconciliation.d.ts +1 -1
- package/dist/projectionReconciliation.js +14 -20
- package/dist/projectionReconciliation.js.map +1 -1
- package/dist/{projectionStaleness-CAdpIsaW.d.ts → projectionStaleness-CmdbpjVK.d.ts} +1 -1
- package/dist/projectionStaleness.d.ts +1 -1
- package/dist/{questionEvidenceLinks-BdQD0TkM.d.ts → questionEvidenceLinks-DFlyPpAj.d.ts} +1 -1
- package/dist/questionEvidenceLinks.d.ts +1 -1
- package/dist/questionEvidenceLinks.js +144 -45
- package/dist/questionEvidenceLinks.js.map +1 -1
- package/dist/resolvers.js +86 -37
- package/dist/resolvers.js.map +1 -1
- package/dist/scopeResolverCompat.js +64 -7
- package/dist/scopeResolverCompat.js.map +1 -1
- package/dist/{text-matching-CMn2WnVD.d.ts → text-matching-DNg4M5Wd.d.ts} +1 -1
- package/dist/text-matching.d.ts +1 -1
- package/dist/topicProjectOverlay.js +56 -13
- package/dist/topicProjectOverlay.js.map +1 -1
- package/dist/topicScope.js +55 -6
- package/dist/topicScope.js.map +1 -1
- package/dist/workflowBridge.js +55 -6
- package/dist/workflowBridge.js.map +1 -1
- package/dist/workspaceIsolation.js +55 -6
- package/dist/workspaceIsolation.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v } from 'convex/values';
|
|
2
|
-
import { componentsGeneric, mutationGeneric, queryGeneric
|
|
2
|
+
import { componentsGeneric, anyApi, mutationGeneric, queryGeneric } 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,6 +41,20 @@ 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
|
|
44
58
|
var LEGACY_SCOPE_FIELD = "graphScopeProjectId";
|
|
45
59
|
function asMappedProjectId(topic) {
|
|
46
60
|
if (!topic) {
|
|
@@ -82,7 +96,14 @@ async function findTopicsByScopeAlias(ctx, scopeId) {
|
|
|
82
96
|
"by_graph_scope_project",
|
|
83
97
|
(q) => q.eq(LEGACY_SCOPE_FIELD, scopeId)
|
|
84
98
|
).collect();
|
|
85
|
-
} catch {
|
|
99
|
+
} catch (error) {
|
|
100
|
+
debugGraphPrimitiveFallback(
|
|
101
|
+
"[topicScope] Failed to resolve scope alias via index",
|
|
102
|
+
{
|
|
103
|
+
error,
|
|
104
|
+
scopeId
|
|
105
|
+
}
|
|
106
|
+
);
|
|
86
107
|
const topics = await ctx.db.query("topics").collect();
|
|
87
108
|
return topics.filter((topic) => {
|
|
88
109
|
const normalizedGlobalId = normalizeScopeValue(topic.globalId);
|
|
@@ -99,7 +120,14 @@ async function tryResolveHostTopicById(ctx, topicId) {
|
|
|
99
120
|
return await ctx.runQuery(api.topics.get, {
|
|
100
121
|
id: topicId
|
|
101
122
|
}) ?? null;
|
|
102
|
-
} catch {
|
|
123
|
+
} catch (error) {
|
|
124
|
+
debugGraphPrimitiveFallback(
|
|
125
|
+
"[topicScope] Failed to resolve topic by host query",
|
|
126
|
+
{
|
|
127
|
+
error,
|
|
128
|
+
topicId
|
|
129
|
+
}
|
|
130
|
+
);
|
|
103
131
|
return null;
|
|
104
132
|
}
|
|
105
133
|
}
|
|
@@ -111,7 +139,14 @@ async function tryResolveHostTopicByLegacyScope(ctx, legacyScopeId) {
|
|
|
111
139
|
return await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
112
140
|
projectId: legacyScopeId
|
|
113
141
|
}) ?? null;
|
|
114
|
-
} catch {
|
|
142
|
+
} catch (error) {
|
|
143
|
+
debugGraphPrimitiveFallback(
|
|
144
|
+
"[topicScope] Failed to resolve topic by legacy scope",
|
|
145
|
+
{
|
|
146
|
+
error,
|
|
147
|
+
legacyScopeId
|
|
148
|
+
}
|
|
149
|
+
);
|
|
115
150
|
return null;
|
|
116
151
|
}
|
|
117
152
|
}
|
|
@@ -140,8 +175,17 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
140
175
|
if (args.topicId) {
|
|
141
176
|
let topic = null;
|
|
142
177
|
try {
|
|
143
|
-
topic = await ctx.db.get(
|
|
144
|
-
|
|
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
|
+
);
|
|
145
189
|
}
|
|
146
190
|
if (!topic) {
|
|
147
191
|
topic = await tryResolveHostTopicById(ctx, String(args.topicId));
|
|
@@ -178,7 +222,14 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
178
222
|
directTopic = await ctx.db.get(
|
|
179
223
|
args.projectId
|
|
180
224
|
);
|
|
181
|
-
} catch {
|
|
225
|
+
} catch (error) {
|
|
226
|
+
debugGraphPrimitiveFallback(
|
|
227
|
+
"[topicScope] Failed to load direct project topic",
|
|
228
|
+
{
|
|
229
|
+
error,
|
|
230
|
+
projectId: args.projectId
|
|
231
|
+
}
|
|
232
|
+
);
|
|
182
233
|
}
|
|
183
234
|
if (directTopic) {
|
|
184
235
|
const inherited = await resolveInheritedWorkspaceScope(ctx, directTopic);
|
|
@@ -248,7 +299,15 @@ async function resolveScope(ctx, args) {
|
|
|
248
299
|
topicId,
|
|
249
300
|
projectId
|
|
250
301
|
});
|
|
251
|
-
} catch {
|
|
302
|
+
} catch (error) {
|
|
303
|
+
debugGraphPrimitiveFallback(
|
|
304
|
+
"[scopeResolverCompat] Failed to resolve scope",
|
|
305
|
+
{
|
|
306
|
+
error,
|
|
307
|
+
topicId,
|
|
308
|
+
projectId
|
|
309
|
+
}
|
|
310
|
+
);
|
|
252
311
|
return null;
|
|
253
312
|
}
|
|
254
313
|
}
|
|
@@ -317,19 +376,37 @@ function isProjectLikeTopic(topic) {
|
|
|
317
376
|
return topic.type === "theme" || topic.type === "thematic" || topic.type === "deal" || topic.type === "monitoring" || readLegacyProjectId(topic) !== void 0 || readNonEmptyString(metadata.projectType) !== void 0;
|
|
318
377
|
}
|
|
319
378
|
function isMissingLucernChildComponentError(error) {
|
|
320
|
-
const message =
|
|
379
|
+
const message = getErrorMessage(error);
|
|
321
380
|
return message.includes(
|
|
322
381
|
'Child component ComponentName(Identifier("lucern")) not found'
|
|
323
382
|
) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
324
383
|
}
|
|
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
|
+
}
|
|
325
393
|
async function resolveTopicDoc(ctx, scopeId) {
|
|
326
394
|
if (ctx?.db && typeof ctx.db.get === "function") {
|
|
327
395
|
try {
|
|
328
|
-
const directTopic = await ctx.db.get(
|
|
396
|
+
const directTopic = await ctx.db.get(
|
|
397
|
+
scopeId
|
|
398
|
+
);
|
|
329
399
|
if (directTopic) {
|
|
330
400
|
return directTopic;
|
|
331
401
|
}
|
|
332
|
-
} catch {
|
|
402
|
+
} catch (error) {
|
|
403
|
+
debugGraphPrimitiveFallback(
|
|
404
|
+
"[topicProjectOverlay] Failed to resolve topic by direct ID",
|
|
405
|
+
{
|
|
406
|
+
error,
|
|
407
|
+
scopeId
|
|
408
|
+
}
|
|
409
|
+
);
|
|
333
410
|
}
|
|
334
411
|
}
|
|
335
412
|
if (typeof ctx.runQuery !== "function") {
|
|
@@ -342,7 +419,14 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
342
419
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
343
420
|
return topic;
|
|
344
421
|
}
|
|
345
|
-
} catch {
|
|
422
|
+
} catch (error) {
|
|
423
|
+
debugGraphPrimitiveFallback(
|
|
424
|
+
"[topicProjectOverlay] Failed to resolve topic by ID query",
|
|
425
|
+
{
|
|
426
|
+
error,
|
|
427
|
+
scopeId
|
|
428
|
+
}
|
|
429
|
+
);
|
|
346
430
|
}
|
|
347
431
|
try {
|
|
348
432
|
const topic = await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
@@ -351,7 +435,11 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
351
435
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
352
436
|
return topic;
|
|
353
437
|
}
|
|
354
|
-
} catch {
|
|
438
|
+
} catch (error) {
|
|
439
|
+
debugGraphPrimitiveFallback(
|
|
440
|
+
"[topicProjectOverlay] Failed to resolve topic by legacy scope ID",
|
|
441
|
+
{ error, scopeId }
|
|
442
|
+
);
|
|
355
443
|
}
|
|
356
444
|
return null;
|
|
357
445
|
}
|
|
@@ -405,7 +493,11 @@ async function listTopicProjectOverlays(ctx, options = {}) {
|
|
|
405
493
|
if (ctx?.db?.query && typeof ctx.db.query === "function") {
|
|
406
494
|
try {
|
|
407
495
|
allTopics = await ctx.db.query("topics").collect();
|
|
408
|
-
} catch {
|
|
496
|
+
} catch (error) {
|
|
497
|
+
debugGraphPrimitiveFallback(
|
|
498
|
+
"[topicProjectOverlay] Failed to read topics table; falling back to API",
|
|
499
|
+
{ error }
|
|
500
|
+
);
|
|
409
501
|
allTopics = [];
|
|
410
502
|
}
|
|
411
503
|
}
|
|
@@ -500,19 +592,28 @@ async function patchTopicProjectOverlay(ctx, scopeId, value) {
|
|
|
500
592
|
"Cannot patch topic without component adapter (ctx.runMutation unavailable)"
|
|
501
593
|
);
|
|
502
594
|
}
|
|
503
|
-
return materializeTopicProjectOverlay(
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
);
|
|
595
|
+
return materializeTopicProjectOverlay({
|
|
596
|
+
...topic,
|
|
597
|
+
...patch,
|
|
598
|
+
metadata: nextMetadata
|
|
599
|
+
});
|
|
510
600
|
}
|
|
511
601
|
|
|
512
602
|
// src/resolvers.ts
|
|
513
603
|
function isMissingLucernChildComponentError2(error) {
|
|
514
|
-
const message =
|
|
515
|
-
return message.includes(
|
|
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";
|
|
516
617
|
}
|
|
517
618
|
function isAdvisoryTopicPatch(value) {
|
|
518
619
|
const advisoryKeys = /* @__PURE__ */ new Set(["lastActivityAt", "updatedAt"]);
|
|
@@ -526,32 +627,27 @@ async function patchProjectWithTolerance(ctx, projectId, value) {
|
|
|
526
627
|
if (!isAdvisoryTopicPatch(value) || !isMissingLucernChildComponentError2(error)) {
|
|
527
628
|
throw error;
|
|
528
629
|
}
|
|
529
|
-
console.warn(
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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
|
+
);
|
|
534
638
|
}
|
|
535
639
|
}
|
|
536
640
|
function defaultResolvers() {
|
|
537
641
|
return {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
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
|
-
}
|
|
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)
|
|
555
651
|
};
|
|
556
652
|
}
|
|
557
653
|
var resolverOverrides = {};
|