@lucern/sdk 0.2.0-alpha.9 → 0.3.0-alpha.1

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.
Files changed (108) hide show
  1. package/README.md +33 -15
  2. package/dist/adminClient.d.ts +15 -9
  3. package/dist/adminClient.js.map +1 -1
  4. package/dist/audience/index.d.ts +38 -0
  5. package/dist/audience/index.js +110 -0
  6. package/dist/audience/index.js.map +1 -0
  7. package/dist/beliefs/index.d.ts +463 -0
  8. package/dist/beliefs/index.js +6695 -0
  9. package/dist/beliefs/index.js.map +1 -0
  10. package/dist/beliefs/lifecycle.d.ts +24 -0
  11. package/dist/beliefs/lifecycle.js +98 -0
  12. package/dist/beliefs/lifecycle.js.map +1 -0
  13. package/dist/beliefsClient.d.ts +76 -12
  14. package/dist/beliefsClient.js +139 -7
  15. package/dist/beliefsClient.js.map +1 -1
  16. package/dist/client-B6aWUUwp.d.ts +2552 -0
  17. package/dist/client.d.ts +31 -2377
  18. package/dist/client.js +802 -263
  19. package/dist/client.js.map +1 -1
  20. package/dist/contracts/api-enums.contract.d.ts +1 -1
  21. package/dist/contracts/api-enums.contract.js +8 -2
  22. package/dist/contracts/api-enums.contract.js.map +1 -1
  23. package/dist/contracts/index.d.ts +4 -2
  24. package/dist/contracts/index.js +119 -4283
  25. package/dist/contracts/index.js.map +1 -1
  26. package/dist/contracts/mcpTools.d.ts +2 -1
  27. package/dist/contracts/mcpTools.js +22 -2981
  28. package/dist/contracts/mcpTools.js.map +1 -1
  29. package/dist/contracts/sdk-tools.contract.d.ts +1 -2
  30. package/dist/contracts/sdk-tools.contract.js +1 -4132
  31. package/dist/contracts/sdk-tools.contract.js.map +1 -1
  32. package/dist/contracts/sdkTools.d.ts +1 -2
  33. package/dist/contracts/sdkTools.js +20 -4127
  34. package/dist/contracts/sdkTools.js.map +1 -1
  35. package/dist/contracts/tool-contracts.d.ts +1 -0
  36. package/dist/contracts/tool-contracts.js +3 -0
  37. package/dist/contracts/tool-contracts.js.map +1 -0
  38. package/dist/contracts/workflow-runtime.contract.js +1 -1
  39. package/dist/contracts/workflow-runtime.contract.js.map +1 -1
  40. package/dist/contracts/workflowRuntime.js +1 -1
  41. package/dist/contracts/workflowRuntime.js.map +1 -1
  42. package/dist/contradictions/index.d.ts +156 -0
  43. package/dist/contradictions/index.js +6689 -0
  44. package/dist/contradictions/index.js.map +1 -0
  45. package/dist/customTools.d.ts +1 -1
  46. package/dist/decisions/index.d.ts +66 -0
  47. package/dist/decisions/index.js +6691 -0
  48. package/dist/decisions/index.js.map +1 -0
  49. package/dist/edges/index.d.ts +202 -0
  50. package/dist/edges/index.js +6690 -0
  51. package/dist/edges/index.js.map +1 -0
  52. package/dist/events.js +7 -5
  53. package/dist/events.js.map +1 -1
  54. package/dist/evidence/index.d.ts +294 -0
  55. package/dist/evidence/index.js +6690 -0
  56. package/dist/evidence/index.js.map +1 -0
  57. package/dist/evidenceClient.d.ts +119 -0
  58. package/dist/evidenceClient.js +350 -0
  59. package/dist/evidenceClient.js.map +1 -0
  60. package/dist/gatewayFacades.d.ts +25 -15
  61. package/dist/gatewayFacades.js +39 -5
  62. package/dist/gatewayFacades.js.map +1 -1
  63. package/dist/identityClient.d.ts +3 -3
  64. package/dist/identityClient.js.map +1 -1
  65. package/dist/index.d.ts +7 -6
  66. package/dist/index.js +1145 -3313
  67. package/dist/index.js.map +1 -1
  68. package/dist/lenses/index.d.ts +194 -0
  69. package/dist/lenses/index.js +6689 -0
  70. package/dist/lenses/index.js.map +1 -0
  71. package/dist/nodes/index.d.ts +61 -0
  72. package/dist/nodes/index.js +6691 -0
  73. package/dist/nodes/index.js.map +1 -0
  74. package/dist/ontologies/index.d.ts +179 -0
  75. package/dist/ontologies/index.js +6692 -0
  76. package/dist/ontologies/index.js.map +1 -0
  77. package/dist/opinion.d.ts +11 -0
  78. package/dist/opinion.js +35 -0
  79. package/dist/opinion.js.map +1 -0
  80. package/dist/questions/index.d.ts +295 -0
  81. package/dist/questions/index.js +6692 -0
  82. package/dist/questions/index.js.map +1 -0
  83. package/dist/sdk-tools.contract-B4c1Zr1o.d.ts +22 -0
  84. package/dist/sourcesClient.d.ts +24 -0
  85. package/dist/{mcpParityClient.js → sourcesClient.js} +15 -192
  86. package/dist/sourcesClient.js.map +1 -0
  87. package/dist/tool-contracts-BUiL9P6z.d.ts +22 -0
  88. package/dist/topics/index.d.ts +66 -0
  89. package/dist/topics/index.js +6690 -0
  90. package/dist/topics/index.js.map +1 -0
  91. package/dist/types.d.ts +27 -8
  92. package/dist/workflowClient.d.ts +18 -5
  93. package/dist/workflowClient.js +19 -7
  94. package/dist/workflowClient.js.map +1 -1
  95. package/dist/worktrees/index.d.ts +211 -0
  96. package/dist/worktrees/index.js +6692 -0
  97. package/dist/worktrees/index.js.map +1 -0
  98. package/package.json +56 -3
  99. package/dist/contracts/mcp-tools.contract.d.ts +0 -1
  100. package/dist/contracts/mcp-tools.contract.js +0 -2986
  101. package/dist/contracts/mcp-tools.contract.js.map +0 -1
  102. package/dist/mcpParityClient.d.ts +0 -74
  103. package/dist/mcpParityClient.js.map +0 -1
  104. package/dist/mcpParitySurface.d.ts +0 -12
  105. package/dist/mcpParitySurface.js +0 -65
  106. package/dist/mcpParitySurface.js.map +0 -1
  107. package/dist/mcpTools-DPZxowDX.d.ts +0 -254
  108. package/dist/sdkTools-CwXJDACb.d.ts +0 -150
package/dist/client.js CHANGED
@@ -998,31 +998,163 @@ function createAuditClient(config = {}) {
998
998
  }
999
999
 
1000
1000
  // src/beliefsClient.ts
1001
+ function asRecord2(value) {
1002
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1003
+ }
1004
+ function readString(value) {
1005
+ if (typeof value !== "string") {
1006
+ return void 0;
1007
+ }
1008
+ const normalized = value.trim();
1009
+ return normalized.length > 0 ? normalized : void 0;
1010
+ }
1011
+ function readNumber(value) {
1012
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
1013
+ }
1014
+ function clamp01(value) {
1015
+ return Math.max(0, Math.min(1, value));
1016
+ }
1017
+ function normalizeOpinionTuple(record) {
1018
+ const opinion = asRecord2(record.opinion);
1019
+ const rawBelief = readNumber(opinion.b) ?? readNumber(record.belief);
1020
+ const rawDisbelief = readNumber(opinion.d) ?? readNumber(record.disbelief);
1021
+ const rawUncertainty = readNumber(opinion.u) ?? readNumber(record.uncertainty);
1022
+ const rawBaseRate = readNumber(opinion.a) ?? readNumber(record.baseRate);
1023
+ if (rawBelief === void 0 || rawDisbelief === void 0 || rawUncertainty === void 0 || rawBaseRate === void 0) {
1024
+ throw new Error(
1025
+ "Gateway opinion history entries must include belief, disbelief, uncertainty, and baseRate."
1026
+ );
1027
+ }
1028
+ return {
1029
+ b: clamp01(rawBelief),
1030
+ d: clamp01(rawDisbelief),
1031
+ u: clamp01(rawUncertainty),
1032
+ a: clamp01(rawBaseRate)
1033
+ };
1034
+ }
1035
+ function mapOpinionHistoryEntriesFromGatewayData(payload) {
1036
+ const entries = Array.isArray(payload.entries) ? payload.entries : [];
1037
+ return entries.map((value) => {
1038
+ const record = asRecord2(value);
1039
+ const tuple = normalizeOpinionTuple(record);
1040
+ const projected = readNumber(record.confidence) ?? clamp01(tuple.b + tuple.a * tuple.u);
1041
+ const triggeringEvidenceId = readString(record.triggeringEvidenceId);
1042
+ const triggeringQuestionId = readString(record.triggeringQuestionId);
1043
+ const triggeringAnswerId = readString(record.triggeringAnswerId);
1044
+ const triggeringContradictionId = readString(
1045
+ record.triggeringContradictionId
1046
+ );
1047
+ const triggeringWorktreeId = readString(record.triggeringWorktreeId);
1048
+ const triggeringRef = triggeringEvidenceId ? { kind: "evidence", id: triggeringEvidenceId } : triggeringQuestionId ? { kind: "question", id: triggeringQuestionId } : triggeringAnswerId ? { kind: "answer", id: triggeringAnswerId } : triggeringContradictionId ? { kind: "contradiction", id: triggeringContradictionId } : triggeringWorktreeId ? { kind: "worktree", id: triggeringWorktreeId } : void 0;
1049
+ const trigger = readString(record.trigger);
1050
+ if (!trigger) {
1051
+ throw new Error("Gateway opinion history entries must include trigger.");
1052
+ }
1053
+ return {
1054
+ t: readNumber(record.timestamp) ?? readNumber(record.assessedAt) ?? 0,
1055
+ b: tuple.b,
1056
+ d: tuple.d,
1057
+ u: tuple.u,
1058
+ a: tuple.a,
1059
+ P: clamp01(projected),
1060
+ trigger,
1061
+ ...triggeringRef ? { triggeringRef } : {},
1062
+ ...readString(record.rationale) ? { rationale: readString(record.rationale) } : {},
1063
+ ...readString(record.userId) ? { userId: readString(record.userId) } : {},
1064
+ ...readString(record.slOperator) ? { slOperator: readString(record.slOperator) } : {}
1065
+ };
1066
+ }).sort((left, right) => left.t - right.t);
1067
+ }
1068
+ function normalizeModulateConfidenceInput(input) {
1069
+ const opinion = input.opinion;
1070
+ return {
1071
+ belief: opinion.b,
1072
+ disbelief: opinion.d,
1073
+ uncertainty: opinion.u,
1074
+ baseRate: opinion.a,
1075
+ trigger: input.trigger,
1076
+ rationale: input.rationale,
1077
+ triggeringEvidenceId: input.triggeringEvidenceId,
1078
+ triggeringQuestionId: input.triggeringQuestionId,
1079
+ triggeringAnswerId: input.triggeringAnswerId,
1080
+ triggeringContradictionId: input.triggeringContradictionId,
1081
+ triggeringWorktreeId: input.triggeringWorktreeId,
1082
+ maxInlinePropagationTargets: input.maxInlinePropagationTargets
1083
+ };
1084
+ }
1001
1085
  function createBeliefsClient(config = {}) {
1002
1086
  const gateway = createGatewayRequestClient(config);
1087
+ function normalizeBaseRate(value) {
1088
+ const baseRate = readNumber(value);
1089
+ const normalized = baseRate ?? 0.5;
1090
+ if (normalized < 0 || normalized > 1) {
1091
+ throw new Error("baseRate must be within [0, 1].");
1092
+ }
1093
+ return normalized;
1094
+ }
1095
+ const modulateConfidence = async (beliefId, input, idempotencyKey) => gateway.request({
1096
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence`,
1097
+ method: "POST",
1098
+ body: normalizeModulateConfidenceInput(input),
1099
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1100
+ });
1101
+ async function getOpinionHistory(beliefId) {
1102
+ const response = await gateway.request({
1103
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
1104
+ });
1105
+ return mapOpinionHistoryEntriesFromGatewayData(response.data);
1106
+ }
1003
1107
  return {
1004
1108
  /**
1005
1109
  * Create a belief within a topic scope.
1006
1110
  */
1007
1111
  async createBelief(input, idempotencyKey) {
1112
+ const baseRate = normalizeBaseRate(input.baseRate);
1008
1113
  return gateway.request({
1009
1114
  path: "/api/platform/v1/beliefs",
1010
1115
  method: "POST",
1011
- body: normalizeNodeWriteInput(input),
1116
+ body: {
1117
+ ...normalizeNodeWriteInput(input),
1118
+ baseRate
1119
+ },
1012
1120
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1013
1121
  });
1014
1122
  },
1015
1123
  /**
1016
- * Record a confidence change for an existing belief.
1124
+ * Refine a draft belief in place.
1017
1125
  */
1018
- async modulateConfidence(beliefId, input, idempotencyKey) {
1126
+ async refineBelief(beliefId, input, idempotencyKey) {
1019
1127
  return gateway.request({
1020
- path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence`,
1021
- method: "POST",
1022
- body: input,
1128
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}`,
1129
+ method: "PATCH",
1130
+ body: normalizeNodeWriteInput(input),
1023
1131
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1024
1132
  });
1025
1133
  },
1134
+ /**
1135
+ * Record a confidence change for an existing belief.
1136
+ */
1137
+ modulateConfidence,
1138
+ /**
1139
+ * Returns the belief's confidence trajectory as a chronological array.
1140
+ *
1141
+ * Canonical UI trend shape (what every trend component consumes):
1142
+ * { t: number, b: number, d: number, u: number, a: number, P: number, trigger: string, triggeringRef?: { kind: "evidence" | "worktree"; id: string } }[]
1143
+ *
1144
+ * Where:
1145
+ * t = assessedAt (epoch ms)
1146
+ * b, d, u, a = Opinion 4-tuple components
1147
+ * P = projected probability = b + a*u (precomputed for UI convenience)
1148
+ * trigger = cause of the score change
1149
+ * triggeringRef = optional pointer to the evidence or worktree that drove the change
1150
+ */
1151
+ async getOpinionHistory(beliefId) {
1152
+ return getOpinionHistory(beliefId);
1153
+ },
1154
+ /** @deprecated Use getOpinionHistory(). */
1155
+ async getConfidenceHistory(beliefId) {
1156
+ return getOpinionHistory(beliefId);
1157
+ },
1026
1158
  /**
1027
1159
  * Fork a scored belief into a new formulation.
1028
1160
  */
@@ -1113,6 +1245,57 @@ function createBeliefsClient(config = {}) {
1113
1245
  }
1114
1246
  };
1115
1247
  }
1248
+
1249
+ // src/sourcesClient.ts
1250
+ function createSourcesClient(config = {}) {
1251
+ const gateway = createGatewayRequestClient(config);
1252
+ return {
1253
+ async upsert(spec, idempotencyKey = randomIdempotencyKey()) {
1254
+ return gateway.request({
1255
+ path: "/api/platform/v1/sources/upsert",
1256
+ method: "POST",
1257
+ body: spec,
1258
+ idempotencyKey
1259
+ });
1260
+ },
1261
+ async get(sourceId) {
1262
+ return gateway.request({
1263
+ path: `/api/platform/v1/sources/${encodeURIComponent(sourceId)}`
1264
+ });
1265
+ }
1266
+ };
1267
+ }
1268
+
1269
+ // src/evidenceClient.ts
1270
+ function createEvidenceClient(config = {}) {
1271
+ const gateway = createGatewayRequestClient(config);
1272
+ return {
1273
+ async classifyEvidence(beliefId, evidenceId, classificationConfig, idempotencyKey) {
1274
+ return gateway.request({
1275
+ path: "/api/platform/v1/evidence/classify",
1276
+ method: "POST",
1277
+ body: {
1278
+ beliefId,
1279
+ evidenceId,
1280
+ config: classificationConfig
1281
+ },
1282
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1283
+ });
1284
+ },
1285
+ async classifyEvidenceBatch(beliefId, evidence, classificationConfig, idempotencyKey) {
1286
+ return gateway.request({
1287
+ path: "/api/platform/v1/evidence/classify-batch",
1288
+ method: "POST",
1289
+ body: {
1290
+ beliefId,
1291
+ evidence,
1292
+ config: classificationConfig
1293
+ },
1294
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1295
+ });
1296
+ }
1297
+ };
1298
+ }
1116
1299
  var DEFAULT_CUSTOM_NAMESPACE = "custom";
1117
1300
  var RESERVED_NAMESPACES = /* @__PURE__ */ new Set(["lucern"]);
1118
1301
  var CustomToolRegistryError = class extends Error {
@@ -1902,14 +2085,14 @@ function createIdentityClient(config = {}) {
1902
2085
  }
1903
2086
 
1904
2087
  // src/topicsClient.ts
1905
- function asRecord2(value) {
2088
+ function asRecord3(value) {
1906
2089
  return value && typeof value === "object" ? value : {};
1907
2090
  }
1908
2091
  function cleanString2(value) {
1909
2092
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
1910
2093
  }
1911
2094
  function normalizeTopicRecord(value) {
1912
- const record = asRecord2(value);
2095
+ const record = asRecord3(value);
1913
2096
  const topicId = cleanString2(record.topicId) ?? cleanString2(record.id) ?? cleanString2(record._id);
1914
2097
  return withTopicAlias({
1915
2098
  ...record,
@@ -1934,7 +2117,7 @@ function createTopicsClient(config = {}) {
1934
2117
  })}`
1935
2118
  }).then(
1936
2119
  (response) => mapGatewayData(response, (data) => {
1937
- const record = asRecord2(data);
2120
+ const record = asRecord3(data);
1938
2121
  const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
1939
2122
  return {
1940
2123
  ...createListResult(items, "topics"),
@@ -1951,7 +2134,7 @@ function createTopicsClient(config = {}) {
1951
2134
  }).then(
1952
2135
  (response) => mapGatewayData(
1953
2136
  response,
1954
- (data) => normalizeTopicRecord(asRecord2(data).topic ?? data)
2137
+ (data) => normalizeTopicRecord(asRecord3(data).topic ?? data)
1955
2138
  )
1956
2139
  );
1957
2140
  },
@@ -1987,7 +2170,7 @@ function createTopicsClient(config = {}) {
1987
2170
  )}`
1988
2171
  }).then(
1989
2172
  (response) => mapGatewayData(response, (data) => {
1990
- const record = asRecord2(data);
2173
+ const record = asRecord3(data);
1991
2174
  return {
1992
2175
  tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
1993
2176
  };
@@ -2021,6 +2204,23 @@ function createTopicsClient(config = {}) {
2021
2204
  }
2022
2205
 
2023
2206
  // src/gatewayFacades.ts
2207
+ function normalizeBeliefConfidenceInput(input) {
2208
+ const opinion = input.opinion;
2209
+ return {
2210
+ belief: opinion.b,
2211
+ disbelief: opinion.d,
2212
+ uncertainty: opinion.u,
2213
+ baseRate: opinion.a,
2214
+ trigger: input.trigger,
2215
+ rationale: input.rationale,
2216
+ triggeringEvidenceId: input.triggeringEvidenceId,
2217
+ triggeringQuestionId: input.triggeringQuestionId,
2218
+ triggeringAnswerId: input.triggeringAnswerId,
2219
+ triggeringContradictionId: input.triggeringContradictionId,
2220
+ triggeringWorktreeId: input.triggeringWorktreeId,
2221
+ maxInlinePropagationTargets: input.maxInlinePropagationTargets
2222
+ };
2223
+ }
2024
2224
  function serializeTypes(types) {
2025
2225
  return Array.isArray(types) && types.length > 0 ? types.join(",") : void 0;
2026
2226
  }
@@ -2072,7 +2272,7 @@ function createBeliefsFacade(config = {}) {
2072
2272
  return gateway.request({
2073
2273
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence`,
2074
2274
  method: "POST",
2075
- body: input,
2275
+ body: normalizeBeliefConfidenceInput(input),
2076
2276
  idempotencyKey
2077
2277
  });
2078
2278
  },
@@ -2150,6 +2350,11 @@ function createBeliefsFacade(config = {}) {
2150
2350
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence-history`
2151
2351
  });
2152
2352
  },
2353
+ async opinionHistory(id) {
2354
+ return gateway.request({
2355
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence-history`
2356
+ });
2357
+ },
2153
2358
  async createContract(id, input, idempotencyKey = randomIdempotencyKey()) {
2154
2359
  return gateway.request({
2155
2360
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/contracts`,
@@ -2752,6 +2957,18 @@ function createWorktreesFacade(config = {}) {
2752
2957
  async list(query) {
2753
2958
  return gateway.request({
2754
2959
  path: `/api/platform/v1/worktrees${toQueryString({
2960
+ topicId: query.topicId,
2961
+ status: query.status,
2962
+ groupBy: query.groupBy,
2963
+ lane: query.lane,
2964
+ campaign: query.campaign,
2965
+ limit: query.limit
2966
+ })}`
2967
+ });
2968
+ },
2969
+ async listCampaigns(query = {}) {
2970
+ return gateway.request({
2971
+ path: `/api/platform/v1/worktrees/campaigns${toQueryString({
2755
2972
  topicId: query.topicId,
2756
2973
  status: query.status,
2757
2974
  limit: query.limit
@@ -2774,10 +2991,10 @@ function createWorktreesFacade(config = {}) {
2774
2991
  objective: input.objective,
2775
2992
  hypothesis: input.hypothesis,
2776
2993
  rationale: input.rationale,
2777
- track: input.track,
2778
- trackPosition: input.trackPosition,
2779
- executionBand: input.executionBand,
2780
- executionOrder: input.executionOrder,
2994
+ campaign: input.campaign,
2995
+ lane: input.lane,
2996
+ laneOrderInCampaign: input.laneOrderInCampaign,
2997
+ orderInLane: input.orderInLane,
2781
2998
  dependsOn: input.dependsOn,
2782
2999
  blocks: input.blocks,
2783
3000
  gate: input.gate,
@@ -3370,199 +3587,483 @@ function createLearningClient(config = {}) {
3370
3587
  };
3371
3588
  }
3372
3589
 
3373
- // src/mcpParityClient.ts
3374
- function withSdkSessionId(args, sessionId) {
3590
+ // src/generated/functionSurface.ts
3591
+ var CONTRACTS = {
3592
+ "activate_worktree": { method: "POST", path: "/worktrees/activate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3593
+ "add_evidence": { method: "POST", path: "/evidence/add", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3594
+ "add_worktree": { method: "POST", path: "/worktrees", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3595
+ "analyze_topic_density": { method: "POST", path: "/scope/topic-density", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3596
+ "answer_question": { method: "POST", path: "/questions/answer", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3597
+ "apply_auto_branching": { method: "POST", path: "/scope/auto-branching", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3598
+ "apply_lens_to_topic": { method: "POST", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3599
+ "apply_ontology": { method: "POST", path: "/ontologies/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3600
+ "archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3601
+ "archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3602
+ "archive_question": { method: "DELETE", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3603
+ "bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3604
+ "broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3605
+ "check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3606
+ "claim_files": { method: "POST", path: "/coordination/file-claims", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3607
+ "compile_context": { method: "POST", path: "/context/compile", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3608
+ "complete_task": { method: "POST", path: "/tasks/complete", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3609
+ "create_answer": { method: "POST", path: "/answers", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3610
+ "create_belief": { method: "POST", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3611
+ "create_edge": { method: "POST", path: "/edges", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3612
+ "create_epistemic_contract": { method: "POST", path: "/contracts", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3613
+ "create_evidence": { method: "POST", path: "/evidence", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3614
+ "create_lens": { method: "POST", path: "/lenses", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3615
+ "create_ontology": { method: "POST", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3616
+ "create_ontology_version": { method: "POST", path: "/ontologies/versions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3617
+ "create_question": { method: "POST", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3618
+ "create_task": { method: "POST", path: "/tasks", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3619
+ "create_topic": { method: "POST", path: "/topics", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3620
+ "deprecate_ontology_version": { method: "POST", path: "/ontologies/versions/deprecate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3621
+ "detect_confirmation_bias": { method: "POST", path: "/graph/confirmation-bias", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3622
+ "discover": { method: "POST", path: "/context/discover", kind: "query", idempotent: false, surfaceIntent: "compatibility" },
3623
+ "discover_entity_connections": { method: "POST", path: "/context/entity-connections", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3624
+ "end_session": { method: "POST", path: "/coordination/end-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3625
+ "evaluate_contract": { method: "POST", path: "/contracts/evaluate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3626
+ "filter_by_permission": { method: "POST", path: "/identity/filter-by-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3627
+ "find_contradictions": { method: "POST", path: "/graph/contradictions", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3628
+ "find_missing_questions": { method: "POST", path: "/questions/missing", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3629
+ "flag_contradiction": { method: "POST", path: "/contradictions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3630
+ "fork_belief": { method: "POST", path: "/beliefs/fork", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3631
+ "generate_session_handoff": { method: "POST", path: "/bootstrap/session-handoff", kind: "query", idempotent: false, surfaceIntent: "system" },
3632
+ "get_agent_inbox": { method: "POST", path: "/coordination/messages/inbox", kind: "query", idempotent: false, surfaceIntent: "system" },
3633
+ "get_answer": { method: "GET", path: "/answers/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3634
+ "get_audit_trail": { method: "POST", path: "/judgments/audit-trail", kind: "query", idempotent: false, surfaceIntent: "system" },
3635
+ "get_belief": { method: "GET", path: "/beliefs/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3636
+ "get_change_history": { method: "POST", path: "/coding/change-history", kind: "query", idempotent: false, surfaceIntent: "system" },
3637
+ "get_code_context": { method: "POST", path: "/coding/context", kind: "query", idempotent: false, surfaceIntent: "system" },
3638
+ "get_confidence_history": { method: "POST", path: "/beliefs/confidence-history", kind: "query", idempotent: false, surfaceIntent: "compatibility" },
3639
+ "get_contract_status": { method: "POST", path: "/contracts/status", kind: "query", idempotent: false, surfaceIntent: "mcp_governance" },
3640
+ "get_evidence": { method: "GET", path: "/evidence/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3641
+ "get_failure_log": { method: "POST", path: "/coding/failure-log", kind: "query", idempotent: false, surfaceIntent: "system" },
3642
+ "get_falsification_questions": { method: "POST", path: "/questions/falsification", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3643
+ "get_graph_gaps": { method: "POST", path: "/graph/gaps", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3644
+ "get_graph_neighborhood": { method: "POST", path: "/graph/neighborhood", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3645
+ "get_graph_structure_analysis": { method: "POST", path: "/graph/structure-analysis", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3646
+ "get_high_priority_questions": { method: "POST", path: "/questions/high-priority", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3647
+ "get_lattice_coverage": { method: "POST", path: "/scope/belief-lattice/coverage", kind: "query", idempotent: false, surfaceIntent: "system" },
3648
+ "get_observation_context": { method: "POST", path: "/observations/context", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3649
+ "get_ontology": { method: "GET", path: "/ontologies/get", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3650
+ "get_question": { method: "GET", path: "/questions/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3651
+ "get_topic": { method: "GET", path: "/topics/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3652
+ "get_topic_coverage": { method: "POST", path: "/graph/topic-coverage", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3653
+ "get_topic_tree": { method: "GET", path: "/topics/tree", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3654
+ "heartbeat_session": { method: "POST", path: "/coordination/heartbeat-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3655
+ "identity_whoami": { method: "GET", path: "/identity/whoami", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3656
+ "ingest_observation": { method: "POST", path: "/observations/ingest", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3657
+ "link_evidence": { method: "POST", path: "/evidence/link", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3658
+ "link_evidence_to_belief": { method: "POST", path: "/evidence/link-belief", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3659
+ "link_evidence_to_question": { method: "POST", path: "/evidence/link-question", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3660
+ "list_active_sessions": { method: "POST", path: "/coordination/active-sessions", kind: "query", idempotent: false, surfaceIntent: "system" },
3661
+ "list_all_worktrees": { method: "GET", path: "/worktrees/all", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3662
+ "list_beliefs": { method: "GET", path: "/beliefs", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3663
+ "list_campaigns": { method: "GET", path: "/worktrees/campaigns", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3664
+ "list_evidence": { method: "GET", path: "/evidence", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3665
+ "list_lenses": { method: "GET", path: "/lenses", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3666
+ "list_ontologies": { method: "GET", path: "/ontologies", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3667
+ "list_questions": { method: "GET", path: "/questions", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3668
+ "list_tasks": { method: "GET", path: "/tasks", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3669
+ "list_topics": { method: "GET", path: "/topics", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3670
+ "list_worktrees": { method: "GET", path: "/worktrees", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3671
+ "manage_write_policy": { method: "POST", path: "/policy/write-policy/manage", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3672
+ "match_entity_type": { method: "POST", path: "/ontologies/match-entity-type", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3673
+ "merge": { method: "POST", path: "/worktrees/merge", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3674
+ "modulate_confidence": { method: "POST", path: "/beliefs/confidence", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3675
+ "open_pull_request": { method: "POST", path: "/worktrees/open-pull-request", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3676
+ "pipeline_snapshot": { method: "POST", path: "/worktrees/pipeline-snapshot", kind: "query", idempotent: false, surfaceIntent: "system" },
3677
+ "publish_ontology_version": { method: "POST", path: "/ontologies/versions/publish", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3678
+ "push": { method: "POST", path: "/worktrees/push", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3679
+ "query_lineage": { method: "POST", path: "/edges/lineage", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3680
+ "record_attempt": { method: "POST", path: "/coding/attempts", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3681
+ "record_judgment": { method: "POST", path: "/judgments", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3682
+ "record_scope_learning": { method: "POST", path: "/scope/learnings", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3683
+ "refine_belief": { method: "PATCH", path: "/beliefs/refine", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3684
+ "refine_question": { method: "PATCH", path: "/questions/refine", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3685
+ "register_session": { method: "POST", path: "/coordination/register-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3686
+ "remove_lens_from_topic": { method: "DELETE", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3687
+ "resolve_effective_ontology": { method: "POST", path: "/ontologies/effective", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3688
+ "search_beliefs": { method: "POST", path: "/beliefs/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3689
+ "search_evidence": { method: "POST", path: "/evidence/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3690
+ "seed_belief_lattice": { method: "POST", path: "/scope/belief-lattice/seed", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3691
+ "send_agent_message": { method: "POST", path: "/coordination/messages/send", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3692
+ "trace_entity_impact": { method: "POST", path: "/graph/trace-entity-impact", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3693
+ "traverse_graph": { method: "POST", path: "/graph/traverse", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3694
+ "trigger_belief_review": { method: "POST", path: "/context/belief-review", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3695
+ "update_ontology": { method: "PATCH", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3696
+ "update_question_status": { method: "PATCH", path: "/questions/status", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3697
+ "update_task": { method: "PATCH", path: "/tasks", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3698
+ "update_topic": { method: "PATCH", path: "/topics", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3699
+ "update_worktree_metadata": { method: "PATCH", path: "/worktrees/metadata", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3700
+ "update_worktree_targets": { method: "PATCH", path: "/worktrees/targets", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" }
3701
+ };
3702
+ function createSessionId() {
3703
+ return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : randomIdempotencyKey();
3704
+ }
3705
+ function withSdkSessionId(input, sessionId) {
3375
3706
  return {
3376
- ...args ?? {},
3377
- __sdkSessionId: sessionId
3707
+ ...input,
3708
+ __sdkSessionId: typeof input.__sdkSessionId === "string" ? input.__sdkSessionId : sessionId
3378
3709
  };
3379
3710
  }
3380
- function createMcpParityClient(config = {}) {
3381
- const gateway = createGatewayRequestClient(config);
3382
- const sessionId = crypto.randomUUID();
3383
- function executeRead(toolName, args) {
3384
- return gateway.request({
3385
- path: `/api/platform/v1/mcp-tools/${encodeURIComponent(toolName)}`,
3386
- method: "POST",
3387
- body: withSdkSessionId(args, sessionId)
3388
- });
3711
+ function toFunctionSurfaceQuery(input) {
3712
+ const params = new URLSearchParams();
3713
+ for (const [key, value] of Object.entries(input)) {
3714
+ if (value === void 0) {
3715
+ continue;
3716
+ }
3717
+ const serialized2 = typeof value === "string" ? value : JSON.stringify(value);
3718
+ if (serialized2 !== void 0) {
3719
+ params.set(key, serialized2);
3720
+ }
3389
3721
  }
3390
- function executeMutation(toolName, args, idempotencyKey) {
3722
+ const serialized = params.toString();
3723
+ return serialized ? `?${serialized}` : "";
3724
+ }
3725
+ function createFunctionSurfaceClient(config = {}) {
3726
+ const gateway = createGatewayRequestClient(config);
3727
+ const sessionId = createSessionId();
3728
+ function execute(name, input, idempotencyKey) {
3729
+ const contract = CONTRACTS[name];
3730
+ const payload = withSdkSessionId(input, sessionId);
3731
+ const path = contract.method === "GET" ? `${contract.path}${toFunctionSurfaceQuery(payload)}` : contract.path;
3391
3732
  return gateway.request({
3392
- path: `/api/platform/v1/mcp-tools/${encodeURIComponent(toolName)}`,
3393
- method: "POST",
3394
- body: withSdkSessionId(args, sessionId),
3395
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
3733
+ path: `/api/platform/v1${path}`,
3734
+ method: contract.method,
3735
+ body: contract.method === "GET" ? void 0 : payload,
3736
+ idempotencyKey: contract.kind !== "query" && Boolean(contract.idempotent) ? idempotencyKey ?? randomIdempotencyKey() : void 0
3396
3737
  });
3397
3738
  }
3398
3739
  return {
3399
3740
  sessionId,
3400
- listTopics(args = {}) {
3401
- return executeRead("list_topics", args);
3741
+ activateWorktree(input = {}, idempotencyKey) {
3742
+ return execute("activate_worktree", input, idempotencyKey);
3402
3743
  },
3403
- createTopic(args, idempotencyKey) {
3404
- return executeMutation("create_topic", args, idempotencyKey);
3744
+ addEvidence(input = {}, idempotencyKey) {
3745
+ return execute("add_evidence", input, idempotencyKey);
3405
3746
  },
3406
- getTopic(args) {
3407
- return executeRead("get_topic", args);
3747
+ addWorktree(input = {}, idempotencyKey) {
3748
+ return execute("add_worktree", input, idempotencyKey);
3408
3749
  },
3409
- getTopicTree(args) {
3410
- return executeRead("get_topic_tree", args);
3750
+ analyzeTopicDensity(input = {}, idempotencyKey) {
3751
+ return execute("analyze_topic_density", input, idempotencyKey);
3411
3752
  },
3412
- activateWorktree(args, idempotencyKey) {
3413
- return executeMutation("activate_worktree", args, idempotencyKey);
3753
+ answerQuestion(input = {}, idempotencyKey) {
3754
+ return execute("answer_question", input, idempotencyKey);
3414
3755
  },
3415
- updateWorktreeMetadata(args, idempotencyKey) {
3416
- return executeMutation("update_worktree_metadata", args, idempotencyKey);
3756
+ applyAutoBranching(input = {}, idempotencyKey) {
3757
+ return execute("apply_auto_branching", input, idempotencyKey);
3417
3758
  },
3418
- updateWorktreeTargets(args, idempotencyKey) {
3419
- return executeMutation("update_worktree_targets", args, idempotencyKey);
3759
+ applyLensToTopic(input = {}, idempotencyKey) {
3760
+ return execute("apply_lens_to_topic", input, idempotencyKey);
3420
3761
  },
3421
- listAllWorktrees(args = {}) {
3422
- return executeRead("list_all_worktrees", args);
3762
+ applyOntology(input = {}, idempotencyKey) {
3763
+ return execute("apply_ontology", input, idempotencyKey);
3423
3764
  },
3424
- pipelineSnapshot(args) {
3425
- return executeRead("pipeline_snapshot", args);
3765
+ archiveBelief(input = {}, idempotencyKey) {
3766
+ return execute("archive_belief", input, idempotencyKey);
3426
3767
  },
3427
- recordScopeLearning(args, idempotencyKey) {
3428
- return executeMutation("record_scope_learning", args, idempotencyKey);
3768
+ archiveOntology(input = {}, idempotencyKey) {
3769
+ return execute("archive_ontology", input, idempotencyKey);
3429
3770
  },
3430
- discover(args) {
3431
- return executeRead("discover", args);
3771
+ archiveQuestion(input = {}, idempotencyKey) {
3772
+ return execute("archive_question", input, idempotencyKey);
3432
3773
  },
3433
- analyzeTopicDensity(args) {
3434
- return executeRead("analyze_topic_density", args);
3774
+ bisectConfidence(input = {}, idempotencyKey) {
3775
+ return execute("bisect_confidence", input, idempotencyKey);
3435
3776
  },
3436
- applyAutoBranching(args, idempotencyKey) {
3437
- return executeMutation("apply_auto_branching", args, idempotencyKey);
3777
+ broadcastMessage(input = {}, idempotencyKey) {
3778
+ return execute("broadcast_message", input, idempotencyKey);
3438
3779
  },
3439
- seedBeliefLattice(args = {}, idempotencyKey) {
3440
- return executeMutation("seed_belief_lattice", args, idempotencyKey);
3780
+ checkPermission(input = {}, idempotencyKey) {
3781
+ return execute("check_permission", input, idempotencyKey);
3441
3782
  },
3442
- getLatticeCoverage(args = {}) {
3443
- return executeRead("get_lattice_coverage", args);
3783
+ claimFiles(input = {}, idempotencyKey) {
3784
+ return execute("claim_files", input, idempotencyKey);
3444
3785
  },
3445
- matchEntityType(args) {
3446
- return executeRead("match_entity_type", args);
3786
+ compileContext(input = {}, idempotencyKey) {
3787
+ return execute("compile_context", input, idempotencyKey);
3447
3788
  },
3448
- discoverEntityConnections(args) {
3449
- return executeRead("discover_entity_connections", args);
3789
+ completeTask(input = {}, idempotencyKey) {
3790
+ return execute("complete_task", input, idempotencyKey);
3450
3791
  },
3451
- triggerBeliefReview(args, idempotencyKey) {
3452
- return executeMutation("trigger_belief_review", args, idempotencyKey);
3792
+ createAnswer(input = {}, idempotencyKey) {
3793
+ return execute("create_answer", input, idempotencyKey);
3453
3794
  },
3454
- listOntologies(args = {}) {
3455
- return executeRead("list_ontologies", args);
3795
+ createBelief(input = {}, idempotencyKey) {
3796
+ return execute("create_belief", input, idempotencyKey);
3456
3797
  },
3457
- getOntology(args) {
3458
- return executeRead("get_ontology", args);
3798
+ createEdge(input = {}, idempotencyKey) {
3799
+ return execute("create_edge", input, idempotencyKey);
3459
3800
  },
3460
- applyOntology(args, idempotencyKey) {
3461
- return executeMutation("apply_ontology", args, idempotencyKey);
3801
+ createEpistemicContract(input = {}, idempotencyKey) {
3802
+ return execute("create_epistemic_contract", input, idempotencyKey);
3462
3803
  },
3463
- createOntology(args, idempotencyKey) {
3464
- return executeMutation("create_ontology", args, idempotencyKey);
3804
+ createEvidence(input = {}, idempotencyKey) {
3805
+ return execute("create_evidence", input, idempotencyKey);
3465
3806
  },
3466
- updateOntology(args, idempotencyKey) {
3467
- return executeMutation("update_ontology", args, idempotencyKey);
3807
+ createLens(input = {}, idempotencyKey) {
3808
+ return execute("create_lens", input, idempotencyKey);
3468
3809
  },
3469
- archiveOntology(args, idempotencyKey) {
3470
- return executeMutation("archive_ontology", args, idempotencyKey);
3810
+ createOntology(input = {}, idempotencyKey) {
3811
+ return execute("create_ontology", input, idempotencyKey);
3471
3812
  },
3472
- createOntologyVersion(args, idempotencyKey) {
3473
- return executeMutation("create_ontology_version", args, idempotencyKey);
3813
+ createOntologyVersion(input = {}, idempotencyKey) {
3814
+ return execute("create_ontology_version", input, idempotencyKey);
3474
3815
  },
3475
- publishOntologyVersion(args, idempotencyKey) {
3476
- return executeMutation("publish_ontology_version", args, idempotencyKey);
3816
+ createQuestion(input = {}, idempotencyKey) {
3817
+ return execute("create_question", input, idempotencyKey);
3477
3818
  },
3478
- deprecateOntologyVersion(args, idempotencyKey) {
3479
- return executeMutation(
3480
- "deprecate_ontology_version",
3481
- args,
3482
- idempotencyKey
3483
- );
3819
+ createTask(input = {}, idempotencyKey) {
3820
+ return execute("create_task", input, idempotencyKey);
3484
3821
  },
3485
- resolveEffectiveOntology(args) {
3486
- return executeRead("resolve_effective_ontology", args);
3822
+ createTopic(input = {}, idempotencyKey) {
3823
+ return execute("create_topic", input, idempotencyKey);
3487
3824
  },
3488
- registerSession(args = {}, idempotencyKey) {
3489
- return executeMutation("register_session", args, idempotencyKey);
3825
+ deprecateOntologyVersion(input = {}, idempotencyKey) {
3826
+ return execute("deprecate_ontology_version", input, idempotencyKey);
3490
3827
  },
3491
- heartbeatSession(args = {}, idempotencyKey) {
3492
- return executeMutation("heartbeat_session", args, idempotencyKey);
3828
+ detectConfirmationBias(input = {}, idempotencyKey) {
3829
+ return execute("detect_confirmation_bias", input, idempotencyKey);
3493
3830
  },
3494
- endSession(args = {}, idempotencyKey) {
3495
- return executeMutation("end_session", args, idempotencyKey);
3831
+ discover(input = {}, idempotencyKey) {
3832
+ return execute("discover", input, idempotencyKey);
3496
3833
  },
3497
- listActiveSessions(args = {}) {
3498
- return executeRead("list_active_sessions", args);
3834
+ discoverEntityConnections(input = {}, idempotencyKey) {
3835
+ return execute("discover_entity_connections", input, idempotencyKey);
3499
3836
  },
3500
- sendAgentMessage(args, idempotencyKey) {
3501
- return executeMutation("send_agent_message", args, idempotencyKey);
3837
+ endSession(input = {}, idempotencyKey) {
3838
+ return execute("end_session", input, idempotencyKey);
3502
3839
  },
3503
- broadcastMessage(args, idempotencyKey) {
3504
- return executeMutation("broadcast_message", args, idempotencyKey);
3840
+ evaluateContract(input = {}, idempotencyKey) {
3841
+ return execute("evaluate_contract", input, idempotencyKey);
3505
3842
  },
3506
- getAgentInbox(args = {}) {
3507
- return executeRead("get_agent_inbox", args);
3843
+ filterByPermission(input = {}, idempotencyKey) {
3844
+ return execute("filter_by_permission", input, idempotencyKey);
3508
3845
  },
3509
- claimFiles(args, idempotencyKey) {
3510
- return executeMutation("claim_files", args, idempotencyKey);
3846
+ findContradictions(input = {}, idempotencyKey) {
3847
+ return execute("find_contradictions", input, idempotencyKey);
3511
3848
  },
3512
- listTasks(args) {
3513
- return executeRead("list_tasks", args);
3849
+ findMissingQuestions(input = {}, idempotencyKey) {
3850
+ return execute("find_missing_questions", input, idempotencyKey);
3514
3851
  },
3515
- createAnswer(args, idempotencyKey) {
3516
- return executeMutation("create_answer", args, idempotencyKey);
3852
+ flagContradiction(input = {}, idempotencyKey) {
3853
+ return execute("flag_contradiction", input, idempotencyKey);
3517
3854
  },
3518
- getAnswer(args) {
3519
- return executeRead("get_answer", args);
3855
+ forkBelief(input = {}, idempotencyKey) {
3856
+ return execute("fork_belief", input, idempotencyKey);
3520
3857
  },
3521
- flagContradiction(args, idempotencyKey) {
3522
- return executeMutation("flag_contradiction", args, idempotencyKey);
3858
+ generateSessionHandoff(input = {}, idempotencyKey) {
3859
+ return execute("generate_session_handoff", input, idempotencyKey);
3523
3860
  },
3524
- ingestObservation(args, idempotencyKey) {
3525
- return executeMutation("ingest_observation", args, idempotencyKey);
3861
+ getAgentInbox(input = {}, idempotencyKey) {
3862
+ return execute("get_agent_inbox", input, idempotencyKey);
3526
3863
  },
3527
- getObservationContext(args) {
3528
- return executeRead("get_observation_context", args);
3864
+ getAnswer(input = {}, idempotencyKey) {
3865
+ return execute("get_answer", input, idempotencyKey);
3529
3866
  },
3530
- getCodeContext(args) {
3531
- return executeRead("get_code_context", args);
3867
+ getAuditTrail(input = {}, idempotencyKey) {
3868
+ return execute("get_audit_trail", input, idempotencyKey);
3532
3869
  },
3533
- getChangeHistory(args) {
3534
- return executeRead("get_change_history", args);
3870
+ getBelief(input = {}, idempotencyKey) {
3871
+ return execute("get_belief", input, idempotencyKey);
3535
3872
  },
3536
- recordAttempt(args, idempotencyKey) {
3537
- return executeMutation("record_attempt", args, idempotencyKey);
3873
+ getChangeHistory(input = {}, idempotencyKey) {
3874
+ return execute("get_change_history", input, idempotencyKey);
3538
3875
  },
3539
- getFailureLog(args) {
3540
- return executeRead("get_failure_log", args);
3876
+ getCodeContext(input = {}, idempotencyKey) {
3877
+ return execute("get_code_context", input, idempotencyKey);
3541
3878
  },
3542
- createEpistemicContract(args, idempotencyKey) {
3543
- return executeMutation(
3544
- "create_epistemic_contract",
3545
- args,
3546
- idempotencyKey
3547
- );
3879
+ getConfidenceHistory(input = {}, idempotencyKey) {
3880
+ return execute("get_confidence_history", input, idempotencyKey);
3881
+ },
3882
+ getContractStatus(input = {}, idempotencyKey) {
3883
+ return execute("get_contract_status", input, idempotencyKey);
3548
3884
  },
3549
- evaluateContract(args, idempotencyKey) {
3550
- return executeMutation("evaluate_contract", args, idempotencyKey);
3885
+ getEvidence(input = {}, idempotencyKey) {
3886
+ return execute("get_evidence", input, idempotencyKey);
3551
3887
  },
3552
- getContractStatus(args) {
3553
- return executeRead("get_contract_status", args);
3888
+ getFailureLog(input = {}, idempotencyKey) {
3889
+ return execute("get_failure_log", input, idempotencyKey);
3554
3890
  },
3555
- checkPermission(args) {
3556
- return executeRead("check_permission", args);
3891
+ getFalsificationQuestions(input = {}, idempotencyKey) {
3892
+ return execute("get_falsification_questions", input, idempotencyKey);
3557
3893
  },
3558
- filterByPermission(args) {
3559
- return executeRead("filter_by_permission", args);
3894
+ getGraphGaps(input = {}, idempotencyKey) {
3895
+ return execute("get_graph_gaps", input, idempotencyKey);
3560
3896
  },
3561
- manageWritePolicy(args, idempotencyKey) {
3562
- return args.action === "set" ? executeMutation("manage_write_policy", args, idempotencyKey) : executeRead("manage_write_policy", args);
3897
+ getGraphNeighborhood(input = {}, idempotencyKey) {
3898
+ return execute("get_graph_neighborhood", input, idempotencyKey);
3563
3899
  },
3564
- generateSessionHandoff(args) {
3565
- return executeRead("generate_session_handoff", args);
3900
+ getGraphStructureAnalysis(input = {}, idempotencyKey) {
3901
+ return execute("get_graph_structure_analysis", input, idempotencyKey);
3902
+ },
3903
+ getHighPriorityQuestions(input = {}, idempotencyKey) {
3904
+ return execute("get_high_priority_questions", input, idempotencyKey);
3905
+ },
3906
+ getLatticeCoverage(input = {}, idempotencyKey) {
3907
+ return execute("get_lattice_coverage", input, idempotencyKey);
3908
+ },
3909
+ getObservationContext(input = {}, idempotencyKey) {
3910
+ return execute("get_observation_context", input, idempotencyKey);
3911
+ },
3912
+ getOntology(input = {}, idempotencyKey) {
3913
+ return execute("get_ontology", input, idempotencyKey);
3914
+ },
3915
+ getQuestion(input = {}, idempotencyKey) {
3916
+ return execute("get_question", input, idempotencyKey);
3917
+ },
3918
+ getTopic(input = {}, idempotencyKey) {
3919
+ return execute("get_topic", input, idempotencyKey);
3920
+ },
3921
+ getTopicCoverage(input = {}, idempotencyKey) {
3922
+ return execute("get_topic_coverage", input, idempotencyKey);
3923
+ },
3924
+ getTopicTree(input = {}, idempotencyKey) {
3925
+ return execute("get_topic_tree", input, idempotencyKey);
3926
+ },
3927
+ heartbeatSession(input = {}, idempotencyKey) {
3928
+ return execute("heartbeat_session", input, idempotencyKey);
3929
+ },
3930
+ whoami(input = {}, idempotencyKey) {
3931
+ return execute("identity_whoami", input, idempotencyKey);
3932
+ },
3933
+ ingestObservation(input = {}, idempotencyKey) {
3934
+ return execute("ingest_observation", input, idempotencyKey);
3935
+ },
3936
+ linkEvidence(input = {}, idempotencyKey) {
3937
+ return execute("link_evidence", input, idempotencyKey);
3938
+ },
3939
+ linkEvidenceToBelief(input = {}, idempotencyKey) {
3940
+ return execute("link_evidence_to_belief", input, idempotencyKey);
3941
+ },
3942
+ linkEvidenceToQuestion(input = {}, idempotencyKey) {
3943
+ return execute("link_evidence_to_question", input, idempotencyKey);
3944
+ },
3945
+ listActiveSessions(input = {}, idempotencyKey) {
3946
+ return execute("list_active_sessions", input, idempotencyKey);
3947
+ },
3948
+ listAllWorktrees(input = {}, idempotencyKey) {
3949
+ return execute("list_all_worktrees", input, idempotencyKey);
3950
+ },
3951
+ listBeliefs(input = {}, idempotencyKey) {
3952
+ return execute("list_beliefs", input, idempotencyKey);
3953
+ },
3954
+ listCampaigns(input = {}, idempotencyKey) {
3955
+ return execute("list_campaigns", input, idempotencyKey);
3956
+ },
3957
+ listEvidence(input = {}, idempotencyKey) {
3958
+ return execute("list_evidence", input, idempotencyKey);
3959
+ },
3960
+ listLenses(input = {}, idempotencyKey) {
3961
+ return execute("list_lenses", input, idempotencyKey);
3962
+ },
3963
+ listOntologies(input = {}, idempotencyKey) {
3964
+ return execute("list_ontologies", input, idempotencyKey);
3965
+ },
3966
+ listQuestions(input = {}, idempotencyKey) {
3967
+ return execute("list_questions", input, idempotencyKey);
3968
+ },
3969
+ listTasks(input = {}, idempotencyKey) {
3970
+ return execute("list_tasks", input, idempotencyKey);
3971
+ },
3972
+ listTopics(input = {}, idempotencyKey) {
3973
+ return execute("list_topics", input, idempotencyKey);
3974
+ },
3975
+ listWorktrees(input = {}, idempotencyKey) {
3976
+ return execute("list_worktrees", input, idempotencyKey);
3977
+ },
3978
+ manageWritePolicy(input = {}, idempotencyKey) {
3979
+ return execute("manage_write_policy", input, idempotencyKey);
3980
+ },
3981
+ matchEntityType(input = {}, idempotencyKey) {
3982
+ return execute("match_entity_type", input, idempotencyKey);
3983
+ },
3984
+ merge(input = {}, idempotencyKey) {
3985
+ return execute("merge", input, idempotencyKey);
3986
+ },
3987
+ modulateConfidence(input = {}, idempotencyKey) {
3988
+ return execute("modulate_confidence", input, idempotencyKey);
3989
+ },
3990
+ openPullRequest(input = {}, idempotencyKey) {
3991
+ return execute("open_pull_request", input, idempotencyKey);
3992
+ },
3993
+ pipelineSnapshot(input = {}, idempotencyKey) {
3994
+ return execute("pipeline_snapshot", input, idempotencyKey);
3995
+ },
3996
+ publishOntologyVersion(input = {}, idempotencyKey) {
3997
+ return execute("publish_ontology_version", input, idempotencyKey);
3998
+ },
3999
+ push(input = {}, idempotencyKey) {
4000
+ return execute("push", input, idempotencyKey);
4001
+ },
4002
+ queryLineage(input = {}, idempotencyKey) {
4003
+ return execute("query_lineage", input, idempotencyKey);
4004
+ },
4005
+ recordAttempt(input = {}, idempotencyKey) {
4006
+ return execute("record_attempt", input, idempotencyKey);
4007
+ },
4008
+ recordJudgment(input = {}, idempotencyKey) {
4009
+ return execute("record_judgment", input, idempotencyKey);
4010
+ },
4011
+ recordScopeLearning(input = {}, idempotencyKey) {
4012
+ return execute("record_scope_learning", input, idempotencyKey);
4013
+ },
4014
+ refineBelief(input = {}, idempotencyKey) {
4015
+ return execute("refine_belief", input, idempotencyKey);
4016
+ },
4017
+ refineQuestion(input = {}, idempotencyKey) {
4018
+ return execute("refine_question", input, idempotencyKey);
4019
+ },
4020
+ registerSession(input = {}, idempotencyKey) {
4021
+ return execute("register_session", input, idempotencyKey);
4022
+ },
4023
+ removeLensFromTopic(input = {}, idempotencyKey) {
4024
+ return execute("remove_lens_from_topic", input, idempotencyKey);
4025
+ },
4026
+ resolveEffectiveOntology(input = {}, idempotencyKey) {
4027
+ return execute("resolve_effective_ontology", input, idempotencyKey);
4028
+ },
4029
+ searchBeliefs(input = {}, idempotencyKey) {
4030
+ return execute("search_beliefs", input, idempotencyKey);
4031
+ },
4032
+ searchEvidence(input = {}, idempotencyKey) {
4033
+ return execute("search_evidence", input, idempotencyKey);
4034
+ },
4035
+ seedBeliefLattice(input = {}, idempotencyKey) {
4036
+ return execute("seed_belief_lattice", input, idempotencyKey);
4037
+ },
4038
+ sendAgentMessage(input = {}, idempotencyKey) {
4039
+ return execute("send_agent_message", input, idempotencyKey);
4040
+ },
4041
+ traceEntityImpact(input = {}, idempotencyKey) {
4042
+ return execute("trace_entity_impact", input, idempotencyKey);
4043
+ },
4044
+ traverseGraph(input = {}, idempotencyKey) {
4045
+ return execute("traverse_graph", input, idempotencyKey);
4046
+ },
4047
+ triggerBeliefReview(input = {}, idempotencyKey) {
4048
+ return execute("trigger_belief_review", input, idempotencyKey);
4049
+ },
4050
+ updateOntology(input = {}, idempotencyKey) {
4051
+ return execute("update_ontology", input, idempotencyKey);
4052
+ },
4053
+ updateQuestionStatus(input = {}, idempotencyKey) {
4054
+ return execute("update_question_status", input, idempotencyKey);
4055
+ },
4056
+ updateTask(input = {}, idempotencyKey) {
4057
+ return execute("update_task", input, idempotencyKey);
4058
+ },
4059
+ updateTopic(input = {}, idempotencyKey) {
4060
+ return execute("update_topic", input, idempotencyKey);
4061
+ },
4062
+ updateWorktreeMetadata(input = {}, idempotencyKey) {
4063
+ return execute("update_worktree_metadata", input, idempotencyKey);
4064
+ },
4065
+ updateWorktreeTargets(input = {}, idempotencyKey) {
4066
+ return execute("update_worktree_targets", input, idempotencyKey);
3566
4067
  }
3567
4068
  };
3568
4069
  }
@@ -4264,10 +4765,11 @@ function createWorkflowClient(config = {}) {
4264
4765
  async listWorktrees(query) {
4265
4766
  const normalized = normalizeTopicQuery(query);
4266
4767
  return gateway.request({
4267
- path: `/api/platform/v1/worktrees${toQueryString({
4768
+ path: `/api/platform/v1/worktrees/all${toQueryString({
4268
4769
  ...normalized,
4269
- track: query.track,
4270
- executionBand: query.executionBand
4770
+ groupBy: query.groupBy,
4771
+ lane: query.lane,
4772
+ campaign: query.campaign
4271
4773
  })}`
4272
4774
  }).then(
4273
4775
  (response) => mapGatewayData(
@@ -4286,8 +4788,9 @@ function createWorkflowClient(config = {}) {
4286
4788
  return gateway.request({
4287
4789
  path: `/api/platform/v1/worktrees${toQueryString({
4288
4790
  status: query.status,
4289
- track: query.track,
4290
- executionBand: query.executionBand,
4791
+ groupBy: query.groupBy,
4792
+ lane: query.lane,
4793
+ campaign: query.campaign,
4291
4794
  limit: query.limit
4292
4795
  })}`
4293
4796
  }).then(
@@ -4299,12 +4802,22 @@ function createWorkflowClient(config = {}) {
4299
4802
  );
4300
4803
  return {
4301
4804
  ...list,
4302
- ...record.tracks && typeof record.tracks === "object" && !Array.isArray(record.tracks) ? { tracks: record.tracks } : {},
4303
- ...record.bands && typeof record.bands === "object" && !Array.isArray(record.bands) ? { bands: record.bands } : {}
4805
+ ...record.lanes && typeof record.lanes === "object" && !Array.isArray(record.lanes) ? { lanes: record.lanes } : {},
4806
+ ...record.campaigns && typeof record.campaigns === "object" && !Array.isArray(record.campaigns) ? { campaigns: record.campaigns } : {}
4304
4807
  };
4305
4808
  })
4306
4809
  );
4307
4810
  },
4811
+ /**
4812
+ * List compact pipeline campaigns with nested lanes.
4813
+ */
4814
+ async listCampaigns(query = {}) {
4815
+ return gateway.request({
4816
+ path: `/api/platform/v1/worktrees/campaigns${toQueryString(
4817
+ normalizeTopicQuery(query)
4818
+ )}`
4819
+ });
4820
+ },
4308
4821
  /**
4309
4822
  * Create a workflow worktree.
4310
4823
  */
@@ -4629,13 +5142,22 @@ function requireText(args) {
4629
5142
  }
4630
5143
  return text;
4631
5144
  }
5145
+ function requireBaseRate(args) {
5146
+ const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
5147
+ if (baseRate < 0 || baseRate > 1) {
5148
+ throw new Error("baseRate must be within [0, 1].");
5149
+ }
5150
+ return baseRate;
5151
+ }
4632
5152
  function exposeGatewayData(response) {
4633
5153
  return Object.assign({}, response, response.data);
4634
5154
  }
4635
5155
  function createLucernClient(config = {}) {
4636
5156
  const gatewayConfig = toGatewayConfig(config);
4637
5157
  const beliefsClient = createBeliefsClient(gatewayConfig);
5158
+ const sourcesClient = createSourcesClient(gatewayConfig);
4638
5159
  const beliefsFacade = createBeliefsFacade(gatewayConfig);
5160
+ const evidenceClient = createEvidenceClient(gatewayConfig);
4639
5161
  const graphClient = createGraphClient(gatewayConfig);
4640
5162
  const graphFacade = createGraphFacade(gatewayConfig);
4641
5163
  const decisionsClient = createDecisionsClient(gatewayConfig);
@@ -4659,7 +5181,7 @@ function createLucernClient(config = {}) {
4659
5181
  const worktreesFacade = createWorktreesFacade(gatewayConfig);
4660
5182
  const policyClient = createPolicyClient(gatewayConfig);
4661
5183
  const ontologyClient = createOntologyClient(gatewayConfig);
4662
- const mcpParityClient = createMcpParityClient(gatewayConfig);
5184
+ const functionSurfaceClient = createFunctionSurfaceClient(gatewayConfig);
4663
5185
  const packsClient = createPacksClient(gatewayConfig);
4664
5186
  const reportsClient = createReportsClient(gatewayConfig);
4665
5187
  const learningClient = createLearningClient(gatewayConfig);
@@ -4739,21 +5261,25 @@ function createLucernClient(config = {}) {
4739
5261
  }
4740
5262
  );
4741
5263
  async function createEvidenceCompat(args) {
4742
- const topicId = requireTopicId(args);
4743
5264
  const text = resolveText(args);
4744
5265
  if (!text) {
4745
5266
  throw new Error("text is required");
4746
5267
  }
5268
+ const rationale = args.rationale ?? args.supports?.reasoning;
5269
+ if (!rationale) {
5270
+ throw new Error("rationale is required");
5271
+ }
4747
5272
  const metadata = {
4748
5273
  ...args.metadata ?? {},
4749
- ...args.supports?.reasoning ? { rationale: args.supports.reasoning } : {}
5274
+ rationale
4750
5275
  };
4751
5276
  return evidenceFacade.create({
4752
- topicId,
5277
+ topicId: resolveTopicId(args),
4753
5278
  text,
4754
5279
  source: args.source ?? args.sourceUrl,
4755
5280
  targetId: args.targetId ?? args.supports?.nodeId,
4756
5281
  weight: args.weight ?? args.supports?.weight,
5282
+ rationale,
4757
5283
  metadata: Object.keys(metadata).length > 0 ? metadata : void 0,
4758
5284
  title: args.title,
4759
5285
  content: args.content,
@@ -4876,6 +5402,10 @@ function createLucernClient(config = {}) {
4876
5402
  async function getConfidenceHistory(nodeId) {
4877
5403
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
4878
5404
  }
5405
+ async function getOpinionHistory(nodeId) {
5406
+ const response = await beliefsFacade.opinionHistory(nodeId);
5407
+ return mapOpinionHistoryEntriesFromGatewayData(response.data);
5408
+ }
4879
5409
  async function getAuditTrail(nodeId, limit = 50) {
4880
5410
  const events = await auditClient.listEvents({ limit });
4881
5411
  const entries = asListItems(events.data, "events").filter((event) => matchesAuditNodeReference(event, nodeId)).slice(0, limit).map((event) => {
@@ -5056,11 +5586,12 @@ function createLucernClient(config = {}) {
5056
5586
  beliefs: {
5057
5587
  create(input) {
5058
5588
  return beliefsFacade.create({
5059
- topicId: requireTopicId(input),
5589
+ topicId: resolveTopicId(input),
5060
5590
  text: requireText(input),
5061
5591
  rationale: input.rationale,
5062
5592
  worktreeId: input.worktreeId,
5063
5593
  pillar: input.pillar,
5594
+ baseRate: requireBaseRate(input),
5064
5595
  sourceBeliefIds: input.sourceBeliefIds,
5065
5596
  sourceType: input.sourceType,
5066
5597
  beliefType: input.beliefType,
@@ -5134,6 +5665,9 @@ function createLucernClient(config = {}) {
5134
5665
  confidenceHistory(nodeId) {
5135
5666
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
5136
5667
  },
5668
+ opinionHistory(nodeId) {
5669
+ return getOpinionHistory(nodeId);
5670
+ },
5137
5671
  createContract(nodeId, input) {
5138
5672
  return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
5139
5673
  },
@@ -5265,6 +5799,12 @@ function createLucernClient(config = {}) {
5265
5799
  beliefId: args.beliefId
5266
5800
  }));
5267
5801
  },
5802
+ classifyEvidence(beliefId, evidenceId, config2, idempotencyKey) {
5803
+ return evidenceClient.classifyEvidence(beliefId, evidenceId, config2, idempotencyKey).then(exposeGatewayData);
5804
+ },
5805
+ classifyEvidenceBatch(beliefId, evidence, config2, idempotencyKey) {
5806
+ return evidenceClient.classifyEvidenceBatch(beliefId, evidence, config2, idempotencyKey).then(exposeGatewayData);
5807
+ },
5268
5808
  updateStatus(input, idempotencyKey) {
5269
5809
  return evidenceFacade.updateStatus(input, idempotencyKey).then(exposeGatewayData);
5270
5810
  },
@@ -5281,10 +5821,18 @@ function createLucernClient(config = {}) {
5281
5821
  return evidenceFacade.updateVerificationStatus(input, idempotencyKey).then(exposeGatewayData);
5282
5822
  }
5283
5823
  },
5824
+ sources: {
5825
+ upsert(input, idempotencyKey) {
5826
+ return sourcesClient.upsert(input, idempotencyKey).then(exposeGatewayData);
5827
+ },
5828
+ get(sourceId) {
5829
+ return sourcesClient.get(sourceId).then(exposeGatewayData);
5830
+ }
5831
+ },
5284
5832
  questions: {
5285
5833
  create(args) {
5286
5834
  return questionsFacade.create({
5287
- topicId: requireTopicId(args),
5835
+ topicId: resolveTopicId(args),
5288
5836
  text: args.text,
5289
5837
  priority: args.priority,
5290
5838
  linkedBeliefId: args.linkedBeliefId,
@@ -5317,10 +5865,22 @@ function createLucernClient(config = {}) {
5317
5865
  }).then(exposeGatewayData);
5318
5866
  },
5319
5867
  batchCreate(input, idempotencyKey) {
5320
- return questionsFacade.batchCreate(input, idempotencyKey).then(exposeGatewayData);
5868
+ return questionsFacade.batchCreate(
5869
+ {
5870
+ ...input,
5871
+ topicId: resolveTopicId(input)
5872
+ },
5873
+ idempotencyKey
5874
+ ).then(exposeGatewayData);
5321
5875
  },
5322
5876
  add(input, idempotencyKey) {
5323
- return questionsFacade.add(input, idempotencyKey).then(exposeGatewayData);
5877
+ return questionsFacade.add(
5878
+ {
5879
+ ...input,
5880
+ topicId: resolveTopicId(input)
5881
+ },
5882
+ idempotencyKey
5883
+ ).then(exposeGatewayData);
5324
5884
  },
5325
5885
  updatePriority(input, idempotencyKey) {
5326
5886
  return questionsFacade.updatePriority(input, idempotencyKey).then(exposeGatewayData);
@@ -5406,6 +5966,7 @@ function createLucernClient(config = {}) {
5406
5966
  },
5407
5967
  queryLineage,
5408
5968
  getConfidenceHistory,
5969
+ getOpinionHistory,
5409
5970
  getAuditTrail,
5410
5971
  traverse(args) {
5411
5972
  return graphFacade.traverse({
@@ -5549,7 +6110,10 @@ function createLucernClient(config = {}) {
5549
6110
  beliefIds: input.beliefIds,
5550
6111
  autoShape: input.autoShape,
5551
6112
  domainPackId: input.domainPackId,
5552
- executionOrder: input.executionOrder,
6113
+ campaign: input.campaign,
6114
+ lane: input.lane,
6115
+ laneOrderInCampaign: input.laneOrderInCampaign,
6116
+ orderInLane: input.orderInLane,
5553
6117
  dependsOn: input.dependsOn,
5554
6118
  blocks: input.blocks,
5555
6119
  gate: input.gate,
@@ -5568,7 +6132,10 @@ function createLucernClient(config = {}) {
5568
6132
  beliefIds: input.beliefIds,
5569
6133
  autoShape: input.autoShape,
5570
6134
  domainPackId: input.domainPackId,
5571
- executionOrder: input.executionOrder,
6135
+ campaign: input.campaign,
6136
+ lane: input.lane,
6137
+ laneOrderInCampaign: input.laneOrderInCampaign,
6138
+ orderInLane: input.orderInLane,
5572
6139
  dependsOn: input.dependsOn,
5573
6140
  blocks: input.blocks,
5574
6141
  gate: input.gate,
@@ -5596,10 +6163,10 @@ function createLucernClient(config = {}) {
5596
6163
  return worktreesFacade.update({
5597
6164
  id: typeof input.worktreeId === "string" ? input.worktreeId : "",
5598
6165
  hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
5599
- track: typeof input.track === "string" ? input.track : void 0,
5600
- trackPosition: typeof input.trackPosition === "number" ? input.trackPosition : void 0,
5601
- executionBand: typeof input.executionBand === "number" ? input.executionBand : void 0,
5602
- executionOrder: typeof input.executionOrder === "number" ? input.executionOrder : void 0,
6166
+ campaign: typeof input.campaign === "number" ? input.campaign : void 0,
6167
+ lane: typeof input.lane === "string" ? input.lane : void 0,
6168
+ laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
6169
+ orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
5603
6170
  dependsOn,
5604
6171
  blocks,
5605
6172
  gate: typeof input.gate === "string" ? input.gate : void 0
@@ -5634,7 +6201,7 @@ function createLucernClient(config = {}) {
5634
6201
  return workflowClient.openPullRequest(worktreeId, input);
5635
6202
  },
5636
6203
  pipelineSnapshot(topicId) {
5637
- return mcpParityClient.pipelineSnapshot({ topicId });
6204
+ return functionSurfaceClient.pipelineSnapshot({ topicId });
5638
6205
  },
5639
6206
  complete(input, idempotencyKey) {
5640
6207
  return worktreesFacade.complete(input, idempotencyKey);
@@ -5670,23 +6237,23 @@ function createLucernClient(config = {}) {
5670
6237
  compile(topicId, input = {}) {
5671
6238
  return contextClient.compile(topicId, input);
5672
6239
  },
5673
- recordScopeLearning(input) {
5674
- return mcpParityClient.recordScopeLearning(input);
6240
+ recordScopeLearning(input, idempotencyKey) {
6241
+ return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
5675
6242
  },
5676
6243
  discover(input) {
5677
6244
  return discoverTopics(input);
5678
6245
  },
5679
6246
  analyzeTopicDensity(input) {
5680
- return mcpParityClient.analyzeTopicDensity(input);
6247
+ return functionSurfaceClient.analyzeTopicDensity(input);
5681
6248
  },
5682
- applyAutoBranching(input) {
5683
- return mcpParityClient.applyAutoBranching(input);
6249
+ applyAutoBranching(input, idempotencyKey) {
6250
+ return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
5684
6251
  },
5685
- seedBeliefLattice(input = {}) {
5686
- return mcpParityClient.seedBeliefLattice(input);
6252
+ seedBeliefLattice(input = {}, idempotencyKey) {
6253
+ return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
5687
6254
  },
5688
6255
  getLatticeCoverage(input = {}) {
5689
- return mcpParityClient.getLatticeCoverage(input);
6256
+ return functionSurfaceClient.getLatticeCoverage(input);
5690
6257
  },
5691
6258
  matchEntityType(input) {
5692
6259
  return ontologiesFacade.match(input).then(exposeGatewayData);
@@ -5701,7 +6268,7 @@ function createLucernClient(config = {}) {
5701
6268
  tasks: {
5702
6269
  create(input) {
5703
6270
  return tasksFacade.create({
5704
- topicId: requireTopicId(input),
6271
+ topicId: resolveTopicId(input),
5705
6272
  title: input.title,
5706
6273
  description: input.description,
5707
6274
  taskType: input.taskType,
@@ -5834,7 +6401,7 @@ function createLucernClient(config = {}) {
5834
6401
  beliefA: args.beliefA,
5835
6402
  beliefB: args.beliefB,
5836
6403
  description: args.description,
5837
- topicId: requireTopicId(args),
6404
+ topicId: resolveTopicId(args),
5838
6405
  severity: args.severity,
5839
6406
  defeatType: args.defeatType
5840
6407
  }).then(exposeGatewayData);
@@ -5880,38 +6447,50 @@ function createLucernClient(config = {}) {
5880
6447
  publishVersion(input) {
5881
6448
  return publishOntologyVersionCompat(input);
5882
6449
  },
6450
+ publishOntologyVersion(input) {
6451
+ return publishOntologyVersionCompat(input);
6452
+ },
5883
6453
  deprecateVersion(input) {
5884
6454
  return deprecateOntologyVersionCompat(input);
5885
6455
  },
6456
+ deprecateOntologyVersion(input) {
6457
+ return deprecateOntologyVersionCompat(input);
6458
+ },
5886
6459
  resolveEffective(input) {
5887
6460
  return resolveEffectiveOntologyCompat(input);
5888
6461
  },
6462
+ resolveEffectiveOntology(input) {
6463
+ return resolveEffectiveOntologyCompat(input);
6464
+ },
5889
6465
  raw: ontologyClient
5890
6466
  },
5891
6467
  coordination: {
5892
- registerSession(input = {}) {
5893
- return mcpParityClient.registerSession(input);
6468
+ registerSession(input = {}, idempotencyKey) {
6469
+ return functionSurfaceClient.registerSession(input, idempotencyKey);
5894
6470
  },
5895
- heartbeatSession(input = {}) {
5896
- return mcpParityClient.heartbeatSession(input);
6471
+ heartbeatSession(input = {}, idempotencyKey) {
6472
+ return functionSurfaceClient.heartbeatSession(input, idempotencyKey);
5897
6473
  },
5898
- endSession(input = {}) {
5899
- return mcpParityClient.endSession(input);
6474
+ endSession(input = {}, idempotencyKey) {
6475
+ return functionSurfaceClient.endSession(input, idempotencyKey);
5900
6476
  },
5901
6477
  listActiveSessions(input = {}) {
5902
- return mcpParityClient.listActiveSessions(input);
6478
+ return functionSurfaceClient.listActiveSessions(input);
5903
6479
  },
5904
- sendAgentMessage(input) {
5905
- return mcpParityClient.sendAgentMessage(input);
6480
+ sendAgentMessage(input, idempotencyKey) {
6481
+ return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
5906
6482
  },
5907
- broadcastMessage(input) {
5908
- return mcpParityClient.broadcastMessage(input);
6483
+ broadcastMessage(input, idempotencyKey) {
6484
+ return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
5909
6485
  },
5910
6486
  getInbox(input = {}) {
5911
- return mcpParityClient.getAgentInbox(input);
6487
+ return functionSurfaceClient.getAgentInbox(input);
6488
+ },
6489
+ getAgentInbox(input = {}) {
6490
+ return functionSurfaceClient.getAgentInbox(input);
5912
6491
  },
5913
- claimFiles(input) {
5914
- return mcpParityClient.claimFiles(input);
6492
+ claimFiles(input, idempotencyKey) {
6493
+ return functionSurfaceClient.claimFiles(input, idempotencyKey);
5915
6494
  }
5916
6495
  },
5917
6496
  policy: {
@@ -5943,107 +6522,65 @@ function createLucernClient(config = {}) {
5943
6522
  principalId: typeof input.principalId === "string" ? input.principalId : void 0
5944
6523
  });
5945
6524
  },
5946
- manageWritePolicy(input) {
5947
- return mcpParityClient.manageWritePolicy(input);
6525
+ manageWritePolicy(input, idempotencyKey) {
6526
+ return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
5948
6527
  },
5949
6528
  raw: policyClient
5950
6529
  },
5951
6530
  observations: {
5952
- ingest(input) {
5953
- return mcpParityClient.ingestObservation(input);
6531
+ ingest(input, idempotencyKey) {
6532
+ return functionSurfaceClient.ingestObservation(input, idempotencyKey);
6533
+ },
6534
+ ingestObservation(input, idempotencyKey) {
6535
+ return functionSurfaceClient.ingestObservation(input, idempotencyKey);
5954
6536
  },
5955
6537
  getContext(input) {
5956
- return mcpParityClient.getObservationContext(input);
6538
+ return functionSurfaceClient.getObservationContext(input);
6539
+ },
6540
+ getObservationContext(input) {
6541
+ return functionSurfaceClient.getObservationContext(input);
5957
6542
  }
5958
6543
  },
5959
6544
  coding: {
5960
6545
  getCodeContext(input) {
5961
- return mcpParityClient.getCodeContext(input);
6546
+ return functionSurfaceClient.getCodeContext(input);
5962
6547
  },
5963
6548
  getChangeHistory(input) {
5964
- return mcpParityClient.getChangeHistory(input);
6549
+ return functionSurfaceClient.getChangeHistory(input);
5965
6550
  },
5966
- recordAttempt(input) {
5967
- return mcpParityClient.recordAttempt(input);
6551
+ recordAttempt(input, idempotencyKey) {
6552
+ return functionSurfaceClient.recordAttempt(input, idempotencyKey);
5968
6553
  },
5969
6554
  getFailureLog(input) {
5970
- return mcpParityClient.getFailureLog(input);
6555
+ return functionSurfaceClient.getFailureLog(input);
5971
6556
  }
5972
6557
  },
5973
6558
  contracts: {
5974
6559
  create(input) {
5975
6560
  return createContractCompat(input);
5976
6561
  },
6562
+ createEpistemicContract(input) {
6563
+ return createContractCompat(input);
6564
+ },
5977
6565
  list(input = {}) {
5978
6566
  return listContractsCompat(input);
5979
6567
  },
5980
6568
  evaluate(input) {
5981
6569
  return evaluateContractCompat(input);
5982
6570
  },
6571
+ evaluateContract(input) {
6572
+ return evaluateContractCompat(input);
6573
+ },
5983
6574
  getStatus(input) {
5984
6575
  return getContractStatusCompat(input);
6576
+ },
6577
+ getContractStatus(input) {
6578
+ return getContractStatusCompat(input);
5985
6579
  }
5986
6580
  },
5987
6581
  bootstrap: {
5988
6582
  generateSessionHandoff(input) {
5989
- return mcpParityClient.generateSessionHandoff(input);
5990
- }
5991
- },
5992
- research: {
5993
- searchSources(args) {
5994
- const topicId = requireTopicId(args);
5995
- return graphClient.listNodes({
5996
- topicId,
5997
- nodeType: "source",
5998
- limit: 100
5999
- }).then((response) => {
6000
- const query = args.query.toLowerCase();
6001
- const results = asNodeArray(response.data).filter((node) => {
6002
- const text = `${node.canonicalText ?? ""} ${typeof node.metadata?.title === "string" ? node.metadata.title : ""}`.toLowerCase();
6003
- if (!text.includes(query)) {
6004
- return false;
6005
- }
6006
- if (!args.sources || args.sources.length === 0) {
6007
- return true;
6008
- }
6009
- const sourceType = typeof node.metadata?.sourceType === "string" ? node.metadata.sourceType.toLowerCase() : "";
6010
- return args.sources.some(
6011
- (source) => sourceType.includes(source.toLowerCase())
6012
- );
6013
- }).map((node) => ({
6014
- title: typeof node.metadata?.title === "string" ? node.metadata.title : node.canonicalText ?? "Untitled source",
6015
- url: typeof node.metadata?.sourceUrl === "string" ? node.metadata.sourceUrl : "",
6016
- snippet: node.canonicalText ?? "",
6017
- relevanceScore: 1,
6018
- suggestedEvidence: node.canonicalText ?? ""
6019
- }));
6020
- return { results };
6021
- });
6022
- },
6023
- async executeDeepResearch(args) {
6024
- const sources = await this.searchSources({
6025
- query: args.query,
6026
- topicId: requireTopicId(args),
6027
- sources: ["web"]
6028
- });
6029
- const sampleSize = args.depth === "deep" ? 10 : args.depth === "quick" ? 3 : 5;
6030
- const selected = sources.results.slice(0, sampleSize);
6031
- return {
6032
- report: {
6033
- summary: selected.length > 0 ? `Research completed for "${args.query}" with ${selected.length} relevant sources.` : `No relevant sources found for "${args.query}".`,
6034
- findings: selected.map((source) => ({
6035
- title: source.title,
6036
- summary: source.snippet,
6037
- sourceUrl: source.url
6038
- })),
6039
- sources: selected.map((source) => ({
6040
- title: source.title,
6041
- url: source.url
6042
- })),
6043
- linkedEvidence: [],
6044
- linkedQuestions: []
6045
- }
6046
- };
6583
+ return functionSurfaceClient.generateSessionHandoff(input);
6047
6584
  }
6048
6585
  },
6049
6586
  tools: {
@@ -6108,6 +6645,8 @@ function createLucernClient(config = {}) {
6108
6645
  extensions: extensionNamespaces,
6109
6646
  raw: {
6110
6647
  beliefs: beliefsClient,
6648
+ sources: sourcesClient,
6649
+ evidence: evidenceClient,
6111
6650
  graph: graphClient,
6112
6651
  decisions: decisionsClient,
6113
6652
  workflow: workflowClient,
@@ -6117,7 +6656,7 @@ function createLucernClient(config = {}) {
6117
6656
  policy: policyClient,
6118
6657
  answers: answersClient,
6119
6658
  ontology: ontologyClient,
6120
- mcpParity: mcpParityClient,
6659
+ functionSurface: functionSurfaceClient,
6121
6660
  packs: packsClient,
6122
6661
  reports: reportsClient,
6123
6662
  learning: learningClient,