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