@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
|
@@ -211,4 +211,4 @@ declare namespace epistemicQuestions {
|
|
|
211
211
|
export { epistemicQuestions_addQuestion as addQuestion, epistemicQuestions_advanceToConviction as advanceToConviction, epistemicQuestions_backfillScoredQuestionEvidence as backfillScoredQuestionEvidence, epistemicQuestions_consolidate as consolidate, epistemicQuestions_create as create, epistemicQuestions_createBatch as createBatch, epistemicQuestions_createEvidenceFromScoredQuestion as createEvidenceFromScoredQuestion, epistemicQuestions_deleteQuestion as deleteQuestion, epistemicQuestions_finalizeConviction as finalizeConviction, epistemicQuestions_flattenQuestionNode as flattenQuestionNode, epistemicQuestions_getByBeliefWithAccess as getByBeliefWithAccess, epistemicQuestions_getByCategory as getByCategory, epistemicQuestions_getById as getById, epistemicQuestions_getByPillar as getByPillar, epistemicQuestions_getByProject as getByProject, epistemicQuestions_getByTopic as getByTopic, epistemicQuestions_getForBelief as getForBelief, epistemicQuestions_getForSprintCluster as getForSprintCluster, epistemicQuestions_getInConviction as getInConviction, epistemicQuestions_getQuestionClusterPositions as getQuestionClusterPositions, epistemicQuestions_internalCreate as internalCreate, epistemicQuestions_internalGetByProject as internalGetByProject, epistemicQuestions_internalGetByTopic as internalGetByTopic, epistemicQuestions_isActiveQuestionNode as isActiveQuestionNode, epistemicQuestions_linkToBelief as linkToBelief, epistemicQuestions_linkToInsight as linkToInsight, epistemicQuestions_list as list, epistemicQuestions_markAnsweredWithArtifact as markAnsweredWithArtifact, epistemicQuestions_matchesRequestedQuestionStatus as matchesRequestedQuestionStatus, epistemicQuestions_resolveLinkedWorktreeId as resolveLinkedWorktreeId, epistemicQuestions_unlinkInsight as unlinkInsight, epistemicQuestions_updateConviction as updateConviction, epistemicQuestions_updatePriority as updatePriority, epistemicQuestions_updateQuestion as updateQuestion, epistemicQuestions_updateStatus as updateStatus };
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
export {
|
|
214
|
+
export { updateQuestion as A, linkToBelief as B, linkToInsight as C, unlinkInsight as D, list as E, getByPillar as F, consolidate as G, deleteQuestion as H, markAnsweredWithArtifact as I, getQuestionClusterPositions as J, createBatch as a, updatePriority as b, create as c, getByProject as d, epistemicQuestions as e, flattenQuestionNode as f, getById as g, getByTopic as h, isActiveQuestionNode as i, getByCategory as j, getForBelief as k, internalGetByProject as l, matchesRequestedQuestionStatus as m, internalGetByTopic as n, internalCreate as o, addQuestion as p, createEvidenceFromScoredQuestion as q, resolveLinkedWorktreeId as r, backfillScoredQuestionEvidence as s, getForSprintCluster as t, updateStatus as u, getInConviction as v, advanceToConviction as w, updateConviction as x, finalizeConviction as y, getByBeliefWithAccess as z };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './convex.js';
|
|
2
|
-
export {
|
|
2
|
+
export { p as addQuestion, w as advanceToConviction, s as backfillScoredQuestionEvidence, G as consolidate, c as create, a as createBatch, q as createEvidenceFromScoredQuestion, H as deleteQuestion, y as finalizeConviction, f as flattenQuestionNode, z as getByBeliefWithAccess, j as getByCategory, g as getById, F as getByPillar, d as getByProject, h as getByTopic, k as getForBelief, t as getForSprintCluster, v as getInConviction, J as getQuestionClusterPositions, o as internalCreate, l as internalGetByProject, n as internalGetByTopic, i as isActiveQuestionNode, B as linkToBelief, C as linkToInsight, E as list, I as markAnsweredWithArtifact, m as matchesRequestedQuestionStatus, r as resolveLinkedWorktreeId, D as unlinkInsight, x as updateConviction, b as updatePriority, A as updateQuestion, u as updateStatus } from './epistemicQuestions-CmEeY6zQ.js';
|
|
3
3
|
import 'convex/values';
|
|
@@ -4,7 +4,7 @@ import { normalizeAudienceKey, canAudienceClassAccess, classFromAudienceKey } fr
|
|
|
4
4
|
import { listAudienceRegistryRows } from '@lucern/access-control/audienceRegistry';
|
|
5
5
|
import { getCurrentUserId } from '@lucern/access-control/auth';
|
|
6
6
|
import { permissiveReturn } from '@lucern/contracts/schema-helpers/validators';
|
|
7
|
-
import { componentsGeneric,
|
|
7
|
+
import { componentsGeneric, mutationGeneric, anyApi, queryGeneric, internalQueryGeneric, internalMutationGeneric } from 'convex/server';
|
|
8
8
|
import { isNodeType, getLayerForNodeType } from '@lucern/contracts/schema-helpers/spine/tables/epistemicNodes';
|
|
9
9
|
|
|
10
10
|
// src/epistemicQuestions.ts
|
|
@@ -16,37 +16,6 @@ var internalQuery = internalQueryGeneric;
|
|
|
16
16
|
var mutation = mutationGeneric;
|
|
17
17
|
var query = queryGeneric;
|
|
18
18
|
|
|
19
|
-
// src/debug.ts
|
|
20
|
-
function isGraphPrimitiveDebugEnabled() {
|
|
21
|
-
const env = globalThis.process?.env;
|
|
22
|
-
return env?.LUCERN_COMPAT_FALLBACK_DEBUG === "1" || env?.LUCERN_GRAPH_DEBUG === "1";
|
|
23
|
-
}
|
|
24
|
-
function formatGraphPrimitiveError(error) {
|
|
25
|
-
if (error instanceof Error) {
|
|
26
|
-
return `${error.name}: ${error.message}`;
|
|
27
|
-
}
|
|
28
|
-
if (typeof error === "string") {
|
|
29
|
-
return error;
|
|
30
|
-
}
|
|
31
|
-
if (error === null) {
|
|
32
|
-
return "null";
|
|
33
|
-
}
|
|
34
|
-
if (error === void 0) {
|
|
35
|
-
return "undefined";
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
return JSON.stringify(error);
|
|
39
|
-
} catch {
|
|
40
|
-
return Object.prototype.toString.call(error);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function debugGraphPrimitiveFallback(message, context) {
|
|
44
|
-
if (!isGraphPrimitiveDebugEnabled()) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
console.debug(message, context ?? {});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
19
|
// src/embeddingTrigger.ts
|
|
51
20
|
async function scheduleEmbeddingGeneration(args) {
|
|
52
21
|
try {
|
|
@@ -64,15 +33,7 @@ async function scheduleEmbeddingGeneration(args) {
|
|
|
64
33
|
confidence: args.confidence
|
|
65
34
|
}
|
|
66
35
|
);
|
|
67
|
-
} catch
|
|
68
|
-
debugGraphPrimitiveFallback(
|
|
69
|
-
"[embeddingTrigger] Failed to schedule embedding generation",
|
|
70
|
-
{
|
|
71
|
-
error,
|
|
72
|
-
nodeId: String(args.nodeId),
|
|
73
|
-
nodeType: args.nodeType
|
|
74
|
-
}
|
|
75
|
-
);
|
|
36
|
+
} catch {
|
|
76
37
|
}
|
|
77
38
|
}
|
|
78
39
|
|
|
@@ -133,37 +94,19 @@ function isProjectLikeTopic(topic) {
|
|
|
133
94
|
return topic.type === "theme" || topic.type === "thematic" || topic.type === "deal" || topic.type === "monitoring" || readLegacyProjectId(topic) !== void 0 || readNonEmptyString(metadata.projectType) !== void 0;
|
|
134
95
|
}
|
|
135
96
|
function isMissingLucernChildComponentError(error) {
|
|
136
|
-
const message =
|
|
97
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
137
98
|
return message.includes(
|
|
138
99
|
'Child component ComponentName(Identifier("lucern")) not found'
|
|
139
100
|
) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
140
101
|
}
|
|
141
|
-
function getErrorMessage(error) {
|
|
142
|
-
if (error instanceof Error) {
|
|
143
|
-
return error.message;
|
|
144
|
-
}
|
|
145
|
-
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
146
|
-
return error.message;
|
|
147
|
-
}
|
|
148
|
-
return "unknown error";
|
|
149
|
-
}
|
|
150
102
|
async function resolveTopicDoc(ctx, scopeId) {
|
|
151
103
|
if (ctx?.db && typeof ctx.db.get === "function") {
|
|
152
104
|
try {
|
|
153
|
-
const directTopic = await ctx.db.get(
|
|
154
|
-
scopeId
|
|
155
|
-
);
|
|
105
|
+
const directTopic = await ctx.db.get(scopeId);
|
|
156
106
|
if (directTopic) {
|
|
157
107
|
return directTopic;
|
|
158
108
|
}
|
|
159
|
-
} catch
|
|
160
|
-
debugGraphPrimitiveFallback(
|
|
161
|
-
"[topicProjectOverlay] Failed to resolve topic by direct ID",
|
|
162
|
-
{
|
|
163
|
-
error,
|
|
164
|
-
scopeId
|
|
165
|
-
}
|
|
166
|
-
);
|
|
109
|
+
} catch {
|
|
167
110
|
}
|
|
168
111
|
}
|
|
169
112
|
if (typeof ctx.runQuery !== "function") {
|
|
@@ -176,14 +119,7 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
176
119
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
177
120
|
return topic;
|
|
178
121
|
}
|
|
179
|
-
} catch
|
|
180
|
-
debugGraphPrimitiveFallback(
|
|
181
|
-
"[topicProjectOverlay] Failed to resolve topic by ID query",
|
|
182
|
-
{
|
|
183
|
-
error,
|
|
184
|
-
scopeId
|
|
185
|
-
}
|
|
186
|
-
);
|
|
122
|
+
} catch {
|
|
187
123
|
}
|
|
188
124
|
try {
|
|
189
125
|
const topic = await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
@@ -192,11 +128,7 @@ async function resolveTopicDoc(ctx, scopeId) {
|
|
|
192
128
|
if (topic?.name !== void 0 && topic?.type !== void 0) {
|
|
193
129
|
return topic;
|
|
194
130
|
}
|
|
195
|
-
} catch
|
|
196
|
-
debugGraphPrimitiveFallback(
|
|
197
|
-
"[topicProjectOverlay] Failed to resolve topic by legacy scope ID",
|
|
198
|
-
{ error, scopeId }
|
|
199
|
-
);
|
|
131
|
+
} catch {
|
|
200
132
|
}
|
|
201
133
|
return null;
|
|
202
134
|
}
|
|
@@ -250,11 +182,7 @@ async function listTopicProjectOverlays(ctx, options = {}) {
|
|
|
250
182
|
if (ctx?.db?.query && typeof ctx.db.query === "function") {
|
|
251
183
|
try {
|
|
252
184
|
allTopics = await ctx.db.query("topics").collect();
|
|
253
|
-
} catch
|
|
254
|
-
debugGraphPrimitiveFallback(
|
|
255
|
-
"[topicProjectOverlay] Failed to read topics table; falling back to API",
|
|
256
|
-
{ error }
|
|
257
|
-
);
|
|
185
|
+
} catch {
|
|
258
186
|
allTopics = [];
|
|
259
187
|
}
|
|
260
188
|
}
|
|
@@ -349,28 +277,19 @@ async function patchTopicProjectOverlay(ctx, scopeId, value) {
|
|
|
349
277
|
"Cannot patch topic without component adapter (ctx.runMutation unavailable)"
|
|
350
278
|
);
|
|
351
279
|
}
|
|
352
|
-
return materializeTopicProjectOverlay(
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
280
|
+
return materializeTopicProjectOverlay(
|
|
281
|
+
{
|
|
282
|
+
...topic,
|
|
283
|
+
...patch,
|
|
284
|
+
metadata: nextMetadata
|
|
285
|
+
}
|
|
286
|
+
);
|
|
357
287
|
}
|
|
358
288
|
|
|
359
289
|
// src/resolvers.ts
|
|
360
290
|
function isMissingLucernChildComponentError2(error) {
|
|
361
|
-
const message =
|
|
362
|
-
return message.includes(
|
|
363
|
-
'Child component ComponentName(Identifier("lucern")) not found'
|
|
364
|
-
) || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
365
|
-
}
|
|
366
|
-
function getErrorMessage2(error) {
|
|
367
|
-
if (error instanceof Error) {
|
|
368
|
-
return error.message;
|
|
369
|
-
}
|
|
370
|
-
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
371
|
-
return error.message;
|
|
372
|
-
}
|
|
373
|
-
return "unknown error";
|
|
291
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
292
|
+
return message.includes('Child component ComponentName(Identifier("lucern")) not found') || message.includes("Child component") && message.includes("lucern") && message.includes("not found");
|
|
374
293
|
}
|
|
375
294
|
function isAdvisoryTopicPatch(value) {
|
|
376
295
|
const advisoryKeys = /* @__PURE__ */ new Set(["lastActivityAt", "updatedAt"]);
|
|
@@ -384,27 +303,32 @@ async function patchProjectWithTolerance(ctx, projectId, value) {
|
|
|
384
303
|
if (!isAdvisoryTopicPatch(value) || !isMissingLucernChildComponentError2(error)) {
|
|
385
304
|
throw error;
|
|
386
305
|
}
|
|
387
|
-
console.warn(
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
error: getErrorMessage2(error)
|
|
393
|
-
}
|
|
394
|
-
);
|
|
306
|
+
console.warn("[lucern graph-primitives] Non-fatal advisory topic patch failure", {
|
|
307
|
+
projectId,
|
|
308
|
+
keys: Object.keys(value),
|
|
309
|
+
error: error instanceof Error ? error.message : error
|
|
310
|
+
});
|
|
395
311
|
}
|
|
396
312
|
}
|
|
397
313
|
function defaultResolvers() {
|
|
398
314
|
return {
|
|
399
|
-
getProject
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
315
|
+
async getProject(ctx, projectId) {
|
|
316
|
+
return await resolveTopicProjectOverlay(ctx, projectId, {
|
|
317
|
+
idMode: "legacy",
|
|
318
|
+
projectLikeOnly: false
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
async patchProject(ctx, projectId, value) {
|
|
322
|
+
await patchProjectWithTolerance(ctx, projectId, value);
|
|
323
|
+
},
|
|
324
|
+
async listTopics(ctx) {
|
|
325
|
+
return await listTopicProjectOverlays(ctx, {
|
|
326
|
+
idMode: "legacy"
|
|
327
|
+
});
|
|
328
|
+
},
|
|
329
|
+
async getFinalArtifact(ctx, artifactId) {
|
|
330
|
+
return await ctx.db.get(artifactId);
|
|
331
|
+
}
|
|
408
332
|
};
|
|
409
333
|
}
|
|
410
334
|
var resolverOverrides = {};
|
|
@@ -455,14 +379,7 @@ async function findTopicsByScopeAlias(ctx, scopeId) {
|
|
|
455
379
|
"by_graph_scope_project",
|
|
456
380
|
(q) => q.eq(LEGACY_SCOPE_FIELD2, scopeId)
|
|
457
381
|
).collect();
|
|
458
|
-
} catch
|
|
459
|
-
debugGraphPrimitiveFallback(
|
|
460
|
-
"[topicScope] Failed to resolve scope alias via index",
|
|
461
|
-
{
|
|
462
|
-
error,
|
|
463
|
-
scopeId
|
|
464
|
-
}
|
|
465
|
-
);
|
|
382
|
+
} catch {
|
|
466
383
|
const topics = await ctx.db.query("topics").collect();
|
|
467
384
|
return topics.filter((topic) => {
|
|
468
385
|
const normalizedGlobalId = normalizeScopeValue(topic.globalId);
|
|
@@ -479,14 +396,7 @@ async function tryResolveHostTopicById(ctx, topicId) {
|
|
|
479
396
|
return await ctx.runQuery(api.topics.get, {
|
|
480
397
|
id: topicId
|
|
481
398
|
}) ?? null;
|
|
482
|
-
} catch
|
|
483
|
-
debugGraphPrimitiveFallback(
|
|
484
|
-
"[topicScope] Failed to resolve topic by host query",
|
|
485
|
-
{
|
|
486
|
-
error,
|
|
487
|
-
topicId
|
|
488
|
-
}
|
|
489
|
-
);
|
|
399
|
+
} catch {
|
|
490
400
|
return null;
|
|
491
401
|
}
|
|
492
402
|
}
|
|
@@ -498,14 +408,7 @@ async function tryResolveHostTopicByLegacyScope(ctx, legacyScopeId) {
|
|
|
498
408
|
return await ctx.runQuery(api.topics.getByLegacyScopeId, {
|
|
499
409
|
projectId: legacyScopeId
|
|
500
410
|
}) ?? null;
|
|
501
|
-
} catch
|
|
502
|
-
debugGraphPrimitiveFallback(
|
|
503
|
-
"[topicScope] Failed to resolve topic by legacy scope",
|
|
504
|
-
{
|
|
505
|
-
error,
|
|
506
|
-
legacyScopeId
|
|
507
|
-
}
|
|
508
|
-
);
|
|
411
|
+
} catch {
|
|
509
412
|
return null;
|
|
510
413
|
}
|
|
511
414
|
}
|
|
@@ -534,17 +437,8 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
534
437
|
if (args.topicId) {
|
|
535
438
|
let topic = null;
|
|
536
439
|
try {
|
|
537
|
-
topic = await ctx.db.get(
|
|
538
|
-
|
|
539
|
-
);
|
|
540
|
-
} catch (error) {
|
|
541
|
-
debugGraphPrimitiveFallback(
|
|
542
|
-
"[topicScope] Failed to load topic by direct id",
|
|
543
|
-
{
|
|
544
|
-
error,
|
|
545
|
-
topicId: args.topicId
|
|
546
|
-
}
|
|
547
|
-
);
|
|
440
|
+
topic = await ctx.db.get(args.topicId);
|
|
441
|
+
} catch {
|
|
548
442
|
}
|
|
549
443
|
if (!topic) {
|
|
550
444
|
topic = await tryResolveHostTopicById(ctx, String(args.topicId));
|
|
@@ -581,14 +475,7 @@ async function resolveTopicProjectScope(ctx, args) {
|
|
|
581
475
|
directTopic = await ctx.db.get(
|
|
582
476
|
args.projectId
|
|
583
477
|
);
|
|
584
|
-
} catch
|
|
585
|
-
debugGraphPrimitiveFallback(
|
|
586
|
-
"[topicScope] Failed to load direct project topic",
|
|
587
|
-
{
|
|
588
|
-
error,
|
|
589
|
-
projectId: args.projectId
|
|
590
|
-
}
|
|
591
|
-
);
|
|
478
|
+
} catch {
|
|
592
479
|
}
|
|
593
480
|
if (directTopic) {
|
|
594
481
|
const inherited = await resolveInheritedWorkspaceScope(ctx, directTopic);
|
|
@@ -963,12 +850,6 @@ function normalizeQuestionTopicId(topicId) {
|
|
|
963
850
|
function resolveQuestionScopeId(scope) {
|
|
964
851
|
return normalizeQuestionTopicId(scope.topicId) ?? scope.projectId ?? void 0;
|
|
965
852
|
}
|
|
966
|
-
function logQuestionFallback(message, error, context) {
|
|
967
|
-
debugGraphPrimitiveFallback(message, {
|
|
968
|
-
error: formatGraphPrimitiveError(error),
|
|
969
|
-
...context ?? {}
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
853
|
async function resolveQuestionScopeOrNull(ctx, args) {
|
|
973
854
|
if (!args.projectId && !args.topicId) {
|
|
974
855
|
return null;
|
|
@@ -978,15 +859,7 @@ async function resolveQuestionScopeOrNull(ctx, args) {
|
|
|
978
859
|
projectId: args.projectId ?? void 0,
|
|
979
860
|
topicId: args.topicId ?? void 0
|
|
980
861
|
});
|
|
981
|
-
} catch
|
|
982
|
-
debugGraphPrimitiveFallback(
|
|
983
|
-
"[epistemicQuestions] Failed to resolve question scope",
|
|
984
|
-
{
|
|
985
|
-
error: formatGraphPrimitiveError(error),
|
|
986
|
-
projectId: args.projectId,
|
|
987
|
-
topicId: args.topicId
|
|
988
|
-
}
|
|
989
|
-
);
|
|
862
|
+
} catch {
|
|
990
863
|
return null;
|
|
991
864
|
}
|
|
992
865
|
}
|
|
@@ -1190,7 +1063,9 @@ var create = mutation({
|
|
|
1190
1063
|
source: args.source || "ai_suggested",
|
|
1191
1064
|
questionStatus: "open",
|
|
1192
1065
|
linkedBeliefNodeId: args.linkedBeliefNodeId,
|
|
1193
|
-
...buildLinkedWorktreeMetadata(
|
|
1066
|
+
...buildLinkedWorktreeMetadata(
|
|
1067
|
+
args.linkedWorktreeId
|
|
1068
|
+
),
|
|
1194
1069
|
testType: args.testType,
|
|
1195
1070
|
importance: args.importance,
|
|
1196
1071
|
epistemicUnlock: args.epistemicUnlock,
|
|
@@ -1601,9 +1476,7 @@ var getByTopic = query({
|
|
|
1601
1476
|
handler: async (ctx, args) => {
|
|
1602
1477
|
const pageSize = clampQuestionLimit(args.limit);
|
|
1603
1478
|
const scanLimit = Math.min(pageSize * 3, MAX_QUESTION_PAGE_SIZE);
|
|
1604
|
-
const scope = await resolveTopicProjectScope(ctx, {
|
|
1605
|
-
topicId: args.topicId
|
|
1606
|
-
});
|
|
1479
|
+
const scope = await resolveTopicProjectScope(ctx, { topicId: args.topicId });
|
|
1607
1480
|
const scopedNodes = await getQuestionNodesForScope(ctx, scope, {
|
|
1608
1481
|
scanLimit
|
|
1609
1482
|
});
|
|
@@ -1627,7 +1500,7 @@ var getByCategory = query({
|
|
|
1627
1500
|
const nodes = await getQuestionNodesForScope(ctx, scope);
|
|
1628
1501
|
return nodes.filter((n) => {
|
|
1629
1502
|
const metadata = n.metadata || {};
|
|
1630
|
-
return questionMatchesScope(n, scope) && isActiveQuestionNode(n) && metadata.category === normalizeCategory(args.category);
|
|
1503
|
+
return questionMatchesScope(n, scope) && (isActiveQuestionNode(n) && metadata.category === normalizeCategory(args.category));
|
|
1631
1504
|
});
|
|
1632
1505
|
}
|
|
1633
1506
|
});
|
|
@@ -1723,9 +1596,7 @@ var internalGetByTopic = internalQuery({
|
|
|
1723
1596
|
const pageSize = clampQuestionLimit(args.limit, 500);
|
|
1724
1597
|
const scanLimit = Math.min(pageSize * 3, MAX_QUESTION_PAGE_SIZE);
|
|
1725
1598
|
const audienceMode = args.audienceMode ?? "internal";
|
|
1726
|
-
const scope = await resolveTopicProjectScope(ctx, {
|
|
1727
|
-
topicId: args.topicId
|
|
1728
|
-
});
|
|
1599
|
+
const scope = await resolveTopicProjectScope(ctx, { topicId: args.topicId });
|
|
1729
1600
|
const registryRows = await listAudienceRegistryRows(ctx, {
|
|
1730
1601
|
tenantId: scope.tenantId,
|
|
1731
1602
|
workspaceId: scope.workspaceId
|
|
@@ -2055,14 +1926,7 @@ A: ${args.answerText}`;
|
|
|
2055
1926
|
if (node?.nodeType === "belief") {
|
|
2056
1927
|
return node;
|
|
2057
1928
|
}
|
|
2058
|
-
} catch
|
|
2059
|
-
debugGraphPrimitiveFallback(
|
|
2060
|
-
"[epistemicQuestions] Failed to resolve belief node",
|
|
2061
|
-
{
|
|
2062
|
-
error: formatGraphPrimitiveError(error),
|
|
2063
|
-
beliefId: bId
|
|
2064
|
-
}
|
|
2065
|
-
);
|
|
1929
|
+
} catch {
|
|
2066
1930
|
return null;
|
|
2067
1931
|
}
|
|
2068
1932
|
return null;
|
|
@@ -2468,14 +2332,7 @@ var getInConviction = query({
|
|
|
2468
2332
|
exclusiveWithCount: 0
|
|
2469
2333
|
};
|
|
2470
2334
|
}
|
|
2471
|
-
} catch
|
|
2472
|
-
debugGraphPrimitiveFallback(
|
|
2473
|
-
"[epistemicQuestions] Failed to hydrate linked belief",
|
|
2474
|
-
{
|
|
2475
|
-
error: formatGraphPrimitiveError(error),
|
|
2476
|
-
beliefId
|
|
2477
|
-
}
|
|
2478
|
-
);
|
|
2335
|
+
} catch {
|
|
2479
2336
|
}
|
|
2480
2337
|
return null;
|
|
2481
2338
|
})
|
|
@@ -2573,14 +2430,6 @@ var advanceToConviction = mutation({
|
|
|
2573
2430
|
triggeringAction: "question_advanced_to_conviction"
|
|
2574
2431
|
});
|
|
2575
2432
|
} catch (e) {
|
|
2576
|
-
logQuestionFallback(
|
|
2577
|
-
"[epistemicQuestions] Failed to log advanceToConviction audit",
|
|
2578
|
-
e,
|
|
2579
|
-
{
|
|
2580
|
-
questionId: args.questionId,
|
|
2581
|
-
projectId: node.projectId
|
|
2582
|
-
}
|
|
2583
|
-
);
|
|
2584
2433
|
console.error("[EpistemicAudit] Failed to log advanceToConviction:", e);
|
|
2585
2434
|
}
|
|
2586
2435
|
await markProjectGraphDirty(ctx, node.projectId, node.topicId);
|
|
@@ -2707,14 +2556,6 @@ var finalizeConviction = mutation({
|
|
|
2707
2556
|
triggeringAction: "question_conviction_finalized"
|
|
2708
2557
|
});
|
|
2709
2558
|
} catch (e) {
|
|
2710
|
-
logQuestionFallback(
|
|
2711
|
-
"[epistemicQuestions] Failed to log finalizeConviction audit",
|
|
2712
|
-
e,
|
|
2713
|
-
{
|
|
2714
|
-
questionId: args.questionId,
|
|
2715
|
-
projectId: node.projectId
|
|
2716
|
-
}
|
|
2717
|
-
);
|
|
2718
2559
|
console.error("[EpistemicAudit] Failed to log finalizeConviction:", e);
|
|
2719
2560
|
}
|
|
2720
2561
|
if (node.projectId || node.topicId) {
|
|
@@ -2738,15 +2579,6 @@ var finalizeConviction = mutation({
|
|
|
2738
2579
|
}
|
|
2739
2580
|
);
|
|
2740
2581
|
} catch (e) {
|
|
2741
|
-
logQuestionFallback(
|
|
2742
|
-
"[epistemicQuestions] Failed to schedule evidence creation from scored question",
|
|
2743
|
-
e,
|
|
2744
|
-
{
|
|
2745
|
-
questionId: args.questionId,
|
|
2746
|
-
beliefId,
|
|
2747
|
-
projectId: node.projectId
|
|
2748
|
-
}
|
|
2749
|
-
);
|
|
2750
2582
|
console.error(
|
|
2751
2583
|
"[finalizeConviction] Failed to schedule evidence creation:",
|
|
2752
2584
|
e
|
|
@@ -2776,24 +2608,10 @@ var getByBeliefWithAccess = query({
|
|
|
2776
2608
|
let beliefNode = null;
|
|
2777
2609
|
try {
|
|
2778
2610
|
beliefNode = await ctx.db.get(args.beliefId);
|
|
2779
|
-
} catch
|
|
2780
|
-
debugGraphPrimitiveFallback(
|
|
2781
|
-
"[epistemicQuestions] Failed to resolve belief node directly",
|
|
2782
|
-
{
|
|
2783
|
-
error: formatGraphPrimitiveError(error),
|
|
2784
|
-
beliefId: args.beliefId
|
|
2785
|
-
}
|
|
2786
|
-
);
|
|
2611
|
+
} catch {
|
|
2787
2612
|
try {
|
|
2788
2613
|
beliefNode = await ctx.db.get(args.beliefId);
|
|
2789
|
-
} catch
|
|
2790
|
-
debugGraphPrimitiveFallback(
|
|
2791
|
-
"[epistemicQuestions] Failed to resolve legacy belief node",
|
|
2792
|
-
{
|
|
2793
|
-
error: formatGraphPrimitiveError(legacyError),
|
|
2794
|
-
beliefId: args.beliefId
|
|
2795
|
-
}
|
|
2796
|
-
);
|
|
2614
|
+
} catch {
|
|
2797
2615
|
return [];
|
|
2798
2616
|
}
|
|
2799
2617
|
}
|
|
@@ -2937,24 +2755,10 @@ var linkToBelief = mutation({
|
|
|
2937
2755
|
let beliefNode = null;
|
|
2938
2756
|
try {
|
|
2939
2757
|
beliefNode = await ctx.db.get(args.beliefId);
|
|
2940
|
-
} catch
|
|
2941
|
-
debugGraphPrimitiveFallback(
|
|
2942
|
-
"[epistemicQuestions] Failed to resolve belief node directly",
|
|
2943
|
-
{
|
|
2944
|
-
error: formatGraphPrimitiveError(error),
|
|
2945
|
-
beliefId: args.beliefId
|
|
2946
|
-
}
|
|
2947
|
-
);
|
|
2758
|
+
} catch {
|
|
2948
2759
|
try {
|
|
2949
2760
|
beliefNode = await ctx.db.get(args.beliefId);
|
|
2950
|
-
} catch
|
|
2951
|
-
debugGraphPrimitiveFallback(
|
|
2952
|
-
"[epistemicQuestions] Failed to resolve legacy belief node",
|
|
2953
|
-
{
|
|
2954
|
-
error: formatGraphPrimitiveError(legacyError),
|
|
2955
|
-
beliefId: args.beliefId
|
|
2956
|
-
}
|
|
2957
|
-
);
|
|
2761
|
+
} catch {
|
|
2958
2762
|
throw new Error("Belief not found");
|
|
2959
2763
|
}
|
|
2960
2764
|
}
|
|
@@ -3015,14 +2819,6 @@ var linkToBelief = mutation({
|
|
|
3015
2819
|
});
|
|
3016
2820
|
}
|
|
3017
2821
|
} catch (e) {
|
|
3018
|
-
logQuestionFallback(
|
|
3019
|
-
"[epistemicQuestions] Failed to create tests edge",
|
|
3020
|
-
e,
|
|
3021
|
-
{
|
|
3022
|
-
questionId: args.questionId,
|
|
3023
|
-
beliefId: args.beliefId
|
|
3024
|
-
}
|
|
3025
|
-
);
|
|
3026
2822
|
console.error("[linkToBelief] Failed to create tests edge:", e);
|
|
3027
2823
|
}
|
|
3028
2824
|
await markProjectGraphDirty(
|
|
@@ -3161,14 +2957,6 @@ var unlinkInsight = mutation({
|
|
|
3161
2957
|
}
|
|
3162
2958
|
}
|
|
3163
2959
|
} catch (e) {
|
|
3164
|
-
logQuestionFallback(
|
|
3165
|
-
"[epistemicQuestions] Failed to remove questionEvidenceLink",
|
|
3166
|
-
e,
|
|
3167
|
-
{
|
|
3168
|
-
questionId: args.questionId,
|
|
3169
|
-
insightId: args.insightId
|
|
3170
|
-
}
|
|
3171
|
-
);
|
|
3172
2960
|
console.error(
|
|
3173
2961
|
"[unlinkInsight] Failed to remove questionEvidenceLink:",
|
|
3174
2962
|
e
|
|
@@ -3191,14 +2979,6 @@ var unlinkInsight = mutation({
|
|
|
3191
2979
|
}
|
|
3192
2980
|
}
|
|
3193
2981
|
} catch (e) {
|
|
3194
|
-
logQuestionFallback(
|
|
3195
|
-
"[epistemicQuestions] Failed to remove derived edge",
|
|
3196
|
-
e,
|
|
3197
|
-
{
|
|
3198
|
-
questionId: args.questionId,
|
|
3199
|
-
insightId: args.insightId
|
|
3200
|
-
}
|
|
3201
|
-
);
|
|
3202
2982
|
console.error("[unlinkInsight] Failed to remove edge:", e);
|
|
3203
2983
|
}
|
|
3204
2984
|
await markProjectGraphDirty(
|
|
@@ -3369,14 +3149,7 @@ var consolidate = mutation({
|
|
|
3369
3149
|
args.questionIds.map(async (qid) => {
|
|
3370
3150
|
try {
|
|
3371
3151
|
return await ctx.db.get(qid);
|
|
3372
|
-
} catch
|
|
3373
|
-
debugGraphPrimitiveFallback(
|
|
3374
|
-
"[epistemicQuestions] Failed to load original question",
|
|
3375
|
-
{
|
|
3376
|
-
error: formatGraphPrimitiveError(error),
|
|
3377
|
-
questionId: qid
|
|
3378
|
-
}
|
|
3379
|
-
);
|
|
3152
|
+
} catch {
|
|
3380
3153
|
return null;
|
|
3381
3154
|
}
|
|
3382
3155
|
})
|
|
@@ -3437,14 +3210,7 @@ var consolidate = mutation({
|
|
|
3437
3210
|
const bMeta = belief.metadata || {};
|
|
3438
3211
|
category = bMeta.category || bMeta.pillar || "other";
|
|
3439
3212
|
}
|
|
3440
|
-
} catch
|
|
3441
|
-
debugGraphPrimitiveFallback(
|
|
3442
|
-
"[epistemicQuestions] Failed to read first linked belief metadata",
|
|
3443
|
-
{
|
|
3444
|
-
error: formatGraphPrimitiveError(error),
|
|
3445
|
-
beliefId: firstBeliefId
|
|
3446
|
-
}
|
|
3447
|
-
);
|
|
3213
|
+
} catch {
|
|
3448
3214
|
}
|
|
3449
3215
|
}
|
|
3450
3216
|
const now = Date.now();
|
|
@@ -3494,14 +3260,7 @@ var consolidate = mutation({
|
|
|
3494
3260
|
}
|
|
3495
3261
|
});
|
|
3496
3262
|
}
|
|
3497
|
-
} catch
|
|
3498
|
-
debugGraphPrimitiveFallback(
|
|
3499
|
-
"[epistemicQuestions] Failed to archive linked question",
|
|
3500
|
-
{
|
|
3501
|
-
error: formatGraphPrimitiveError(error),
|
|
3502
|
-
questionId: qid
|
|
3503
|
-
}
|
|
3504
|
-
);
|
|
3263
|
+
} catch {
|
|
3505
3264
|
}
|
|
3506
3265
|
}
|
|
3507
3266
|
await ctx.scheduler.runAfter(0, internal.neo4jSync.syncNodeToNeo4j, {
|
|
@@ -3633,15 +3392,7 @@ var getQuestionClusterPositions = query({
|
|
|
3633
3392
|
projectId: args.projectId,
|
|
3634
3393
|
topicId: args.topicId
|
|
3635
3394
|
});
|
|
3636
|
-
} catch
|
|
3637
|
-
debugGraphPrimitiveFallback(
|
|
3638
|
-
"[epistemicQuestions] Failed to resolve question cluster scope",
|
|
3639
|
-
{
|
|
3640
|
-
error: formatGraphPrimitiveError(error),
|
|
3641
|
-
projectId: args.projectId,
|
|
3642
|
-
topicId: args.topicId
|
|
3643
|
-
}
|
|
3644
|
-
);
|
|
3395
|
+
} catch {
|
|
3645
3396
|
return {
|
|
3646
3397
|
positions: {},
|
|
3647
3398
|
counts: {
|