@lucern/mcp 0.2.0-alpha.8 → 0.2.0-alpha.9

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/gateway.js CHANGED
@@ -852,7 +852,7 @@ function makeProxy(which) {
852
852
  }
853
853
  var api = makeProxy("api");
854
854
  var components = makeProxy("components");
855
- var internal = makeProxy("internal");
855
+ makeProxy("internal");
856
856
 
857
857
  // ../server-core/src/domain/confidencePolicy.ts
858
858
  var allowAlwaysPolicy = {
@@ -1728,7 +1728,7 @@ function resolveExternalId(value) {
1728
1728
  async function resolveBeliefTopicIdWithGatewayAuth(authContext, beliefId) {
1729
1729
  const normalizedBeliefId = resolveExternalId(beliefId) ?? beliefId;
1730
1730
  const belief = await authContext.convex.query(
1731
- api.epistemicBeliefs.getById,
1731
+ components.lucern.epistemicBeliefs.getById,
1732
1732
  {
1733
1733
  beliefId: normalizedBeliefId,
1734
1734
  nodeId: normalizedBeliefId
@@ -1758,13 +1758,13 @@ async function emitBeliefEventFromGatewayAuth(authContext, args) {
1758
1758
  function createGatewayBeliefPort(authContext) {
1759
1759
  return {
1760
1760
  fetchBelief(rawId) {
1761
- return authContext.convex.query(api.epistemicBeliefs.getById, {
1761
+ return authContext.convex.query(components.lucern.epistemicBeliefs.getById, {
1762
1762
  beliefId: rawId,
1763
1763
  nodeId: rawId
1764
1764
  });
1765
1765
  },
1766
1766
  listBeliefsByTopic(args) {
1767
- return authContext.convex.query(api.epistemicBeliefs.getByTopic, {
1767
+ return authContext.convex.query(components.lucern.epistemicBeliefs.getByTopic, {
1768
1768
  topicId: args.topicId,
1769
1769
  userId: authContext.userId,
1770
1770
  status: args.status,
@@ -1775,7 +1775,7 @@ function createGatewayBeliefPort(authContext) {
1775
1775
  });
1776
1776
  },
1777
1777
  createBelief(input) {
1778
- return authContext.convex.mutation(api.epistemicBeliefs.create, {
1778
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.create, {
1779
1779
  topicId: input.topicId,
1780
1780
  formulation: input.text,
1781
1781
  rationale: input.rationale,
@@ -1792,7 +1792,7 @@ function createGatewayBeliefPort(authContext) {
1792
1792
  });
1793
1793
  },
1794
1794
  refineBelief(input) {
1795
- return authContext.convex.mutation(api.epistemicBeliefs.refineBelief, {
1795
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.refineBelief, {
1796
1796
  nodeId: input.beliefRawId,
1797
1797
  canonicalText: input.text,
1798
1798
  rationale: input.rationale,
@@ -1800,7 +1800,7 @@ function createGatewayBeliefPort(authContext) {
1800
1800
  });
1801
1801
  },
1802
1802
  forkBelief(input) {
1803
- return authContext.convex.mutation(api.epistemicBeliefs.forkBelief, {
1803
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.forkBelief, {
1804
1804
  parentNodeId: input.beliefRawId,
1805
1805
  newFormulation: input.text,
1806
1806
  forkReason: input.forkReason,
@@ -1809,7 +1809,7 @@ function createGatewayBeliefPort(authContext) {
1809
1809
  });
1810
1810
  },
1811
1811
  modulateConfidence(input) {
1812
- return authContext.convex.mutation(api.epistemicBeliefs.modulateConfidence, {
1812
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.modulateConfidence, {
1813
1813
  nodeId: input.beliefRawId,
1814
1814
  trigger: input.trigger,
1815
1815
  rationale: input.rationale,
@@ -1821,19 +1821,19 @@ function createGatewayBeliefPort(authContext) {
1821
1821
  });
1822
1822
  },
1823
1823
  archiveBelief(input) {
1824
- return authContext.convex.mutation(api.epistemicBeliefs.archive, {
1824
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.archive, {
1825
1825
  nodeId: input.beliefRawId,
1826
1826
  reason: input.reason,
1827
1827
  userId: authContext.userId
1828
1828
  });
1829
1829
  },
1830
1830
  getLineage(rawId) {
1831
- return authContext.convex.query(api.epistemicBeliefs.getLineage, {
1831
+ return authContext.convex.query(components.lucern.epistemicBeliefs.getLineage, {
1832
1832
  nodeId: rawId
1833
1833
  });
1834
1834
  },
1835
1835
  getConfidenceHistory(rawId) {
1836
- return authContext.convex.query(api.epistemicBeliefs.getConfidenceHistory, {
1836
+ return authContext.convex.query(components.lucern.epistemicBeliefs.getConfidenceHistory, {
1837
1837
  nodeId: rawId
1838
1838
  });
1839
1839
  },
@@ -1858,7 +1858,7 @@ function createGatewayBeliefPort(authContext) {
1858
1858
  );
1859
1859
  },
1860
1860
  getRelationships(rawId) {
1861
- return authContext.convex.query(api.epistemicBeliefs.getRelationships, {
1861
+ return authContext.convex.query(components.lucern.epistemicBeliefs.getRelationships, {
1862
1862
  nodeId: rawId,
1863
1863
  direction: "both"
1864
1864
  });
@@ -1983,7 +1983,7 @@ async function getBeliefRelationshipsFromGatewayAuth(authContext, id, direction)
1983
1983
  }
1984
1984
  function updateBeliefStatusFromGatewayAuth(authContext, input) {
1985
1985
  const externalNodeId = input.id ?? input.nodeId ?? input.beliefId;
1986
- return authContext.convex.mutation(api.epistemicBeliefs.updateStatus, {
1986
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.updateStatus, {
1987
1987
  nodeId: resolveBeliefNodeId(input),
1988
1988
  status: input.status,
1989
1989
  reason: input.reason,
@@ -1995,7 +1995,7 @@ function updateBeliefStatusFromGatewayAuth(authContext, input) {
1995
1995
  }
1996
1996
  function updateBeliefRationaleFromGatewayAuth(authContext, input) {
1997
1997
  const externalNodeId = input.id ?? input.nodeId ?? input.beliefId;
1998
- return authContext.convex.mutation(api.epistemicBeliefs.updateRationale, {
1998
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.updateRationale, {
1999
1999
  nodeId: resolveBeliefNodeId(input),
2000
2000
  rationale: input.rationale,
2001
2001
  userId: authContext.userId
@@ -2005,7 +2005,7 @@ function updateBeliefRationaleFromGatewayAuth(authContext, input) {
2005
2005
  }));
2006
2006
  }
2007
2007
  function linkBeliefsFromGatewayAuth(authContext, input) {
2008
- return authContext.convex.mutation(api.epistemicBeliefs.linkBeliefs, {
2008
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.linkBeliefs, {
2009
2009
  fromNodeId: resolveExternalId(input.fromNodeId) ?? "",
2010
2010
  toNodeId: resolveExternalId(input.toNodeId) ?? "",
2011
2011
  edgeType: input.edgeType,
@@ -2015,7 +2015,7 @@ function linkBeliefsFromGatewayAuth(authContext, input) {
2015
2015
  });
2016
2016
  }
2017
2017
  function unlinkBeliefEvidenceFromGatewayAuth(authContext, input) {
2018
- return authContext.convex.mutation(api.epistemicBeliefs.unlinkEvidence, {
2018
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.unlinkEvidence, {
2019
2019
  beliefNodeId: input.beliefNodeId ?? resolveExternalId(input.beliefId) ?? resolveExternalId(input.nodeId) ?? "",
2020
2020
  insightId: resolveExternalId(input.insightId ?? input.evidenceId) ?? "",
2021
2021
  userId: authContext.userId
@@ -2023,7 +2023,7 @@ function unlinkBeliefEvidenceFromGatewayAuth(authContext, input) {
2023
2023
  }
2024
2024
  function updateBeliefCriticalityFromGatewayAuth(authContext, input) {
2025
2025
  const externalNodeId = input.id ?? input.nodeId ?? input.beliefId;
2026
- return authContext.convex.mutation(api.epistemicBeliefs.updateCriticality, {
2026
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.updateCriticality, {
2027
2027
  nodeId: resolveBeliefNodeId(input),
2028
2028
  criticality: input.criticality,
2029
2029
  userId: authContext.userId
@@ -2033,7 +2033,7 @@ function updateBeliefCriticalityFromGatewayAuth(authContext, input) {
2033
2033
  }));
2034
2034
  }
2035
2035
  function batchUpdateBeliefCriticalityFromGatewayAuth(authContext, input) {
2036
- return authContext.convex.mutation(api.epistemicBeliefs.batchUpdateCriticality, {
2036
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.batchUpdateCriticality, {
2037
2037
  updates: input.updates.map((update) => ({
2038
2038
  ...update,
2039
2039
  beliefId: resolveExternalId(update.beliefId) ?? update.beliefId,
@@ -2048,7 +2048,7 @@ function batchUpdateBeliefCriticalityFromGatewayAuth(authContext, input) {
2048
2048
  });
2049
2049
  }
2050
2050
  function reassignBeliefsTopicFromGatewayAuth(authContext, input) {
2051
- return authContext.convex.mutation(api.epistemicBeliefs.reassignBeliefsTopic, {
2051
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.reassignBeliefsTopic, {
2052
2052
  beliefNodeIds: (input.beliefNodeIds ?? input.beliefIds ?? []).map(
2053
2053
  (id) => resolveExternalId(id) ?? id
2054
2054
  ),
@@ -2309,7 +2309,7 @@ async function ensureTopicAccessWithQuery(runQuery, topicId, userId, contextLabe
2309
2309
  if (!topicId) {
2310
2310
  return;
2311
2311
  }
2312
- const allowed = await runQuery(api.topics.checkAccess, {
2312
+ const allowed = await runQuery(components.lucern.topics.checkAccess, {
2313
2313
  topicId,
2314
2314
  userId
2315
2315
  });
@@ -2344,12 +2344,12 @@ async function emitContradictionEventFromGatewayAuth(authContext, args) {
2344
2344
  function createGatewayContradictionsPort(authContext) {
2345
2345
  return {
2346
2346
  fetchBelief(rawId) {
2347
- return authContext.convex.query(api.epistemicBeliefs.getById, {
2347
+ return authContext.convex.query(components.lucern.epistemicBeliefs.getById, {
2348
2348
  beliefId: rawId
2349
2349
  });
2350
2350
  },
2351
2351
  flagContradiction(input) {
2352
- return authContext.convex.mutation(api.contradictions.create, {
2352
+ return authContext.convex.mutation(components.lucern.contradictions.create, {
2353
2353
  beliefId: input.beliefARawId,
2354
2354
  supportingInsightIds: [],
2355
2355
  contradictingInsightIds: [input.beliefBRawId],
@@ -2366,14 +2366,14 @@ function createGatewayContradictionsPort(authContext) {
2366
2366
  });
2367
2367
  },
2368
2368
  listByTopic(args) {
2369
- return authContext.convex.query(api.contradictions.getByTopic, {
2369
+ return authContext.convex.query(components.lucern.contradictions.getByTopic, {
2370
2370
  topicId: args.topicId,
2371
2371
  userId: authContext.userId,
2372
2372
  limit: args.limit
2373
2373
  });
2374
2374
  },
2375
2375
  getById(id) {
2376
- return authContext.convex.query(api.contradictions.getById, {
2376
+ return authContext.convex.query(components.lucern.contradictions.getById, {
2377
2377
  contradictionId: id
2378
2378
  });
2379
2379
  }
@@ -2630,7 +2630,7 @@ async function fetchNodeWithQuery(runQuery, id) {
2630
2630
  }
2631
2631
  })();
2632
2632
  try {
2633
- const byNodeId = await runQuery(api.epistemicNodes.get, {
2633
+ const byNodeId = await runQuery(components.lucern.epistemicNodes.get, {
2634
2634
  nodeId: rawId
2635
2635
  });
2636
2636
  if (byNodeId) {
@@ -2639,7 +2639,7 @@ async function fetchNodeWithQuery(runQuery, id) {
2639
2639
  } catch {
2640
2640
  }
2641
2641
  try {
2642
- return await runQuery(api.epistemicNodes.getByGlobalId, {
2642
+ return await runQuery(components.lucern.epistemicNodes.getByGlobalId, {
2643
2643
  globalId: id
2644
2644
  });
2645
2645
  } catch {
@@ -2673,7 +2673,7 @@ async function ensureTopicAccessWithQuery2(runQuery, topicId, userId, contextLab
2673
2673
  if (!topicId) {
2674
2674
  return;
2675
2675
  }
2676
- const allowed = await runQuery(api.topics.checkAccess, {
2676
+ const allowed = await runQuery(components.lucern.topics.checkAccess, {
2677
2677
  topicId,
2678
2678
  userId
2679
2679
  });
@@ -3150,14 +3150,14 @@ function resolveExternalId3(value) {
3150
3150
  }
3151
3151
  }
3152
3152
  async function resolveEvidenceTopicIdWithGatewayAuth(authContext, evidenceId) {
3153
- const evidence = await authContext.convex.query(api.epistemicEvidence.getById, {
3153
+ const evidence = await authContext.convex.query(components.lucern.epistemicEvidence.getById, {
3154
3154
  evidenceId,
3155
3155
  nodeId: evidenceId
3156
3156
  });
3157
3157
  return readString7(evidence?.topicId);
3158
3158
  }
3159
3159
  async function resolveEvidenceNodeIdWithGatewayAuth(authContext, evidenceId) {
3160
- const evidence = await authContext.convex.query(api.epistemicEvidence.getById, {
3160
+ const evidence = await authContext.convex.query(components.lucern.epistemicEvidence.getById, {
3161
3161
  evidenceId,
3162
3162
  nodeId: evidenceId
3163
3163
  });
@@ -3185,20 +3185,20 @@ async function emitEvidenceEventFromGatewayAuth(authContext, args) {
3185
3185
  function createGatewayEvidencePort(authContext) {
3186
3186
  return {
3187
3187
  fetchEvidence(rawId) {
3188
- return authContext.convex.query(api.epistemicEvidence.getById, {
3188
+ return authContext.convex.query(components.lucern.epistemicEvidence.getById, {
3189
3189
  evidenceId: rawId,
3190
3190
  nodeId: rawId
3191
3191
  });
3192
3192
  },
3193
3193
  listEvidenceByTopic(args) {
3194
- return authContext.convex.query(api.epistemicEvidence.getByTopic, {
3194
+ return authContext.convex.query(components.lucern.epistemicEvidence.getByTopic, {
3195
3195
  topicId: args.topicId,
3196
3196
  userId: authContext.userId,
3197
3197
  limit: args.limit
3198
3198
  });
3199
3199
  },
3200
3200
  listEvidenceForBelief(rawBeliefId) {
3201
- return authContext.convex.query(api.epistemicEvidence.getForBelief, {
3201
+ return authContext.convex.query(components.lucern.epistemicEvidence.getForBelief, {
3202
3202
  beliefNodeId: rawBeliefId
3203
3203
  });
3204
3204
  },
@@ -3211,7 +3211,7 @@ function createGatewayEvidencePort(authContext) {
3211
3211
  );
3212
3212
  },
3213
3213
  async createEvidence(input) {
3214
- const created = await authContext.convex.mutation(api.epistemicEvidence.create, {
3214
+ const created = await authContext.convex.mutation(components.lucern.epistemicEvidence.create, {
3215
3215
  topicId: input.topicId,
3216
3216
  text: input.text,
3217
3217
  title: input.title,
@@ -3240,7 +3240,7 @@ function createGatewayEvidencePort(authContext) {
3240
3240
  ...linkArgs
3241
3241
  });
3242
3242
  } else {
3243
- await authContext.convex.mutation(api.epistemicBeliefs.linkEvidence, {
3243
+ await authContext.convex.mutation(components.lucern.epistemicBeliefs.linkEvidence, {
3244
3244
  beliefNodeId: input.target.rawId,
3245
3245
  insightId: rawId,
3246
3246
  type: input.weight < 0 ? "contradicting" : "supporting",
@@ -3251,7 +3251,7 @@ function createGatewayEvidencePort(authContext) {
3251
3251
  return created;
3252
3252
  },
3253
3253
  linkEvidenceToBelief(input) {
3254
- return authContext.convex.mutation(api.epistemicBeliefs.linkEvidence, {
3254
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.linkEvidence, {
3255
3255
  beliefNodeId: input.targetRawId,
3256
3256
  insightId: input.evidenceRawId,
3257
3257
  type: input.weight < 0 ? "contradicting" : "supporting",
@@ -3359,7 +3359,7 @@ async function updateEvidenceStatusFromGatewayAuth(authContext, input) {
3359
3359
  input.id ?? input.nodeId ?? input.evidenceId ?? input.insightId ?? ""
3360
3360
  ) ?? ""
3361
3361
  );
3362
- return authContext.convex.mutation(api.epistemicEvidence.updateStatus, {
3362
+ return authContext.convex.mutation(components.lucern.epistemicEvidence.updateStatus, {
3363
3363
  nodeId: resolvedNodeId ?? input.nodeId ?? input.id,
3364
3364
  status: input.status,
3365
3365
  userId: authContext.userId
@@ -3369,7 +3369,7 @@ function updateEvidenceFromGatewayAuth(authContext, input) {
3369
3369
  const evidenceId = resolveExternalId3(
3370
3370
  input.id ?? input.evidenceId ?? input.insightId ?? input.nodeId ?? ""
3371
3371
  ) ?? "";
3372
- return authContext.convex.mutation(api.epistemicEvidence.update, {
3372
+ return authContext.convex.mutation(components.lucern.epistemicEvidence.update, {
3373
3373
  insightId: evidenceId,
3374
3374
  text: input.text,
3375
3375
  kind: input.kind,
@@ -3383,7 +3383,7 @@ function flagEvidenceAsIncorrectFromGatewayAuth(authContext, input) {
3383
3383
  const evidenceId = resolveExternalId3(
3384
3384
  input.id ?? input.evidenceId ?? input.insightId ?? input.nodeId ?? ""
3385
3385
  ) ?? "";
3386
- return authContext.convex.mutation(api.epistemicEvidence.flagAsIncorrect, {
3386
+ return authContext.convex.mutation(components.lucern.epistemicEvidence.flagAsIncorrect, {
3387
3387
  insightId: evidenceId,
3388
3388
  reason: input.reason,
3389
3389
  suggestedCorrection: input.suggestedCorrection,
@@ -3394,7 +3394,7 @@ function removeEvidenceFromGatewayAuth(authContext, input) {
3394
3394
  const evidenceId = resolveExternalId3(
3395
3395
  input.id ?? input.evidenceId ?? input.insightId ?? input.nodeId ?? ""
3396
3396
  ) ?? "";
3397
- return authContext.convex.mutation(api.epistemicEvidence.remove, {
3397
+ return authContext.convex.mutation(components.lucern.epistemicEvidence.remove, {
3398
3398
  insightId: evidenceId,
3399
3399
  userId: authContext.userId
3400
3400
  });
@@ -3406,7 +3406,7 @@ async function updateEvidenceVerificationStatusFromGatewayAuth(authContext, inpu
3406
3406
  input.id ?? input.nodeId ?? input.evidenceId ?? input.insightId ?? ""
3407
3407
  ) ?? ""
3408
3408
  );
3409
- return authContext.convex.mutation(api.epistemicEvidence.updateVerificationStatus, {
3409
+ return authContext.convex.mutation(components.lucern.epistemicEvidence.updateVerificationStatus, {
3410
3410
  nodeId: resolvedNodeId ?? input.nodeId ?? input.id,
3411
3411
  verificationHash: input.verificationHash,
3412
3412
  verificationStatus: input.verificationStatus,
@@ -3985,7 +3985,7 @@ function resolveExternalId4(value, prefix) {
3985
3985
  }
3986
3986
  }
3987
3987
  async function resolveQuestionTopicIdWithGatewayAuth(authContext, questionId) {
3988
- const question = await authContext.convex.query(api.epistemicQuestions.getById, {
3988
+ const question = await authContext.convex.query(components.lucern.epistemicQuestions.getById, {
3989
3989
  questionId,
3990
3990
  nodeId: questionId
3991
3991
  });
@@ -4039,20 +4039,20 @@ function normalizeLatestAnswerRecord(questionId, answer) {
4039
4039
  function createGatewayQuestionsPort(authContext) {
4040
4040
  return {
4041
4041
  fetchQuestion(rawId) {
4042
- return authContext.convex.query(api.epistemicQuestions.getById, {
4042
+ return authContext.convex.query(components.lucern.epistemicQuestions.getById, {
4043
4043
  questionId: rawId,
4044
4044
  nodeId: rawId
4045
4045
  });
4046
4046
  },
4047
4047
  listQuestionsByTopic(args) {
4048
- return authContext.convex.query(api.epistemicQuestions.getByTopic, {
4048
+ return authContext.convex.query(components.lucern.epistemicQuestions.getByTopic, {
4049
4049
  topicId: args.topicId,
4050
4050
  userId: authContext.userId,
4051
4051
  limit: args.limit
4052
4052
  });
4053
4053
  },
4054
4054
  createQuestion(input) {
4055
- return authContext.convex.mutation(api.epistemicQuestions.create, {
4055
+ return authContext.convex.mutation(components.lucern.epistemicQuestions.create, {
4056
4056
  topicId: input.topicId,
4057
4057
  question: input.text,
4058
4058
  priority: input.priority,
@@ -4061,13 +4061,13 @@ function createGatewayQuestionsPort(authContext) {
4061
4061
  });
4062
4062
  },
4063
4063
  refineQuestion(input) {
4064
- return authContext.convex.mutation(api.epistemicQuestions.updateQuestion, {
4064
+ return authContext.convex.mutation(components.lucern.epistemicQuestions.updateQuestion, {
4065
4065
  questionId: input.questionRawId,
4066
4066
  question: input.text
4067
4067
  });
4068
4068
  },
4069
4069
  updateQuestionStatus(input) {
4070
- return authContext.convex.mutation(api.epistemicQuestions.updateStatus, {
4070
+ return authContext.convex.mutation(components.lucern.epistemicQuestions.updateStatus, {
4071
4071
  questionId: input.questionRawId,
4072
4072
  status: input.status,
4073
4073
  userId: authContext.userId
@@ -4180,7 +4180,7 @@ async function updateQuestionStatusFromGatewayAuth(authContext, input) {
4180
4180
  return payload;
4181
4181
  }
4182
4182
  function createQuestionsBatchFromGatewayAuth(authContext, input) {
4183
- return authContext.convex.mutation(api.epistemicQuestions.createBatch, {
4183
+ return authContext.convex.mutation(components.lucern.epistemicQuestions.createBatch, {
4184
4184
  topicId: input.topicId,
4185
4185
  questions: input.questions.map((question) => ({
4186
4186
  ...question,
@@ -4195,7 +4195,7 @@ function createQuestionsBatchFromGatewayAuth(authContext, input) {
4195
4195
  });
4196
4196
  }
4197
4197
  async function addQuestionFromGatewayAuth(authContext, input) {
4198
- const questionId = await authContext.convex.mutation(api.epistemicQuestions.addQuestion, {
4198
+ const questionId = await authContext.convex.mutation(components.lucern.epistemicQuestions.addQuestion, {
4199
4199
  topicId: input.topicId,
4200
4200
  question: input.question ?? input.text ?? "",
4201
4201
  category: input.category,
@@ -4213,7 +4213,7 @@ async function addQuestionFromGatewayAuth(authContext, input) {
4213
4213
  return getQuestionFromGatewayAuth(authContext, String(questionId));
4214
4214
  }
4215
4215
  async function updateQuestionPriorityFromGatewayAuth(authContext, input) {
4216
- await authContext.convex.mutation(api.epistemicQuestions.updatePriority, {
4216
+ await authContext.convex.mutation(components.lucern.epistemicQuestions.updatePriority, {
4217
4217
  nodeId: resolveExternalId4(input.id ?? input.nodeId ?? input.questionId, "que") ?? "",
4218
4218
  priority: input.priority,
4219
4219
  userId: authContext.userId
@@ -4224,14 +4224,14 @@ async function updateQuestionPriorityFromGatewayAuth(authContext, input) {
4224
4224
  );
4225
4225
  }
4226
4226
  function advanceQuestionToConvictionFromGatewayAuth(authContext, input) {
4227
- return authContext.convex.mutation(api.epistemicQuestions.advanceToConviction, {
4227
+ return authContext.convex.mutation(components.lucern.epistemicQuestions.advanceToConviction, {
4228
4228
  questionId: resolveExternalId4(input.questionId ?? input.id ?? input.nodeId, "que") ?? "",
4229
4229
  worktreeId: input.worktreeId,
4230
4230
  userId: authContext.userId
4231
4231
  });
4232
4232
  }
4233
4233
  function updateQuestionConvictionFromGatewayAuth(authContext, input) {
4234
- return authContext.convex.mutation(api.epistemicQuestions.updateConviction, {
4234
+ return authContext.convex.mutation(components.lucern.epistemicQuestions.updateConviction, {
4235
4235
  questionId: resolveExternalId4(input.questionId ?? input.id ?? input.nodeId, "que") ?? "",
4236
4236
  conviction: input.conviction,
4237
4237
  answerCompleteness: input.answerCompleteness,
@@ -4240,7 +4240,7 @@ function updateQuestionConvictionFromGatewayAuth(authContext, input) {
4240
4240
  });
4241
4241
  }
4242
4242
  function finalizeQuestionConvictionFromGatewayAuth(authContext, input) {
4243
- return authContext.convex.mutation(api.epistemicQuestions.finalizeConviction, {
4243
+ return authContext.convex.mutation(components.lucern.epistemicQuestions.finalizeConviction, {
4244
4244
  questionId: resolveExternalId4(input.questionId ?? input.id ?? input.nodeId, "que") ?? "",
4245
4245
  conviction: input.conviction,
4246
4246
  answer: input.answer,
@@ -4252,7 +4252,7 @@ function finalizeQuestionConvictionFromGatewayAuth(authContext, input) {
4252
4252
  }
4253
4253
  async function updateQuestionFromGatewayAuth(authContext, input) {
4254
4254
  const questionId = resolveExternalId4(input.questionId ?? input.id ?? input.nodeId, "que") ?? "";
4255
- await authContext.convex.mutation(api.epistemicQuestions.updateQuestion, {
4255
+ await authContext.convex.mutation(components.lucern.epistemicQuestions.updateQuestion, {
4256
4256
  questionId,
4257
4257
  question: input.question ?? input.text,
4258
4258
  category: input.category,
@@ -4261,7 +4261,7 @@ async function updateQuestionFromGatewayAuth(authContext, input) {
4261
4261
  return getQuestionFromGatewayAuth(authContext, questionId);
4262
4262
  }
4263
4263
  function deleteQuestionFromGatewayAuth(authContext, input) {
4264
- return authContext.convex.mutation(api.epistemicQuestions.deleteQuestion, {
4264
+ return authContext.convex.mutation(components.lucern.epistemicQuestions.deleteQuestion, {
4265
4265
  questionId: resolveExternalId4(input.questionId ?? input.id ?? input.nodeId, "que") ?? "",
4266
4266
  userId: authContext.userId
4267
4267
  });
@@ -4461,7 +4461,7 @@ function createGatewayGraphPort(authContext) {
4461
4461
  return page.beliefs;
4462
4462
  },
4463
4463
  async fetchBelief(input) {
4464
- const belief = await authContext.convex.query(api.epistemicBeliefs.getById, {
4464
+ const belief = await authContext.convex.query(components.lucern.epistemicBeliefs.getById, {
4465
4465
  beliefId: input.beliefId,
4466
4466
  nodeId: input.beliefId
4467
4467
  });
@@ -4988,13 +4988,13 @@ function createGatewayOntologiesPort(authContext) {
4988
4988
  return result ?? null;
4989
4989
  },
4990
4990
  bindOntologyToTopic(args) {
4991
- return authContext.convex.mutation(api.topics.update, {
4991
+ return authContext.convex.mutation(components.lucern.topics.update, {
4992
4992
  id: args.topicRawId,
4993
4993
  ontologyId: args.ontologyRawId
4994
4994
  });
4995
4995
  },
4996
4996
  async fetchTopic(topicRawId) {
4997
- const result = await authContext.convex.query(api.topics.get, {
4997
+ const result = await authContext.convex.query(components.lucern.topics.get, {
4998
4998
  id: topicRawId
4999
4999
  });
5000
5000
  return result ?? null;
@@ -5015,7 +5015,7 @@ function createGatewayOntologiesPort(authContext) {
5015
5015
  if (!input.topicRawId) {
5016
5016
  return null;
5017
5017
  }
5018
- const resolved = await authContext.convex.query(api.topics.resolveTopicOntology, {
5018
+ const resolved = await authContext.convex.query(components.lucern.topics.resolveTopicOntology, {
5019
5019
  topicId: input.topicRawId
5020
5020
  });
5021
5021
  const resolvedOntologyId = resolved && typeof resolved === "object" ? resolved.ontologyId : void 0;
@@ -5655,13 +5655,13 @@ async function emitTaskEventFromGatewayAuth(authContext, args) {
5655
5655
  function createGatewayTasksPort(authContext) {
5656
5656
  return {
5657
5657
  fetchTask(rawId) {
5658
- return authContext.convex.query(api.tasks.get, {
5658
+ return authContext.convex.query(components.lucern.tasks.get, {
5659
5659
  taskId: rawId,
5660
5660
  userId: authContext.userId
5661
5661
  });
5662
5662
  },
5663
5663
  listTasksByTopic(args) {
5664
- return authContext.convex.query(api.tasks.getByTopic, {
5664
+ return authContext.convex.query(components.lucern.tasks.getByTopic, {
5665
5665
  topicId: args.topicId,
5666
5666
  ...args.status ? { status: args.status } : {},
5667
5667
  ...typeof args.limit === "number" ? { limit: args.limit } : {},
@@ -5669,13 +5669,13 @@ function createGatewayTasksPort(authContext) {
5669
5669
  });
5670
5670
  },
5671
5671
  listTasksByWorktree(args) {
5672
- return authContext.convex.query(api.tasks.getByWorktree, {
5672
+ return authContext.convex.query(components.lucern.tasks.getByWorktree, {
5673
5673
  worktreeId: args.worktreeId,
5674
5674
  userId: authContext.userId
5675
5675
  });
5676
5676
  },
5677
5677
  createTask(input) {
5678
- return authContext.convex.mutation(api.tasks.create, {
5678
+ return authContext.convex.mutation(components.lucern.tasks.create, {
5679
5679
  topicId: input.topicId,
5680
5680
  title: input.title,
5681
5681
  ...input.description ? { description: input.description } : {},
@@ -5689,7 +5689,7 @@ function createGatewayTasksPort(authContext) {
5689
5689
  });
5690
5690
  },
5691
5691
  updateTask(input) {
5692
- return authContext.convex.mutation(api.tasks.update, {
5692
+ return authContext.convex.mutation(components.lucern.tasks.update, {
5693
5693
  taskId: input.taskRawId,
5694
5694
  ...input.title !== void 0 ? { title: input.title } : {},
5695
5695
  ...input.description !== void 0 ? { description: input.description } : {},
@@ -5703,7 +5703,7 @@ function createGatewayTasksPort(authContext) {
5703
5703
  });
5704
5704
  },
5705
5705
  completeTask(input) {
5706
- return authContext.convex.mutation(api.tasks.complete, {
5706
+ return authContext.convex.mutation(components.lucern.tasks.complete, {
5707
5707
  taskId: input.taskRawId,
5708
5708
  ...input.outputSummary ? { outputSummary: input.outputSummary } : {},
5709
5709
  userId: authContext.userId
@@ -6126,22 +6126,22 @@ function readCanonicalTopicRawId(value) {
6126
6126
  function createGatewayTopicsPort(authContext) {
6127
6127
  return {
6128
6128
  fetchTopic(rawId) {
6129
- return authContext.convex.query(api.topics.get, { id: rawId });
6129
+ return authContext.convex.query(components.lucern.topics.get, { id: rawId });
6130
6130
  },
6131
6131
  listTopics(query) {
6132
6132
  if (query.ontologyId) {
6133
- return authContext.convex.query(api.topics.listByOntology, {
6133
+ return authContext.convex.query(components.lucern.topics.listByOntology, {
6134
6134
  ontologyId: query.ontologyId
6135
6135
  });
6136
6136
  }
6137
- return authContext.convex.query(api.topics.list, {
6137
+ return authContext.convex.query(components.lucern.topics.list, {
6138
6138
  type: query.type,
6139
6139
  parentTopicId: query.parentTopicRawId,
6140
6140
  status: query.status
6141
6141
  });
6142
6142
  },
6143
6143
  createTopic(input) {
6144
- return authContext.convex.mutation(api.topics.create, {
6144
+ return authContext.convex.mutation(components.lucern.topics.create, {
6145
6145
  name: input.name,
6146
6146
  description: input.description,
6147
6147
  type: input.type,
@@ -6154,7 +6154,7 @@ function createGatewayTopicsPort(authContext) {
6154
6154
  });
6155
6155
  },
6156
6156
  updateTopic(input) {
6157
- return authContext.convex.mutation(api.topics.update, {
6157
+ return authContext.convex.mutation(components.lucern.topics.update, {
6158
6158
  id: input.topicRawId,
6159
6159
  name: input.name,
6160
6160
  description: input.description,
@@ -6166,27 +6166,27 @@ function createGatewayTopicsPort(authContext) {
6166
6166
  });
6167
6167
  },
6168
6168
  fetchTopicTree(args) {
6169
- return authContext.convex.query(api.topics.getTree, {
6169
+ return authContext.convex.query(components.lucern.topics.getTree, {
6170
6170
  rootId: args.rootRawId,
6171
6171
  ...typeof args.maxDepth === "number" ? { maxDepth: args.maxDepth } : {}
6172
6172
  });
6173
6173
  },
6174
6174
  listBeliefsByTopic(args) {
6175
- return authContext.convex.query(api.epistemicBeliefs.getByTopic, {
6175
+ return authContext.convex.query(components.lucern.epistemicBeliefs.getByTopic, {
6176
6176
  topicId: args.topicId,
6177
6177
  userId: authContext.userId,
6178
6178
  limit: args.limit
6179
6179
  });
6180
6180
  },
6181
6181
  listQuestionsByTopic(args) {
6182
- return authContext.convex.query(api.epistemicQuestions.getByTopic, {
6182
+ return authContext.convex.query(components.lucern.epistemicQuestions.getByTopic, {
6183
6183
  topicId: args.topicId,
6184
6184
  userId: authContext.userId,
6185
6185
  limit: args.limit
6186
6186
  });
6187
6187
  },
6188
6188
  listEvidenceByTopic(args) {
6189
- return authContext.convex.query(api.epistemicEvidence.getByTopic, {
6189
+ return authContext.convex.query(components.lucern.epistemicEvidence.getByTopic, {
6190
6190
  topicId: args.topicId,
6191
6191
  userId: authContext.userId,
6192
6192
  limit: args.limit
@@ -6241,11 +6241,11 @@ function getTopicCoverageFromGatewayAuth(authContext, input) {
6241
6241
  }
6242
6242
  async function removeTopicFromGatewayAuth(authContext, input) {
6243
6243
  const requestedId = normalizeTopicEventId(input.id);
6244
- const existingTopic = await authContext.convex.query(api.topics.get, {
6244
+ const existingTopic = await authContext.convex.query(components.lucern.topics.get, {
6245
6245
  id: requestedId
6246
6246
  });
6247
6247
  const normalizedId = readCanonicalTopicRawId(existingTopic) ?? requestedId;
6248
- const payload = await authContext.convex.mutation(api.topics.remove, {
6248
+ const payload = await authContext.convex.mutation(components.lucern.topics.remove, {
6249
6249
  id: normalizedId
6250
6250
  });
6251
6251
  return {
@@ -6254,7 +6254,7 @@ async function removeTopicFromGatewayAuth(authContext, input) {
6254
6254
  };
6255
6255
  }
6256
6256
  function bulkCreateTopicsFromGatewayAuth(authContext, input) {
6257
- return authContext.convex.mutation(internal.topics.bulkCreate, {
6257
+ return authContext.convex.mutation(components.lucern.topics.bulkCreate, {
6258
6258
  topics: input.topics.map((topic) => ({
6259
6259
  ...topic,
6260
6260
  createdBy: topic.createdBy ?? authContext.userId
@@ -6632,7 +6632,7 @@ function withRequestedWorktreeId(payload, worktreeId) {
6632
6632
  };
6633
6633
  }
6634
6634
  async function resolveWorktreeTopicIdWithGatewayAuth(authContext, worktreeId) {
6635
- const worktree = await authContext.convex.query(api.worktrees.get, {
6635
+ const worktree = await authContext.convex.query(components.lucern.worktrees.get, {
6636
6636
  worktreeId
6637
6637
  });
6638
6638
  return readString18(worktree?.topicId);
@@ -6659,19 +6659,19 @@ async function emitWorktreeEventFromGatewayAuth(authContext, args) {
6659
6659
  function createGatewayWorktreesPort(authContext) {
6660
6660
  return {
6661
6661
  fetchWorktree(rawId) {
6662
- return authContext.convex.query(api.worktrees.get, {
6662
+ return authContext.convex.query(components.lucern.worktrees.get, {
6663
6663
  worktreeId: rawId
6664
6664
  });
6665
6665
  },
6666
6666
  listWorktreesByTopic(args) {
6667
- return authContext.convex.query(api.worktrees.list, {
6667
+ return authContext.convex.query(components.lucern.worktrees.list, {
6668
6668
  topicId: args.topicId,
6669
6669
  limit: args.limit
6670
6670
  });
6671
6671
  },
6672
6672
  async createWorktree(input) {
6673
6673
  const shouldAutoShape = input.autoShape === true || Boolean(input.domainPackId?.trim());
6674
- const created = shouldAutoShape ? await authContext.convex.mutation(internal.worktrees.createShaped, {
6674
+ const created = shouldAutoShape ? await authContext.convex.mutation(components.lucern.worktrees.createShaped, {
6675
6675
  ...buildCreateMutationArgs(
6676
6676
  {
6677
6677
  ...input,
@@ -6687,7 +6687,7 @@ function createGatewayWorktreesPort(authContext) {
6687
6687
  ...input.staffingHint?.trim() ? { staffingHint: input.staffingHint.trim() } : {},
6688
6688
  ...typeof input.lastReconciledAt === "number" ? { lastReconciledAt: input.lastReconciledAt } : {},
6689
6689
  ...input.autoFixPolicy ? { autoFixPolicy: input.autoFixPolicy } : {}
6690
- }) : await authContext.convex.mutation(api.worktrees.create, buildCreateMutationArgs(
6690
+ }) : await authContext.convex.mutation(components.lucern.worktrees.create, buildCreateMutationArgs(
6691
6691
  {
6692
6692
  ...input,
6693
6693
  topicId: input.topicRawId,
@@ -6700,7 +6700,7 @@ function createGatewayWorktreesPort(authContext) {
6700
6700
  const createdRecord = created && typeof created === "object" ? created : {};
6701
6701
  const worktreeId = typeof created === "string" ? created : typeof createdRecord.worktreeId === "string" ? createdRecord.worktreeId : "";
6702
6702
  if (worktreeId) {
6703
- await authContext.convex.mutation(api.worktrees.updateMetadata, {
6703
+ await authContext.convex.mutation(components.lucern.worktrees.updateMetadata, {
6704
6704
  worktreeId,
6705
6705
  ...Array.isArray(input.proofArtifacts) ? { proofArtifacts: input.proofArtifacts } : {},
6706
6706
  ...input.staffingHint?.trim() ? { staffingHint: input.staffingHint.trim() } : {},
@@ -6712,13 +6712,13 @@ function createGatewayWorktreesPort(authContext) {
6712
6712
  return created;
6713
6713
  },
6714
6714
  activateWorktree(args) {
6715
- return authContext.convex.mutation(api.worktrees.activate, {
6715
+ return authContext.convex.mutation(components.lucern.worktrees.activate, {
6716
6716
  worktreeId: args.worktreeRawId,
6717
6717
  userId: authContext.userId
6718
6718
  });
6719
6719
  },
6720
6720
  completeWorktree(args) {
6721
- return authContext.convex.mutation(api.worktrees.complete, {
6721
+ return authContext.convex.mutation(components.lucern.worktrees.complete, {
6722
6722
  worktreeId: args.worktreeRawId,
6723
6723
  keyFindings: [args.summary],
6724
6724
  decisionsReached: [],
@@ -6728,7 +6728,7 @@ function createGatewayWorktreesPort(authContext) {
6728
6728
  },
6729
6729
  scoreBeliefOutcome(args) {
6730
6730
  const opinion = toSubjectiveLogicOpinion(args.confidence);
6731
- return authContext.convex.mutation(api.epistemicBeliefs.modulateConfidence, {
6731
+ return authContext.convex.mutation(components.lucern.epistemicBeliefs.modulateConfidence, {
6732
6732
  nodeId: args.beliefRawId,
6733
6733
  trigger: "worktree_outcome",
6734
6734
  rationale: args.rationale,
@@ -6737,7 +6737,7 @@ function createGatewayWorktreesPort(authContext) {
6737
6737
  });
6738
6738
  },
6739
6739
  updateWorktreeMetadata(input) {
6740
- return authContext.convex.mutation(api.worktrees.updateMetadata, {
6740
+ return authContext.convex.mutation(components.lucern.worktrees.updateMetadata, {
6741
6741
  worktreeId: input.worktreeRawId,
6742
6742
  ...input.objective ? { objective: input.objective } : {},
6743
6743
  ...input.hypothesis ? { hypothesis: input.hypothesis } : {},
@@ -6760,7 +6760,7 @@ function createGatewayWorktreesPort(authContext) {
6760
6760
  });
6761
6761
  },
6762
6762
  updateWorktreeTargets(input) {
6763
- return authContext.convex.mutation(api.worktrees.updateTargets, {
6763
+ return authContext.convex.mutation(components.lucern.worktrees.updateTargets, {
6764
6764
  worktreeId: input.worktreeRawId,
6765
6765
  ...input.addBeliefRawIds?.length ? { addBeliefIds: input.addBeliefRawIds.map((id) => id) } : {},
6766
6766
  ...input.addQuestionRawIds?.length ? { addQuestionIds: input.addQuestionRawIds.map((id) => id) } : {},
@@ -6802,7 +6802,7 @@ function listWorktreesFromGatewayAuth(authContext, query) {
6802
6802
  return listWorktrees(createGatewayWorktreesPort(authContext), query);
6803
6803
  }
6804
6804
  async function listAllWorktreesFromGatewayAuth(authContext, query = {}) {
6805
- const rows = await authContext.convex.query(api.worktrees.listAll, {
6805
+ const rows = await authContext.convex.query(components.lucern.worktrees.listAll, {
6806
6806
  ...query.status ? { status: query.status } : {},
6807
6807
  ...query.track ? { track: query.track } : {},
6808
6808
  ...typeof query.executionBand === "number" ? { executionBand: query.executionBand } : {},
@@ -6881,7 +6881,7 @@ async function updateWorktreeTargetsFromGatewayAuth(authContext, input) {
6881
6881
  return payload;
6882
6882
  }
6883
6883
  function completeWorktreeRecordFromGatewayAuth(authContext, input) {
6884
- return authContext.convex.mutation(api.worktrees.complete, {
6884
+ return authContext.convex.mutation(components.lucern.worktrees.complete, {
6885
6885
  worktreeId: resolveExternalId5(input.worktreeId, "wt") ?? input.worktreeId,
6886
6886
  keyFindings: input.keyFindings ?? [],
6887
6887
  decisionsReached: input.decisionsReached ?? [],
@@ -6890,13 +6890,13 @@ function completeWorktreeRecordFromGatewayAuth(authContext, input) {
6890
6890
  }).then((payload) => withRequestedWorktreeId(payload, input.worktreeId));
6891
6891
  }
6892
6892
  function advanceWorktreePhaseFromGatewayAuth(authContext, input) {
6893
- return authContext.convex.mutation(api.worktrees.advancePhase, {
6893
+ return authContext.convex.mutation(components.lucern.worktrees.advancePhase, {
6894
6894
  worktreeId: resolveExternalId5(input.worktreeId, "wt") ?? input.worktreeId,
6895
6895
  userId: authContext.userId
6896
6896
  });
6897
6897
  }
6898
6898
  function setWorktreePhaseFromGatewayAuth(authContext, input) {
6899
- return authContext.convex.mutation(api.worktrees.setPhase, {
6899
+ return authContext.convex.mutation(components.lucern.worktrees.setPhase, {
6900
6900
  worktreeId: resolveExternalId5(input.worktreeId, "wt") ?? input.worktreeId,
6901
6901
  phase: input.phase,
6902
6902
  userId: authContext.userId
@@ -6910,7 +6910,7 @@ function patchWorktreeStateFromGatewayAuth(authContext, input) {
6910
6910
  }).then((payload) => withRequestedWorktreeId(payload, input.worktreeId));
6911
6911
  }
6912
6912
  function bulkCreateWorktreesFromGatewayAuth(authContext, input) {
6913
- return authContext.convex.mutation(internal.worktrees.bulkCreate, {
6913
+ return authContext.convex.mutation(components.lucern.worktrees.bulkCreate, {
6914
6914
  worktrees: input.worktrees
6915
6915
  });
6916
6916
  }