@lucern/graph-primitives 0.3.0-alpha.6 → 0.3.0-alpha.8
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,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,
|
|
4
|
+
import { componentsGeneric, mutationGeneric, anyApi, queryGeneric } from 'convex/server';
|
|
5
5
|
|
|
6
6
|
// src/questionEvidenceLinks.ts
|
|
7
7
|
var api = anyApi;
|
|
@@ -10,6 +10,18 @@ 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
|
+
|
|
13
25
|
// src/matcherFeedbackUtils.ts
|
|
14
26
|
function isOperationalLinkStatus(status) {
|
|
15
27
|
return status !== "suggested" && status !== "dismissed";
|
|
@@ -87,19 +99,37 @@ function isProjectLikeTopic(topic) {
|
|
|
87
99
|
return topic.type === "theme" || topic.type === "thematic" || topic.type === "deal" || topic.type === "monitoring" || readLegacyProjectId(topic) !== void 0 || readNonEmptyString(metadata.projectType) !== void 0;
|
|
88
100
|
}
|
|
89
101
|
function isMissingLucernChildComponentError(error) {
|
|
90
|
-
const message =
|
|
102
|
+
const message = getErrorMessage(error);
|
|
91
103
|
return message.includes(
|
|
92
104
|
'Child component ComponentName(Identifier("lucern")) not found'
|
|
93
105
|
) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
94
106
|
}
|
|
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
|
+
}
|
|
95
116
|
async function resolveTopicDoc(ctx, scopeId) {
|
|
96
117
|
if (ctx?.db && typeof ctx.db.get === "function") {
|
|
97
118
|
try {
|
|
98
|
-
const directTopic = await ctx.db.get(
|
|
119
|
+
const directTopic = await ctx.db.get(
|
|
120
|
+
scopeId
|
|
121
|
+
);
|
|
99
122
|
if (directTopic) {
|
|
100
123
|
return directTopic;
|
|
101
124
|
}
|
|
102
|
-
} catch {
|
|
125
|
+
} catch (error) {
|
|
126
|
+
debugGraphPrimitiveFallback(
|
|
127
|
+
"[topicProjectOverlay] Failed to resolve topic by direct ID",
|
|
128
|
+
{
|
|
129
|
+
error,
|
|
130
|
+
scopeId
|
|
131
|
+
}
|
|
132
|
+
);
|
|
103
133
|
}
|
|
104
134
|
}
|
|
105
135
|
if (typeof ctx.runQuery !== "function") {
|
|
@@ -112,7 +142,14 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
112
142
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
113
143
|
return topic;
|
|
114
144
|
}
|
|
115
|
-
} catch {
|
|
145
|
+
} catch (error) {
|
|
146
|
+
debugGraphPrimitiveFallback(
|
|
147
|
+
"[topicProjectOverlay] Failed to resolve topic by ID query",
|
|
148
|
+
{
|
|
149
|
+
error,
|
|
150
|
+
scopeId
|
|
151
|
+
}
|
|
152
|
+
);
|
|
116
153
|
}
|
|
117
154
|
try {
|
|
118
155
|
const topic = await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
@@ -121,7 +158,11 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
121
158
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
122
159
|
return topic;
|
|
123
160
|
}
|
|
124
|
-
} catch {
|
|
161
|
+
} catch (error) {
|
|
162
|
+
debugGraphPrimitiveFallback(
|
|
163
|
+
"[topicProjectOverlay] Failed to resolve topic by legacy scope ID",
|
|
164
|
+
{ error, scopeId }
|
|
165
|
+
);
|
|
125
166
|
}
|
|
126
167
|
return null;
|
|
127
168
|
}
|
|
@@ -175,7 +216,11 @@ async function listTopicProjectOverlays(ctx, options = {}) {
|
|
|
175
216
|
if (ctx?.db?.query && typeof ctx.db.query === "function") {
|
|
176
217
|
try {
|
|
177
218
|
allTopics = await ctx.db.query("topics").collect();
|
|
178
|
-
} catch {
|
|
219
|
+
} catch (error) {
|
|
220
|
+
debugGraphPrimitiveFallback(
|
|
221
|
+
"[topicProjectOverlay] Failed to read topics table; falling back to API",
|
|
222
|
+
{ error }
|
|
223
|
+
);
|
|
179
224
|
allTopics = [];
|
|
180
225
|
}
|
|
181
226
|
}
|
|
@@ -270,19 +315,28 @@ async function patchTopicProjectOverlay(ctx, scopeId, value) {
|
|
|
270
315
|
"Cannot patch topic without component adapter (ctx.runMutation unavailable)"
|
|
271
316
|
);
|
|
272
317
|
}
|
|
273
|
-
return materializeTopicProjectOverlay(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
);
|
|
318
|
+
return materializeTopicProjectOverlay({
|
|
319
|
+
...topic,
|
|
320
|
+
...patch,
|
|
321
|
+
metadata: nextMetadata
|
|
322
|
+
});
|
|
280
323
|
}
|
|
281
324
|
|
|
282
325
|
// src/resolvers.ts
|
|
283
326
|
function isMissingLucernChildComponentError2(error) {
|
|
284
|
-
const message =
|
|
285
|
-
return message.includes(
|
|
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";
|
|
286
340
|
}
|
|
287
341
|
function isAdvisoryTopicPatch(value) {
|
|
288
342
|
const advisoryKeys = /* @__PURE__ */ new Set(["lastActivityAt", "updatedAt"]);
|
|
@@ -296,32 +350,27 @@ async function patchProjectWithTolerance(ctx, projectId, value) {
|
|
|
296
350
|
if (!isAdvisoryTopicPatch(value) || !isMissingLucernChildComponentError2(error)) {
|
|
297
351
|
throw error;
|
|
298
352
|
}
|
|
299
|
-
console.warn(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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
|
+
);
|
|
304
361
|
}
|
|
305
362
|
}
|
|
306
363
|
function defaultResolvers() {
|
|
307
364
|
return {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
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
|
-
}
|
|
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)
|
|
325
374
|
};
|
|
326
375
|
}
|
|
327
376
|
var resolverOverrides = {};
|
|
@@ -372,7 +421,14 @@ async function findTopicsByScopeAlias(ctx, scopeId) {
|
|
|
372
421
|
"by_graph_scope_project",
|
|
373
422
|
(q) => q.eq(LEGACY_SCOPE_FIELD2, scopeId)
|
|
374
423
|
).collect();
|
|
375
|
-
} catch {
|
|
424
|
+
} catch (error) {
|
|
425
|
+
debugGraphPrimitiveFallback(
|
|
426
|
+
"[topicScope] Failed to resolve scope alias via index",
|
|
427
|
+
{
|
|
428
|
+
error,
|
|
429
|
+
scopeId
|
|
430
|
+
}
|
|
431
|
+
);
|
|
376
432
|
const topics = await ctx.db.query("topics").collect();
|
|
377
433
|
return topics.filter((topic) => {
|
|
378
434
|
const normalizedGlobalId = normalizeScopeValue(topic.globalId);
|
|
@@ -389,7 +445,14 @@ async function tryResolveHostTopicById(ctx, topicId) {
|
|
|
389
445
|
return await ctx.runQuery(api.topics.get, {
|
|
390
446
|
id: topicId
|
|
391
447
|
}) ?? null;
|
|
392
|
-
} catch {
|
|
448
|
+
} catch (error) {
|
|
449
|
+
debugGraphPrimitiveFallback(
|
|
450
|
+
"[topicScope] Failed to resolve topic by host query",
|
|
451
|
+
{
|
|
452
|
+
error,
|
|
453
|
+
topicId
|
|
454
|
+
}
|
|
455
|
+
);
|
|
393
456
|
return null;
|
|
394
457
|
}
|
|
395
458
|
}
|
|
@@ -401,7 +464,14 @@ async function tryResolveHostTopicByLegacyScope(ctx, legacyScopeId) {
|
|
|
401
464
|
return await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
402
465
|
projectId: legacyScopeId
|
|
403
466
|
}) ?? null;
|
|
404
|
-
} catch {
|
|
467
|
+
} catch (error) {
|
|
468
|
+
debugGraphPrimitiveFallback(
|
|
469
|
+
"[topicScope] Failed to resolve topic by legacy scope",
|
|
470
|
+
{
|
|
471
|
+
error,
|
|
472
|
+
legacyScopeId
|
|
473
|
+
}
|
|
474
|
+
);
|
|
405
475
|
return null;
|
|
406
476
|
}
|
|
407
477
|
}
|
|
@@ -430,8 +500,17 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
430
500
|
if (args.topicId) {
|
|
431
501
|
let topic = null;
|
|
432
502
|
try {
|
|
433
|
-
topic = await ctx.db.get(
|
|
434
|
-
|
|
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
|
+
);
|
|
435
514
|
}
|
|
436
515
|
if (!topic) {
|
|
437
516
|
topic = await tryResolveHostTopicById(ctx, String(args.topicId));
|
|
@@ -468,7 +547,14 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
468
547
|
directTopic = await ctx.db.get(
|
|
469
548
|
args.projectId
|
|
470
549
|
);
|
|
471
|
-
} catch {
|
|
550
|
+
} catch (error) {
|
|
551
|
+
debugGraphPrimitiveFallback(
|
|
552
|
+
"[topicScope] Failed to load direct project topic",
|
|
553
|
+
{
|
|
554
|
+
error,
|
|
555
|
+
projectId: args.projectId
|
|
556
|
+
}
|
|
557
|
+
);
|
|
472
558
|
}
|
|
473
559
|
if (directTopic) {
|
|
474
560
|
const inherited = await resolveInheritedWorkspaceScope(ctx, directTopic);
|
|
@@ -1019,7 +1105,20 @@ var getByProject = query({
|
|
|
1019
1105
|
if (!hasAccess) {
|
|
1020
1106
|
return [];
|
|
1021
1107
|
}
|
|
1022
|
-
|
|
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
|
+
}
|
|
1023
1122
|
if (!scope) {
|
|
1024
1123
|
return [];
|
|
1025
1124
|
}
|