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

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 (101) hide show
  1. package/README.md +6 -0
  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 +6694 -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 +91 -12
  14. package/dist/beliefsClient.js +176 -7
  15. package/dist/beliefsClient.js.map +1 -1
  16. package/dist/client-DAuKnDlx.d.ts +2547 -0
  17. package/dist/client.d.ts +31 -2377
  18. package/dist/client.js +783 -245
  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 +118 -4282
  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/contradictions/index.d.ts +156 -0
  39. package/dist/contradictions/index.js +6688 -0
  40. package/dist/contradictions/index.js.map +1 -0
  41. package/dist/customTools.d.ts +1 -1
  42. package/dist/decisions/index.d.ts +66 -0
  43. package/dist/decisions/index.js +6690 -0
  44. package/dist/decisions/index.js.map +1 -0
  45. package/dist/edges/index.d.ts +202 -0
  46. package/dist/edges/index.js +6689 -0
  47. package/dist/edges/index.js.map +1 -0
  48. package/dist/events.js +7 -5
  49. package/dist/events.js.map +1 -1
  50. package/dist/evidence/index.d.ts +293 -0
  51. package/dist/evidence/index.js +6689 -0
  52. package/dist/evidence/index.js.map +1 -0
  53. package/dist/evidenceClient.d.ts +119 -0
  54. package/dist/evidenceClient.js +350 -0
  55. package/dist/evidenceClient.js.map +1 -0
  56. package/dist/gatewayFacades.d.ts +8 -10
  57. package/dist/gatewayFacades.js +54 -1
  58. package/dist/gatewayFacades.js.map +1 -1
  59. package/dist/identityClient.d.ts +3 -3
  60. package/dist/identityClient.js.map +1 -1
  61. package/dist/index.d.ts +7 -6
  62. package/dist/index.js +1092 -3294
  63. package/dist/index.js.map +1 -1
  64. package/dist/lenses/index.d.ts +192 -0
  65. package/dist/lenses/index.js +6688 -0
  66. package/dist/lenses/index.js.map +1 -0
  67. package/dist/nodes/index.d.ts +61 -0
  68. package/dist/nodes/index.js +6690 -0
  69. package/dist/nodes/index.js.map +1 -0
  70. package/dist/ontologies/index.d.ts +179 -0
  71. package/dist/ontologies/index.js +6691 -0
  72. package/dist/ontologies/index.js.map +1 -0
  73. package/dist/opinion.d.ts +11 -0
  74. package/dist/opinion.js +35 -0
  75. package/dist/opinion.js.map +1 -0
  76. package/dist/questions/index.d.ts +295 -0
  77. package/dist/questions/index.js +6691 -0
  78. package/dist/questions/index.js.map +1 -0
  79. package/dist/sdk-tools.contract-B4c1Zr1o.d.ts +22 -0
  80. package/dist/sourcesClient.d.ts +24 -0
  81. package/dist/{mcpParityClient.js → sourcesClient.js} +15 -192
  82. package/dist/sourcesClient.js.map +1 -0
  83. package/dist/tool-contracts-BUiL9P6z.d.ts +22 -0
  84. package/dist/topics/index.d.ts +66 -0
  85. package/dist/topics/index.js +6689 -0
  86. package/dist/topics/index.js.map +1 -0
  87. package/dist/types.d.ts +20 -1
  88. package/dist/worktrees/index.d.ts +208 -0
  89. package/dist/worktrees/index.js +6691 -0
  90. package/dist/worktrees/index.js.map +1 -0
  91. package/package.json +55 -3
  92. package/dist/contracts/mcp-tools.contract.d.ts +0 -1
  93. package/dist/contracts/mcp-tools.contract.js +0 -2986
  94. package/dist/contracts/mcp-tools.contract.js.map +0 -1
  95. package/dist/mcpParityClient.d.ts +0 -74
  96. package/dist/mcpParityClient.js.map +0 -1
  97. package/dist/mcpParitySurface.d.ts +0 -12
  98. package/dist/mcpParitySurface.js +0 -65
  99. package/dist/mcpParitySurface.js.map +0 -1
  100. package/dist/mcpTools-DPZxowDX.d.ts +0 -254
  101. package/dist/sdkTools-CwXJDACb.d.ts +0 -150
package/dist/client.js CHANGED
@@ -997,32 +997,201 @@ function createAuditClient(config = {}) {
997
997
  };
998
998
  }
999
999
 
1000
+ // src/opinion.ts
1001
+ function clamp01(value) {
1002
+ if (!Number.isFinite(value)) {
1003
+ return 0;
1004
+ }
1005
+ return Math.max(0, Math.min(1, value));
1006
+ }
1007
+ function vacuous(baseRate = 0.5) {
1008
+ return { b: 0, d: 0, u: 1, a: clamp01(baseRate) };
1009
+ }
1010
+ function dogmatic(probability, baseRate = 0.5) {
1011
+ const p = clamp01(probability);
1012
+ return { b: p, d: 1 - p, u: 0, a: clamp01(baseRate) };
1013
+ }
1014
+ function opinionFromBaseRate(probability) {
1015
+ return vacuous(clamp01(probability));
1016
+ }
1017
+ function opinionFromDogmatic(probability, baseRate = 0.5) {
1018
+ return dogmatic(clamp01(probability), clamp01(baseRate));
1019
+ }
1020
+ function opinionFromProjected(probability, uncertainty, baseRate = 0.5) {
1021
+ const p = clamp01(probability);
1022
+ const u = clamp01(uncertainty);
1023
+ const remainingMass = 1 - u;
1024
+ return {
1025
+ b: p * remainingMass,
1026
+ d: (1 - p) * remainingMass,
1027
+ u,
1028
+ a: clamp01(baseRate)
1029
+ };
1030
+ }
1031
+
1000
1032
  // src/beliefsClient.ts
1033
+ function asRecord2(value) {
1034
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1035
+ }
1036
+ function readString(value) {
1037
+ if (typeof value !== "string") {
1038
+ return void 0;
1039
+ }
1040
+ const normalized = value.trim();
1041
+ return normalized.length > 0 ? normalized : void 0;
1042
+ }
1043
+ function readNumber(value) {
1044
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
1045
+ }
1046
+ function clamp012(value) {
1047
+ return Math.max(0, Math.min(1, value));
1048
+ }
1049
+ function normalizeOpinionTuple(record) {
1050
+ const opinion = asRecord2(record.opinion);
1051
+ const rawBelief = readNumber(opinion.b) ?? readNumber(record.belief);
1052
+ const rawDisbelief = readNumber(opinion.d) ?? readNumber(record.disbelief);
1053
+ const rawUncertainty = readNumber(opinion.u) ?? readNumber(record.uncertainty);
1054
+ const rawBaseRate = readNumber(opinion.a) ?? readNumber(record.baseRate);
1055
+ if (rawBelief === void 0 && rawDisbelief === void 0 && rawUncertainty === void 0) {
1056
+ const projected = clamp012(readNumber(record.confidence) ?? 0);
1057
+ return {
1058
+ b: projected,
1059
+ d: 1 - projected,
1060
+ u: 0,
1061
+ a: 0.5
1062
+ };
1063
+ }
1064
+ return {
1065
+ b: clamp012(rawBelief ?? 0),
1066
+ d: clamp012(rawDisbelief ?? 0),
1067
+ u: clamp012(rawUncertainty ?? 0),
1068
+ a: clamp012(rawBaseRate ?? 0.5)
1069
+ };
1070
+ }
1071
+ function mapOpinionHistoryEntriesFromGatewayData(payload) {
1072
+ const entries = Array.isArray(payload.entries) ? payload.entries : [];
1073
+ return entries.map((value) => {
1074
+ const record = asRecord2(value);
1075
+ const tuple = normalizeOpinionTuple(record);
1076
+ const projected = readNumber(record.confidence) ?? clamp012(tuple.b + tuple.a * tuple.u);
1077
+ const triggeringEvidenceId = readString(record.triggeringEvidenceId);
1078
+ const triggeringWorktreeId = readString(record.triggeringWorktreeId);
1079
+ return {
1080
+ t: readNumber(record.timestamp) ?? readNumber(record.assessedAt) ?? 0,
1081
+ b: tuple.b,
1082
+ d: tuple.d,
1083
+ u: tuple.u,
1084
+ a: tuple.a,
1085
+ P: clamp012(projected),
1086
+ trigger: readString(record.trigger) ?? "manual",
1087
+ ...triggeringEvidenceId ? {
1088
+ triggeringRef: {
1089
+ kind: "evidence",
1090
+ id: triggeringEvidenceId
1091
+ }
1092
+ } : triggeringWorktreeId ? {
1093
+ triggeringRef: {
1094
+ kind: "worktree",
1095
+ id: triggeringWorktreeId
1096
+ }
1097
+ } : {},
1098
+ ...readString(record.rationale) ? { rationale: readString(record.rationale) } : {},
1099
+ ...readString(record.userId) ? { userId: readString(record.userId) } : {},
1100
+ ...readString(record.slOperator) ? { slOperator: readString(record.slOperator) } : {}
1101
+ };
1102
+ }).sort((left, right) => left.t - right.t);
1103
+ }
1104
+ function normalizeModulateConfidenceInput(input) {
1105
+ const opinion = "opinion" in input ? input.opinion : input.interpretation === "base_rate" ? opinionFromBaseRate(input.confidence) : input.interpretation === "dogmatic" ? opinionFromDogmatic(input.confidence, input.baseRate) : opinionFromProjected(
1106
+ input.confidence,
1107
+ input.uncertainty,
1108
+ input.baseRate
1109
+ );
1110
+ return {
1111
+ belief: opinion.b,
1112
+ disbelief: opinion.d,
1113
+ uncertainty: opinion.u,
1114
+ baseRate: opinion.a,
1115
+ trigger: input.trigger,
1116
+ rationale: input.rationale,
1117
+ maxInlinePropagationTargets: input.maxInlinePropagationTargets
1118
+ };
1119
+ }
1001
1120
  function createBeliefsClient(config = {}) {
1002
1121
  const gateway = createGatewayRequestClient(config);
1122
+ function requireBaseRate2(value) {
1123
+ const baseRate = readNumber(value);
1124
+ if (baseRate === void 0) {
1125
+ throw new Error("baseRate is required for belief creation.");
1126
+ }
1127
+ if (baseRate < 0 || baseRate > 1) {
1128
+ throw new Error("baseRate must be within [0, 1].");
1129
+ }
1130
+ return baseRate;
1131
+ }
1132
+ const modulateConfidence = async (beliefId, input, idempotencyKey) => gateway.request({
1133
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence`,
1134
+ method: "POST",
1135
+ body: normalizeModulateConfidenceInput(input),
1136
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1137
+ });
1138
+ async function getOpinionHistory(beliefId) {
1139
+ const response = await gateway.request({
1140
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
1141
+ });
1142
+ return mapOpinionHistoryEntriesFromGatewayData(response.data);
1143
+ }
1003
1144
  return {
1004
1145
  /**
1005
1146
  * Create a belief within a topic scope.
1006
1147
  */
1007
1148
  async createBelief(input, idempotencyKey) {
1149
+ const baseRate = requireBaseRate2(input.baseRate);
1008
1150
  return gateway.request({
1009
1151
  path: "/api/platform/v1/beliefs",
1010
1152
  method: "POST",
1011
- body: normalizeNodeWriteInput(input),
1153
+ body: {
1154
+ ...normalizeNodeWriteInput(input),
1155
+ baseRate
1156
+ },
1012
1157
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1013
1158
  });
1014
1159
  },
1015
1160
  /**
1016
- * Record a confidence change for an existing belief.
1161
+ * Refine a draft belief in place.
1017
1162
  */
1018
- async modulateConfidence(beliefId, input, idempotencyKey) {
1163
+ async refineBelief(beliefId, input, idempotencyKey) {
1019
1164
  return gateway.request({
1020
- path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence`,
1021
- method: "POST",
1022
- body: input,
1165
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}`,
1166
+ method: "PATCH",
1167
+ body: normalizeNodeWriteInput(input),
1023
1168
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1024
1169
  });
1025
1170
  },
1171
+ /**
1172
+ * Record a confidence change for an existing belief.
1173
+ */
1174
+ modulateConfidence,
1175
+ /**
1176
+ * Returns the belief's confidence trajectory as a chronological array.
1177
+ *
1178
+ * Canonical UI trend shape (what every trend component consumes):
1179
+ * { t: number, b: number, d: number, u: number, a: number, P: number, trigger: string, triggeringRef?: { kind: "evidence" | "worktree"; id: string } }[]
1180
+ *
1181
+ * Where:
1182
+ * t = assessedAt (epoch ms)
1183
+ * b, d, u, a = Opinion 4-tuple components
1184
+ * P = projected probability = b + a*u (precomputed for UI convenience)
1185
+ * trigger = cause of the score change
1186
+ * triggeringRef = optional pointer to the evidence or worktree that drove the change
1187
+ */
1188
+ async getOpinionHistory(beliefId) {
1189
+ return getOpinionHistory(beliefId);
1190
+ },
1191
+ /** @deprecated Use getOpinionHistory(). */
1192
+ async getConfidenceHistory(beliefId) {
1193
+ return getOpinionHistory(beliefId);
1194
+ },
1026
1195
  /**
1027
1196
  * Fork a scored belief into a new formulation.
1028
1197
  */
@@ -1113,6 +1282,57 @@ function createBeliefsClient(config = {}) {
1113
1282
  }
1114
1283
  };
1115
1284
  }
1285
+
1286
+ // src/sourcesClient.ts
1287
+ function createSourcesClient(config = {}) {
1288
+ const gateway = createGatewayRequestClient(config);
1289
+ return {
1290
+ async upsert(spec, idempotencyKey = randomIdempotencyKey()) {
1291
+ return gateway.request({
1292
+ path: "/api/platform/v1/sources/upsert",
1293
+ method: "POST",
1294
+ body: spec,
1295
+ idempotencyKey
1296
+ });
1297
+ },
1298
+ async get(sourceId) {
1299
+ return gateway.request({
1300
+ path: `/api/platform/v1/sources/${encodeURIComponent(sourceId)}`
1301
+ });
1302
+ }
1303
+ };
1304
+ }
1305
+
1306
+ // src/evidenceClient.ts
1307
+ function createEvidenceClient(config = {}) {
1308
+ const gateway = createGatewayRequestClient(config);
1309
+ return {
1310
+ async classifyEvidence(beliefId, evidenceId, classificationConfig, idempotencyKey) {
1311
+ return gateway.request({
1312
+ path: "/api/platform/v1/evidence/classify",
1313
+ method: "POST",
1314
+ body: {
1315
+ beliefId,
1316
+ evidenceId,
1317
+ config: classificationConfig
1318
+ },
1319
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1320
+ });
1321
+ },
1322
+ async classifyEvidenceBatch(beliefId, evidence, classificationConfig, idempotencyKey) {
1323
+ return gateway.request({
1324
+ path: "/api/platform/v1/evidence/classify-batch",
1325
+ method: "POST",
1326
+ body: {
1327
+ beliefId,
1328
+ evidence,
1329
+ config: classificationConfig
1330
+ },
1331
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1332
+ });
1333
+ }
1334
+ };
1335
+ }
1116
1336
  var DEFAULT_CUSTOM_NAMESPACE = "custom";
1117
1337
  var RESERVED_NAMESPACES = /* @__PURE__ */ new Set(["lucern"]);
1118
1338
  var CustomToolRegistryError = class extends Error {
@@ -1902,14 +2122,14 @@ function createIdentityClient(config = {}) {
1902
2122
  }
1903
2123
 
1904
2124
  // src/topicsClient.ts
1905
- function asRecord2(value) {
2125
+ function asRecord3(value) {
1906
2126
  return value && typeof value === "object" ? value : {};
1907
2127
  }
1908
2128
  function cleanString2(value) {
1909
2129
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
1910
2130
  }
1911
2131
  function normalizeTopicRecord(value) {
1912
- const record = asRecord2(value);
2132
+ const record = asRecord3(value);
1913
2133
  const topicId = cleanString2(record.topicId) ?? cleanString2(record.id) ?? cleanString2(record._id);
1914
2134
  return withTopicAlias({
1915
2135
  ...record,
@@ -1934,7 +2154,7 @@ function createTopicsClient(config = {}) {
1934
2154
  })}`
1935
2155
  }).then(
1936
2156
  (response) => mapGatewayData(response, (data) => {
1937
- const record = asRecord2(data);
2157
+ const record = asRecord3(data);
1938
2158
  const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
1939
2159
  return {
1940
2160
  ...createListResult(items, "topics"),
@@ -1951,7 +2171,7 @@ function createTopicsClient(config = {}) {
1951
2171
  }).then(
1952
2172
  (response) => mapGatewayData(
1953
2173
  response,
1954
- (data) => normalizeTopicRecord(asRecord2(data).topic ?? data)
2174
+ (data) => normalizeTopicRecord(asRecord3(data).topic ?? data)
1955
2175
  )
1956
2176
  );
1957
2177
  },
@@ -1987,7 +2207,7 @@ function createTopicsClient(config = {}) {
1987
2207
  )}`
1988
2208
  }).then(
1989
2209
  (response) => mapGatewayData(response, (data) => {
1990
- const record = asRecord2(data);
2210
+ const record = asRecord3(data);
1991
2211
  return {
1992
2212
  tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
1993
2213
  };
@@ -2021,6 +2241,22 @@ function createTopicsClient(config = {}) {
2021
2241
  }
2022
2242
 
2023
2243
  // src/gatewayFacades.ts
2244
+ function normalizeBeliefConfidenceInput(input) {
2245
+ const opinion = "opinion" in input ? input.opinion : input.interpretation === "base_rate" ? opinionFromBaseRate(input.confidence) : input.interpretation === "dogmatic" ? opinionFromDogmatic(input.confidence, input.baseRate) : opinionFromProjected(
2246
+ input.confidence,
2247
+ input.uncertainty,
2248
+ input.baseRate
2249
+ );
2250
+ return {
2251
+ belief: opinion.b,
2252
+ disbelief: opinion.d,
2253
+ uncertainty: opinion.u,
2254
+ baseRate: opinion.a,
2255
+ trigger: input.trigger,
2256
+ rationale: input.rationale,
2257
+ maxInlinePropagationTargets: input.maxInlinePropagationTargets
2258
+ };
2259
+ }
2024
2260
  function serializeTypes(types) {
2025
2261
  return Array.isArray(types) && types.length > 0 ? types.join(",") : void 0;
2026
2262
  }
@@ -2072,7 +2308,7 @@ function createBeliefsFacade(config = {}) {
2072
2308
  return gateway.request({
2073
2309
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence`,
2074
2310
  method: "POST",
2075
- body: input,
2311
+ body: normalizeBeliefConfidenceInput(input),
2076
2312
  idempotencyKey
2077
2313
  });
2078
2314
  },
@@ -2150,6 +2386,11 @@ function createBeliefsFacade(config = {}) {
2150
2386
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence-history`
2151
2387
  });
2152
2388
  },
2389
+ async opinionHistory(id) {
2390
+ return gateway.request({
2391
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence-history`
2392
+ });
2393
+ },
2153
2394
  async createContract(id, input, idempotencyKey = randomIdempotencyKey()) {
2154
2395
  return gateway.request({
2155
2396
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/contracts`,
@@ -3370,199 +3611,479 @@ function createLearningClient(config = {}) {
3370
3611
  };
3371
3612
  }
3372
3613
 
3373
- // src/mcpParityClient.ts
3374
- function withSdkSessionId(args, sessionId) {
3614
+ // src/generated/functionSurface.ts
3615
+ var CONTRACTS = {
3616
+ "activate_worktree": { method: "POST", path: "/worktrees/activate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3617
+ "add_evidence": { method: "POST", path: "/evidence/add", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3618
+ "add_worktree": { method: "POST", path: "/worktrees", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3619
+ "analyze_topic_density": { method: "POST", path: "/scope/topic-density", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3620
+ "answer_question": { method: "POST", path: "/questions/answer", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3621
+ "apply_auto_branching": { method: "POST", path: "/scope/auto-branching", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3622
+ "apply_lens_to_topic": { method: "POST", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3623
+ "apply_ontology": { method: "POST", path: "/ontologies/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3624
+ "archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3625
+ "archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3626
+ "archive_question": { method: "DELETE", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3627
+ "bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3628
+ "broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3629
+ "check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3630
+ "claim_files": { method: "POST", path: "/coordination/file-claims", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3631
+ "compile_context": { method: "POST", path: "/context/compile", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3632
+ "complete_task": { method: "POST", path: "/tasks/complete", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3633
+ "create_answer": { method: "POST", path: "/answers", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3634
+ "create_belief": { method: "POST", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3635
+ "create_edge": { method: "POST", path: "/edges", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3636
+ "create_epistemic_contract": { method: "POST", path: "/contracts", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3637
+ "create_evidence": { method: "POST", path: "/evidence", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3638
+ "create_lens": { method: "POST", path: "/lenses", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3639
+ "create_ontology": { method: "POST", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3640
+ "create_ontology_version": { method: "POST", path: "/ontologies/versions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3641
+ "create_question": { method: "POST", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3642
+ "create_task": { method: "POST", path: "/tasks", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3643
+ "create_topic": { method: "POST", path: "/topics", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3644
+ "deprecate_ontology_version": { method: "POST", path: "/ontologies/versions/deprecate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3645
+ "detect_confirmation_bias": { method: "POST", path: "/graph/confirmation-bias", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3646
+ "discover": { method: "POST", path: "/context/discover", kind: "query", idempotent: false, surfaceIntent: "compatibility" },
3647
+ "discover_entity_connections": { method: "POST", path: "/context/entity-connections", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3648
+ "end_session": { method: "POST", path: "/coordination/end-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3649
+ "evaluate_contract": { method: "POST", path: "/contracts/evaluate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3650
+ "filter_by_permission": { method: "POST", path: "/identity/filter-by-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3651
+ "find_contradictions": { method: "POST", path: "/graph/contradictions", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3652
+ "find_missing_questions": { method: "POST", path: "/questions/missing", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3653
+ "flag_contradiction": { method: "POST", path: "/contradictions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3654
+ "fork_belief": { method: "POST", path: "/beliefs/fork", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3655
+ "generate_session_handoff": { method: "POST", path: "/bootstrap/session-handoff", kind: "query", idempotent: false, surfaceIntent: "system" },
3656
+ "get_agent_inbox": { method: "POST", path: "/coordination/messages/inbox", kind: "query", idempotent: false, surfaceIntent: "system" },
3657
+ "get_answer": { method: "GET", path: "/answers/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3658
+ "get_audit_trail": { method: "POST", path: "/judgments/audit-trail", kind: "query", idempotent: false, surfaceIntent: "system" },
3659
+ "get_belief": { method: "GET", path: "/beliefs/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3660
+ "get_change_history": { method: "POST", path: "/coding/change-history", kind: "query", idempotent: false, surfaceIntent: "system" },
3661
+ "get_code_context": { method: "POST", path: "/coding/context", kind: "query", idempotent: false, surfaceIntent: "system" },
3662
+ "get_confidence_history": { method: "POST", path: "/beliefs/confidence-history", kind: "query", idempotent: false, surfaceIntent: "compatibility" },
3663
+ "get_contract_status": { method: "POST", path: "/contracts/status", kind: "query", idempotent: false, surfaceIntent: "mcp_governance" },
3664
+ "get_evidence": { method: "GET", path: "/evidence/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3665
+ "get_failure_log": { method: "POST", path: "/coding/failure-log", kind: "query", idempotent: false, surfaceIntent: "system" },
3666
+ "get_falsification_questions": { method: "POST", path: "/questions/falsification", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3667
+ "get_graph_gaps": { method: "POST", path: "/graph/gaps", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3668
+ "get_graph_neighborhood": { method: "POST", path: "/graph/neighborhood", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3669
+ "get_graph_structure_analysis": { method: "POST", path: "/graph/structure-analysis", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3670
+ "get_high_priority_questions": { method: "POST", path: "/questions/high-priority", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3671
+ "get_lattice_coverage": { method: "POST", path: "/scope/belief-lattice/coverage", kind: "query", idempotent: false, surfaceIntent: "system" },
3672
+ "get_observation_context": { method: "POST", path: "/observations/context", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3673
+ "get_ontology": { method: "GET", path: "/ontologies/get", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3674
+ "get_question": { method: "GET", path: "/questions/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3675
+ "get_topic": { method: "GET", path: "/topics/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3676
+ "get_topic_coverage": { method: "POST", path: "/graph/topic-coverage", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3677
+ "get_topic_tree": { method: "GET", path: "/topics/tree", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3678
+ "heartbeat_session": { method: "POST", path: "/coordination/heartbeat-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3679
+ "identity_whoami": { method: "GET", path: "/identity/whoami", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3680
+ "ingest_observation": { method: "POST", path: "/observations/ingest", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3681
+ "link_evidence": { method: "POST", path: "/evidence/link", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3682
+ "link_evidence_to_belief": { method: "POST", path: "/evidence/link-belief", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3683
+ "link_evidence_to_question": { method: "POST", path: "/evidence/link-question", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3684
+ "list_active_sessions": { method: "POST", path: "/coordination/active-sessions", kind: "query", idempotent: false, surfaceIntent: "system" },
3685
+ "list_all_worktrees": { method: "GET", path: "/worktrees/all", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3686
+ "list_beliefs": { method: "GET", path: "/beliefs", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3687
+ "list_evidence": { method: "GET", path: "/evidence", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3688
+ "list_lenses": { method: "GET", path: "/lenses", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3689
+ "list_ontologies": { method: "GET", path: "/ontologies", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3690
+ "list_questions": { method: "GET", path: "/questions", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3691
+ "list_tasks": { method: "GET", path: "/tasks", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3692
+ "list_topics": { method: "GET", path: "/topics", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3693
+ "list_worktrees": { method: "GET", path: "/worktrees", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3694
+ "manage_write_policy": { method: "POST", path: "/policy/write-policy/manage", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3695
+ "match_entity_type": { method: "POST", path: "/ontologies/match-entity-type", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3696
+ "merge": { method: "POST", path: "/worktrees/merge", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3697
+ "modulate_confidence": { method: "POST", path: "/beliefs/confidence", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3698
+ "open_pull_request": { method: "POST", path: "/worktrees/open-pull-request", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3699
+ "pipeline_snapshot": { method: "POST", path: "/worktrees/pipeline-snapshot", kind: "query", idempotent: false, surfaceIntent: "system" },
3700
+ "publish_ontology_version": { method: "POST", path: "/ontologies/versions/publish", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3701
+ "push": { method: "POST", path: "/worktrees/push", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3702
+ "query_lineage": { method: "POST", path: "/edges/lineage", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3703
+ "record_attempt": { method: "POST", path: "/coding/attempts", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3704
+ "record_judgment": { method: "POST", path: "/judgments", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3705
+ "record_scope_learning": { method: "POST", path: "/scope/learnings", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3706
+ "refine_belief": { method: "PATCH", path: "/beliefs/refine", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3707
+ "refine_question": { method: "PATCH", path: "/questions/refine", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3708
+ "register_session": { method: "POST", path: "/coordination/register-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3709
+ "remove_lens_from_topic": { method: "DELETE", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3710
+ "resolve_effective_ontology": { method: "POST", path: "/ontologies/effective", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3711
+ "search_beliefs": { method: "POST", path: "/beliefs/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3712
+ "search_evidence": { method: "POST", path: "/evidence/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3713
+ "seed_belief_lattice": { method: "POST", path: "/scope/belief-lattice/seed", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3714
+ "send_agent_message": { method: "POST", path: "/coordination/messages/send", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3715
+ "trace_entity_impact": { method: "POST", path: "/graph/trace-entity-impact", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3716
+ "traverse_graph": { method: "POST", path: "/graph/traverse", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3717
+ "trigger_belief_review": { method: "POST", path: "/context/belief-review", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3718
+ "update_ontology": { method: "PATCH", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3719
+ "update_question_status": { method: "PATCH", path: "/questions/status", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3720
+ "update_task": { method: "PATCH", path: "/tasks", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3721
+ "update_topic": { method: "PATCH", path: "/topics", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3722
+ "update_worktree_metadata": { method: "PATCH", path: "/worktrees/metadata", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3723
+ "update_worktree_targets": { method: "PATCH", path: "/worktrees/targets", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" }
3724
+ };
3725
+ function createSessionId() {
3726
+ return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : randomIdempotencyKey();
3727
+ }
3728
+ function withSdkSessionId(input, sessionId) {
3375
3729
  return {
3376
- ...args ?? {},
3377
- __sdkSessionId: sessionId
3730
+ ...input,
3731
+ __sdkSessionId: typeof input.__sdkSessionId === "string" ? input.__sdkSessionId : sessionId
3378
3732
  };
3379
3733
  }
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
- });
3734
+ function toFunctionSurfaceQuery(input) {
3735
+ const params = new URLSearchParams();
3736
+ for (const [key, value] of Object.entries(input)) {
3737
+ if (value === void 0) {
3738
+ continue;
3739
+ }
3740
+ const serialized2 = typeof value === "string" ? value : JSON.stringify(value);
3741
+ if (serialized2 !== void 0) {
3742
+ params.set(key, serialized2);
3743
+ }
3389
3744
  }
3390
- function executeMutation(toolName, args, idempotencyKey) {
3745
+ const serialized = params.toString();
3746
+ return serialized ? `?${serialized}` : "";
3747
+ }
3748
+ function createFunctionSurfaceClient(config = {}) {
3749
+ const gateway = createGatewayRequestClient(config);
3750
+ const sessionId = createSessionId();
3751
+ function execute(name, input, idempotencyKey) {
3752
+ const contract = CONTRACTS[name];
3753
+ const payload = withSdkSessionId(input, sessionId);
3754
+ const path = contract.method === "GET" ? `${contract.path}${toFunctionSurfaceQuery(payload)}` : contract.path;
3391
3755
  return gateway.request({
3392
- path: `/api/platform/v1/mcp-tools/${encodeURIComponent(toolName)}`,
3393
- method: "POST",
3394
- body: withSdkSessionId(args, sessionId),
3395
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
3756
+ path: `/api/platform/v1${path}`,
3757
+ method: contract.method,
3758
+ body: contract.method === "GET" ? void 0 : payload,
3759
+ idempotencyKey: contract.kind !== "query" && Boolean(contract.idempotent) ? idempotencyKey ?? randomIdempotencyKey() : void 0
3396
3760
  });
3397
3761
  }
3398
3762
  return {
3399
3763
  sessionId,
3400
- listTopics(args = {}) {
3401
- return executeRead("list_topics", args);
3764
+ activateWorktree(input = {}, idempotencyKey) {
3765
+ return execute("activate_worktree", input, idempotencyKey);
3402
3766
  },
3403
- createTopic(args, idempotencyKey) {
3404
- return executeMutation("create_topic", args, idempotencyKey);
3767
+ addEvidence(input = {}, idempotencyKey) {
3768
+ return execute("add_evidence", input, idempotencyKey);
3405
3769
  },
3406
- getTopic(args) {
3407
- return executeRead("get_topic", args);
3770
+ addWorktree(input = {}, idempotencyKey) {
3771
+ return execute("add_worktree", input, idempotencyKey);
3408
3772
  },
3409
- getTopicTree(args) {
3410
- return executeRead("get_topic_tree", args);
3773
+ analyzeTopicDensity(input = {}, idempotencyKey) {
3774
+ return execute("analyze_topic_density", input, idempotencyKey);
3411
3775
  },
3412
- activateWorktree(args, idempotencyKey) {
3413
- return executeMutation("activate_worktree", args, idempotencyKey);
3776
+ answerQuestion(input = {}, idempotencyKey) {
3777
+ return execute("answer_question", input, idempotencyKey);
3414
3778
  },
3415
- updateWorktreeMetadata(args, idempotencyKey) {
3416
- return executeMutation("update_worktree_metadata", args, idempotencyKey);
3779
+ applyAutoBranching(input = {}, idempotencyKey) {
3780
+ return execute("apply_auto_branching", input, idempotencyKey);
3417
3781
  },
3418
- updateWorktreeTargets(args, idempotencyKey) {
3419
- return executeMutation("update_worktree_targets", args, idempotencyKey);
3782
+ applyLensToTopic(input = {}, idempotencyKey) {
3783
+ return execute("apply_lens_to_topic", input, idempotencyKey);
3420
3784
  },
3421
- listAllWorktrees(args = {}) {
3422
- return executeRead("list_all_worktrees", args);
3785
+ applyOntology(input = {}, idempotencyKey) {
3786
+ return execute("apply_ontology", input, idempotencyKey);
3423
3787
  },
3424
- pipelineSnapshot(args) {
3425
- return executeRead("pipeline_snapshot", args);
3788
+ archiveBelief(input = {}, idempotencyKey) {
3789
+ return execute("archive_belief", input, idempotencyKey);
3426
3790
  },
3427
- recordScopeLearning(args, idempotencyKey) {
3428
- return executeMutation("record_scope_learning", args, idempotencyKey);
3791
+ archiveOntology(input = {}, idempotencyKey) {
3792
+ return execute("archive_ontology", input, idempotencyKey);
3429
3793
  },
3430
- discover(args) {
3431
- return executeRead("discover", args);
3794
+ archiveQuestion(input = {}, idempotencyKey) {
3795
+ return execute("archive_question", input, idempotencyKey);
3432
3796
  },
3433
- analyzeTopicDensity(args) {
3434
- return executeRead("analyze_topic_density", args);
3797
+ bisectConfidence(input = {}, idempotencyKey) {
3798
+ return execute("bisect_confidence", input, idempotencyKey);
3435
3799
  },
3436
- applyAutoBranching(args, idempotencyKey) {
3437
- return executeMutation("apply_auto_branching", args, idempotencyKey);
3800
+ broadcastMessage(input = {}, idempotencyKey) {
3801
+ return execute("broadcast_message", input, idempotencyKey);
3438
3802
  },
3439
- seedBeliefLattice(args = {}, idempotencyKey) {
3440
- return executeMutation("seed_belief_lattice", args, idempotencyKey);
3803
+ checkPermission(input = {}, idempotencyKey) {
3804
+ return execute("check_permission", input, idempotencyKey);
3441
3805
  },
3442
- getLatticeCoverage(args = {}) {
3443
- return executeRead("get_lattice_coverage", args);
3806
+ claimFiles(input = {}, idempotencyKey) {
3807
+ return execute("claim_files", input, idempotencyKey);
3444
3808
  },
3445
- matchEntityType(args) {
3446
- return executeRead("match_entity_type", args);
3809
+ compileContext(input = {}, idempotencyKey) {
3810
+ return execute("compile_context", input, idempotencyKey);
3447
3811
  },
3448
- discoverEntityConnections(args) {
3449
- return executeRead("discover_entity_connections", args);
3812
+ completeTask(input = {}, idempotencyKey) {
3813
+ return execute("complete_task", input, idempotencyKey);
3450
3814
  },
3451
- triggerBeliefReview(args, idempotencyKey) {
3452
- return executeMutation("trigger_belief_review", args, idempotencyKey);
3815
+ createAnswer(input = {}, idempotencyKey) {
3816
+ return execute("create_answer", input, idempotencyKey);
3453
3817
  },
3454
- listOntologies(args = {}) {
3455
- return executeRead("list_ontologies", args);
3818
+ createBelief(input = {}, idempotencyKey) {
3819
+ return execute("create_belief", input, idempotencyKey);
3456
3820
  },
3457
- getOntology(args) {
3458
- return executeRead("get_ontology", args);
3821
+ createEdge(input = {}, idempotencyKey) {
3822
+ return execute("create_edge", input, idempotencyKey);
3459
3823
  },
3460
- applyOntology(args, idempotencyKey) {
3461
- return executeMutation("apply_ontology", args, idempotencyKey);
3824
+ createEpistemicContract(input = {}, idempotencyKey) {
3825
+ return execute("create_epistemic_contract", input, idempotencyKey);
3462
3826
  },
3463
- createOntology(args, idempotencyKey) {
3464
- return executeMutation("create_ontology", args, idempotencyKey);
3827
+ createEvidence(input = {}, idempotencyKey) {
3828
+ return execute("create_evidence", input, idempotencyKey);
3465
3829
  },
3466
- updateOntology(args, idempotencyKey) {
3467
- return executeMutation("update_ontology", args, idempotencyKey);
3830
+ createLens(input = {}, idempotencyKey) {
3831
+ return execute("create_lens", input, idempotencyKey);
3468
3832
  },
3469
- archiveOntology(args, idempotencyKey) {
3470
- return executeMutation("archive_ontology", args, idempotencyKey);
3833
+ createOntology(input = {}, idempotencyKey) {
3834
+ return execute("create_ontology", input, idempotencyKey);
3471
3835
  },
3472
- createOntologyVersion(args, idempotencyKey) {
3473
- return executeMutation("create_ontology_version", args, idempotencyKey);
3836
+ createOntologyVersion(input = {}, idempotencyKey) {
3837
+ return execute("create_ontology_version", input, idempotencyKey);
3474
3838
  },
3475
- publishOntologyVersion(args, idempotencyKey) {
3476
- return executeMutation("publish_ontology_version", args, idempotencyKey);
3839
+ createQuestion(input = {}, idempotencyKey) {
3840
+ return execute("create_question", input, idempotencyKey);
3477
3841
  },
3478
- deprecateOntologyVersion(args, idempotencyKey) {
3479
- return executeMutation(
3480
- "deprecate_ontology_version",
3481
- args,
3482
- idempotencyKey
3483
- );
3842
+ createTask(input = {}, idempotencyKey) {
3843
+ return execute("create_task", input, idempotencyKey);
3484
3844
  },
3485
- resolveEffectiveOntology(args) {
3486
- return executeRead("resolve_effective_ontology", args);
3845
+ createTopic(input = {}, idempotencyKey) {
3846
+ return execute("create_topic", input, idempotencyKey);
3487
3847
  },
3488
- registerSession(args = {}, idempotencyKey) {
3489
- return executeMutation("register_session", args, idempotencyKey);
3848
+ deprecateOntologyVersion(input = {}, idempotencyKey) {
3849
+ return execute("deprecate_ontology_version", input, idempotencyKey);
3490
3850
  },
3491
- heartbeatSession(args = {}, idempotencyKey) {
3492
- return executeMutation("heartbeat_session", args, idempotencyKey);
3851
+ detectConfirmationBias(input = {}, idempotencyKey) {
3852
+ return execute("detect_confirmation_bias", input, idempotencyKey);
3493
3853
  },
3494
- endSession(args = {}, idempotencyKey) {
3495
- return executeMutation("end_session", args, idempotencyKey);
3854
+ discover(input = {}, idempotencyKey) {
3855
+ return execute("discover", input, idempotencyKey);
3496
3856
  },
3497
- listActiveSessions(args = {}) {
3498
- return executeRead("list_active_sessions", args);
3857
+ discoverEntityConnections(input = {}, idempotencyKey) {
3858
+ return execute("discover_entity_connections", input, idempotencyKey);
3499
3859
  },
3500
- sendAgentMessage(args, idempotencyKey) {
3501
- return executeMutation("send_agent_message", args, idempotencyKey);
3860
+ endSession(input = {}, idempotencyKey) {
3861
+ return execute("end_session", input, idempotencyKey);
3502
3862
  },
3503
- broadcastMessage(args, idempotencyKey) {
3504
- return executeMutation("broadcast_message", args, idempotencyKey);
3863
+ evaluateContract(input = {}, idempotencyKey) {
3864
+ return execute("evaluate_contract", input, idempotencyKey);
3505
3865
  },
3506
- getAgentInbox(args = {}) {
3507
- return executeRead("get_agent_inbox", args);
3866
+ filterByPermission(input = {}, idempotencyKey) {
3867
+ return execute("filter_by_permission", input, idempotencyKey);
3508
3868
  },
3509
- claimFiles(args, idempotencyKey) {
3510
- return executeMutation("claim_files", args, idempotencyKey);
3869
+ findContradictions(input = {}, idempotencyKey) {
3870
+ return execute("find_contradictions", input, idempotencyKey);
3511
3871
  },
3512
- listTasks(args) {
3513
- return executeRead("list_tasks", args);
3872
+ findMissingQuestions(input = {}, idempotencyKey) {
3873
+ return execute("find_missing_questions", input, idempotencyKey);
3514
3874
  },
3515
- createAnswer(args, idempotencyKey) {
3516
- return executeMutation("create_answer", args, idempotencyKey);
3875
+ flagContradiction(input = {}, idempotencyKey) {
3876
+ return execute("flag_contradiction", input, idempotencyKey);
3517
3877
  },
3518
- getAnswer(args) {
3519
- return executeRead("get_answer", args);
3878
+ forkBelief(input = {}, idempotencyKey) {
3879
+ return execute("fork_belief", input, idempotencyKey);
3520
3880
  },
3521
- flagContradiction(args, idempotencyKey) {
3522
- return executeMutation("flag_contradiction", args, idempotencyKey);
3881
+ generateSessionHandoff(input = {}, idempotencyKey) {
3882
+ return execute("generate_session_handoff", input, idempotencyKey);
3523
3883
  },
3524
- ingestObservation(args, idempotencyKey) {
3525
- return executeMutation("ingest_observation", args, idempotencyKey);
3884
+ getAgentInbox(input = {}, idempotencyKey) {
3885
+ return execute("get_agent_inbox", input, idempotencyKey);
3526
3886
  },
3527
- getObservationContext(args) {
3528
- return executeRead("get_observation_context", args);
3887
+ getAnswer(input = {}, idempotencyKey) {
3888
+ return execute("get_answer", input, idempotencyKey);
3529
3889
  },
3530
- getCodeContext(args) {
3531
- return executeRead("get_code_context", args);
3890
+ getAuditTrail(input = {}, idempotencyKey) {
3891
+ return execute("get_audit_trail", input, idempotencyKey);
3532
3892
  },
3533
- getChangeHistory(args) {
3534
- return executeRead("get_change_history", args);
3893
+ getBelief(input = {}, idempotencyKey) {
3894
+ return execute("get_belief", input, idempotencyKey);
3535
3895
  },
3536
- recordAttempt(args, idempotencyKey) {
3537
- return executeMutation("record_attempt", args, idempotencyKey);
3896
+ getChangeHistory(input = {}, idempotencyKey) {
3897
+ return execute("get_change_history", input, idempotencyKey);
3538
3898
  },
3539
- getFailureLog(args) {
3540
- return executeRead("get_failure_log", args);
3899
+ getCodeContext(input = {}, idempotencyKey) {
3900
+ return execute("get_code_context", input, idempotencyKey);
3541
3901
  },
3542
- createEpistemicContract(args, idempotencyKey) {
3543
- return executeMutation(
3544
- "create_epistemic_contract",
3545
- args,
3546
- idempotencyKey
3547
- );
3902
+ getConfidenceHistory(input = {}, idempotencyKey) {
3903
+ return execute("get_confidence_history", input, idempotencyKey);
3904
+ },
3905
+ getContractStatus(input = {}, idempotencyKey) {
3906
+ return execute("get_contract_status", input, idempotencyKey);
3907
+ },
3908
+ getEvidence(input = {}, idempotencyKey) {
3909
+ return execute("get_evidence", input, idempotencyKey);
3910
+ },
3911
+ getFailureLog(input = {}, idempotencyKey) {
3912
+ return execute("get_failure_log", input, idempotencyKey);
3913
+ },
3914
+ getFalsificationQuestions(input = {}, idempotencyKey) {
3915
+ return execute("get_falsification_questions", input, idempotencyKey);
3916
+ },
3917
+ getGraphGaps(input = {}, idempotencyKey) {
3918
+ return execute("get_graph_gaps", input, idempotencyKey);
3919
+ },
3920
+ getGraphNeighborhood(input = {}, idempotencyKey) {
3921
+ return execute("get_graph_neighborhood", input, idempotencyKey);
3922
+ },
3923
+ getGraphStructureAnalysis(input = {}, idempotencyKey) {
3924
+ return execute("get_graph_structure_analysis", input, idempotencyKey);
3925
+ },
3926
+ getHighPriorityQuestions(input = {}, idempotencyKey) {
3927
+ return execute("get_high_priority_questions", input, idempotencyKey);
3928
+ },
3929
+ getLatticeCoverage(input = {}, idempotencyKey) {
3930
+ return execute("get_lattice_coverage", input, idempotencyKey);
3931
+ },
3932
+ getObservationContext(input = {}, idempotencyKey) {
3933
+ return execute("get_observation_context", input, idempotencyKey);
3934
+ },
3935
+ getOntology(input = {}, idempotencyKey) {
3936
+ return execute("get_ontology", input, idempotencyKey);
3937
+ },
3938
+ getQuestion(input = {}, idempotencyKey) {
3939
+ return execute("get_question", input, idempotencyKey);
3940
+ },
3941
+ getTopic(input = {}, idempotencyKey) {
3942
+ return execute("get_topic", input, idempotencyKey);
3943
+ },
3944
+ getTopicCoverage(input = {}, idempotencyKey) {
3945
+ return execute("get_topic_coverage", input, idempotencyKey);
3946
+ },
3947
+ getTopicTree(input = {}, idempotencyKey) {
3948
+ return execute("get_topic_tree", input, idempotencyKey);
3949
+ },
3950
+ heartbeatSession(input = {}, idempotencyKey) {
3951
+ return execute("heartbeat_session", input, idempotencyKey);
3952
+ },
3953
+ whoami(input = {}, idempotencyKey) {
3954
+ return execute("identity_whoami", input, idempotencyKey);
3955
+ },
3956
+ ingestObservation(input = {}, idempotencyKey) {
3957
+ return execute("ingest_observation", input, idempotencyKey);
3958
+ },
3959
+ linkEvidence(input = {}, idempotencyKey) {
3960
+ return execute("link_evidence", input, idempotencyKey);
3961
+ },
3962
+ linkEvidenceToBelief(input = {}, idempotencyKey) {
3963
+ return execute("link_evidence_to_belief", input, idempotencyKey);
3964
+ },
3965
+ linkEvidenceToQuestion(input = {}, idempotencyKey) {
3966
+ return execute("link_evidence_to_question", input, idempotencyKey);
3967
+ },
3968
+ listActiveSessions(input = {}, idempotencyKey) {
3969
+ return execute("list_active_sessions", input, idempotencyKey);
3970
+ },
3971
+ listAllWorktrees(input = {}, idempotencyKey) {
3972
+ return execute("list_all_worktrees", input, idempotencyKey);
3973
+ },
3974
+ listBeliefs(input = {}, idempotencyKey) {
3975
+ return execute("list_beliefs", input, idempotencyKey);
3976
+ },
3977
+ listEvidence(input = {}, idempotencyKey) {
3978
+ return execute("list_evidence", input, idempotencyKey);
3979
+ },
3980
+ listLenses(input = {}, idempotencyKey) {
3981
+ return execute("list_lenses", input, idempotencyKey);
3982
+ },
3983
+ listOntologies(input = {}, idempotencyKey) {
3984
+ return execute("list_ontologies", input, idempotencyKey);
3985
+ },
3986
+ listQuestions(input = {}, idempotencyKey) {
3987
+ return execute("list_questions", input, idempotencyKey);
3988
+ },
3989
+ listTasks(input = {}, idempotencyKey) {
3990
+ return execute("list_tasks", input, idempotencyKey);
3991
+ },
3992
+ listTopics(input = {}, idempotencyKey) {
3993
+ return execute("list_topics", input, idempotencyKey);
3994
+ },
3995
+ listWorktrees(input = {}, idempotencyKey) {
3996
+ return execute("list_worktrees", input, idempotencyKey);
3997
+ },
3998
+ manageWritePolicy(input = {}, idempotencyKey) {
3999
+ return execute("manage_write_policy", input, idempotencyKey);
4000
+ },
4001
+ matchEntityType(input = {}, idempotencyKey) {
4002
+ return execute("match_entity_type", input, idempotencyKey);
4003
+ },
4004
+ merge(input = {}, idempotencyKey) {
4005
+ return execute("merge", input, idempotencyKey);
4006
+ },
4007
+ modulateConfidence(input = {}, idempotencyKey) {
4008
+ return execute("modulate_confidence", input, idempotencyKey);
4009
+ },
4010
+ openPullRequest(input = {}, idempotencyKey) {
4011
+ return execute("open_pull_request", input, idempotencyKey);
4012
+ },
4013
+ pipelineSnapshot(input = {}, idempotencyKey) {
4014
+ return execute("pipeline_snapshot", input, idempotencyKey);
4015
+ },
4016
+ publishOntologyVersion(input = {}, idempotencyKey) {
4017
+ return execute("publish_ontology_version", input, idempotencyKey);
4018
+ },
4019
+ push(input = {}, idempotencyKey) {
4020
+ return execute("push", input, idempotencyKey);
4021
+ },
4022
+ queryLineage(input = {}, idempotencyKey) {
4023
+ return execute("query_lineage", input, idempotencyKey);
4024
+ },
4025
+ recordAttempt(input = {}, idempotencyKey) {
4026
+ return execute("record_attempt", input, idempotencyKey);
4027
+ },
4028
+ recordJudgment(input = {}, idempotencyKey) {
4029
+ return execute("record_judgment", input, idempotencyKey);
4030
+ },
4031
+ recordScopeLearning(input = {}, idempotencyKey) {
4032
+ return execute("record_scope_learning", input, idempotencyKey);
4033
+ },
4034
+ refineBelief(input = {}, idempotencyKey) {
4035
+ return execute("refine_belief", input, idempotencyKey);
4036
+ },
4037
+ refineQuestion(input = {}, idempotencyKey) {
4038
+ return execute("refine_question", input, idempotencyKey);
4039
+ },
4040
+ registerSession(input = {}, idempotencyKey) {
4041
+ return execute("register_session", input, idempotencyKey);
4042
+ },
4043
+ removeLensFromTopic(input = {}, idempotencyKey) {
4044
+ return execute("remove_lens_from_topic", input, idempotencyKey);
4045
+ },
4046
+ resolveEffectiveOntology(input = {}, idempotencyKey) {
4047
+ return execute("resolve_effective_ontology", input, idempotencyKey);
3548
4048
  },
3549
- evaluateContract(args, idempotencyKey) {
3550
- return executeMutation("evaluate_contract", args, idempotencyKey);
4049
+ searchBeliefs(input = {}, idempotencyKey) {
4050
+ return execute("search_beliefs", input, idempotencyKey);
3551
4051
  },
3552
- getContractStatus(args) {
3553
- return executeRead("get_contract_status", args);
4052
+ searchEvidence(input = {}, idempotencyKey) {
4053
+ return execute("search_evidence", input, idempotencyKey);
3554
4054
  },
3555
- checkPermission(args) {
3556
- return executeRead("check_permission", args);
4055
+ seedBeliefLattice(input = {}, idempotencyKey) {
4056
+ return execute("seed_belief_lattice", input, idempotencyKey);
3557
4057
  },
3558
- filterByPermission(args) {
3559
- return executeRead("filter_by_permission", args);
4058
+ sendAgentMessage(input = {}, idempotencyKey) {
4059
+ return execute("send_agent_message", input, idempotencyKey);
3560
4060
  },
3561
- manageWritePolicy(args, idempotencyKey) {
3562
- return args.action === "set" ? executeMutation("manage_write_policy", args, idempotencyKey) : executeRead("manage_write_policy", args);
4061
+ traceEntityImpact(input = {}, idempotencyKey) {
4062
+ return execute("trace_entity_impact", input, idempotencyKey);
3563
4063
  },
3564
- generateSessionHandoff(args) {
3565
- return executeRead("generate_session_handoff", args);
4064
+ traverseGraph(input = {}, idempotencyKey) {
4065
+ return execute("traverse_graph", input, idempotencyKey);
4066
+ },
4067
+ triggerBeliefReview(input = {}, idempotencyKey) {
4068
+ return execute("trigger_belief_review", input, idempotencyKey);
4069
+ },
4070
+ updateOntology(input = {}, idempotencyKey) {
4071
+ return execute("update_ontology", input, idempotencyKey);
4072
+ },
4073
+ updateQuestionStatus(input = {}, idempotencyKey) {
4074
+ return execute("update_question_status", input, idempotencyKey);
4075
+ },
4076
+ updateTask(input = {}, idempotencyKey) {
4077
+ return execute("update_task", input, idempotencyKey);
4078
+ },
4079
+ updateTopic(input = {}, idempotencyKey) {
4080
+ return execute("update_topic", input, idempotencyKey);
4081
+ },
4082
+ updateWorktreeMetadata(input = {}, idempotencyKey) {
4083
+ return execute("update_worktree_metadata", input, idempotencyKey);
4084
+ },
4085
+ updateWorktreeTargets(input = {}, idempotencyKey) {
4086
+ return execute("update_worktree_targets", input, idempotencyKey);
3566
4087
  }
3567
4088
  };
3568
4089
  }
@@ -4629,13 +5150,24 @@ function requireText(args) {
4629
5150
  }
4630
5151
  return text;
4631
5152
  }
5153
+ function requireBaseRate(args) {
5154
+ if (typeof args.baseRate !== "number" || !Number.isFinite(args.baseRate)) {
5155
+ throw new Error("baseRate is required.");
5156
+ }
5157
+ if (args.baseRate < 0 || args.baseRate > 1) {
5158
+ throw new Error("baseRate must be within [0, 1].");
5159
+ }
5160
+ return args.baseRate;
5161
+ }
4632
5162
  function exposeGatewayData(response) {
4633
5163
  return Object.assign({}, response, response.data);
4634
5164
  }
4635
5165
  function createLucernClient(config = {}) {
4636
5166
  const gatewayConfig = toGatewayConfig(config);
4637
5167
  const beliefsClient = createBeliefsClient(gatewayConfig);
5168
+ const sourcesClient = createSourcesClient(gatewayConfig);
4638
5169
  const beliefsFacade = createBeliefsFacade(gatewayConfig);
5170
+ const evidenceClient = createEvidenceClient(gatewayConfig);
4639
5171
  const graphClient = createGraphClient(gatewayConfig);
4640
5172
  const graphFacade = createGraphFacade(gatewayConfig);
4641
5173
  const decisionsClient = createDecisionsClient(gatewayConfig);
@@ -4659,7 +5191,7 @@ function createLucernClient(config = {}) {
4659
5191
  const worktreesFacade = createWorktreesFacade(gatewayConfig);
4660
5192
  const policyClient = createPolicyClient(gatewayConfig);
4661
5193
  const ontologyClient = createOntologyClient(gatewayConfig);
4662
- const mcpParityClient = createMcpParityClient(gatewayConfig);
5194
+ const functionSurfaceClient = createFunctionSurfaceClient(gatewayConfig);
4663
5195
  const packsClient = createPacksClient(gatewayConfig);
4664
5196
  const reportsClient = createReportsClient(gatewayConfig);
4665
5197
  const learningClient = createLearningClient(gatewayConfig);
@@ -4739,7 +5271,6 @@ function createLucernClient(config = {}) {
4739
5271
  }
4740
5272
  );
4741
5273
  async function createEvidenceCompat(args) {
4742
- const topicId = requireTopicId(args);
4743
5274
  const text = resolveText(args);
4744
5275
  if (!text) {
4745
5276
  throw new Error("text is required");
@@ -4749,7 +5280,7 @@ function createLucernClient(config = {}) {
4749
5280
  ...args.supports?.reasoning ? { rationale: args.supports.reasoning } : {}
4750
5281
  };
4751
5282
  return evidenceFacade.create({
4752
- topicId,
5283
+ topicId: resolveTopicId(args),
4753
5284
  text,
4754
5285
  source: args.source ?? args.sourceUrl,
4755
5286
  targetId: args.targetId ?? args.supports?.nodeId,
@@ -4876,6 +5407,10 @@ function createLucernClient(config = {}) {
4876
5407
  async function getConfidenceHistory(nodeId) {
4877
5408
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
4878
5409
  }
5410
+ async function getOpinionHistory(nodeId) {
5411
+ const response = await beliefsFacade.opinionHistory(nodeId);
5412
+ return mapOpinionHistoryEntriesFromGatewayData(response.data);
5413
+ }
4879
5414
  async function getAuditTrail(nodeId, limit = 50) {
4880
5415
  const events = await auditClient.listEvents({ limit });
4881
5416
  const entries = asListItems(events.data, "events").filter((event) => matchesAuditNodeReference(event, nodeId)).slice(0, limit).map((event) => {
@@ -5056,11 +5591,12 @@ function createLucernClient(config = {}) {
5056
5591
  beliefs: {
5057
5592
  create(input) {
5058
5593
  return beliefsFacade.create({
5059
- topicId: requireTopicId(input),
5594
+ topicId: resolveTopicId(input),
5060
5595
  text: requireText(input),
5061
5596
  rationale: input.rationale,
5062
5597
  worktreeId: input.worktreeId,
5063
5598
  pillar: input.pillar,
5599
+ baseRate: requireBaseRate(input),
5064
5600
  sourceBeliefIds: input.sourceBeliefIds,
5065
5601
  sourceType: input.sourceType,
5066
5602
  beliefType: input.beliefType,
@@ -5134,6 +5670,9 @@ function createLucernClient(config = {}) {
5134
5670
  confidenceHistory(nodeId) {
5135
5671
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
5136
5672
  },
5673
+ opinionHistory(nodeId) {
5674
+ return getOpinionHistory(nodeId);
5675
+ },
5137
5676
  createContract(nodeId, input) {
5138
5677
  return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
5139
5678
  },
@@ -5265,6 +5804,12 @@ function createLucernClient(config = {}) {
5265
5804
  beliefId: args.beliefId
5266
5805
  }));
5267
5806
  },
5807
+ classifyEvidence(beliefId, evidenceId, config2, idempotencyKey) {
5808
+ return evidenceClient.classifyEvidence(beliefId, evidenceId, config2, idempotencyKey).then(exposeGatewayData);
5809
+ },
5810
+ classifyEvidenceBatch(beliefId, evidence, config2, idempotencyKey) {
5811
+ return evidenceClient.classifyEvidenceBatch(beliefId, evidence, config2, idempotencyKey).then(exposeGatewayData);
5812
+ },
5268
5813
  updateStatus(input, idempotencyKey) {
5269
5814
  return evidenceFacade.updateStatus(input, idempotencyKey).then(exposeGatewayData);
5270
5815
  },
@@ -5281,10 +5826,18 @@ function createLucernClient(config = {}) {
5281
5826
  return evidenceFacade.updateVerificationStatus(input, idempotencyKey).then(exposeGatewayData);
5282
5827
  }
5283
5828
  },
5829
+ sources: {
5830
+ upsert(input, idempotencyKey) {
5831
+ return sourcesClient.upsert(input, idempotencyKey).then(exposeGatewayData);
5832
+ },
5833
+ get(sourceId) {
5834
+ return sourcesClient.get(sourceId).then(exposeGatewayData);
5835
+ }
5836
+ },
5284
5837
  questions: {
5285
5838
  create(args) {
5286
5839
  return questionsFacade.create({
5287
- topicId: requireTopicId(args),
5840
+ topicId: resolveTopicId(args),
5288
5841
  text: args.text,
5289
5842
  priority: args.priority,
5290
5843
  linkedBeliefId: args.linkedBeliefId,
@@ -5317,10 +5870,22 @@ function createLucernClient(config = {}) {
5317
5870
  }).then(exposeGatewayData);
5318
5871
  },
5319
5872
  batchCreate(input, idempotencyKey) {
5320
- return questionsFacade.batchCreate(input, idempotencyKey).then(exposeGatewayData);
5873
+ return questionsFacade.batchCreate(
5874
+ {
5875
+ ...input,
5876
+ topicId: resolveTopicId(input)
5877
+ },
5878
+ idempotencyKey
5879
+ ).then(exposeGatewayData);
5321
5880
  },
5322
5881
  add(input, idempotencyKey) {
5323
- return questionsFacade.add(input, idempotencyKey).then(exposeGatewayData);
5882
+ return questionsFacade.add(
5883
+ {
5884
+ ...input,
5885
+ topicId: resolveTopicId(input)
5886
+ },
5887
+ idempotencyKey
5888
+ ).then(exposeGatewayData);
5324
5889
  },
5325
5890
  updatePriority(input, idempotencyKey) {
5326
5891
  return questionsFacade.updatePriority(input, idempotencyKey).then(exposeGatewayData);
@@ -5406,6 +5971,7 @@ function createLucernClient(config = {}) {
5406
5971
  },
5407
5972
  queryLineage,
5408
5973
  getConfidenceHistory,
5974
+ getOpinionHistory,
5409
5975
  getAuditTrail,
5410
5976
  traverse(args) {
5411
5977
  return graphFacade.traverse({
@@ -5634,7 +6200,7 @@ function createLucernClient(config = {}) {
5634
6200
  return workflowClient.openPullRequest(worktreeId, input);
5635
6201
  },
5636
6202
  pipelineSnapshot(topicId) {
5637
- return mcpParityClient.pipelineSnapshot({ topicId });
6203
+ return functionSurfaceClient.pipelineSnapshot({ topicId });
5638
6204
  },
5639
6205
  complete(input, idempotencyKey) {
5640
6206
  return worktreesFacade.complete(input, idempotencyKey);
@@ -5670,23 +6236,23 @@ function createLucernClient(config = {}) {
5670
6236
  compile(topicId, input = {}) {
5671
6237
  return contextClient.compile(topicId, input);
5672
6238
  },
5673
- recordScopeLearning(input) {
5674
- return mcpParityClient.recordScopeLearning(input);
6239
+ recordScopeLearning(input, idempotencyKey) {
6240
+ return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
5675
6241
  },
5676
6242
  discover(input) {
5677
6243
  return discoverTopics(input);
5678
6244
  },
5679
6245
  analyzeTopicDensity(input) {
5680
- return mcpParityClient.analyzeTopicDensity(input);
6246
+ return functionSurfaceClient.analyzeTopicDensity(input);
5681
6247
  },
5682
- applyAutoBranching(input) {
5683
- return mcpParityClient.applyAutoBranching(input);
6248
+ applyAutoBranching(input, idempotencyKey) {
6249
+ return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
5684
6250
  },
5685
- seedBeliefLattice(input = {}) {
5686
- return mcpParityClient.seedBeliefLattice(input);
6251
+ seedBeliefLattice(input = {}, idempotencyKey) {
6252
+ return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
5687
6253
  },
5688
6254
  getLatticeCoverage(input = {}) {
5689
- return mcpParityClient.getLatticeCoverage(input);
6255
+ return functionSurfaceClient.getLatticeCoverage(input);
5690
6256
  },
5691
6257
  matchEntityType(input) {
5692
6258
  return ontologiesFacade.match(input).then(exposeGatewayData);
@@ -5701,7 +6267,7 @@ function createLucernClient(config = {}) {
5701
6267
  tasks: {
5702
6268
  create(input) {
5703
6269
  return tasksFacade.create({
5704
- topicId: requireTopicId(input),
6270
+ topicId: resolveTopicId(input),
5705
6271
  title: input.title,
5706
6272
  description: input.description,
5707
6273
  taskType: input.taskType,
@@ -5834,7 +6400,7 @@ function createLucernClient(config = {}) {
5834
6400
  beliefA: args.beliefA,
5835
6401
  beliefB: args.beliefB,
5836
6402
  description: args.description,
5837
- topicId: requireTopicId(args),
6403
+ topicId: resolveTopicId(args),
5838
6404
  severity: args.severity,
5839
6405
  defeatType: args.defeatType
5840
6406
  }).then(exposeGatewayData);
@@ -5880,38 +6446,50 @@ function createLucernClient(config = {}) {
5880
6446
  publishVersion(input) {
5881
6447
  return publishOntologyVersionCompat(input);
5882
6448
  },
6449
+ publishOntologyVersion(input) {
6450
+ return publishOntologyVersionCompat(input);
6451
+ },
5883
6452
  deprecateVersion(input) {
5884
6453
  return deprecateOntologyVersionCompat(input);
5885
6454
  },
6455
+ deprecateOntologyVersion(input) {
6456
+ return deprecateOntologyVersionCompat(input);
6457
+ },
5886
6458
  resolveEffective(input) {
5887
6459
  return resolveEffectiveOntologyCompat(input);
5888
6460
  },
6461
+ resolveEffectiveOntology(input) {
6462
+ return resolveEffectiveOntologyCompat(input);
6463
+ },
5889
6464
  raw: ontologyClient
5890
6465
  },
5891
6466
  coordination: {
5892
- registerSession(input = {}) {
5893
- return mcpParityClient.registerSession(input);
6467
+ registerSession(input = {}, idempotencyKey) {
6468
+ return functionSurfaceClient.registerSession(input, idempotencyKey);
5894
6469
  },
5895
- heartbeatSession(input = {}) {
5896
- return mcpParityClient.heartbeatSession(input);
6470
+ heartbeatSession(input = {}, idempotencyKey) {
6471
+ return functionSurfaceClient.heartbeatSession(input, idempotencyKey);
5897
6472
  },
5898
- endSession(input = {}) {
5899
- return mcpParityClient.endSession(input);
6473
+ endSession(input = {}, idempotencyKey) {
6474
+ return functionSurfaceClient.endSession(input, idempotencyKey);
5900
6475
  },
5901
6476
  listActiveSessions(input = {}) {
5902
- return mcpParityClient.listActiveSessions(input);
6477
+ return functionSurfaceClient.listActiveSessions(input);
5903
6478
  },
5904
- sendAgentMessage(input) {
5905
- return mcpParityClient.sendAgentMessage(input);
6479
+ sendAgentMessage(input, idempotencyKey) {
6480
+ return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
5906
6481
  },
5907
- broadcastMessage(input) {
5908
- return mcpParityClient.broadcastMessage(input);
6482
+ broadcastMessage(input, idempotencyKey) {
6483
+ return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
5909
6484
  },
5910
6485
  getInbox(input = {}) {
5911
- return mcpParityClient.getAgentInbox(input);
6486
+ return functionSurfaceClient.getAgentInbox(input);
6487
+ },
6488
+ getAgentInbox(input = {}) {
6489
+ return functionSurfaceClient.getAgentInbox(input);
5912
6490
  },
5913
- claimFiles(input) {
5914
- return mcpParityClient.claimFiles(input);
6491
+ claimFiles(input, idempotencyKey) {
6492
+ return functionSurfaceClient.claimFiles(input, idempotencyKey);
5915
6493
  }
5916
6494
  },
5917
6495
  policy: {
@@ -5943,107 +6521,65 @@ function createLucernClient(config = {}) {
5943
6521
  principalId: typeof input.principalId === "string" ? input.principalId : void 0
5944
6522
  });
5945
6523
  },
5946
- manageWritePolicy(input) {
5947
- return mcpParityClient.manageWritePolicy(input);
6524
+ manageWritePolicy(input, idempotencyKey) {
6525
+ return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
5948
6526
  },
5949
6527
  raw: policyClient
5950
6528
  },
5951
6529
  observations: {
5952
- ingest(input) {
5953
- return mcpParityClient.ingestObservation(input);
6530
+ ingest(input, idempotencyKey) {
6531
+ return functionSurfaceClient.ingestObservation(input, idempotencyKey);
6532
+ },
6533
+ ingestObservation(input, idempotencyKey) {
6534
+ return functionSurfaceClient.ingestObservation(input, idempotencyKey);
5954
6535
  },
5955
6536
  getContext(input) {
5956
- return mcpParityClient.getObservationContext(input);
6537
+ return functionSurfaceClient.getObservationContext(input);
6538
+ },
6539
+ getObservationContext(input) {
6540
+ return functionSurfaceClient.getObservationContext(input);
5957
6541
  }
5958
6542
  },
5959
6543
  coding: {
5960
6544
  getCodeContext(input) {
5961
- return mcpParityClient.getCodeContext(input);
6545
+ return functionSurfaceClient.getCodeContext(input);
5962
6546
  },
5963
6547
  getChangeHistory(input) {
5964
- return mcpParityClient.getChangeHistory(input);
6548
+ return functionSurfaceClient.getChangeHistory(input);
5965
6549
  },
5966
- recordAttempt(input) {
5967
- return mcpParityClient.recordAttempt(input);
6550
+ recordAttempt(input, idempotencyKey) {
6551
+ return functionSurfaceClient.recordAttempt(input, idempotencyKey);
5968
6552
  },
5969
6553
  getFailureLog(input) {
5970
- return mcpParityClient.getFailureLog(input);
6554
+ return functionSurfaceClient.getFailureLog(input);
5971
6555
  }
5972
6556
  },
5973
6557
  contracts: {
5974
6558
  create(input) {
5975
6559
  return createContractCompat(input);
5976
6560
  },
6561
+ createEpistemicContract(input) {
6562
+ return createContractCompat(input);
6563
+ },
5977
6564
  list(input = {}) {
5978
6565
  return listContractsCompat(input);
5979
6566
  },
5980
6567
  evaluate(input) {
5981
6568
  return evaluateContractCompat(input);
5982
6569
  },
6570
+ evaluateContract(input) {
6571
+ return evaluateContractCompat(input);
6572
+ },
5983
6573
  getStatus(input) {
5984
6574
  return getContractStatusCompat(input);
6575
+ },
6576
+ getContractStatus(input) {
6577
+ return getContractStatusCompat(input);
5985
6578
  }
5986
6579
  },
5987
6580
  bootstrap: {
5988
6581
  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
- };
6582
+ return functionSurfaceClient.generateSessionHandoff(input);
6047
6583
  }
6048
6584
  },
6049
6585
  tools: {
@@ -6108,6 +6644,8 @@ function createLucernClient(config = {}) {
6108
6644
  extensions: extensionNamespaces,
6109
6645
  raw: {
6110
6646
  beliefs: beliefsClient,
6647
+ sources: sourcesClient,
6648
+ evidence: evidenceClient,
6111
6649
  graph: graphClient,
6112
6650
  decisions: decisionsClient,
6113
6651
  workflow: workflowClient,
@@ -6117,7 +6655,7 @@ function createLucernClient(config = {}) {
6117
6655
  policy: policyClient,
6118
6656
  answers: answersClient,
6119
6657
  ontology: ontologyClient,
6120
- mcpParity: mcpParityClient,
6658
+ functionSurface: functionSurfaceClient,
6121
6659
  packs: packsClient,
6122
6660
  reports: reportsClient,
6123
6661
  learning: learningClient,