@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 +92 -92
- package/dist/gateway.js.map +1 -1
- package/dist/runtime.js +20 -20
- package/dist/runtime.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path2 from 'path';
|
|
3
|
-
import { api,
|
|
3
|
+
import { api, components, internal } from '@lucern/reasoning-kernel/_generated/api';
|
|
4
4
|
import 'stream';
|
|
5
5
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
6
6
|
import { ConvexHttpClient } from 'convex/browser';
|
|
@@ -309,7 +309,7 @@ registerKernelApi({
|
|
|
309
309
|
internal: internal
|
|
310
310
|
});
|
|
311
311
|
var api2 = api;
|
|
312
|
-
var
|
|
312
|
+
var components2 = components;
|
|
313
313
|
function isQuietMcpBoot() {
|
|
314
314
|
return process.env.LUCERN_MCP_QUIET === "1";
|
|
315
315
|
}
|
|
@@ -509,7 +509,7 @@ async function tryGetTopicById(topicId) {
|
|
|
509
509
|
return null;
|
|
510
510
|
}
|
|
511
511
|
try {
|
|
512
|
-
const topic = await adminQuery(
|
|
512
|
+
const topic = await adminQuery(components2.lucern.topics.get, {
|
|
513
513
|
id: normalizedTopicId
|
|
514
514
|
});
|
|
515
515
|
return topic || null;
|
|
@@ -519,7 +519,7 @@ async function tryGetTopicById(topicId) {
|
|
|
519
519
|
}
|
|
520
520
|
async function tryGetNodeById(nodeId) {
|
|
521
521
|
try {
|
|
522
|
-
const node = await adminQuery(
|
|
522
|
+
const node = await adminQuery(components2.lucern.epistemicNodes.getInternal, {
|
|
523
523
|
nodeId
|
|
524
524
|
});
|
|
525
525
|
return node || null;
|
|
@@ -529,7 +529,7 @@ async function tryGetNodeById(nodeId) {
|
|
|
529
529
|
}
|
|
530
530
|
async function findTopicByMappedProjectId(legacyScopeId) {
|
|
531
531
|
try {
|
|
532
|
-
const topics = await adminQuery(
|
|
532
|
+
const topics = await adminQuery(components2.lucern.topics.list, {});
|
|
533
533
|
return topics.find((topic) => readTopicMappedProjectId(topic) === legacyScopeId) || null;
|
|
534
534
|
} catch {
|
|
535
535
|
return null;
|
|
@@ -773,7 +773,7 @@ async function resolveBeliefs(nodeIds) {
|
|
|
773
773
|
const results = [];
|
|
774
774
|
for (const nodeId of nodeIds) {
|
|
775
775
|
try {
|
|
776
|
-
const node = await adminQuery(
|
|
776
|
+
const node = await adminQuery(components2.lucern.epistemicNodes.get, {
|
|
777
777
|
nodeId
|
|
778
778
|
});
|
|
779
779
|
if (!node) {
|
|
@@ -793,7 +793,7 @@ async function resolveQuestions(nodeIds) {
|
|
|
793
793
|
const results = [];
|
|
794
794
|
for (const nodeId of nodeIds) {
|
|
795
795
|
try {
|
|
796
|
-
const node = await adminQuery(
|
|
796
|
+
const node = await adminQuery(components2.lucern.epistemicNodes.get, {
|
|
797
797
|
nodeId
|
|
798
798
|
});
|
|
799
799
|
if (!node) {
|
|
@@ -821,7 +821,7 @@ async function beginBuildSession(args) {
|
|
|
821
821
|
const prBase = typeof args.prBase === "string" && args.prBase.trim().length > 0 ? args.prBase.trim() : "staging";
|
|
822
822
|
const sessionMode = typeof args.sessionMode === "string" && args.sessionMode.trim().length > 0 ? args.sessionMode.trim() : "async";
|
|
823
823
|
const activateIfPlanning = args.activateIfPlanning !== false;
|
|
824
|
-
const worktree = await adminQuery(
|
|
824
|
+
const worktree = await adminQuery(components2.lucern.worktrees.get, {
|
|
825
825
|
worktreeId
|
|
826
826
|
});
|
|
827
827
|
if (!worktree) {
|
|
@@ -841,7 +841,7 @@ async function beginBuildSession(args) {
|
|
|
841
841
|
const targetQuestionIds = worktree.targetQuestionIds || [];
|
|
842
842
|
if (activateIfPlanning && status === "planning") {
|
|
843
843
|
try {
|
|
844
|
-
await adminMutation(
|
|
844
|
+
await adminMutation(components2.lucern.worktrees.activate, {
|
|
845
845
|
worktreeId
|
|
846
846
|
});
|
|
847
847
|
status = "active";
|
|
@@ -850,7 +850,7 @@ async function beginBuildSession(args) {
|
|
|
850
850
|
}
|
|
851
851
|
let topicName = "Unknown";
|
|
852
852
|
try {
|
|
853
|
-
const topic = await adminQuery(
|
|
853
|
+
const topic = await adminQuery(components2.lucern.topics.get, {
|
|
854
854
|
id: topicId
|
|
855
855
|
});
|
|
856
856
|
if (topic) {
|
|
@@ -881,7 +881,7 @@ async function beginBuildSession(args) {
|
|
|
881
881
|
}
|
|
882
882
|
} catch {
|
|
883
883
|
try {
|
|
884
|
-
const node = await adminQuery(
|
|
884
|
+
const node = await adminQuery(components2.lucern.epistemicNodes.get, {
|
|
885
885
|
nodeId: question.nodeId
|
|
886
886
|
});
|
|
887
887
|
if (node?._id) {
|
|
@@ -913,7 +913,7 @@ async function beginBuildSession(args) {
|
|
|
913
913
|
});
|
|
914
914
|
}
|
|
915
915
|
try {
|
|
916
|
-
const topicQuestions = await adminQuery(
|
|
916
|
+
const topicQuestions = await adminQuery(components2.lucern.epistemicQuestions.getByTopic, {
|
|
917
917
|
topicId,
|
|
918
918
|
userId: "system",
|
|
919
919
|
limit: 20
|
|
@@ -936,7 +936,7 @@ async function beginBuildSession(args) {
|
|
|
936
936
|
const dependencies = [];
|
|
937
937
|
for (const dependencyId of dependsOn.slice(0, 5)) {
|
|
938
938
|
try {
|
|
939
|
-
const dependency = await adminQuery(
|
|
939
|
+
const dependency = await adminQuery(components2.lucern.worktrees.get, {
|
|
940
940
|
worktreeId: dependencyId
|
|
941
941
|
});
|
|
942
942
|
dependencies.push({
|
|
@@ -955,7 +955,7 @@ async function beginBuildSession(args) {
|
|
|
955
955
|
const unblocks = [];
|
|
956
956
|
for (const blockedId of blocks.slice(0, 5)) {
|
|
957
957
|
try {
|
|
958
|
-
const blocked = await adminQuery(
|
|
958
|
+
const blocked = await adminQuery(components2.lucern.worktrees.get, {
|
|
959
959
|
worktreeId: blockedId
|
|
960
960
|
});
|
|
961
961
|
unblocks.push({
|
|
@@ -2407,7 +2407,7 @@ async function buildWorktreeArtifact(args) {
|
|
|
2407
2407
|
const thesisText = thesisHtml ? stripHtml(thesisHtml) : null;
|
|
2408
2408
|
const memoText = memoHtml ? stripHtml(memoHtml) : null;
|
|
2409
2409
|
const [beliefs, qa, recentEvidence, openQuestions, versionHistory] = await Promise.all([
|
|
2410
|
-
adminQuery(
|
|
2410
|
+
adminQuery(components2.lucern.epistemicBeliefs.getByWorktree, {
|
|
2411
2411
|
worktreeId
|
|
2412
2412
|
}).catch(() => []),
|
|
2413
2413
|
args.topicId ? adminQuery(api2.worktrees.getWorktreeQAForReport, {
|
|
@@ -2415,12 +2415,12 @@ async function buildWorktreeArtifact(args) {
|
|
|
2415
2415
|
topicId: args.topicId,
|
|
2416
2416
|
userId: args.userId
|
|
2417
2417
|
}).catch(() => null) : Promise.resolve(null),
|
|
2418
|
-
args.topicId ? adminQuery(
|
|
2418
|
+
args.topicId ? adminQuery(components2.lucern.epistemicEvidence.getByTopic, {
|
|
2419
2419
|
topicId: args.topicId,
|
|
2420
2420
|
userId: args.userId,
|
|
2421
2421
|
limit: 8
|
|
2422
2422
|
}).catch(() => []) : Promise.resolve([]),
|
|
2423
|
-
args.topicId ? adminQuery(
|
|
2423
|
+
args.topicId ? adminQuery(components2.lucern.epistemicQuestions.getByTopic, {
|
|
2424
2424
|
topicId: args.topicId,
|
|
2425
2425
|
userId: args.userId,
|
|
2426
2426
|
limit: 8,
|
|
@@ -2499,19 +2499,19 @@ var thesisArtifactHandlers = {
|
|
|
2499
2499
|
const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? Math.max(1, Math.min(10, Math.floor(args.limit))) : 5;
|
|
2500
2500
|
let selectedWorktree = null;
|
|
2501
2501
|
if (worktreeId) {
|
|
2502
|
-
selectedWorktree = await adminQuery(
|
|
2502
|
+
selectedWorktree = await adminQuery(components2.lucern.worktrees.get, {
|
|
2503
2503
|
worktreeId
|
|
2504
2504
|
}).catch(() => null);
|
|
2505
2505
|
}
|
|
2506
2506
|
const resolvedTopicId = requestedTopicId || normalizeTopicId(selectedWorktree ?? {}) || null;
|
|
2507
2507
|
let topicName = null;
|
|
2508
2508
|
if (resolvedTopicId) {
|
|
2509
|
-
const topic = await adminQuery(
|
|
2509
|
+
const topic = await adminQuery(components2.lucern.topics.get, {
|
|
2510
2510
|
id: resolvedTopicId
|
|
2511
2511
|
}).catch(() => null);
|
|
2512
2512
|
topicName = typeof topic?.name === "string" ? topic.name : null;
|
|
2513
2513
|
}
|
|
2514
|
-
const topicWorktrees = resolvedTopicId ? await adminQuery(
|
|
2514
|
+
const topicWorktrees = resolvedTopicId ? await adminQuery(components2.lucern.worktrees.getByTopic, {
|
|
2515
2515
|
topicId: resolvedTopicId
|
|
2516
2516
|
}).catch(() => []) : [];
|
|
2517
2517
|
const rankedTopicArtifacts = topicWorktrees.filter(hasThesisArtifact).sort(rankWorktreesByArtifact);
|