@lucern/mcp 0.3.0-alpha.7 → 0.3.0-alpha.8
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/cli.js +86 -57
- package/dist/cli.js.map +1 -1
- package/dist/gateway.js +5 -5
- package/dist/gateway.js.map +1 -1
- package/dist/hosted-route.js +79 -55
- package/dist/hosted-route.js.map +1 -1
- package/dist/index.js +86 -57
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +19 -9
- package/dist/runtime.js.map +1 -1
- package/package.json +6 -6
package/dist/cli.js
CHANGED
|
@@ -128,9 +128,14 @@ function loadProfile(options) {
|
|
|
128
128
|
const profiles = readProfilesFile(profilesPath());
|
|
129
129
|
const localEnv = options.readLocalEnv === false ? {} : readLocalEnvFiles(options.cwd);
|
|
130
130
|
const mergedEnv = { ...localEnv, ...options.env };
|
|
131
|
-
const selected = options.profileName ?? mergedEnv.LUCERN_PROFILE ?? profiles.activeProfile ?? credentials.LUCERN_PROFILE ?? "default";
|
|
132
|
-
const savedProfile = profiles.profiles?.[selected] ?? {};
|
|
133
131
|
const envProfile = profileFromEnvironment(mergedEnv);
|
|
132
|
+
const hasEnvCredentials = Boolean(
|
|
133
|
+
envProfile.apiKey || envProfile.userToken || envProfile.packKey
|
|
134
|
+
);
|
|
135
|
+
const explicitProfileSelected = options.profileName !== void 0 || mergedEnv.LUCERN_PROFILE !== void 0;
|
|
136
|
+
const selectedProfile = options.profileName ?? mergedEnv.LUCERN_PROFILE ?? profiles.activeProfile ?? credentials.LUCERN_PROFILE ?? "default";
|
|
137
|
+
const selected = hasEnvCredentials && !explicitProfileSelected ? "env" : selectedProfile;
|
|
138
|
+
const savedProfile = hasEnvCredentials && !explicitProfileSelected ? {} : profiles.profiles?.[selectedProfile] ?? {};
|
|
134
139
|
const credentialsProfile = {
|
|
135
140
|
apiKey: credentials.LUCERN_API_KEY,
|
|
136
141
|
userToken: readFirst(credentials, ["LUCERN_SESSION_TOKEN", "LUCERN_USER_TOKEN"]),
|
|
@@ -7911,15 +7916,15 @@ var IDENTITY_WHOAMI = {
|
|
|
7911
7916
|
};
|
|
7912
7917
|
var COMPILE_CONTEXT = {
|
|
7913
7918
|
name: "compile_context",
|
|
7914
|
-
description: "Compile a focused reasoning context
|
|
7919
|
+
description: "Compile a focused reasoning context. If topicId is omitted, Lucern resolves the best topic from the query. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
|
|
7915
7920
|
parameters: {
|
|
7916
7921
|
topicId: {
|
|
7917
7922
|
type: "string",
|
|
7918
|
-
description: "
|
|
7923
|
+
description: "Optional topic scope ID. Omit to resolve the topic from query."
|
|
7919
7924
|
},
|
|
7920
7925
|
query: {
|
|
7921
7926
|
type: "string",
|
|
7922
|
-
description: "
|
|
7927
|
+
description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
|
|
7923
7928
|
},
|
|
7924
7929
|
budget: {
|
|
7925
7930
|
type: "number",
|
|
@@ -7943,7 +7948,7 @@ var COMPILE_CONTEXT = {
|
|
|
7943
7948
|
description: "Include related ontological entities in the compiled result"
|
|
7944
7949
|
}
|
|
7945
7950
|
},
|
|
7946
|
-
required: [
|
|
7951
|
+
required: [],
|
|
7947
7952
|
response: {
|
|
7948
7953
|
description: "Compiled context pack for the requested topic",
|
|
7949
7954
|
fields: {
|
|
@@ -10454,7 +10459,7 @@ var contextContracts = [
|
|
|
10454
10459
|
path: "/context/compile",
|
|
10455
10460
|
sdkNamespace: "context",
|
|
10456
10461
|
sdkMethod: "compileContext",
|
|
10457
|
-
summary: "Compile a focused reasoning context
|
|
10462
|
+
summary: "Compile a focused reasoning context, resolving topic from query when omitted.",
|
|
10458
10463
|
convex: {
|
|
10459
10464
|
module: "contextCompiler",
|
|
10460
10465
|
functionName: "compile",
|
|
@@ -18836,50 +18841,55 @@ function cleanNumber(value) {
|
|
|
18836
18841
|
function cleanBoolean(value) {
|
|
18837
18842
|
return typeof value === "boolean" ? value : void 0;
|
|
18838
18843
|
}
|
|
18839
|
-
function buildCompileContextRequest(
|
|
18840
|
-
const
|
|
18841
|
-
const
|
|
18844
|
+
function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
|
|
18845
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
18846
|
+
const payload = {};
|
|
18847
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString4(topicIdOrInput) : cleanString4(effectiveInput.topicId);
|
|
18848
|
+
if (topicId) {
|
|
18849
|
+
payload.topicId = topicId;
|
|
18850
|
+
}
|
|
18851
|
+
const query5 = cleanString4(effectiveInput.query);
|
|
18842
18852
|
if (query5) {
|
|
18843
18853
|
payload.query = query5;
|
|
18844
18854
|
}
|
|
18845
|
-
const budget = cleanNumber(
|
|
18855
|
+
const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
|
|
18846
18856
|
if (budget !== void 0) {
|
|
18847
18857
|
payload.budget = budget;
|
|
18848
18858
|
}
|
|
18849
|
-
const ranking = cleanString4(
|
|
18859
|
+
const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
|
|
18850
18860
|
if (ranking) {
|
|
18851
18861
|
payload.ranking = ranking;
|
|
18852
18862
|
}
|
|
18853
|
-
const limit = cleanNumber(
|
|
18863
|
+
const limit = cleanNumber(effectiveInput.limit);
|
|
18854
18864
|
if (limit !== void 0) {
|
|
18855
18865
|
payload.limit = limit;
|
|
18856
18866
|
}
|
|
18857
|
-
const maxDepth = cleanNumber(
|
|
18867
|
+
const maxDepth = cleanNumber(effectiveInput.maxDepth);
|
|
18858
18868
|
if (maxDepth !== void 0) {
|
|
18859
18869
|
payload.maxDepth = maxDepth;
|
|
18860
18870
|
}
|
|
18861
|
-
const includeEntities = cleanBoolean(
|
|
18871
|
+
const includeEntities = cleanBoolean(effectiveInput.includeEntities);
|
|
18862
18872
|
if (includeEntities !== void 0) {
|
|
18863
18873
|
payload.includeEntities = includeEntities;
|
|
18864
18874
|
}
|
|
18865
|
-
const mode = cleanString4(
|
|
18875
|
+
const mode = cleanString4(effectiveInput.mode);
|
|
18866
18876
|
if (mode) {
|
|
18867
18877
|
payload.mode = mode;
|
|
18868
18878
|
}
|
|
18869
|
-
const includeFailures = cleanBoolean(
|
|
18879
|
+
const includeFailures = cleanBoolean(effectiveInput.includeFailures);
|
|
18870
18880
|
if (includeFailures !== void 0) {
|
|
18871
18881
|
payload.includeFailures = includeFailures;
|
|
18872
18882
|
}
|
|
18873
|
-
const worktreeId = cleanString4(
|
|
18883
|
+
const worktreeId = cleanString4(effectiveInput.worktreeId);
|
|
18874
18884
|
if (worktreeId) {
|
|
18875
18885
|
payload.worktreeId = worktreeId;
|
|
18876
18886
|
}
|
|
18877
|
-
const sessionId = cleanString4(
|
|
18887
|
+
const sessionId = cleanString4(effectiveInput.sessionId);
|
|
18878
18888
|
if (sessionId) {
|
|
18879
18889
|
payload.sessionId = sessionId;
|
|
18880
18890
|
}
|
|
18881
|
-
if (Array.isArray(
|
|
18882
|
-
payload.packWeightOverrides =
|
|
18891
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
18892
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
18883
18893
|
}
|
|
18884
18894
|
return {
|
|
18885
18895
|
path: "/api/platform/v1/context/compile",
|
|
@@ -18891,13 +18901,20 @@ function createContextClient(config = {}) {
|
|
|
18891
18901
|
const gateway = createGatewayRequestClient(config);
|
|
18892
18902
|
return {
|
|
18893
18903
|
/**
|
|
18894
|
-
* Compile a focused reasoning context pack
|
|
18895
|
-
* @param
|
|
18904
|
+
* Compile a focused reasoning context pack.
|
|
18905
|
+
* @param topicIdOrInput - Optional topic ID, or compile input for query-first resolution.
|
|
18896
18906
|
* @param input - Optional compile parameters (query, budget, ranking, etc.).
|
|
18897
18907
|
* @returns The compiled context payload with beliefs, questions, and evidence.
|
|
18898
18908
|
*/
|
|
18899
|
-
async compile(
|
|
18900
|
-
const request = buildCompileContextRequest(
|
|
18909
|
+
async compile(topicIdOrInput = {}, input = {}) {
|
|
18910
|
+
const request = buildCompileContextRequest(topicIdOrInput, input);
|
|
18911
|
+
return gateway.request({
|
|
18912
|
+
...request,
|
|
18913
|
+
body: request.body
|
|
18914
|
+
});
|
|
18915
|
+
},
|
|
18916
|
+
async compileByQuery(input = {}) {
|
|
18917
|
+
const request = buildCompileContextRequest(input);
|
|
18901
18918
|
return gateway.request({
|
|
18902
18919
|
...request,
|
|
18903
18920
|
body: request.body
|
|
@@ -21672,7 +21689,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
21672
21689
|
}
|
|
21673
21690
|
|
|
21674
21691
|
// ../sdk/src/version.ts
|
|
21675
|
-
var LUCERN_SDK_VERSION = "0.3.0-alpha.
|
|
21692
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.8";
|
|
21676
21693
|
|
|
21677
21694
|
// ../sdk/src/workflowClient.ts
|
|
21678
21695
|
function normalizeLensQuery(value) {
|
|
@@ -23837,50 +23854,55 @@ function cleanNumber2(value) {
|
|
|
23837
23854
|
function cleanBoolean2(value) {
|
|
23838
23855
|
return typeof value === "boolean" ? value : void 0;
|
|
23839
23856
|
}
|
|
23840
|
-
function buildCompileContextRequest2(
|
|
23841
|
-
const
|
|
23842
|
-
const
|
|
23857
|
+
function buildCompileContextRequest2(topicIdOrInput = {}, input = {}) {
|
|
23858
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
23859
|
+
const payload = {};
|
|
23860
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString6(topicIdOrInput) : cleanString6(effectiveInput.topicId);
|
|
23861
|
+
if (topicId) {
|
|
23862
|
+
payload.topicId = topicId;
|
|
23863
|
+
}
|
|
23864
|
+
const query5 = cleanString6(effectiveInput.query);
|
|
23843
23865
|
if (query5) {
|
|
23844
23866
|
payload.query = query5;
|
|
23845
23867
|
}
|
|
23846
|
-
const budget = cleanNumber2(
|
|
23868
|
+
const budget = cleanNumber2(effectiveInput.budget) ?? cleanNumber2(effectiveInput.tokenBudget);
|
|
23847
23869
|
if (budget !== void 0) {
|
|
23848
23870
|
payload.budget = budget;
|
|
23849
23871
|
}
|
|
23850
|
-
const ranking = cleanString6(
|
|
23872
|
+
const ranking = cleanString6(effectiveInput.ranking) ?? cleanString6(effectiveInput.rankingProfile);
|
|
23851
23873
|
if (ranking) {
|
|
23852
23874
|
payload.ranking = ranking;
|
|
23853
23875
|
}
|
|
23854
|
-
const limit = cleanNumber2(
|
|
23876
|
+
const limit = cleanNumber2(effectiveInput.limit);
|
|
23855
23877
|
if (limit !== void 0) {
|
|
23856
23878
|
payload.limit = limit;
|
|
23857
23879
|
}
|
|
23858
|
-
const maxDepth = cleanNumber2(
|
|
23880
|
+
const maxDepth = cleanNumber2(effectiveInput.maxDepth);
|
|
23859
23881
|
if (maxDepth !== void 0) {
|
|
23860
23882
|
payload.maxDepth = maxDepth;
|
|
23861
23883
|
}
|
|
23862
|
-
const includeEntities = cleanBoolean2(
|
|
23884
|
+
const includeEntities = cleanBoolean2(effectiveInput.includeEntities);
|
|
23863
23885
|
if (includeEntities !== void 0) {
|
|
23864
23886
|
payload.includeEntities = includeEntities;
|
|
23865
23887
|
}
|
|
23866
|
-
const mode = cleanString6(
|
|
23888
|
+
const mode = cleanString6(effectiveInput.mode);
|
|
23867
23889
|
if (mode) {
|
|
23868
23890
|
payload.mode = mode;
|
|
23869
23891
|
}
|
|
23870
|
-
const includeFailures = cleanBoolean2(
|
|
23892
|
+
const includeFailures = cleanBoolean2(effectiveInput.includeFailures);
|
|
23871
23893
|
if (includeFailures !== void 0) {
|
|
23872
23894
|
payload.includeFailures = includeFailures;
|
|
23873
23895
|
}
|
|
23874
|
-
const worktreeId = cleanString6(
|
|
23896
|
+
const worktreeId = cleanString6(effectiveInput.worktreeId);
|
|
23875
23897
|
if (worktreeId) {
|
|
23876
23898
|
payload.worktreeId = worktreeId;
|
|
23877
23899
|
}
|
|
23878
|
-
const sessionId = cleanString6(
|
|
23900
|
+
const sessionId = cleanString6(effectiveInput.sessionId);
|
|
23879
23901
|
if (sessionId) {
|
|
23880
23902
|
payload.sessionId = sessionId;
|
|
23881
23903
|
}
|
|
23882
|
-
if (Array.isArray(
|
|
23883
|
-
payload.packWeightOverrides =
|
|
23904
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
23905
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
23884
23906
|
}
|
|
23885
23907
|
return {
|
|
23886
23908
|
path: "/api/platform/v1/context/compile",
|
|
@@ -23890,8 +23912,12 @@ function buildCompileContextRequest2(topicId, input = {}) {
|
|
|
23890
23912
|
}
|
|
23891
23913
|
function createContextFacade(config) {
|
|
23892
23914
|
return {
|
|
23893
|
-
compile(
|
|
23894
|
-
const request = buildCompileContextRequest2(
|
|
23915
|
+
compile(topicIdOrInput = {}, input = {}) {
|
|
23916
|
+
const request = buildCompileContextRequest2(topicIdOrInput, input);
|
|
23917
|
+
return config.transport.request(request);
|
|
23918
|
+
},
|
|
23919
|
+
compileByQuery(input = {}) {
|
|
23920
|
+
const request = buildCompileContextRequest2(input);
|
|
23895
23921
|
return config.transport.request(request);
|
|
23896
23922
|
}
|
|
23897
23923
|
};
|
|
@@ -26649,24 +26675,27 @@ function readResultString(value, key) {
|
|
|
26649
26675
|
}
|
|
26650
26676
|
function createContextHandlers(context) {
|
|
26651
26677
|
const compiler = createContextClient(context.sdkConfig);
|
|
26678
|
+
const functionSurface = createFunctionSurfaceClient(context.sdkConfig);
|
|
26652
26679
|
return {
|
|
26653
26680
|
compile_context: contractToHandler(
|
|
26654
26681
|
MCP_TOOL_CONTRACTS.compile_context,
|
|
26655
26682
|
async (params) => {
|
|
26656
|
-
const topicId = readTopicId4(params
|
|
26657
|
-
const
|
|
26658
|
-
|
|
26659
|
-
{
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
|
|
26664
|
-
|
|
26665
|
-
|
|
26666
|
-
|
|
26667
|
-
|
|
26668
|
-
|
|
26669
|
-
|
|
26683
|
+
const topicId = readTopicId4(params);
|
|
26684
|
+
const query5 = readString3(params, "query");
|
|
26685
|
+
const input = {
|
|
26686
|
+
...query5 ? { query: query5 } : {},
|
|
26687
|
+
...readNumber2(params, "budget") !== void 0 ? { budget: readNumber2(params, "budget") } : {},
|
|
26688
|
+
...readString3(params, "ranking") ? {
|
|
26689
|
+
ranking: readString3(params, "ranking")
|
|
26690
|
+
} : {},
|
|
26691
|
+
...readNumber2(params, "limit") !== void 0 ? { limit: readNumber2(params, "limit") } : {},
|
|
26692
|
+
...readNumber2(params, "maxDepth") !== void 0 ? { maxDepth: readNumber2(params, "maxDepth") } : {},
|
|
26693
|
+
...readBoolean(params, "includeEntities") !== void 0 ? { includeEntities: readBoolean(params, "includeEntities") } : {}
|
|
26694
|
+
};
|
|
26695
|
+
if (!topicId && !query5) {
|
|
26696
|
+
throw new Error("[compile_context] query is required when topicId is omitted.");
|
|
26697
|
+
}
|
|
26698
|
+
const response = topicId ? await compiler.compile(topicId, input) : await functionSurface.compileContext(input);
|
|
26670
26699
|
writeLocalLucernContext({
|
|
26671
26700
|
topicId: readResultString(response.data, "topicId") ?? topicId,
|
|
26672
26701
|
topicName: readResultString(response.data, "topicName"),
|
|
@@ -28505,7 +28534,7 @@ function createLucernStandaloneMcpServer(options) {
|
|
|
28505
28534
|
});
|
|
28506
28535
|
const server = new McpServer({
|
|
28507
28536
|
name: "lucern-mcp",
|
|
28508
|
-
version: "0.3.0-alpha.
|
|
28537
|
+
version: "0.3.0-alpha.8"
|
|
28509
28538
|
});
|
|
28510
28539
|
registerTools(server, runtime);
|
|
28511
28540
|
const resources = registerResources(server, runtime, observationStore);
|