@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/cli.js CHANGED
@@ -1170,6 +1170,7 @@ defineTable({
1170
1170
  shape: z.object({
1171
1171
  "tenantId": idOf("tenants"),
1172
1172
  "workspaceId": idOf("workspaces").optional(),
1173
+ "environment": z.enum(["dev", "staging", "prod"]).optional(),
1173
1174
  "keyPrefix": z.enum(["luc", "stk"]),
1174
1175
  "keyHash": z.string(),
1175
1176
  "keyHint": z.string(),
@@ -10214,7 +10215,7 @@ function compactRecord2(input) {
10214
10215
  Object.entries(input).filter(([, value]) => value !== void 0)
10215
10216
  );
10216
10217
  }
10217
- var listBeliefsProjection = defineProjection({
10218
+ defineProjection({
10218
10219
  contractName: "list_beliefs",
10219
10220
  inputSchema: listBeliefsInputSchema,
10220
10221
  project: (input) => compactRecord2({
@@ -15530,11 +15531,8 @@ var identityContracts = [
15530
15531
  sdkNamespace: "identity",
15531
15532
  sdkMethod: "whoami",
15532
15533
  summary: "Describe the current gateway principal.",
15533
- convex: {
15534
- module: "identity",
15535
- functionName: "whoami",
15536
- kind: "query",
15537
- inputProjection: withPrincipal
15534
+ gateway: {
15535
+ handler: "identity.whoami"
15538
15536
  }
15539
15537
  }),
15540
15538
  surfaceContract({
@@ -15554,7 +15552,7 @@ var identityContracts = [
15554
15552
  providerProjectId: z.string().min(1).optional()
15555
15553
  }),
15556
15554
  convex: {
15557
- module: "identity",
15555
+ module: "platform",
15558
15556
  functionName: "resolveInteractivePrincipal",
15559
15557
  kind: "query"
15560
15558
  }
@@ -15638,15 +15636,6 @@ var beliefLookupInput = (input) => compactRecord4({
15638
15636
  var beliefNodeInput = (input) => compactRecord4({
15639
15637
  nodeId: input.nodeId ?? input.id ?? input.beliefId
15640
15638
  });
15641
- var beliefTopicInput = (input) => {
15642
- const parsed = listBeliefsProjection.inputSchema.safeParse(input);
15643
- if (!parsed.success) {
15644
- throw new Error(
15645
- `list_beliefs projection input rejected: ${parsed.error.message}`
15646
- );
15647
- }
15648
- return compactRecord4(listBeliefsProjection.project(parsed.data));
15649
- };
15650
15639
  var createBeliefInput = (input, context) => {
15651
15640
  return withUserId(
15652
15641
  compactRecord4({
@@ -15735,11 +15724,8 @@ var beliefsContracts = [
15735
15724
  sdkNamespace: "beliefs",
15736
15725
  sdkMethod: "listBeliefs",
15737
15726
  summary: "List beliefs for a topic.",
15738
- convex: {
15739
- module: "beliefs",
15740
- functionName: "getByTopic",
15741
- kind: "query",
15742
- inputProjection: beliefTopicInput
15727
+ gateway: {
15728
+ handler: "beliefs.list"
15743
15729
  },
15744
15730
  args: listBeliefsInputSchema
15745
15731
  }),
@@ -15924,12 +15910,6 @@ var evidenceIdInput = (input) => compactRecord4({
15924
15910
  insightId: input.insightId,
15925
15911
  nodeId: input.nodeId ?? input.id ?? input.evidenceId
15926
15912
  });
15927
- var evidenceTopicInput = (input) => compactRecord4({
15928
- topicId: input.topicId,
15929
- status: input.status,
15930
- userId: input.userId,
15931
- limit: input.limit
15932
- });
15933
15913
  var createEvidenceInput = (input, context) => {
15934
15914
  const parsed = createEvidenceProjection.inputSchema.safeParse(input);
15935
15915
  if (!parsed.success) {
@@ -16060,11 +16040,8 @@ var evidenceContracts = [
16060
16040
  sdkNamespace: "evidence",
16061
16041
  sdkMethod: "listEvidence",
16062
16042
  summary: "List evidence for a topic.",
16063
- convex: {
16064
- module: "evidence",
16065
- functionName: "getByTopic",
16066
- kind: "query",
16067
- inputProjection: evidenceTopicInput
16043
+ gateway: {
16044
+ handler: "evidence.list"
16068
16045
  }
16069
16046
  }),
16070
16047
  surfaceContract({
@@ -16299,11 +16276,8 @@ var questionsContracts = [
16299
16276
  sdkNamespace: "questions",
16300
16277
  sdkMethod: "listQuestions",
16301
16278
  summary: "List questions for a topic.",
16302
- convex: {
16303
- module: "questions",
16304
- functionName: "getByTopic",
16305
- kind: "query",
16306
- inputProjection: questionTopicInput
16279
+ gateway: {
16280
+ handler: "questions.list"
16307
16281
  }
16308
16282
  }),
16309
16283
  surfaceContract({
@@ -21140,13 +21114,31 @@ function mergeHeaderRecord(base, addition) {
21140
21114
  }
21141
21115
  return Object.fromEntries(headers.entries());
21142
21116
  }
21117
+ function cleanHeaderValue(value) {
21118
+ const normalized = value?.trim();
21119
+ return normalized ? normalized : void 0;
21120
+ }
21143
21121
  function createGatewayRequestClient(config = {}) {
21144
21122
  const fetchImpl = config.fetchImpl ?? fetch;
21145
21123
  const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
21146
21124
  const maxRetries = config.maxRetries ?? 2;
21147
21125
  const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
21148
21126
  async function resolveAuthHeaders2() {
21149
- const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
21127
+ const provided = config.getAuthHeaders ? await config.getAuthHeaders() : {};
21128
+ const headers = new Headers(provided);
21129
+ const setIfAbsent = (name, value) => {
21130
+ const normalized = cleanHeaderValue(value);
21131
+ if (normalized && !headers.has(name)) {
21132
+ headers.set(name, normalized);
21133
+ }
21134
+ };
21135
+ setIfAbsent("x-lucern-key", config.apiKey);
21136
+ setIfAbsent("x-lucern-session-token", config.userToken);
21137
+ setIfAbsent("x-lucern-environment", config.environment);
21138
+ setIfAbsent("x-lucern-clerk-id", config.clerkId);
21139
+ setIfAbsent("x-lucern-user-id", config.userId ?? config.clerkId);
21140
+ setIfAbsent("x-lucern-deployment-host", config.deploymentHost);
21141
+ const base = Object.fromEntries(headers.entries());
21150
21142
  const authContextInput = await resolveConfiguredAuthContext(
21151
21143
  config.authContext
21152
21144
  );
@@ -28042,7 +28034,7 @@ function createToolRegistryClient(config = {}) {
28042
28034
  }
28043
28035
 
28044
28036
  // ../sdk/src/version.ts
28045
- var LUCERN_SDK_VERSION = "0.3.0-alpha.15";
28037
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.16";
28046
28038
 
28047
28039
  // ../sdk/src/workflowClient.ts
28048
28040
  function normalizeLensQuery(value) {
@@ -28450,6 +28442,12 @@ function toGatewayConfig(config) {
28450
28442
  return {
28451
28443
  baseUrl: config.baseUrl,
28452
28444
  fetchImpl: config.fetchImpl,
28445
+ apiKey: config.apiKey,
28446
+ userToken: config.userToken,
28447
+ environment: config.environment,
28448
+ clerkId: config.clerkId,
28449
+ userId: config.userId,
28450
+ deploymentHost: config.deploymentHost,
28453
28451
  maxRetries: config.maxRetries,
28454
28452
  timeoutMs: config.timeoutMs,
28455
28453
  timeoutMsByMethod: config.timeoutMsByMethod,
@@ -28458,19 +28456,7 @@ function toGatewayConfig(config) {
28458
28456
  onResponse: config.onResponse,
28459
28457
  authContext: config.authContext,
28460
28458
  requireCanonicalAuthContext: config.requireCanonicalAuthContext,
28461
- getAuthHeaders: async () => {
28462
- const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
28463
- if (config.apiKey && !base["x-lucern-key"] && !base.Authorization) {
28464
- base["x-lucern-key"] = config.apiKey;
28465
- }
28466
- if (config.userToken && !base["x-lucern-session-token"]) {
28467
- base["x-lucern-session-token"] = config.userToken;
28468
- }
28469
- if (config.environment && !base["x-lucern-environment"]) {
28470
- base["x-lucern-environment"] = config.environment;
28471
- }
28472
- return base;
28473
- }
28459
+ getAuthHeaders: config.getAuthHeaders
28474
28460
  };
28475
28461
  }
28476
28462
  function exposeGatewayData(response) {
@@ -34969,7 +34955,7 @@ function createLucernStandaloneMcpServer(options) {
34969
34955
  });
34970
34956
  const server = new McpServer({
34971
34957
  name: "lucern-mcp",
34972
- version: "0.3.0-alpha.15"
34958
+ version: "0.3.0-alpha.16"
34973
34959
  });
34974
34960
  registerTools(server, runtime);
34975
34961
  const resources = registerResources(server, runtime, observationStore);