@lucern/graph-primitives 0.3.0-alpha.17 → 0.3.0-alpha.3
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-DZ6tkLYq.d.ts → beliefDecay-Q_26RTc-.d.ts} +1 -1
- package/dist/beliefDecay.d.ts +1 -1
- package/dist/beliefDecay.js +47 -158
- package/dist/beliefDecay.js.map +1 -1
- package/dist/{beliefEvidenceLinks-CWOXxxJg.d.ts → beliefEvidenceLinks-42FlR48t.d.ts} +1 -1
- package/dist/beliefEvidenceLinks.d.ts +1 -1
- package/dist/beliefEvidenceLinks.js +45 -141
- package/dist/beliefEvidenceLinks.js.map +1 -1
- package/dist/{beliefLifecycle-y8WLXqQj.d.ts → beliefLifecycle-C-AehZgF.d.ts} +1 -1
- package/dist/beliefLifecycle.d.ts +1 -1
- package/dist/confidencePropagationDispatch.d.ts +1 -1
- package/dist/confidencePropagationDispatch.js +3 -1
- package/dist/confidencePropagationDispatch.js.map +1 -1
- package/dist/{contradictions-51VLsESq.d.ts → contradictions-Hdwl7zid.d.ts} +1 -1
- package/dist/contradictions.d.ts +1 -1
- package/dist/contradictions.js +8 -67
- package/dist/contradictions.js.map +1 -1
- 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 +3 -1
- package/dist/edges/index.js.map +1 -1
- package/dist/edges/informs.js +3 -1
- package/dist/edges/informs.js.map +1 -1
- package/dist/edges/refutes.js +3 -1
- 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 +4 -2
- package/dist/edges/utils.js.map +1 -1
- package/dist/embeddingTrigger.js +1 -21
- package/dist/embeddingTrigger.js.map +1 -1
- package/dist/entityBridge.js +1 -1
- package/dist/entityBridge.js.map +1 -1
- package/dist/{entityLifecycle-CvgSK5FV.d.ts → entityLifecycle-BkhRJ-XI.d.ts} +1 -1
- package/dist/entityLifecycle.d.ts +1 -1
- package/dist/entityLifecycle.js +47 -134
- package/dist/entityLifecycle.js.map +1 -1
- package/dist/{epistemicAnswers-C5ib4z6_.d.ts → epistemicAnswers-DSP1slZ9.d.ts} +1 -1
- package/dist/epistemicAnswers.d.ts +1 -1
- package/dist/epistemicAnswers.js +8 -67
- package/dist/epistemicAnswers.js.map +1 -1
- package/dist/{epistemicBeliefs-DzKjZAeC.d.ts → epistemicBeliefs-DtFVTp-k.d.ts} +3 -3
- package/dist/epistemicBeliefs.d.ts +2 -2
- package/dist/epistemicBeliefs.js +114 -289
- package/dist/epistemicBeliefs.js.map +1 -1
- package/dist/epistemicContracts.d.ts +1 -1
- package/dist/epistemicContracts.js +115 -297
- package/dist/epistemicContracts.js.map +1 -1
- package/dist/{epistemicEdges-CvlKnEyy.d.ts → epistemicEdges-DcA8ErUG.d.ts} +1 -1
- package/dist/epistemicEdges.d.ts +1 -1
- package/dist/epistemicEdges.js +60 -192
- package/dist/epistemicEdges.js.map +1 -1
- package/dist/{epistemicEvidence-xw6UUrwh.d.ts → epistemicEvidence-Bo638XDP.d.ts} +1 -1
- package/dist/epistemicEvidence.d.ts +1 -1
- package/dist/epistemicEvidence.js +49 -163
- package/dist/epistemicEvidence.js.map +1 -1
- package/dist/{epistemicHelpers-DevrYgPN.d.ts → epistemicHelpers-Bd9xbaib.d.ts} +1 -1
- package/dist/epistemicHelpers.d.ts +1 -1
- package/dist/{epistemicLinking-CfE00tHJ.d.ts → epistemicLinking-CyeLOIzN.d.ts} +1 -1
- package/dist/epistemicLinking.d.ts +1 -1
- package/dist/epistemicLinking.js +1 -1
- package/dist/{epistemicNodes-DjSUfvyD.d.ts → epistemicNodes-BpD6Koud.d.ts} +1 -1
- package/dist/epistemicNodes.d.ts +1 -1
- package/dist/epistemicNodes.js +33 -163
- package/dist/epistemicNodes.js.map +1 -1
- package/dist/{epistemicQuestions-B_nUclrH.d.ts → epistemicQuestions-CmEeY6zQ.d.ts} +1 -1
- package/dist/epistemicQuestions.d.ts +1 -1
- package/dist/epistemicQuestions.js +62 -311
- package/dist/epistemicQuestions.js.map +1 -1
- package/dist/{epistemicSources-dlKj58Jp.d.ts → epistemicSources-ZazxHOK1.d.ts} +1 -1
- package/dist/epistemicSources.d.ts +1 -1
- package/dist/epistemicSources.js +8 -65
- package/dist/epistemicSources.js.map +1 -1
- package/dist/evaluators/index.js +115 -297
- 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 +1 -20
- package/dist/evaluators/shared.js.map +1 -1
- package/dist/evaluators/testRunnerEvaluator.js +1 -20
- 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 +206 -729
- package/dist/index.js.map +1 -1
- package/dist/{ontology-matching-C6rrz2VP.d.ts → ontology-matching-Buhu23ss.d.ts} +1 -1
- package/dist/ontology-matching.d.ts +1 -1
- package/dist/{ontologyApproval-CFYmqKmk.d.ts → ontologyApproval-Ba0Jjk1k.d.ts} +1 -1
- package/dist/ontologyApproval.d.ts +1 -1
- package/dist/ontologyDefinitions.js +3 -4
- package/dist/ontologyDefinitions.js.map +1 -1
- package/dist/ontologyHelpers.d.ts +1 -1
- package/dist/ontologyHelpers.js +3 -4
- package/dist/ontologyHelpers.js.map +1 -1
- package/dist/{projectionReconciliation-jww2fBI0.d.ts → projectionReconciliation-CxrXYGaB.d.ts} +1 -1
- package/dist/projectionReconciliation.d.ts +1 -1
- package/dist/projectionReconciliation.js +20 -14
- package/dist/projectionReconciliation.js.map +1 -1
- package/dist/{projectionStaleness-CmdbpjVK.d.ts → projectionStaleness-CAdpIsaW.d.ts} +1 -1
- package/dist/projectionStaleness.d.ts +1 -1
- package/dist/{questionEvidenceLinks-DFlyPpAj.d.ts → questionEvidenceLinks-BdQD0TkM.d.ts} +1 -1
- package/dist/questionEvidenceLinks.d.ts +1 -1
- package/dist/questionEvidenceLinks.js +45 -144
- package/dist/questionEvidenceLinks.js.map +1 -1
- package/dist/resolvers.js +37 -86
- package/dist/resolvers.js.map +1 -1
- package/dist/scopeResolverCompat.js +7 -64
- package/dist/scopeResolverCompat.js.map +1 -1
- package/dist/{text-matching-DNg4M5Wd.d.ts → text-matching-CMn2WnVD.d.ts} +1 -1
- package/dist/text-matching.d.ts +1 -1
- package/dist/topicProjectOverlay.js +13 -56
- package/dist/topicProjectOverlay.js.map +1 -1
- package/dist/topicScope.js +6 -55
- package/dist/topicScope.js.map +1 -1
- package/dist/workflowBridge.js +6 -55
- package/dist/workflowBridge.js.map +1 -1
- package/dist/workspaceIsolation.js +6 -55
- package/dist/workspaceIsolation.js.map +1 -1
- package/package.json +5 -5
- package/dist/debug.d.ts +0 -4
- package/dist/debug.js +0 -34
- package/dist/debug.js.map +0 -1
package/dist/entityLifecycle.js
CHANGED
|
@@ -2,7 +2,7 @@ import { v } from 'convex/values';
|
|
|
2
2
|
import { checkProjectAccess } from '@lucern/access-control/access';
|
|
3
3
|
import { getCurrentUserId } from '@lucern/access-control/auth';
|
|
4
4
|
import { permissiveReturn } from '@lucern/contracts/schema-helpers/validators';
|
|
5
|
-
import { componentsGeneric,
|
|
5
|
+
import { componentsGeneric, queryGeneric, mutationGeneric, anyApi } from 'convex/server';
|
|
6
6
|
|
|
7
7
|
// src/entityLifecycle.ts
|
|
8
8
|
var api = anyApi;
|
|
@@ -151,18 +151,6 @@ async function validateEntityTypeForTopic(ctx, topicId, nodeType) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
// src/debug.ts
|
|
155
|
-
function isGraphPrimitiveDebugEnabled() {
|
|
156
|
-
const env = globalThis.process?.env;
|
|
157
|
-
return env?.LUCERN_COMPAT_FALLBACK_DEBUG === "1" || env?.LUCERN_GRAPH_DEBUG === "1";
|
|
158
|
-
}
|
|
159
|
-
function debugGraphPrimitiveFallback(message, context) {
|
|
160
|
-
if (!isGraphPrimitiveDebugEnabled()) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
console.debug(message, context ?? {});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
154
|
// src/topicProjectOverlay.ts
|
|
167
155
|
var LEGACY_SCOPE_FIELD = "graphScopeProjectId";
|
|
168
156
|
function readNonEmptyString(value) {
|
|
@@ -208,37 +196,19 @@ function isProjectLikeTopic(topic) {
|
|
|
208
196
|
return topic.type === "theme" || topic.type === "thematic" || topic.type === "deal" || topic.type === "monitoring" || readLegacyProjectId(topic) !== void 0 || readNonEmptyString(metadata.projectType) !== void 0;
|
|
209
197
|
}
|
|
210
198
|
function isMissingLucernChildComponentError(error) {
|
|
211
|
-
const message =
|
|
199
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
212
200
|
return message.includes(
|
|
213
201
|
'Child component ComponentName(Identifier("lucern")) not found'
|
|
214
202
|
) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
215
203
|
}
|
|
216
|
-
function getErrorMessage(error) {
|
|
217
|
-
if (error instanceof Error) {
|
|
218
|
-
return error.message;
|
|
219
|
-
}
|
|
220
|
-
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
221
|
-
return error.message;
|
|
222
|
-
}
|
|
223
|
-
return "unknown error";
|
|
224
|
-
}
|
|
225
204
|
async function resolveTopicDoc(ctx, scopeId) {
|
|
226
205
|
if (ctx?.db && typeof ctx.db.get === "function") {
|
|
227
206
|
try {
|
|
228
|
-
const directTopic = await ctx.db.get(
|
|
229
|
-
scopeId
|
|
230
|
-
);
|
|
207
|
+
const directTopic = await ctx.db.get(scopeId);
|
|
231
208
|
if (directTopic) {
|
|
232
209
|
return directTopic;
|
|
233
210
|
}
|
|
234
|
-
} catch
|
|
235
|
-
debugGraphPrimitiveFallback(
|
|
236
|
-
"[topicProjectOverlay] Failed to resolve topic by direct ID",
|
|
237
|
-
{
|
|
238
|
-
error,
|
|
239
|
-
scopeId
|
|
240
|
-
}
|
|
241
|
-
);
|
|
211
|
+
} catch {
|
|
242
212
|
}
|
|
243
213
|
}
|
|
244
214
|
if (typeof ctx.runQuery !== "function") {
|
|
@@ -251,14 +221,7 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
251
221
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
252
222
|
return topic;
|
|
253
223
|
}
|
|
254
|
-
} catch
|
|
255
|
-
debugGraphPrimitiveFallback(
|
|
256
|
-
"[topicProjectOverlay] Failed to resolve topic by ID query",
|
|
257
|
-
{
|
|
258
|
-
error,
|
|
259
|
-
scopeId
|
|
260
|
-
}
|
|
261
|
-
);
|
|
224
|
+
} catch {
|
|
262
225
|
}
|
|
263
226
|
try {
|
|
264
227
|
const topic = await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
@@ -267,11 +230,7 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
267
230
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
268
231
|
return topic;
|
|
269
232
|
}
|
|
270
|
-
} catch
|
|
271
|
-
debugGraphPrimitiveFallback(
|
|
272
|
-
"[topicProjectOverlay] Failed to resolve topic by legacy scope ID",
|
|
273
|
-
{ error, scopeId }
|
|
274
|
-
);
|
|
233
|
+
} catch {
|
|
275
234
|
}
|
|
276
235
|
return null;
|
|
277
236
|
}
|
|
@@ -325,11 +284,7 @@ async function listTopicProjectOverlays(ctx, options = {}) {
|
|
|
325
284
|
if (ctx?.db?.query && typeof ctx.db.query === "function") {
|
|
326
285
|
try {
|
|
327
286
|
allTopics = await ctx.db.query("topics").collect();
|
|
328
|
-
} catch
|
|
329
|
-
debugGraphPrimitiveFallback(
|
|
330
|
-
"[topicProjectOverlay] Failed to read topics table; falling back to API",
|
|
331
|
-
{ error }
|
|
332
|
-
);
|
|
287
|
+
} catch {
|
|
333
288
|
allTopics = [];
|
|
334
289
|
}
|
|
335
290
|
}
|
|
@@ -424,28 +379,19 @@ async function patchTopicProjectOverlay(ctx, scopeId, value) {
|
|
|
424
379
|
"Cannot patch topic without component adapter (ctx.runMutation unavailable)"
|
|
425
380
|
);
|
|
426
381
|
}
|
|
427
|
-
return materializeTopicProjectOverlay(
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
382
|
+
return materializeTopicProjectOverlay(
|
|
383
|
+
{
|
|
384
|
+
...topic,
|
|
385
|
+
...patch,
|
|
386
|
+
metadata: nextMetadata
|
|
387
|
+
}
|
|
388
|
+
);
|
|
432
389
|
}
|
|
433
390
|
|
|
434
391
|
// src/resolvers.ts
|
|
435
392
|
function isMissingLucernChildComponentError2(error) {
|
|
436
|
-
const message =
|
|
437
|
-
return message.includes(
|
|
438
|
-
'Child component ComponentName(Identifier("lucern")) not found'
|
|
439
|
-
) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
440
|
-
}
|
|
441
|
-
function getErrorMessage2(error) {
|
|
442
|
-
if (error instanceof Error) {
|
|
443
|
-
return error.message;
|
|
444
|
-
}
|
|
445
|
-
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
446
|
-
return error.message;
|
|
447
|
-
}
|
|
448
|
-
return "unknown error";
|
|
393
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
394
|
+
return message.includes('Child component ComponentName(Identifier("lucern")) not found') || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
449
395
|
}
|
|
450
396
|
function isAdvisoryTopicPatch(value) {
|
|
451
397
|
const advisoryKeys = /* @__PURE__ */ new Set(["lastActivityAt", "updatedAt"]);
|
|
@@ -459,27 +405,32 @@ async function patchProjectWithTolerance(ctx, projectId, value) {
|
|
|
459
405
|
if (!isAdvisoryTopicPatch(value) || !isMissingLucernChildComponentError2(error)) {
|
|
460
406
|
throw error;
|
|
461
407
|
}
|
|
462
|
-
console.warn(
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
error: getErrorMessage2(error)
|
|
468
|
-
}
|
|
469
|
-
);
|
|
408
|
+
console.warn("[lucern graph-primitives] Non-fatal advisory topic patch failure", {
|
|
409
|
+
projectId,
|
|
410
|
+
keys: Object.keys(value),
|
|
411
|
+
error: error instanceof Error ? error.message : error
|
|
412
|
+
});
|
|
470
413
|
}
|
|
471
414
|
}
|
|
472
415
|
function defaultResolvers() {
|
|
473
416
|
return {
|
|
474
|
-
getProject
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
417
|
+
async getProject(ctx, projectId) {
|
|
418
|
+
return await resolveTopicProjectOverlay(ctx, projectId, {
|
|
419
|
+
idMode: "legacy",
|
|
420
|
+
projectLikeOnly: false
|
|
421
|
+
});
|
|
422
|
+
},
|
|
423
|
+
async patchProject(ctx, projectId, value) {
|
|
424
|
+
await patchProjectWithTolerance(ctx, projectId, value);
|
|
425
|
+
},
|
|
426
|
+
async listTopics(ctx) {
|
|
427
|
+
return await listTopicProjectOverlays(ctx, {
|
|
428
|
+
idMode: "legacy"
|
|
429
|
+
});
|
|
430
|
+
},
|
|
431
|
+
async getFinalArtifact(ctx, artifactId) {
|
|
432
|
+
return await ctx.db.get(artifactId);
|
|
433
|
+
}
|
|
483
434
|
};
|
|
484
435
|
}
|
|
485
436
|
var resolverOverrides = {};
|
|
@@ -530,14 +481,7 @@ async function findTopicsByScopeAlias(ctx, scopeId) {
|
|
|
530
481
|
"by_graph_scope_project",
|
|
531
482
|
(q) => q.eq(LEGACY_SCOPE_FIELD2, scopeId)
|
|
532
483
|
).collect();
|
|
533
|
-
} catch
|
|
534
|
-
debugGraphPrimitiveFallback(
|
|
535
|
-
"[topicScope] Failed to resolve scope alias via index",
|
|
536
|
-
{
|
|
537
|
-
error,
|
|
538
|
-
scopeId
|
|
539
|
-
}
|
|
540
|
-
);
|
|
484
|
+
} catch {
|
|
541
485
|
const topics = await ctx.db.query("topics").collect();
|
|
542
486
|
return topics.filter((topic) => {
|
|
543
487
|
const normalizedGlobalId = normalizeScopeValue(topic.globalId);
|
|
@@ -554,14 +498,7 @@ async function tryResolveHostTopicById(ctx, topicId) {
|
|
|
554
498
|
return await ctx.runQuery(api.topics.get, {
|
|
555
499
|
id: topicId
|
|
556
500
|
}) ?? null;
|
|
557
|
-
} catch
|
|
558
|
-
debugGraphPrimitiveFallback(
|
|
559
|
-
"[topicScope] Failed to resolve topic by host query",
|
|
560
|
-
{
|
|
561
|
-
error,
|
|
562
|
-
topicId
|
|
563
|
-
}
|
|
564
|
-
);
|
|
501
|
+
} catch {
|
|
565
502
|
return null;
|
|
566
503
|
}
|
|
567
504
|
}
|
|
@@ -573,14 +510,7 @@ async function tryResolveHostTopicByLegacyScope(ctx, legacyScopeId) {
|
|
|
573
510
|
return await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
574
511
|
projectId: legacyScopeId
|
|
575
512
|
}) ?? null;
|
|
576
|
-
} catch
|
|
577
|
-
debugGraphPrimitiveFallback(
|
|
578
|
-
"[topicScope] Failed to resolve topic by legacy scope",
|
|
579
|
-
{
|
|
580
|
-
error,
|
|
581
|
-
legacyScopeId
|
|
582
|
-
}
|
|
583
|
-
);
|
|
513
|
+
} catch {
|
|
584
514
|
return null;
|
|
585
515
|
}
|
|
586
516
|
}
|
|
@@ -609,17 +539,8 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
609
539
|
if (args.topicId) {
|
|
610
540
|
let topic = null;
|
|
611
541
|
try {
|
|
612
|
-
topic = await ctx.db.get(
|
|
613
|
-
|
|
614
|
-
);
|
|
615
|
-
} catch (error) {
|
|
616
|
-
debugGraphPrimitiveFallback(
|
|
617
|
-
"[topicScope] Failed to load topic by direct id",
|
|
618
|
-
{
|
|
619
|
-
error,
|
|
620
|
-
topicId: args.topicId
|
|
621
|
-
}
|
|
622
|
-
);
|
|
542
|
+
topic = await ctx.db.get(args.topicId);
|
|
543
|
+
} catch {
|
|
623
544
|
}
|
|
624
545
|
if (!topic) {
|
|
625
546
|
topic = await tryResolveHostTopicById(ctx, String(args.topicId));
|
|
@@ -656,14 +577,7 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
656
577
|
directTopic = await ctx.db.get(
|
|
657
578
|
args.projectId
|
|
658
579
|
);
|
|
659
|
-
} catch
|
|
660
|
-
debugGraphPrimitiveFallback(
|
|
661
|
-
"[topicScope] Failed to load direct project topic",
|
|
662
|
-
{
|
|
663
|
-
error,
|
|
664
|
-
projectId: args.projectId
|
|
665
|
-
}
|
|
666
|
-
);
|
|
580
|
+
} catch {
|
|
667
581
|
}
|
|
668
582
|
if (directTopic) {
|
|
669
583
|
const inherited = await resolveInheritedWorkspaceScope(ctx, directTopic);
|
|
@@ -765,10 +679,9 @@ var ONTOLOGICAL_NODE_TYPES = [
|
|
|
765
679
|
"function",
|
|
766
680
|
"value_chain"
|
|
767
681
|
];
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
);
|
|
682
|
+
function isOntologicalNodeType(nodeType) {
|
|
683
|
+
return ONTOLOGICAL_NODE_TYPES.includes(nodeType);
|
|
684
|
+
}
|
|
772
685
|
function normalizeCanonicalEntityText(value) {
|
|
773
686
|
return value.trim().toLowerCase().replace(/\s+/g, " ");
|
|
774
687
|
}
|