@lucern/mcp 0.3.0-alpha.15 → 0.3.0-alpha.16

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.
@@ -890,13 +890,31 @@ function mergeHeaderRecord(base, addition) {
890
890
  }
891
891
  return Object.fromEntries(headers.entries());
892
892
  }
893
+ function cleanHeaderValue(value) {
894
+ const normalized = value?.trim();
895
+ return normalized ? normalized : void 0;
896
+ }
893
897
  function createGatewayRequestClient(config = {}) {
894
898
  const fetchImpl = config.fetchImpl ?? fetch;
895
899
  const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
896
900
  const maxRetries = config.maxRetries ?? 2;
897
901
  const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
898
902
  async function resolveAuthHeaders() {
899
- const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
903
+ const provided = config.getAuthHeaders ? await config.getAuthHeaders() : {};
904
+ const headers = new Headers(provided);
905
+ const setIfAbsent = (name, value) => {
906
+ const normalized = cleanHeaderValue(value);
907
+ if (normalized && !headers.has(name)) {
908
+ headers.set(name, normalized);
909
+ }
910
+ };
911
+ setIfAbsent("x-lucern-key", config.apiKey);
912
+ setIfAbsent("x-lucern-session-token", config.userToken);
913
+ setIfAbsent("x-lucern-environment", config.environment);
914
+ setIfAbsent("x-lucern-clerk-id", config.clerkId);
915
+ setIfAbsent("x-lucern-user-id", config.userId ?? config.clerkId);
916
+ setIfAbsent("x-lucern-deployment-host", config.deploymentHost);
917
+ const base = Object.fromEntries(headers.entries());
900
918
  const authContextInput = await resolveConfiguredAuthContext(
901
919
  config.authContext
902
920
  );
@@ -7792,7 +7810,7 @@ function createToolRegistryClient(config = {}) {
7792
7810
  }
7793
7811
 
7794
7812
  // ../sdk/src/version.ts
7795
- var LUCERN_SDK_VERSION = "0.3.0-alpha.15";
7813
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.16";
7796
7814
 
7797
7815
  // ../sdk/src/workflowClient.ts
7798
7816
  function normalizeLensQuery(value) {
@@ -8200,6 +8218,12 @@ function toGatewayConfig(config) {
8200
8218
  return {
8201
8219
  baseUrl: config.baseUrl,
8202
8220
  fetchImpl: config.fetchImpl,
8221
+ apiKey: config.apiKey,
8222
+ userToken: config.userToken,
8223
+ environment: config.environment,
8224
+ clerkId: config.clerkId,
8225
+ userId: config.userId,
8226
+ deploymentHost: config.deploymentHost,
8203
8227
  maxRetries: config.maxRetries,
8204
8228
  timeoutMs: config.timeoutMs,
8205
8229
  timeoutMsByMethod: config.timeoutMsByMethod,
@@ -8208,19 +8232,7 @@ function toGatewayConfig(config) {
8208
8232
  onResponse: config.onResponse,
8209
8233
  authContext: config.authContext,
8210
8234
  requireCanonicalAuthContext: config.requireCanonicalAuthContext,
8211
- getAuthHeaders: async () => {
8212
- const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
8213
- if (config.apiKey && !base["x-lucern-key"] && !base.Authorization) {
8214
- base["x-lucern-key"] = config.apiKey;
8215
- }
8216
- if (config.userToken && !base["x-lucern-session-token"]) {
8217
- base["x-lucern-session-token"] = config.userToken;
8218
- }
8219
- if (config.environment && !base["x-lucern-environment"]) {
8220
- base["x-lucern-environment"] = config.environment;
8221
- }
8222
- return base;
8223
- }
8235
+ getAuthHeaders: config.getAuthHeaders
8224
8236
  };
8225
8237
  }
8226
8238
  function exposeGatewayData(response) {
@@ -17893,6 +17905,7 @@ defineTable({
17893
17905
  shape: z.object({
17894
17906
  "tenantId": idOf("tenants"),
17895
17907
  "workspaceId": idOf("workspaces").optional(),
17908
+ "environment": z.enum(["dev", "staging", "prod"]).optional(),
17896
17909
  "keyPrefix": z.enum(["luc", "stk"]),
17897
17910
  "keyHash": z.string(),
17898
17911
  "keyHint": z.string(),
@@ -26937,7 +26950,7 @@ function compactRecord2(input) {
26937
26950
  Object.entries(input).filter(([, value]) => value !== void 0)
26938
26951
  );
26939
26952
  }
26940
- var listBeliefsProjection = defineProjection({
26953
+ defineProjection({
26941
26954
  contractName: "list_beliefs",
26942
26955
  inputSchema: listBeliefsInputSchema,
26943
26956
  project: (input) => compactRecord2({
@@ -27566,11 +27579,8 @@ var identityContracts = [
27566
27579
  sdkNamespace: "identity",
27567
27580
  sdkMethod: "whoami",
27568
27581
  summary: "Describe the current gateway principal.",
27569
- convex: {
27570
- module: "identity",
27571
- functionName: "whoami",
27572
- kind: "query",
27573
- inputProjection: withPrincipal
27582
+ gateway: {
27583
+ handler: "identity.whoami"
27574
27584
  }
27575
27585
  }),
27576
27586
  surfaceContract({
@@ -27590,7 +27600,7 @@ var identityContracts = [
27590
27600
  providerProjectId: z.string().min(1).optional()
27591
27601
  }),
27592
27602
  convex: {
27593
- module: "identity",
27603
+ module: "platform",
27594
27604
  functionName: "resolveInteractivePrincipal",
27595
27605
  kind: "query"
27596
27606
  }
@@ -27674,15 +27684,6 @@ var beliefLookupInput = (input) => compactRecord4({
27674
27684
  var beliefNodeInput = (input) => compactRecord4({
27675
27685
  nodeId: input.nodeId ?? input.id ?? input.beliefId
27676
27686
  });
27677
- var beliefTopicInput = (input) => {
27678
- const parsed = listBeliefsProjection.inputSchema.safeParse(input);
27679
- if (!parsed.success) {
27680
- throw new Error(
27681
- `list_beliefs projection input rejected: ${parsed.error.message}`
27682
- );
27683
- }
27684
- return compactRecord4(listBeliefsProjection.project(parsed.data));
27685
- };
27686
27687
  var createBeliefInput = (input, context) => {
27687
27688
  return withUserId(
27688
27689
  compactRecord4({
@@ -27771,11 +27772,8 @@ var beliefsContracts = [
27771
27772
  sdkNamespace: "beliefs",
27772
27773
  sdkMethod: "listBeliefs",
27773
27774
  summary: "List beliefs for a topic.",
27774
- convex: {
27775
- module: "beliefs",
27776
- functionName: "getByTopic",
27777
- kind: "query",
27778
- inputProjection: beliefTopicInput
27775
+ gateway: {
27776
+ handler: "beliefs.list"
27779
27777
  },
27780
27778
  args: listBeliefsInputSchema
27781
27779
  }),
@@ -27960,12 +27958,6 @@ var evidenceIdInput = (input) => compactRecord4({
27960
27958
  insightId: input.insightId,
27961
27959
  nodeId: input.nodeId ?? input.id ?? input.evidenceId
27962
27960
  });
27963
- var evidenceTopicInput = (input) => compactRecord4({
27964
- topicId: input.topicId,
27965
- status: input.status,
27966
- userId: input.userId,
27967
- limit: input.limit
27968
- });
27969
27961
  var createEvidenceInput = (input, context) => {
27970
27962
  const parsed = createEvidenceProjection.inputSchema.safeParse(input);
27971
27963
  if (!parsed.success) {
@@ -28096,11 +28088,8 @@ var evidenceContracts = [
28096
28088
  sdkNamespace: "evidence",
28097
28089
  sdkMethod: "listEvidence",
28098
28090
  summary: "List evidence for a topic.",
28099
- convex: {
28100
- module: "evidence",
28101
- functionName: "getByTopic",
28102
- kind: "query",
28103
- inputProjection: evidenceTopicInput
28091
+ gateway: {
28092
+ handler: "evidence.list"
28104
28093
  }
28105
28094
  }),
28106
28095
  surfaceContract({
@@ -28335,11 +28324,8 @@ var questionsContracts = [
28335
28324
  sdkNamespace: "questions",
28336
28325
  sdkMethod: "listQuestions",
28337
28326
  summary: "List questions for a topic.",
28338
- convex: {
28339
- module: "questions",
28340
- functionName: "getByTopic",
28341
- kind: "query",
28342
- inputProjection: questionTopicInput
28327
+ gateway: {
28328
+ handler: "questions.list"
28343
28329
  }
28344
28330
  }),
28345
28331
  surfaceContract({
@@ -34658,7 +34644,7 @@ function createLucernStandaloneMcpServer(options) {
34658
34644
  });
34659
34645
  const server = new McpServer({
34660
34646
  name: "lucern-mcp",
34661
- version: "0.3.0-alpha.15"
34647
+ version: "0.3.0-alpha.16"
34662
34648
  });
34663
34649
  registerTools(server, runtime);
34664
34650
  const resources = registerResources(server, runtime, observationStore);