@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.
package/dist/index.js CHANGED
@@ -1342,6 +1342,7 @@ defineTable({
1342
1342
  shape: z.object({
1343
1343
  "tenantId": idOf("tenants"),
1344
1344
  "workspaceId": idOf("workspaces").optional(),
1345
+ "environment": z.enum(["dev", "staging", "prod"]).optional(),
1345
1346
  "keyPrefix": z.enum(["luc", "stk"]),
1346
1347
  "keyHash": z.string(),
1347
1348
  "keyHint": z.string(),
@@ -10386,7 +10387,7 @@ function compactRecord2(input) {
10386
10387
  Object.entries(input).filter(([, value]) => value !== void 0)
10387
10388
  );
10388
10389
  }
10389
- var listBeliefsProjection = defineProjection({
10390
+ defineProjection({
10390
10391
  contractName: "list_beliefs",
10391
10392
  inputSchema: listBeliefsInputSchema,
10392
10393
  project: (input) => compactRecord2({
@@ -15702,11 +15703,8 @@ var identityContracts = [
15702
15703
  sdkNamespace: "identity",
15703
15704
  sdkMethod: "whoami",
15704
15705
  summary: "Describe the current gateway principal.",
15705
- convex: {
15706
- module: "identity",
15707
- functionName: "whoami",
15708
- kind: "query",
15709
- inputProjection: withPrincipal
15706
+ gateway: {
15707
+ handler: "identity.whoami"
15710
15708
  }
15711
15709
  }),
15712
15710
  surfaceContract({
@@ -15726,7 +15724,7 @@ var identityContracts = [
15726
15724
  providerProjectId: z.string().min(1).optional()
15727
15725
  }),
15728
15726
  convex: {
15729
- module: "identity",
15727
+ module: "platform",
15730
15728
  functionName: "resolveInteractivePrincipal",
15731
15729
  kind: "query"
15732
15730
  }
@@ -15810,15 +15808,6 @@ var beliefLookupInput = (input) => compactRecord4({
15810
15808
  var beliefNodeInput = (input) => compactRecord4({
15811
15809
  nodeId: input.nodeId ?? input.id ?? input.beliefId
15812
15810
  });
15813
- var beliefTopicInput = (input) => {
15814
- const parsed = listBeliefsProjection.inputSchema.safeParse(input);
15815
- if (!parsed.success) {
15816
- throw new Error(
15817
- `list_beliefs projection input rejected: ${parsed.error.message}`
15818
- );
15819
- }
15820
- return compactRecord4(listBeliefsProjection.project(parsed.data));
15821
- };
15822
15811
  var createBeliefInput = (input, context) => {
15823
15812
  return withUserId(
15824
15813
  compactRecord4({
@@ -15907,11 +15896,8 @@ var beliefsContracts = [
15907
15896
  sdkNamespace: "beliefs",
15908
15897
  sdkMethod: "listBeliefs",
15909
15898
  summary: "List beliefs for a topic.",
15910
- convex: {
15911
- module: "beliefs",
15912
- functionName: "getByTopic",
15913
- kind: "query",
15914
- inputProjection: beliefTopicInput
15899
+ gateway: {
15900
+ handler: "beliefs.list"
15915
15901
  },
15916
15902
  args: listBeliefsInputSchema
15917
15903
  }),
@@ -16096,12 +16082,6 @@ var evidenceIdInput = (input) => compactRecord4({
16096
16082
  insightId: input.insightId,
16097
16083
  nodeId: input.nodeId ?? input.id ?? input.evidenceId
16098
16084
  });
16099
- var evidenceTopicInput = (input) => compactRecord4({
16100
- topicId: input.topicId,
16101
- status: input.status,
16102
- userId: input.userId,
16103
- limit: input.limit
16104
- });
16105
16085
  var createEvidenceInput = (input, context) => {
16106
16086
  const parsed = createEvidenceProjection.inputSchema.safeParse(input);
16107
16087
  if (!parsed.success) {
@@ -16232,11 +16212,8 @@ var evidenceContracts = [
16232
16212
  sdkNamespace: "evidence",
16233
16213
  sdkMethod: "listEvidence",
16234
16214
  summary: "List evidence for a topic.",
16235
- convex: {
16236
- module: "evidence",
16237
- functionName: "getByTopic",
16238
- kind: "query",
16239
- inputProjection: evidenceTopicInput
16215
+ gateway: {
16216
+ handler: "evidence.list"
16240
16217
  }
16241
16218
  }),
16242
16219
  surfaceContract({
@@ -16471,11 +16448,8 @@ var questionsContracts = [
16471
16448
  sdkNamespace: "questions",
16472
16449
  sdkMethod: "listQuestions",
16473
16450
  summary: "List questions for a topic.",
16474
- convex: {
16475
- module: "questions",
16476
- functionName: "getByTopic",
16477
- kind: "query",
16478
- inputProjection: questionTopicInput
16451
+ gateway: {
16452
+ handler: "questions.list"
16479
16453
  }
16480
16454
  }),
16481
16455
  surfaceContract({
@@ -21265,13 +21239,31 @@ function mergeHeaderRecord(base, addition) {
21265
21239
  }
21266
21240
  return Object.fromEntries(headers.entries());
21267
21241
  }
21242
+ function cleanHeaderValue(value) {
21243
+ const normalized = value?.trim();
21244
+ return normalized ? normalized : void 0;
21245
+ }
21268
21246
  function createGatewayRequestClient(config = {}) {
21269
21247
  const fetchImpl = config.fetchImpl ?? fetch;
21270
21248
  const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
21271
21249
  const maxRetries = config.maxRetries ?? 2;
21272
21250
  const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
21273
21251
  async function resolveAuthHeaders2() {
21274
- const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
21252
+ const provided = config.getAuthHeaders ? await config.getAuthHeaders() : {};
21253
+ const headers = new Headers(provided);
21254
+ const setIfAbsent = (name, value) => {
21255
+ const normalized = cleanHeaderValue(value);
21256
+ if (normalized && !headers.has(name)) {
21257
+ headers.set(name, normalized);
21258
+ }
21259
+ };
21260
+ setIfAbsent("x-lucern-key", config.apiKey);
21261
+ setIfAbsent("x-lucern-session-token", config.userToken);
21262
+ setIfAbsent("x-lucern-environment", config.environment);
21263
+ setIfAbsent("x-lucern-clerk-id", config.clerkId);
21264
+ setIfAbsent("x-lucern-user-id", config.userId ?? config.clerkId);
21265
+ setIfAbsent("x-lucern-deployment-host", config.deploymentHost);
21266
+ const base = Object.fromEntries(headers.entries());
21275
21267
  const authContextInput = await resolveConfiguredAuthContext(
21276
21268
  config.authContext
21277
21269
  );
@@ -28167,7 +28159,7 @@ function createToolRegistryClient(config = {}) {
28167
28159
  }
28168
28160
 
28169
28161
  // ../sdk/src/version.ts
28170
- var LUCERN_SDK_VERSION = "0.3.0-alpha.15";
28162
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.16";
28171
28163
 
28172
28164
  // ../sdk/src/workflowClient.ts
28173
28165
  function normalizeLensQuery(value) {
@@ -28575,6 +28567,12 @@ function toGatewayConfig(config) {
28575
28567
  return {
28576
28568
  baseUrl: config.baseUrl,
28577
28569
  fetchImpl: config.fetchImpl,
28570
+ apiKey: config.apiKey,
28571
+ userToken: config.userToken,
28572
+ environment: config.environment,
28573
+ clerkId: config.clerkId,
28574
+ userId: config.userId,
28575
+ deploymentHost: config.deploymentHost,
28578
28576
  maxRetries: config.maxRetries,
28579
28577
  timeoutMs: config.timeoutMs,
28580
28578
  timeoutMsByMethod: config.timeoutMsByMethod,
@@ -28583,19 +28581,7 @@ function toGatewayConfig(config) {
28583
28581
  onResponse: config.onResponse,
28584
28582
  authContext: config.authContext,
28585
28583
  requireCanonicalAuthContext: config.requireCanonicalAuthContext,
28586
- getAuthHeaders: async () => {
28587
- const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
28588
- if (config.apiKey && !base["x-lucern-key"] && !base.Authorization) {
28589
- base["x-lucern-key"] = config.apiKey;
28590
- }
28591
- if (config.userToken && !base["x-lucern-session-token"]) {
28592
- base["x-lucern-session-token"] = config.userToken;
28593
- }
28594
- if (config.environment && !base["x-lucern-environment"]) {
28595
- base["x-lucern-environment"] = config.environment;
28596
- }
28597
- return base;
28598
- }
28584
+ getAuthHeaders: config.getAuthHeaders
28599
28585
  };
28600
28586
  }
28601
28587
  function exposeGatewayData(response) {
@@ -34994,7 +34980,7 @@ function createLucernStandaloneMcpServer(options) {
34994
34980
  });
34995
34981
  const server = new McpServer({
34996
34982
  name: "lucern-mcp",
34997
- version: "0.3.0-alpha.15"
34983
+ version: "0.3.0-alpha.16"
34998
34984
  });
34999
34985
  registerTools(server, runtime);
35000
34986
  const resources = registerResources(server, runtime, observationStore);