@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
|
@@ -125,4 +125,4 @@ declare namespace epistemicEvidence {
|
|
|
125
125
|
export { epistemicEvidence_create as create, epistemicEvidence_createAndLink as createAndLink, epistemicEvidence_flagAsIncorrect as flagAsIncorrect, epistemicEvidence_flattenEvidenceNode as flattenEvidenceNode, epistemicEvidence_getById as getById, epistemicEvidence_getByProject as getByProject, epistemicEvidence_getByProjectSystem as getByProjectSystem, epistemicEvidence_getByTopic as getByTopic, epistemicEvidence_getEvidenceBalance as getEvidenceBalance, epistemicEvidence_getForBelief as getForBelief, epistemicEvidence_internalCreate as internalCreate, epistemicEvidence_internalGetByProject as internalGetByProject, epistemicEvidence_internalGetByTopic as internalGetByTopic, epistemicEvidence_remove as remove, epistemicEvidence_resolveEvidenceLinkedWorktreeId as resolveEvidenceLinkedWorktreeId, epistemicEvidence_update as update, epistemicEvidence_updateStatus as updateStatus, epistemicEvidence_updateVerificationStatus as updateVerificationStatus };
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
export { createAndLink as a,
|
|
128
|
+
export { createAndLink as a, flattenEvidenceNode as b, create as c, getByProject as d, epistemicEvidence as e, flagAsIncorrect as f, getById as g, getByProjectSystem as h, getByTopic as i, getEvidenceBalance as j, getForBelief as k, internalCreate as l, internalGetByProject as m, internalGetByTopic as n, resolveEvidenceLinkedWorktreeId as o, updateStatus as p, updateVerificationStatus as q, remove as r, update as u };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './convex.js';
|
|
2
|
-
export { c as create, a as createAndLink,
|
|
2
|
+
export { c as create, a as createAndLink, f as flagAsIncorrect, b as flattenEvidenceNode, g as getById, d as getByProject, h as getByProjectSystem, i as getByTopic, j as getEvidenceBalance, k as getForBelief, l as internalCreate, m as internalGetByProject, n as internalGetByTopic, r as remove, o as resolveEvidenceLinkedWorktreeId, u as update, p as updateStatus, q as updateVerificationStatus } from './epistemicEvidence-xw6UUrwh.js';
|
|
3
3
|
import 'convex/values';
|
|
@@ -3,7 +3,7 @@ import { requireProjectAccess, checkScopeAccess, checkProjectAccess } from '@luc
|
|
|
3
3
|
import { canAudienceClassAccess, normalizeAudienceKey, classFromAudienceKey } from '@lucern/access-control/audience';
|
|
4
4
|
import { listAudienceRegistryRows } from '@lucern/access-control/audienceRegistry';
|
|
5
5
|
import { permissiveReturn } from '@lucern/contracts/schema-helpers/validators';
|
|
6
|
-
import { componentsGeneric,
|
|
6
|
+
import { componentsGeneric, anyApi, mutationGeneric, queryGeneric, internalQueryGeneric, internalMutationGeneric } from 'convex/server';
|
|
7
7
|
import { isNodeType, getLayerForNodeType } from '@lucern/contracts/schema-helpers/spine/tables/epistemicNodes';
|
|
8
8
|
|
|
9
9
|
// src/epistemicEvidence.ts
|
|
@@ -15,6 +15,18 @@ var internalQuery = internalQueryGeneric;
|
|
|
15
15
|
var mutation = mutationGeneric;
|
|
16
16
|
var query = queryGeneric;
|
|
17
17
|
|
|
18
|
+
// src/debug.ts
|
|
19
|
+
function isGraphPrimitiveDebugEnabled() {
|
|
20
|
+
const env = globalThis.process?.env;
|
|
21
|
+
return env?.LUCERN_COMPAT_FALLBACK_DEBUG === "1" || env?.LUCERN_GRAPH_DEBUG === "1";
|
|
22
|
+
}
|
|
23
|
+
function debugGraphPrimitiveFallback(message, context) {
|
|
24
|
+
if (!isGraphPrimitiveDebugEnabled()) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.debug(message, context ?? {});
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
// src/embeddingTrigger.ts
|
|
19
31
|
async function scheduleEmbeddingGeneration(args) {
|
|
20
32
|
try {
|
|
@@ -32,7 +44,15 @@ async function scheduleEmbeddingGeneration(args) {
|
|
|
32
44
|
confidence: args.confidence
|
|
33
45
|
}
|
|
34
46
|
);
|
|
35
|
-
} catch {
|
|
47
|
+
} catch (error) {
|
|
48
|
+
debugGraphPrimitiveFallback(
|
|
49
|
+
"[embeddingTrigger] Failed to schedule embedding generation",
|
|
50
|
+
{
|
|
51
|
+
error,
|
|
52
|
+
nodeId: String(args.nodeId),
|
|
53
|
+
nodeType: args.nodeType
|
|
54
|
+
}
|
|
55
|
+
);
|
|
36
56
|
}
|
|
37
57
|
}
|
|
38
58
|
|
|
@@ -93,19 +113,37 @@ function isProjectLikeTopic(topic) {
|
|
|
93
113
|
return topic.type === "theme" || topic.type === "thematic" || topic.type === "deal" || topic.type === "monitoring" || readLegacyProjectId(topic) !== void 0 || readNonEmptyString(metadata.projectType) !== void 0;
|
|
94
114
|
}
|
|
95
115
|
function isMissingLucernChildComponentError(error) {
|
|
96
|
-
const message =
|
|
116
|
+
const message = getErrorMessage(error);
|
|
97
117
|
return message.includes(
|
|
98
118
|
'Child component ComponentName(Identifier("lucern")) not found'
|
|
99
119
|
) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
100
120
|
}
|
|
121
|
+
function getErrorMessage(error) {
|
|
122
|
+
if (error instanceof Error) {
|
|
123
|
+
return error.message;
|
|
124
|
+
}
|
|
125
|
+
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
126
|
+
return error.message;
|
|
127
|
+
}
|
|
128
|
+
return "unknown error";
|
|
129
|
+
}
|
|
101
130
|
async function resolveTopicDoc(ctx, scopeId) {
|
|
102
131
|
if (ctx?.db && typeof ctx.db.get === "function") {
|
|
103
132
|
try {
|
|
104
|
-
const directTopic = await ctx.db.get(
|
|
133
|
+
const directTopic = await ctx.db.get(
|
|
134
|
+
scopeId
|
|
135
|
+
);
|
|
105
136
|
if (directTopic) {
|
|
106
137
|
return directTopic;
|
|
107
138
|
}
|
|
108
|
-
} catch {
|
|
139
|
+
} catch (error) {
|
|
140
|
+
debugGraphPrimitiveFallback(
|
|
141
|
+
"[topicProjectOverlay] Failed to resolve topic by direct ID",
|
|
142
|
+
{
|
|
143
|
+
error,
|
|
144
|
+
scopeId
|
|
145
|
+
}
|
|
146
|
+
);
|
|
109
147
|
}
|
|
110
148
|
}
|
|
111
149
|
if (typeof ctx.runQuery !== "function") {
|
|
@@ -118,7 +156,14 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
118
156
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
119
157
|
return topic;
|
|
120
158
|
}
|
|
121
|
-
} catch {
|
|
159
|
+
} catch (error) {
|
|
160
|
+
debugGraphPrimitiveFallback(
|
|
161
|
+
"[topicProjectOverlay] Failed to resolve topic by ID query",
|
|
162
|
+
{
|
|
163
|
+
error,
|
|
164
|
+
scopeId
|
|
165
|
+
}
|
|
166
|
+
);
|
|
122
167
|
}
|
|
123
168
|
try {
|
|
124
169
|
const topic = await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
@@ -127,7 +172,11 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
127
172
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
128
173
|
return topic;
|
|
129
174
|
}
|
|
130
|
-
} catch {
|
|
175
|
+
} catch (error) {
|
|
176
|
+
debugGraphPrimitiveFallback(
|
|
177
|
+
"[topicProjectOverlay] Failed to resolve topic by legacy scope ID",
|
|
178
|
+
{ error, scopeId }
|
|
179
|
+
);
|
|
131
180
|
}
|
|
132
181
|
return null;
|
|
133
182
|
}
|
|
@@ -181,7 +230,11 @@ async function listTopicProjectOverlays(ctx, options = {}) {
|
|
|
181
230
|
if (ctx?.db?.query && typeof ctx.db.query === "function") {
|
|
182
231
|
try {
|
|
183
232
|
allTopics = await ctx.db.query("topics").collect();
|
|
184
|
-
} catch {
|
|
233
|
+
} catch (error) {
|
|
234
|
+
debugGraphPrimitiveFallback(
|
|
235
|
+
"[topicProjectOverlay] Failed to read topics table; falling back to API",
|
|
236
|
+
{ error }
|
|
237
|
+
);
|
|
185
238
|
allTopics = [];
|
|
186
239
|
}
|
|
187
240
|
}
|
|
@@ -276,19 +329,28 @@ async function patchTopicProjectOverlay(ctx, scopeId, value) {
|
|
|
276
329
|
"Cannot patch topic without component adapter (ctx.runMutation unavailable)"
|
|
277
330
|
);
|
|
278
331
|
}
|
|
279
|
-
return materializeTopicProjectOverlay(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
);
|
|
332
|
+
return materializeTopicProjectOverlay({
|
|
333
|
+
...topic,
|
|
334
|
+
...patch,
|
|
335
|
+
metadata: nextMetadata
|
|
336
|
+
});
|
|
286
337
|
}
|
|
287
338
|
|
|
288
339
|
// src/resolvers.ts
|
|
289
340
|
function isMissingLucernChildComponentError2(error) {
|
|
290
|
-
const message =
|
|
291
|
-
return message.includes(
|
|
341
|
+
const message = getErrorMessage2(error);
|
|
342
|
+
return message.includes(
|
|
343
|
+
'Child component ComponentName(Identifier("lucern")) not found'
|
|
344
|
+
) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
345
|
+
}
|
|
346
|
+
function getErrorMessage2(error) {
|
|
347
|
+
if (error instanceof Error) {
|
|
348
|
+
return error.message;
|
|
349
|
+
}
|
|
350
|
+
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
351
|
+
return error.message;
|
|
352
|
+
}
|
|
353
|
+
return "unknown error";
|
|
292
354
|
}
|
|
293
355
|
function isAdvisoryTopicPatch(value) {
|
|
294
356
|
const advisoryKeys = /* @__PURE__ */ new Set(["lastActivityAt", "updatedAt"]);
|
|
@@ -302,32 +364,27 @@ async function patchProjectWithTolerance(ctx, projectId, value) {
|
|
|
302
364
|
if (!isAdvisoryTopicPatch(value) || !isMissingLucernChildComponentError2(error)) {
|
|
303
365
|
throw error;
|
|
304
366
|
}
|
|
305
|
-
console.warn(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
367
|
+
console.warn(
|
|
368
|
+
"[lucern graph-primitives] Non-fatal advisory topic patch failure",
|
|
369
|
+
{
|
|
370
|
+
projectId,
|
|
371
|
+
keys: Object.keys(value),
|
|
372
|
+
error: getErrorMessage2(error)
|
|
373
|
+
}
|
|
374
|
+
);
|
|
310
375
|
}
|
|
311
376
|
}
|
|
312
377
|
function defaultResolvers() {
|
|
313
378
|
return {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
async listTopics(ctx) {
|
|
324
|
-
return await listTopicProjectOverlays(ctx, {
|
|
325
|
-
idMode: "legacy"
|
|
326
|
-
});
|
|
327
|
-
},
|
|
328
|
-
async getFinalArtifact(ctx, artifactId) {
|
|
329
|
-
return await ctx.db.get(artifactId);
|
|
330
|
-
}
|
|
379
|
+
getProject: (ctx, projectId) => resolveTopicProjectOverlay(ctx, projectId, {
|
|
380
|
+
idMode: "legacy",
|
|
381
|
+
projectLikeOnly: false
|
|
382
|
+
}),
|
|
383
|
+
patchProject: (ctx, projectId, value) => patchProjectWithTolerance(ctx, projectId, value),
|
|
384
|
+
listTopics: (ctx) => listTopicProjectOverlays(ctx, {
|
|
385
|
+
idMode: "legacy"
|
|
386
|
+
}),
|
|
387
|
+
getFinalArtifact: (ctx, artifactId) => ctx.db.get(artifactId)
|
|
331
388
|
};
|
|
332
389
|
}
|
|
333
390
|
var resolverOverrides = {};
|
|
@@ -378,7 +435,14 @@ async function findTopicsByScopeAlias(ctx, scopeId) {
|
|
|
378
435
|
"by_graph_scope_project",
|
|
379
436
|
(q) => q.eq(LEGACY_SCOPE_FIELD2, scopeId)
|
|
380
437
|
).collect();
|
|
381
|
-
} catch {
|
|
438
|
+
} catch (error) {
|
|
439
|
+
debugGraphPrimitiveFallback(
|
|
440
|
+
"[topicScope] Failed to resolve scope alias via index",
|
|
441
|
+
{
|
|
442
|
+
error,
|
|
443
|
+
scopeId
|
|
444
|
+
}
|
|
445
|
+
);
|
|
382
446
|
const topics = await ctx.db.query("topics").collect();
|
|
383
447
|
return topics.filter((topic) => {
|
|
384
448
|
const normalizedGlobalId = normalizeScopeValue(topic.globalId);
|
|
@@ -395,7 +459,14 @@ async function tryResolveHostTopicById(ctx, topicId) {
|
|
|
395
459
|
return await ctx.runQuery(api.topics.get, {
|
|
396
460
|
id: topicId
|
|
397
461
|
}) ?? null;
|
|
398
|
-
} catch {
|
|
462
|
+
} catch (error) {
|
|
463
|
+
debugGraphPrimitiveFallback(
|
|
464
|
+
"[topicScope] Failed to resolve topic by host query",
|
|
465
|
+
{
|
|
466
|
+
error,
|
|
467
|
+
topicId
|
|
468
|
+
}
|
|
469
|
+
);
|
|
399
470
|
return null;
|
|
400
471
|
}
|
|
401
472
|
}
|
|
@@ -407,7 +478,14 @@ async function tryResolveHostTopicByLegacyScope(ctx, legacyScopeId) {
|
|
|
407
478
|
return await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
408
479
|
projectId: legacyScopeId
|
|
409
480
|
}) ?? null;
|
|
410
|
-
} catch {
|
|
481
|
+
} catch (error) {
|
|
482
|
+
debugGraphPrimitiveFallback(
|
|
483
|
+
"[topicScope] Failed to resolve topic by legacy scope",
|
|
484
|
+
{
|
|
485
|
+
error,
|
|
486
|
+
legacyScopeId
|
|
487
|
+
}
|
|
488
|
+
);
|
|
411
489
|
return null;
|
|
412
490
|
}
|
|
413
491
|
}
|
|
@@ -436,8 +514,17 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
436
514
|
if (args.topicId) {
|
|
437
515
|
let topic = null;
|
|
438
516
|
try {
|
|
439
|
-
topic = await ctx.db.get(
|
|
440
|
-
|
|
517
|
+
topic = await ctx.db.get(
|
|
518
|
+
args.topicId
|
|
519
|
+
);
|
|
520
|
+
} catch (error) {
|
|
521
|
+
debugGraphPrimitiveFallback(
|
|
522
|
+
"[topicScope] Failed to load topic by direct id",
|
|
523
|
+
{
|
|
524
|
+
error,
|
|
525
|
+
topicId: args.topicId
|
|
526
|
+
}
|
|
527
|
+
);
|
|
441
528
|
}
|
|
442
529
|
if (!topic) {
|
|
443
530
|
topic = await tryResolveHostTopicById(ctx, String(args.topicId));
|
|
@@ -474,7 +561,14 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
474
561
|
directTopic = await ctx.db.get(
|
|
475
562
|
args.projectId
|
|
476
563
|
);
|
|
477
|
-
} catch {
|
|
564
|
+
} catch (error) {
|
|
565
|
+
debugGraphPrimitiveFallback(
|
|
566
|
+
"[topicScope] Failed to load direct project topic",
|
|
567
|
+
{
|
|
568
|
+
error,
|
|
569
|
+
projectId: args.projectId
|
|
570
|
+
}
|
|
571
|
+
);
|
|
478
572
|
}
|
|
479
573
|
if (directTopic) {
|
|
480
574
|
const inherited = await resolveInheritedWorkspaceScope(ctx, directTopic);
|
|
@@ -725,7 +819,15 @@ async function resolveEvidenceScopeOrNull(ctx, args) {
|
|
|
725
819
|
projectId: args.projectId ?? void 0,
|
|
726
820
|
topicId: args.topicId ?? void 0
|
|
727
821
|
});
|
|
728
|
-
} catch {
|
|
822
|
+
} catch (error) {
|
|
823
|
+
debugGraphPrimitiveFallback(
|
|
824
|
+
"[epistemicEvidence] Failed to resolve evidence scope",
|
|
825
|
+
{
|
|
826
|
+
error,
|
|
827
|
+
projectId: args.projectId,
|
|
828
|
+
topicId: args.topicId
|
|
829
|
+
}
|
|
830
|
+
);
|
|
729
831
|
return null;
|
|
730
832
|
}
|
|
731
833
|
}
|
|
@@ -1101,7 +1203,15 @@ var getByProject = query({
|
|
|
1101
1203
|
projectId: args.projectId,
|
|
1102
1204
|
topicId: args.topicId
|
|
1103
1205
|
});
|
|
1104
|
-
} catch {
|
|
1206
|
+
} catch (error) {
|
|
1207
|
+
debugGraphPrimitiveFallback(
|
|
1208
|
+
"[epistemicEvidence] Failed to resolve getByProject scope",
|
|
1209
|
+
{
|
|
1210
|
+
error,
|
|
1211
|
+
projectId: args.projectId,
|
|
1212
|
+
topicId: args.topicId
|
|
1213
|
+
}
|
|
1214
|
+
);
|
|
1105
1215
|
return [];
|
|
1106
1216
|
}
|
|
1107
1217
|
if (args.userId) {
|
|
@@ -1136,7 +1246,9 @@ var getByTopic = query({
|
|
|
1136
1246
|
handler: async (ctx, args) => {
|
|
1137
1247
|
const pageSize = clampEvidenceLimit(args.limit);
|
|
1138
1248
|
const scanLimit = Math.min(pageSize * 3, MAX_EVIDENCE_PAGE_SIZE);
|
|
1139
|
-
const scope = await resolveTopicProjectScope(ctx, {
|
|
1249
|
+
const scope = await resolveTopicProjectScope(ctx, {
|
|
1250
|
+
topicId: args.topicId
|
|
1251
|
+
});
|
|
1140
1252
|
const topicNodes = await ctx.db.query("epistemicNodes").withIndex(
|
|
1141
1253
|
"by_topic_type",
|
|
1142
1254
|
(q) => q.eq("topicId", scope.topicId).eq("nodeType", "evidence")
|
|
@@ -1246,7 +1358,9 @@ var internalGetByTopic = internalQuery({
|
|
|
1246
1358
|
const pageSize = clampEvidenceLimit(args.limit, 500);
|
|
1247
1359
|
const scanLimit = Math.min(pageSize * 3, MAX_EVIDENCE_PAGE_SIZE);
|
|
1248
1360
|
const audienceMode = args.audienceMode ?? "internal";
|
|
1249
|
-
const scope = await resolveTopicProjectScope(ctx, {
|
|
1361
|
+
const scope = await resolveTopicProjectScope(ctx, {
|
|
1362
|
+
topicId: args.topicId
|
|
1363
|
+
});
|
|
1250
1364
|
const registryRows = await listAudienceRegistryRows(ctx, {
|
|
1251
1365
|
tenantId: scope.tenantId,
|
|
1252
1366
|
workspaceId: scope.workspaceId
|